repoburg 1.3.275 → 1.3.276
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/frontend/dist/assets/{index-BNyA-dQb.js → index-CZYdmbey.js} +90 -95
- package/agent-pane/frontend/dist/assets/index-l4iJLb5_.css +1 -0
- package/agent-pane/frontend/dist/index.html +2 -2
- package/daemon/dist/index.js +0 -0
- package/package.json +1 -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-BKDM-AC5.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Jy=Object.defineProperty;var ex=(t,s,r)=>s in t?Jy(t,s,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[s]=r;var lt=(t,s,r)=>ex(t,typeof s!="symbol"?s+"":s,r);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))o(a);new MutationObserver(a=>{for(const u of a)if(u.type==="childList")for(const f of u.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function r(a){const u={};return a.integrity&&(u.integrity=a.integrity),a.referrerPolicy&&(u.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?u.credentials="include":a.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function o(a){if(a.ep)return;a.ep=!0;const u=r(a);fetch(a.href,u)}})();function Bm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var au={exports:{}},no={},lu={exports:{}},We={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var Zy=Object.defineProperty;var Jy=(t,s,r)=>s in t?Zy(t,s,{enumerable:!0,config
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Gp;function
|
|
9
|
+
*/var Gp;function tx(){if(Gp)return We;Gp=1;var t=Symbol.for("react.element"),s=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),f=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.iterator;function x(E){return E===null||typeof E!="object"?null:(E=k&&E[k]||E["@@iterator"],typeof E=="function"?E:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function T(E,L,de){this.props=E,this.context=L,this.refs=C,this.updater=de||b}T.prototype.isReactComponent={},T.prototype.setState=function(E,L){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,L,"setState")},T.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function I(){}I.prototype=T.prototype;function A(E,L,de){this.props=E,this.context=L,this.refs=C,this.updater=de||b}var U=A.prototype=new I;U.constructor=A,j(U,T.prototype),U.isPureReactComponent=!0;var O=Array.isArray,W=Object.prototype.hasOwnProperty,Z={current:null},Y={key:!0,ref:!0,__self:!0,__source:!0};function Q(E,L,de){var K,ce={},fe=null,Pe=null;if(L!=null)for(K in L.ref!==void 0&&(Pe=L.ref),L.key!==void 0&&(fe=""+L.key),L)W.call(L,K)&&!Y.hasOwnProperty(K)&&(ce[K]=L[K]);var Ce=arguments.length-2;if(Ce===1)ce.children=de;else if(1<Ce){for(var Ee=Array(Ce),_e=0;_e<Ce;_e++)Ee[_e]=arguments[_e+2];ce.children=Ee}if(E&&E.defaultProps)for(K in Ce=E.defaultProps,Ce)ce[K]===void 0&&(ce[K]=Ce[K]);return{$$typeof:t,type:E,key:fe,ref:Pe,props:ce,_owner:Z.current}}function ue(E,L){return{$$typeof:t,type:E.type,key:L,ref:E.ref,props:E.props,_owner:E._owner}}function he(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function H(E){var L={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(de){return L[de]})}var Te=/\/+/g;function Ne(E,L){return typeof E=="object"&&E!==null&&E.key!=null?H(""+E.key):L.toString(36)}function Le(E,L,de,K,ce){var fe=typeof E;(fe==="undefined"||fe==="boolean")&&(E=null);var Pe=!1;if(E===null)Pe=!0;else switch(fe){case"string":case"number":Pe=!0;break;case"object":switch(E.$$typeof){case t:case s:Pe=!0}}if(Pe)return Pe=E,ce=ce(Pe),E=K===""?"."+Ne(Pe,0):K,O(ce)?(de="",E!=null&&(de=E.replace(Te,"$&/")+"/"),Le(ce,L,de,"",function(_e){return _e})):ce!=null&&(he(ce)&&(ce=ue(ce,de+(!ce.key||Pe&&Pe.key===ce.key?"":(""+ce.key).replace(Te,"$&/")+"/")+E)),L.push(ce)),1;if(Pe=0,K=K===""?".":K+":",O(E))for(var Ce=0;Ce<E.length;Ce++){fe=E[Ce];var Ee=K+Ne(fe,Ce);Pe+=Le(fe,L,de,Ee,ce)}else if(Ee=x(E),typeof Ee=="function")for(E=Ee.call(E),Ce=0;!(fe=E.next()).done;)fe=fe.value,Ee=K+Ne(fe,Ce++),Pe+=Le(fe,L,de,Ee,ce);else if(fe==="object")throw L=String(E),Error("Objects are not valid as a React child (found: "+(L==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":L)+"). If you meant to render a collection of children, use an array instead.");return Pe}function se(E,L,de){if(E==null)return E;var K=[],ce=0;return Le(E,K,"","",function(fe){return L.call(de,fe,ce++)}),K}function G(E){if(E._status===-1){var L=E._result;L=L(),L.then(function(de){(E._status===0||E._status===-1)&&(E._status=1,E._result=de)},function(de){(E._status===0||E._status===-1)&&(E._status=2,E._result=de)}),E._status===-1&&(E._status=0,E._result=L)}if(E._status===1)return E._result.default;throw E._result}var X={current:null},P={transition:null},J={ReactCurrentDispatcher:X,ReactCurrentBatchConfig:P,ReactCurrentOwner:Z};function q(){throw Error("act(...) is not supported in production builds of React.")}return We.Children={map:se,forEach:function(E,L,de){se(E,function(){L.apply(this,arguments)},de)},count:function(E){var L=0;return se(E,function(){L++}),L},toArray:function(E){return se(E,function(L){return L})||[]},only:function(E){if(!he(E))throw Error("React.Children.only expected to receive a single React element child.");return E}},We.Component=T,We.Fragment=r,We.Profiler=a,We.PureComponent=A,We.StrictMode=o,We.Suspense=g,We.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=J,We.act=q,We.cloneElement=function(E,L,de){if(E==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+E+".");var K=j({},E.props),ce=E.key,fe=E.ref,Pe=E._owner;if(L!=null){if(L.ref!==void 0&&(fe=L.ref,Pe=Z.current),L.key!==void 0&&(ce=""+L.key),E.type&&E.type.defaultProps)var Ce=E.type.defaultProps;for(Ee in L)W.call(L,Ee)&&!Y.hasOwnProperty(Ee)&&(K[Ee]=L[Ee]===void 0&&Ce!==void 0?Ce[Ee]:L[Ee])}var Ee=arguments.length-2;if(Ee===1)K.children=de;else if(1<Ee){Ce=Array(Ee);for(var _e=0;_e<Ee;_e++)Ce[_e]=arguments[_e+2];K.children=Ce}return{$$typeof:t,type:E.type,key:ce,ref:fe,props:K,_owner:Pe}},We.createContext=function(E){return E={$$typeof:f,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},E.Provider={$$typeof:u,_context:E},E.Consumer=E},We.createElement=Q,We.createFactory=function(E){var L=Q.bind(null,E);return L.type=E,L},We.createRef=function(){return{current:null}},We.forwardRef=function(E){return{$$typeof:h,render:E}},We.isValidElement=he,We.lazy=function(E){return{$$typeof:v,_payload:{_status:-1,_result:E},_init:G}},We.memo=function(E,L){return{$$typeof:m,type:E,compare:L===void 0?null:L}},We.startTransition=function(E){var L=P.transition;P.transition={};try{E()}finally{P.transition=L}},We.unstable_act=q,We.useCallback=function(E,L){return X.current.useCallback(E,L)},We.useContext=function(E){return X.current.useContext(E)},We.useDebugValue=function(){},We.useDeferredValue=function(E){return X.current.useDeferredValue(E)},We.useEffect=function(E,L){return X.current.useEffect(E,L)},We.useId=function(){return X.current.useId()},We.useImperativeHandle=function(E,L,de){return X.current.useImperativeHandle(E,L,de)},We.useInsertionEffect=function(E,L){return X.current.useInsertionEffect(E,L)},We.useLayoutEffect=function(E,L){return X.current.useLayoutEffect(E,L)},We.useMemo=function(E,L){return X.current.useMemo(E,L)},We.useReducer=function(E,L,de){return X.current.useReducer(E,L,de)},We.useRef=function(E){return X.current.useRef(E)},We.useState=function(E){return X.current.useState(E)},We.useSyncExternalStore=function(E,L,de){return X.current.useSyncExternalStore(E,L,de)},We.useTransition=function(){return X.current.useTransition()},We.version="18.3.1",We}var Kp;function Qu(){return Kp||(Kp=1,lu.exports=tx()),lu.exports}/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.production.min.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var Zy=Object.defineProperty;var Jy=(t,s,r)=>s in t?Zy(t,s,{enumerable:!0,config
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Yp;function
|
|
17
|
+
*/var Yp;function nx(){if(Yp)return no;Yp=1;var t=Qu(),s=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function f(h,g,m){var v,k={},x=null,b=null;m!==void 0&&(x=""+m),g.key!==void 0&&(x=""+g.key),g.ref!==void 0&&(b=g.ref);for(v in g)o.call(g,v)&&!u.hasOwnProperty(v)&&(k[v]=g[v]);if(h&&h.defaultProps)for(v in g=h.defaultProps,g)k[v]===void 0&&(k[v]=g[v]);return{$$typeof:s,type:h,key:x,ref:b,props:k,_owner:a.current}}return no.Fragment=r,no.jsx=f,no.jsxs=f,no}var Xp;function sx(){return Xp||(Xp=1,au.exports=nx()),au.exports}var l=sx(),w=Qu();const rt=Bm(w);var Da={},cu={exports:{}},jn={},uu={exports:{}},du={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.min.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var Zy=Object.defineProperty;var Jy=(t,s,r)=>s in t?Zy(t,s,{enumerable:!0,config
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var Qp;function
|
|
25
|
+
*/var Qp;function rx(){return Qp||(Qp=1,(function(t){function s(P,J){var q=P.length;P.push(J);e:for(;0<q;){var E=q-1>>>1,L=P[E];if(0<a(L,J))P[E]=J,P[q]=L,q=E;else break e}}function r(P){return P.length===0?null:P[0]}function o(P){if(P.length===0)return null;var J=P[0],q=P.pop();if(q!==J){P[0]=q;e:for(var E=0,L=P.length,de=L>>>1;E<de;){var K=2*(E+1)-1,ce=P[K],fe=K+1,Pe=P[fe];if(0>a(ce,q))fe<L&&0>a(Pe,ce)?(P[E]=Pe,P[fe]=q,E=fe):(P[E]=ce,P[K]=q,E=K);else if(fe<L&&0>a(Pe,q))P[E]=Pe,P[fe]=q,E=fe;else break e}}return J}function a(P,J){var q=P.sortIndex-J.sortIndex;return q!==0?q:P.id-J.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var f=Date,h=f.now();t.unstable_now=function(){return f.now()-h}}var g=[],m=[],v=1,k=null,x=3,b=!1,j=!1,C=!1,T=typeof setTimeout=="function"?setTimeout:null,I=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function U(P){for(var J=r(m);J!==null;){if(J.callback===null)o(m);else if(J.startTime<=P)o(m),J.sortIndex=J.expirationTime,s(g,J);else break;J=r(m)}}function O(P){if(C=!1,U(P),!j)if(r(g)!==null)j=!0,G(W);else{var J=r(m);J!==null&&X(O,J.startTime-P)}}function W(P,J){j=!1,C&&(C=!1,I(Q),Q=-1),b=!0;var q=x;try{for(U(J),k=r(g);k!==null&&(!(k.expirationTime>J)||P&&!H());){var E=k.callback;if(typeof E=="function"){k.callback=null,x=k.priorityLevel;var L=E(k.expirationTime<=J);J=t.unstable_now(),typeof L=="function"?k.callback=L:k===r(g)&&o(g),U(J)}else o(g);k=r(g)}if(k!==null)var de=!0;else{var K=r(m);K!==null&&X(O,K.startTime-J),de=!1}return de}finally{k=null,x=q,b=!1}}var Z=!1,Y=null,Q=-1,ue=5,he=-1;function H(){return!(t.unstable_now()-he<ue)}function Te(){if(Y!==null){var P=t.unstable_now();he=P;var J=!0;try{J=Y(!0,P)}finally{J?Ne():(Z=!1,Y=null)}}else Z=!1}var Ne;if(typeof A=="function")Ne=function(){A(Te)};else if(typeof MessageChannel<"u"){var Le=new MessageChannel,se=Le.port2;Le.port1.onmessage=Te,Ne=function(){se.postMessage(null)}}else Ne=function(){T(Te,0)};function G(P){Y=P,Z||(Z=!0,Ne())}function X(P,J){Q=T(function(){P(t.unstable_now())},J)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_continueExecution=function(){j||b||(j=!0,G(W))},t.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ue=0<P?Math.floor(1e3/P):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return r(g)},t.unstable_next=function(P){switch(x){case 1:case 2:case 3:var J=3;break;default:J=x}var q=x;x=J;try{return P()}finally{x=q}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(P,J){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var q=x;x=P;try{return J()}finally{x=q}},t.unstable_scheduleCallback=function(P,J,q){var E=t.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?E+q:E):q=E,P){case 1:var L=-1;break;case 2:L=250;break;case 5:L=1073741823;break;case 4:L=1e4;break;default:L=5e3}return L=q+L,P={id:v++,callback:J,priorityLevel:P,startTime:q,expirationTime:L,sortIndex:-1},q>E?(P.sortIndex=q,s(m,P),r(g)===null&&P===r(m)&&(C?(I(Q),Q=-1):C=!0,X(O,q-E))):(P.sortIndex=L,s(g,P),j||b||(j=!0,G(W))),P},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(P){var J=x;return function(){var q=x;x=J;try{return P.apply(this,arguments)}finally{x=q}}}})(du)),du}var Zp;function ix(){return Zp||(Zp=1,uu.exports=rx()),uu.exports}/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.min.js
|
|
28
28
|
*
|
|
@@ -30,28 +30,28 @@ var Zy=Object.defineProperty;var Jy=(t,s,r)=>s in t?Zy(t,s,{enumerable:!0,config
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var Jp;function
|
|
33
|
+
*/var Jp;function ox(){if(Jp)return jn;Jp=1;var t=Qu(),s=ix();function r(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,i=1;i<arguments.length;i++)n+="&args[]="+encodeURIComponent(arguments[i]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,a={};function u(e,n){f(e,n),f(e+"Capture",n)}function f(e,n){for(a[e]=n,e=0;e<n.length;e++)o.add(n[e])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),g=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,v={},k={};function x(e){return g.call(k,e)?!0:g.call(v,e)?!1:m.test(e)?k[e]=!0:(v[e]=!0,!1)}function b(e,n,i,c){if(i!==null&&i.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return c?!1:i!==null?!i.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function j(e,n,i,c){if(n===null||typeof n>"u"||b(e,n,i,c))return!0;if(c)return!1;if(i!==null)switch(i.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(e,n,i,c,d,p,y){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=c,this.attributeNamespace=d,this.mustUseProperty=i,this.propertyName=e,this.type=n,this.sanitizeURL=p,this.removeEmptyString=y}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){T[e]=new C(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];T[n]=new C(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){T[e]=new C(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){T[e]=new C(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){T[e]=new C(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){T[e]=new C(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){T[e]=new C(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){T[e]=new C(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){T[e]=new C(e,5,!1,e.toLowerCase(),null,!1,!1)});var I=/[\-:]([a-z])/g;function A(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(I,A);T[n]=new C(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(I,A);T[n]=new C(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(I,A);T[n]=new C(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){T[e]=new C(e,1,!1,e.toLowerCase(),null,!1,!1)}),T.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){T[e]=new C(e,1,!1,e.toLowerCase(),null,!0,!0)});function U(e,n,i,c){var d=T.hasOwnProperty(n)?T[n]:null;(d!==null?d.type!==0:c||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(j(n,i,d,c)&&(i=null),c||d===null?x(n)&&(i===null?e.removeAttribute(n):e.setAttribute(n,""+i)):d.mustUseProperty?e[d.propertyName]=i===null?d.type===3?!1:"":i:(n=d.attributeName,c=d.attributeNamespace,i===null?e.removeAttribute(n):(d=d.type,i=d===3||d===4&&i===!0?"":""+i,c?e.setAttributeNS(c,n,i):e.setAttribute(n,i))))}var O=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,W=Symbol.for("react.element"),Z=Symbol.for("react.portal"),Y=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),ue=Symbol.for("react.profiler"),he=Symbol.for("react.provider"),H=Symbol.for("react.context"),Te=Symbol.for("react.forward_ref"),Ne=Symbol.for("react.suspense"),Le=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),X=Symbol.for("react.offscreen"),P=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var q=Object.assign,E;function L(e){if(E===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);E=n&&n[1]||""}return`
|
|
34
34
|
`+E+e}var de=!1;function K(e,n){if(!e||de)return"";de=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(B){var c=B}Reflect.construct(e,[],n)}else{try{n.call()}catch(B){c=B}e.call(n.prototype)}else{try{throw Error()}catch(B){c=B}e()}}catch(B){if(B&&c&&typeof B.stack=="string"){for(var d=B.stack.split(`
|
|
35
35
|
`),p=c.stack.split(`
|
|
36
36
|
`),y=d.length-1,N=p.length-1;1<=y&&0<=N&&d[y]!==p[N];)N--;for(;1<=y&&0<=N;y--,N--)if(d[y]!==p[N]){if(y!==1||N!==1)do if(y--,N--,0>N||d[y]!==p[N]){var R=`
|
|
37
|
-
`+d[y].replace(" at new "," at ");return e.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",e.displayName)),R}while(1<=y&&0<=N);break}}}finally{de=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?L(e):""}function ce(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=K(e.type,!1),e;case 11:return e=K(e.type.render,!1),e;case 1:return e=K(e.type,!0),e;default:return""}}function fe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Y:return"Fragment";case Z:return"Portal";case ue:return"Profiler";case Q:return"StrictMode";case Ne:return"Suspense";case Le:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case H:return(e.displayName||"Context")+".Consumer";case he:return(e._context.displayName||"Context")+".Provider";case Te:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return n=e.displayName||null,n!==null?n:fe(e.type)||"Memo";case G:n=e._payload,e=e._init;try{return fe(e(n))}catch{}}return null}function Pe(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(n);case 8:return n===Q?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Ce(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ee(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function je(e){var n=Ee(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),c=""+e[n];if(!e.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var d=i.get,p=i.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(y){c=""+y,p.call(this,y)}}),Object.defineProperty(e,n,{enumerable:i.enumerable}),{getValue:function(){return c},setValue:function(y){c=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function it(e){e._valueTracker||(e._valueTracker=je(e))}function _e(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),c="";return e&&(c=Ee(e)?e.checked?"true":"false":e.value),e=c,e!==i?(n.setValue(e),!0):!1}function kt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ze(e,n){var i=n.checked;return q({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function It(e,n){var i=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;i=Ce(n.value!=null?n.value:i),e._wrapperState={initialChecked:c,initialValue:i,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Fe(e,n){n=n.checked,n!=null&&U(e,"checked",n,!1)}function Dt(e,n){Fe(e,n);var i=Ce(n.value),c=n.type;if(i!=null)c==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(c==="submit"||c==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?St(e,n.type,i):n.hasOwnProperty("defaultValue")&&St(e,n.type,Ce(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Rn(e,n,i){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,i||n===e.value||(e.value=n),e.defaultValue=n}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function St(e,n,i){(n!=="number"||kt(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var Mt=Array.isArray;function ht(e,n,i,c){if(e=e.options,n){n={};for(var d=0;d<i.length;d++)n["$"+i[d]]=!0;for(i=0;i<e.length;i++)d=n.hasOwnProperty("$"+e[i].value),e[i].selected!==d&&(e[i].selected=d),d&&c&&(e[i].defaultSelected=!0)}else{for(i=""+Ce(i),n=null,d=0;d<e.length;d++){if(e[d].value===i){e[d].selected=!0,c&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function en(e,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return q({},n,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function V(e,n){var i=n.value;if(i==null){if(i=n.children,n=n.defaultValue,i!=null){if(n!=null)throw Error(r(92));if(Mt(i)){if(1<i.length)throw Error(r(93));i=i[0]}n=i}n==null&&(n=""),i=n}e._wrapperState={initialValue:Ce(i)}}function pe(e,n){var i=Ce(n.value),c=Ce(n.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),n.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),c!=null&&(e.defaultValue=""+c)}function Ue(e){var n=e.textContent;n===e._wrapperState.initialValue&&n!==""&&n!==null&&(e.value=n)}function tt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function mt(e,n){return e==null||e==="http://www.w3.org/1999/xhtml"?tt(n):e==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var gt,Rt=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,i,c,d){MSApp.execUnsafeLocalFunction(function(){return e(n,i,c,d)})}:e})(function(e,n){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=n;else{for(gt=gt||document.createElement("div"),gt.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=gt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Ht(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var ut={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},An=["Webkit","ms","Moz","O"];Object.keys(ut).forEach(function(e){An.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),ut[n]=ut[e]})});function Hn(e,n,i){return n==null||typeof n=="boolean"||n===""?"":i||typeof n!="number"||n===0||ut.hasOwnProperty(e)&&ut[e]?(""+n).trim():n+"px"}function Ts(e,n){e=e.style;for(var i in n)if(n.hasOwnProperty(i)){var c=i.indexOf("--")===0,d=Hn(i,n[i],c);i==="float"&&(i="cssFloat"),c?e.setProperty(i,d):e[i]=d}}var ms=q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function In(e,n){if(n){if(ms[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Dn(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pn=null;function wn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ft=null,Vt=null,st=null;function vt(e){if(e=Ui(e)){if(typeof Ft!="function")throw Error(r(280));var n=e.stateNode;n&&(n=Ko(n),Ft(e.stateNode,e.type,n))}}function yt(e){Vt?st?st.push(e):st=[e]:Vt=e}function qt(){if(Vt){var e=Vt,n=st;if(st=Vt=null,vt(e),n)for(e=0;e<n.length;e++)vt(n[e])}}function bt(e,n){return e(n)}function xt(){}var ot=!1;function Gt(e,n,i){if(ot)return e(n,i);ot=!0;try{return bt(e,n,i)}finally{ot=!1,(Vt!==null||st!==null)&&(xt(),qt())}}function Je(e,n){var i=e.stateNode;if(i===null)return null;var c=Ko(i);if(c===null)return null;i=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(e=e.type,c=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!c;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var j=!1;if(h)try{var oe={};Object.defineProperty(oe,"passive",{get:function(){j=!0}}),window.addEventListener("test",oe,oe),window.removeEventListener("test",oe,oe)}catch{j=!1}function ie(e,n,i,c,d,p,y,N,R){var B=Array.prototype.slice.call(arguments,3);try{n.apply(i,B)}catch(ne){this.onError(ne)}}var ge=!1,$e=null,Be=!1,De=null,at={onError:function(e){ge=!0,$e=e}};function Mn(e,n,i,c,d,p,y,N,R){ge=!1,$e=null,ie.apply(at,arguments)}function Ln(e,n,i,c,d,p,y,N,R){if(Mn.apply(this,arguments),ge){if(ge){var B=$e;ge=!1,$e=null}else throw Error(r(198));Be||(Be=!0,De=B)}}function He(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function kn(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function $s(e){if(He(e)!==e)throw Error(r(188))}function ts(e){var n=e.alternate;if(!n){if(n=He(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,c=n;;){var d=i.return;if(d===null)break;var p=d.alternate;if(p===null){if(c=d.return,c!==null){i=c;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===i)return $s(d),e;if(p===c)return $s(d),n;p=p.sibling}throw Error(r(188))}if(i.return!==c.return)i=d,c=p;else{for(var y=!1,N=d.child;N;){if(N===i){y=!0,i=d,c=p;break}if(N===c){y=!0,c=d,i=p;break}N=N.sibling}if(!y){for(N=p.child;N;){if(N===i){y=!0,i=p,c=d;break}if(N===c){y=!0,c=p,i=d;break}N=N.sibling}if(!y)throw Error(r(189))}}if(i.alternate!==c)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function ns(e){return e=ts(e),e!==null?Xe(e):null}function Xe(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var n=Xe(e);if(n!==null)return n;e=e.sibling}return null}var Tt=s.unstable_scheduleCallback,ss=s.unstable_cancelCallback,El=s.unstable_shouldYield,Rl=s.unstable_requestPaint,Nt=s.unstable_now,gs=s.unstable_getCurrentPriorityLevel,zs=s.unstable_ImmediatePriority,vs=s.unstable_UserBlockingPriority,Or=s.unstable_NormalPriority,fr=s.unstable_LowPriority,Ro=s.unstable_IdlePriority,pr=null,Pn=null;function $r(e){if(Pn&&typeof Pn.onCommitFiberRoot=="function")try{Pn.onCommitFiberRoot(pr,e,void 0,(e.current.flags&128)===128)}catch{}}var hn=Math.clz32?Math.clz32:hr,zr=Math.log,Fs=Math.LN2;function hr(e){return e>>>=0,e===0?32:31-(zr(e)/Fs|0)|0}var mn=64,Fr=4194304;function mr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function gr(e,n){var i=e.pendingLanes;if(i===0)return 0;var c=0,d=e.suspendedLanes,p=e.pingedLanes,y=i&268435455;if(y!==0){var N=y&~d;N!==0?c=mr(N):(p&=y,p!==0&&(c=mr(p)))}else y=i&~d,y!==0?c=mr(y):p!==0&&(c=mr(p));if(c===0)return 0;if(n!==0&&n!==c&&(n&d)===0&&(d=c&-c,p=n&-n,d>=p||d===16&&(p&4194240)!==0))return n;if((c&4)!==0&&(c|=i&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=c;0<n;)i=31-hn(n),d=1<<i,c|=e[i],n&=~d;return c}function Ao(e,n){switch(e){case 1:case 2:case 4:return n+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Io(e,n){for(var i=e.suspendedLanes,c=e.pingedLanes,d=e.expirationTimes,p=e.pendingLanes;0<p;){var y=31-hn(p),N=1<<y,R=d[y];R===-1?((N&i)===0||(N&c)!==0)&&(d[y]=Ao(N,n)):R<=n&&(e.expiredLanes|=N),p&=~N}}function Ti(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ni(){var e=mn;return mn<<=1,(mn&4194240)===0&&(mn=64),e}function Ci(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function vr(e,n,i){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-hn(n),e[n]=i}function Do(e,n){var i=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var c=e.eventTimes;for(e=e.expirationTimes;0<i;){var d=31-hn(i),p=1<<d;n[d]=0,c[d]=-1,e[d]=-1,i&=~p}}function Us(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var c=31-hn(i),d=1<<c;d&n|e[c]&n&&(e[c]|=n),i&=~d}}var Ge=0;function ae(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var S,$,ee,we,be,Oe=!1,Ke=[],Qe=null,Ct=null,_t=null,Ns=new Map,Lt=new Map,Bs=[],wv="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 Ed(e,n){switch(e){case"focusin":case"focusout":Qe=null;break;case"dragenter":case"dragleave":Ct=null;break;case"mouseover":case"mouseout":_t=null;break;case"pointerover":case"pointerout":Ns.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lt.delete(n.pointerId)}}function _i(e,n,i,c,d,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:i,eventSystemFlags:c,nativeEvent:p,targetContainers:[d]},n!==null&&(n=Ui(n),n!==null&&$(n)),e):(e.eventSystemFlags|=c,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function kv(e,n,i,c,d){switch(n){case"focusin":return Qe=_i(Qe,e,n,i,c,d),!0;case"dragenter":return Ct=_i(Ct,e,n,i,c,d),!0;case"mouseover":return _t=_i(_t,e,n,i,c,d),!0;case"pointerover":var p=d.pointerId;return Ns.set(p,_i(Ns.get(p)||null,e,n,i,c,d)),!0;case"gotpointercapture":return p=d.pointerId,Lt.set(p,_i(Lt.get(p)||null,e,n,i,c,d)),!0}return!1}function Rd(e){var n=yr(e.target);if(n!==null){var i=He(n);if(i!==null){if(n=i.tag,n===13){if(n=kn(i),n!==null){e.blockedOn=n,be(e.priority,function(){ee(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Mo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=Il(e.domEventName,e.eventSystemFlags,n[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var c=new i.constructor(i.type,i);pn=c,i.target.dispatchEvent(c),pn=null}else return n=Ui(i),n!==null&&$(n),e.blockedOn=i,!1;n.shift()}return!0}function Ad(e,n,i){Mo(e)&&i.delete(n)}function Sv(){Oe=!1,Qe!==null&&Mo(Qe)&&(Qe=null),Ct!==null&&Mo(Ct)&&(Ct=null),_t!==null&&Mo(_t)&&(_t=null),Ns.forEach(Ad),Lt.forEach(Ad)}function ji(e,n){e.blockedOn===n&&(e.blockedOn=null,Oe||(Oe=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Sv)))}function Ei(e){function n(d){return ji(d,e)}if(0<Ke.length){ji(Ke[0],e);for(var i=1;i<Ke.length;i++){var c=Ke[i];c.blockedOn===e&&(c.blockedOn=null)}}for(Qe!==null&&ji(Qe,e),Ct!==null&&ji(Ct,e),_t!==null&&ji(_t,e),Ns.forEach(n),Lt.forEach(n),i=0;i<Bs.length;i++)c=Bs[i],c.blockedOn===e&&(c.blockedOn=null);for(;0<Bs.length&&(i=Bs[0],i.blockedOn===null);)Rd(i),i.blockedOn===null&&Bs.shift()}var Ur=O.ReactCurrentBatchConfig,Lo=!0;function bv(e,n,i,c){var d=Ge,p=Ur.transition;Ur.transition=null;try{Ge=1,Al(e,n,i,c)}finally{Ge=d,Ur.transition=p}}function Tv(e,n,i,c){var d=Ge,p=Ur.transition;Ur.transition=null;try{Ge=4,Al(e,n,i,c)}finally{Ge=d,Ur.transition=p}}function Al(e,n,i,c){if(Lo){var d=Il(e,n,i,c);if(d===null)Yl(e,n,c,Po,i),Ed(e,c);else if(kv(d,e,n,i,c))c.stopPropagation();else if(Ed(e,c),n&4&&-1<wv.indexOf(e)){for(;d!==null;){var p=Ui(d);if(p!==null&&S(p),p=Il(e,n,i,c),p===null&&Yl(e,n,c,Po,i),p===d)break;d=p}d!==null&&c.stopPropagation()}else Yl(e,n,c,null,i)}}var Po=null;function Il(e,n,i,c){if(Po=null,e=wn(c),e=yr(e),e!==null)if(n=He(e),n===null)e=null;else if(i=n.tag,i===13){if(e=kn(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null);return Po=e,null}function Id(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(gs()){case zs:return 1;case vs:return 4;case Or:case fr:return 16;case Ro:return 536870912;default:return 16}default:return 16}}var Ws=null,Dl=null,Oo=null;function Dd(){if(Oo)return Oo;var e,n=Dl,i=n.length,c,d="value"in Ws?Ws.value:Ws.textContent,p=d.length;for(e=0;e<i&&n[e]===d[e];e++);var y=i-e;for(c=1;c<=y&&n[i-c]===d[p-c];c++);return Oo=d.slice(e,1<c?1-c:void 0)}function $o(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function zo(){return!0}function Md(){return!1}function On(e){function n(i,c,d,p,y){this._reactName=i,this._targetInst=d,this.type=c,this.nativeEvent=p,this.target=y,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(i=e[N],this[N]=i?i(p):p[N]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?zo:Md,this.isPropagationStopped=Md,this}return q(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=zo)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=zo)},persist:function(){},isPersistent:zo}),n}var Br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ml=On(Br),Ri=q({},Br,{view:0,detail:0}),Nv=On(Ri),Ll,Pl,Ai,Fo=q({},Ri,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$l,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ai&&(Ai&&e.type==="mousemove"?(Ll=e.screenX-Ai.screenX,Pl=e.screenY-Ai.screenY):Pl=Ll=0,Ai=e),Ll)},movementY:function(e){return"movementY"in e?e.movementY:Pl}}),Ld=On(Fo),Cv=q({},Fo,{dataTransfer:0}),_v=On(Cv),jv=q({},Ri,{relatedTarget:0}),Ol=On(jv),Ev=q({},Br,{animationName:0,elapsedTime:0,pseudoElement:0}),Rv=On(Ev),Av=q({},Br,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Iv=On(Av),Dv=q({},Br,{data:0}),Pd=On(Dv),Mv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Lv={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"},Pv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ov(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Pv[e])?!!n[e]:!1}function $l(){return Ov}var $v=q({},Ri,{key:function(e){if(e.key){var n=Mv[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=$o(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Lv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$l,charCode:function(e){return e.type==="keypress"?$o(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$o(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zv=On($v),Fv=q({},Fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Od=On(Fv),Uv=q({},Ri,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$l}),Bv=On(Uv),Wv=q({},Br,{propertyName:0,elapsedTime:0,pseudoElement:0}),Hv=On(Wv),Vv=q({},Fo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),qv=On(Vv),Gv=[9,13,27,32],zl=h&&"CompositionEvent"in window,Ii=null;h&&"documentMode"in document&&(Ii=document.documentMode);var Kv=h&&"TextEvent"in window&&!Ii,$d=h&&(!zl||Ii&&8<Ii&&11>=Ii),zd=" ",Fd=!1;function Ud(e,n){switch(e){case"keyup":return Gv.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wr=!1;function Yv(e,n){switch(e){case"compositionend":return Bd(n);case"keypress":return n.which!==32?null:(Fd=!0,zd);case"textInput":return e=n.data,e===zd&&Fd?null:e;default:return null}}function Xv(e,n){if(Wr)return e==="compositionend"||!zl&&Ud(e,n)?(e=Dd(),Oo=Dl=Ws=null,Wr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return $d&&n.locale!=="ko"?null:n.data;default:return null}}var Qv={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 Wd(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Qv[e.type]:n==="textarea"}function Hd(e,n,i,c){yt(c),n=Vo(n,"onChange"),0<n.length&&(i=new Ml("onChange","change",null,i,c),e.push({event:i,listeners:n}))}var Di=null,Mi=null;function Zv(e){cf(e,0)}function Uo(e){var n=Kr(e);if(_e(n))return e}function Jv(e,n){if(e==="change")return n}var Vd=!1;if(h){var Fl;if(h){var Ul="oninput"in document;if(!Ul){var qd=document.createElement("div");qd.setAttribute("oninput","return;"),Ul=typeof qd.oninput=="function"}Fl=Ul}else Fl=!1;Vd=Fl&&(!document.documentMode||9<document.documentMode)}function Gd(){Di&&(Di.detachEvent("onpropertychange",Kd),Mi=Di=null)}function Kd(e){if(e.propertyName==="value"&&Uo(Mi)){var n=[];Hd(n,Mi,e,wn(e)),Gt(Zv,n)}}function ey(e,n,i){e==="focusin"?(Gd(),Di=n,Mi=i,Di.attachEvent("onpropertychange",Kd)):e==="focusout"&&Gd()}function ty(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Uo(Mi)}function ny(e,n){if(e==="click")return Uo(n)}function sy(e,n){if(e==="input"||e==="change")return Uo(n)}function ry(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var rs=typeof Object.is=="function"?Object.is:ry;function Li(e,n){if(rs(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),c=Object.keys(n);if(i.length!==c.length)return!1;for(c=0;c<i.length;c++){var d=i[c];if(!g.call(n,d)||!rs(e[d],n[d]))return!1}return!0}function Yd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xd(e,n){var i=Yd(e);e=0;for(var c;i;){if(i.nodeType===3){if(c=e+i.textContent.length,e<=n&&c>=n)return{node:i,offset:n-e};e=c}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Yd(i)}}function Qd(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Qd(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Zd(){for(var e=window,n=kt();n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=kt(e.document)}return n}function Bl(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function iy(e){var n=Zd(),i=e.focusedElem,c=e.selectionRange;if(n!==i&&i&&i.ownerDocument&&Qd(i.ownerDocument.documentElement,i)){if(c!==null&&Bl(i)){if(n=c.start,e=c.end,e===void 0&&(e=n),"selectionStart"in i)i.selectionStart=n,i.selectionEnd=Math.min(e,i.value.length);else if(e=(n=i.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var d=i.textContent.length,p=Math.min(c.start,d);c=c.end===void 0?p:Math.min(c.end,d),!e.extend&&p>c&&(d=c,c=p,p=d),d=Xd(i,p);var y=Xd(i,c);d&&y&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(d.node,d.offset),e.removeAllRanges(),p>c?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=i;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<n.length;i++)e=n[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var oy=h&&"documentMode"in document&&11>=document.documentMode,Hr=null,Wl=null,Pi=null,Hl=!1;function Jd(e,n,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Hl||Hr==null||Hr!==kt(c)||(c=Hr,"selectionStart"in c&&Bl(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Pi&&Li(Pi,c)||(Pi=c,c=Vo(Wl,"onSelect"),0<c.length&&(n=new Ml("onSelect","select",null,n,i),e.push({event:n,listeners:c}),n.target=Hr)))}function Bo(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Vr={animationend:Bo("Animation","AnimationEnd"),animationiteration:Bo("Animation","AnimationIteration"),animationstart:Bo("Animation","AnimationStart"),transitionend:Bo("Transition","TransitionEnd")},Vl={},ef={};h&&(ef=document.createElement("div").style,"AnimationEvent"in window||(delete Vr.animationend.animation,delete Vr.animationiteration.animation,delete Vr.animationstart.animation),"TransitionEvent"in window||delete Vr.transitionend.transition);function Wo(e){if(Vl[e])return Vl[e];if(!Vr[e])return e;var n=Vr[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in ef)return Vl[e]=n[i];return e}var tf=Wo("animationend"),nf=Wo("animationiteration"),sf=Wo("animationstart"),rf=Wo("transitionend"),of=new Map,af="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Hs(e,n){of.set(e,n),u(n,[e])}for(var ql=0;ql<af.length;ql++){var Gl=af[ql],ay=Gl.toLowerCase(),ly=Gl[0].toUpperCase()+Gl.slice(1);Hs(ay,"on"+ly)}Hs(tf,"onAnimationEnd"),Hs(nf,"onAnimationIteration"),Hs(sf,"onAnimationStart"),Hs("dblclick","onDoubleClick"),Hs("focusin","onFocus"),Hs("focusout","onBlur"),Hs(rf,"onTransitionEnd"),f("onMouseEnter",["mouseout","mouseover"]),f("onMouseLeave",["mouseout","mouseover"]),f("onPointerEnter",["pointerout","pointerover"]),f("onPointerLeave",["pointerout","pointerover"]),u("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),u("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),u("onBeforeInput",["compositionend","keypress","textInput","paste"]),u("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oi="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(" "),cy=new Set("cancel close invalid load scroll toggle".split(" ").concat(Oi));function lf(e,n,i){var c=e.type||"unknown-event";e.currentTarget=i,Ln(c,n,void 0,e),e.currentTarget=null}function cf(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var c=e[i],d=c.event;c=c.listeners;e:{var p=void 0;if(n)for(var y=c.length-1;0<=y;y--){var N=c[y],R=N.instance,B=N.currentTarget;if(N=N.listener,R!==p&&d.isPropagationStopped())break e;lf(d,N,B),p=R}else for(y=0;y<c.length;y++){if(N=c[y],R=N.instance,B=N.currentTarget,N=N.listener,R!==p&&d.isPropagationStopped())break e;lf(d,N,B),p=R}}}if(Be)throw e=De,Be=!1,De=null,e}function dt(e,n){var i=n[tc];i===void 0&&(i=n[tc]=new Set);var c=e+"__bubble";i.has(c)||(uf(n,e,2,!1),i.add(c))}function Kl(e,n,i){var c=0;n&&(c|=4),uf(i,e,c,n)}var Ho="_reactListening"+Math.random().toString(36).slice(2);function $i(e){if(!e[Ho]){e[Ho]=!0,o.forEach(function(i){i!=="selectionchange"&&(cy.has(i)||Kl(i,!1,e),Kl(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Ho]||(n[Ho]=!0,Kl("selectionchange",!1,n))}}function uf(e,n,i,c){switch(Id(n)){case 1:var d=bv;break;case 4:d=Tv;break;default:d=Al}i=d.bind(null,n,i,e),d=void 0,!j||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),c?d!==void 0?e.addEventListener(n,i,{capture:!0,passive:d}):e.addEventListener(n,i,!0):d!==void 0?e.addEventListener(n,i,{passive:d}):e.addEventListener(n,i,!1)}function Yl(e,n,i,c,d){var p=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var y=c.tag;if(y===3||y===4){var N=c.stateNode.containerInfo;if(N===d||N.nodeType===8&&N.parentNode===d)break;if(y===4)for(y=c.return;y!==null;){var R=y.tag;if((R===3||R===4)&&(R=y.stateNode.containerInfo,R===d||R.nodeType===8&&R.parentNode===d))return;y=y.return}for(;N!==null;){if(y=yr(N),y===null)return;if(R=y.tag,R===5||R===6){c=p=y;continue e}N=N.parentNode}}c=c.return}Gt(function(){var B=p,ne=wn(i),re=[];e:{var te=of.get(e);if(te!==void 0){var me=Ml,xe=e;switch(e){case"keypress":if($o(i)===0)break e;case"keydown":case"keyup":me=zv;break;case"focusin":xe="focus",me=Ol;break;case"focusout":xe="blur",me=Ol;break;case"beforeblur":case"afterblur":me=Ol;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":me=Ld;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=_v;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=Bv;break;case tf:case nf:case sf:me=Rv;break;case rf:me=Hv;break;case"scroll":me=Nv;break;case"wheel":me=qv;break;case"copy":case"cut":case"paste":me=Iv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=Od}var ke=(n&4)!==0,Pt=!ke&&e==="scroll",z=ke?te!==null?te+"Capture":null:te;ke=[];for(var D=B,F;D!==null;){F=D;var le=F.stateNode;if(F.tag===5&&le!==null&&(F=le,z!==null&&(le=Je(D,z),le!=null&&ke.push(zi(D,le,F)))),Pt)break;D=D.return}0<ke.length&&(te=new me(te,xe,null,i,ne),re.push({event:te,listeners:ke}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",me=e==="mouseout"||e==="pointerout",te&&i!==pn&&(xe=i.relatedTarget||i.fromElement)&&(yr(xe)||xe[Cs]))break e;if((me||te)&&(te=ne.window===ne?ne:(te=ne.ownerDocument)?te.defaultView||te.parentWindow:window,me?(xe=i.relatedTarget||i.toElement,me=B,xe=xe?yr(xe):null,xe!==null&&(Pt=He(xe),xe!==Pt||xe.tag!==5&&xe.tag!==6)&&(xe=null)):(me=null,xe=B),me!==xe)){if(ke=Ld,le="onMouseLeave",z="onMouseEnter",D="mouse",(e==="pointerout"||e==="pointerover")&&(ke=Od,le="onPointerLeave",z="onPointerEnter",D="pointer"),Pt=me==null?te:Kr(me),F=xe==null?te:Kr(xe),te=new ke(le,D+"leave",me,i,ne),te.target=Pt,te.relatedTarget=F,le=null,yr(ne)===B&&(ke=new ke(z,D+"enter",xe,i,ne),ke.target=F,ke.relatedTarget=Pt,le=ke),Pt=le,me&&xe)t:{for(ke=me,z=xe,D=0,F=ke;F;F=qr(F))D++;for(F=0,le=z;le;le=qr(le))F++;for(;0<D-F;)ke=qr(ke),D--;for(;0<F-D;)z=qr(z),F--;for(;D--;){if(ke===z||z!==null&&ke===z.alternate)break t;ke=qr(ke),z=qr(z)}ke=null}else ke=null;me!==null&&df(re,te,me,ke,!1),xe!==null&&Pt!==null&&df(re,Pt,xe,ke,!0)}}e:{if(te=B?Kr(B):window,me=te.nodeName&&te.nodeName.toLowerCase(),me==="select"||me==="input"&&te.type==="file")var Se=Jv;else if(Wd(te))if(Vd)Se=sy;else{Se=ty;var Ae=ey}else(me=te.nodeName)&&me.toLowerCase()==="input"&&(te.type==="checkbox"||te.type==="radio")&&(Se=ny);if(Se&&(Se=Se(e,B))){Hd(re,Se,i,ne);break e}Ae&&Ae(e,te,B),e==="focusout"&&(Ae=te._wrapperState)&&Ae.controlled&&te.type==="number"&&St(te,"number",te.value)}switch(Ae=B?Kr(B):window,e){case"focusin":(Wd(Ae)||Ae.contentEditable==="true")&&(Hr=Ae,Wl=B,Pi=null);break;case"focusout":Pi=Wl=Hr=null;break;case"mousedown":Hl=!0;break;case"contextmenu":case"mouseup":case"dragend":Hl=!1,Jd(re,i,ne);break;case"selectionchange":if(oy)break;case"keydown":case"keyup":Jd(re,i,ne)}var Ie;if(zl)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Wr?Ud(e,i)&&(Me="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Me="onCompositionStart");Me&&($d&&i.locale!=="ko"&&(Wr||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Wr&&(Ie=Dd()):(Ws=ne,Dl="value"in Ws?Ws.value:Ws.textContent,Wr=!0)),Ae=Vo(B,Me),0<Ae.length&&(Me=new Pd(Me,e,null,i,ne),re.push({event:Me,listeners:Ae}),Ie?Me.data=Ie:(Ie=Bd(i),Ie!==null&&(Me.data=Ie)))),(Ie=Kv?Yv(e,i):Xv(e,i))&&(B=Vo(B,"onBeforeInput"),0<B.length&&(ne=new Pd("onBeforeInput","beforeinput",null,i,ne),re.push({event:ne,listeners:B}),ne.data=Ie))}cf(re,n)})}function zi(e,n,i){return{instance:e,listener:n,currentTarget:i}}function Vo(e,n){for(var i=n+"Capture",c=[];e!==null;){var d=e,p=d.stateNode;d.tag===5&&p!==null&&(d=p,p=Je(e,i),p!=null&&c.unshift(zi(e,p,d)),p=Je(e,n),p!=null&&c.push(zi(e,p,d))),e=e.return}return c}function qr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function df(e,n,i,c,d){for(var p=n._reactName,y=[];i!==null&&i!==c;){var N=i,R=N.alternate,B=N.stateNode;if(R!==null&&R===c)break;N.tag===5&&B!==null&&(N=B,d?(R=Je(i,p),R!=null&&y.unshift(zi(i,R,N))):d||(R=Je(i,p),R!=null&&y.push(zi(i,R,N)))),i=i.return}y.length!==0&&e.push({event:n,listeners:y})}var uy=/\r\n?/g,dy=/\u0000|\uFFFD/g;function ff(e){return(typeof e=="string"?e:""+e).replace(uy,`
|
|
38
|
-
`).replace(dy,"")}function qo(e,n,i){if(n=ff(n),ff(e)!==n&&i)throw Error(r(425))}function Go(){}var Xl=null,Ql=null;function Zl(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var Jl=typeof setTimeout=="function"?setTimeout:void 0,fy=typeof clearTimeout=="function"?clearTimeout:void 0,pf=typeof Promise=="function"?Promise:void 0,py=typeof queueMicrotask=="function"?queueMicrotask:typeof pf<"u"?function(e){return pf.resolve(null).then(e).catch(hy)}:Jl;function hy(e){setTimeout(function(){throw e})}function ec(e,n){var i=n,c=0;do{var d=i.nextSibling;if(e.removeChild(i),d&&d.nodeType===8)if(i=d.data,i==="/$"){if(c===0){e.removeChild(d),Ei(n);return}c--}else i!=="$"&&i!=="$?"&&i!=="$!"||c++;i=d}while(i);Ei(n)}function Vs(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function hf(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(n===0)return e;n--}else i==="/$"&&n++}e=e.previousSibling}return null}var Gr=Math.random().toString(36).slice(2),ys="__reactFiber$"+Gr,Fi="__reactProps$"+Gr,Cs="__reactContainer$"+Gr,tc="__reactEvents$"+Gr,my="__reactListeners$"+Gr,gy="__reactHandles$"+Gr;function yr(e){var n=e[ys];if(n)return n;for(var i=e.parentNode;i;){if(n=i[Cs]||i[ys]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=hf(e);e!==null;){if(i=e[ys])return i;e=hf(e)}return n}e=i,i=e.parentNode}return null}function Ui(e){return e=e[ys]||e[Cs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Kr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ko(e){return e[Fi]||null}var nc=[],Yr=-1;function qs(e){return{current:e}}function ft(e){0>Yr||(e.current=nc[Yr],nc[Yr]=null,Yr--)}function ct(e,n){Yr++,nc[Yr]=e.current,e.current=n}var Gs={},on=qs(Gs),Sn=qs(!1),xr=Gs;function Xr(e,n){var i=e.type.contextTypes;if(!i)return Gs;var c=e.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var d={},p;for(p in i)d[p]=n[p];return c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=d),d}function bn(e){return e=e.childContextTypes,e!=null}function Yo(){ft(Sn),ft(on)}function mf(e,n,i){if(on.current!==Gs)throw Error(r(168));ct(on,n),ct(Sn,i)}function gf(e,n,i){var c=e.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return i;c=c.getChildContext();for(var d in c)if(!(d in n))throw Error(r(108,Pe(e)||"Unknown",d));return q({},i,c)}function Xo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Gs,xr=on.current,ct(on,e),ct(Sn,Sn.current),!0}function vf(e,n,i){var c=e.stateNode;if(!c)throw Error(r(169));i?(e=gf(e,n,xr),c.__reactInternalMemoizedMergedChildContext=e,ft(Sn),ft(on),ct(on,e)):ft(Sn),ct(Sn,i)}var _s=null,Qo=!1,sc=!1;function yf(e){_s===null?_s=[e]:_s.push(e)}function vy(e){Qo=!0,yf(e)}function Ks(){if(!sc&&_s!==null){sc=!0;var e=0,n=Ge;try{var i=_s;for(Ge=1;e<i.length;e++){var c=i[e];do c=c(!0);while(c!==null)}_s=null,Qo=!1}catch(d){throw _s!==null&&(_s=_s.slice(e+1)),Tt(zs,Ks),d}finally{Ge=n,sc=!1}}return null}var Qr=[],Zr=0,Zo=null,Jo=0,Vn=[],qn=0,wr=null,js=1,Es="";function kr(e,n){Qr[Zr++]=Jo,Qr[Zr++]=Zo,Zo=e,Jo=n}function xf(e,n,i){Vn[qn++]=js,Vn[qn++]=Es,Vn[qn++]=wr,wr=e;var c=js;e=Es;var d=32-hn(c)-1;c&=~(1<<d),i+=1;var p=32-hn(n)+d;if(30<p){var y=d-d%5;p=(c&(1<<y)-1).toString(32),c>>=y,d-=y,js=1<<32-hn(n)+d|i<<d|c,Es=p+e}else js=1<<p|i<<d|c,Es=e}function rc(e){e.return!==null&&(kr(e,1),xf(e,1,0))}function ic(e){for(;e===Zo;)Zo=Qr[--Zr],Qr[Zr]=null,Jo=Qr[--Zr],Qr[Zr]=null;for(;e===wr;)wr=Vn[--qn],Vn[qn]=null,Es=Vn[--qn],Vn[qn]=null,js=Vn[--qn],Vn[qn]=null}var $n=null,zn=null,wt=!1,is=null;function wf(e,n){var i=Xn(5,null,null,0);i.elementType="DELETED",i.stateNode=n,i.return=e,n=e.deletions,n===null?(e.deletions=[i],e.flags|=16):n.push(i)}function kf(e,n){switch(e.tag){case 5:var i=e.type;return n=n.nodeType!==1||i.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,$n=e,zn=Vs(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,$n=e,zn=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(i=wr!==null?{id:js,overflow:Es}:null,e.memoizedState={dehydrated:n,treeContext:i,retryLane:1073741824},i=Xn(18,null,null,0),i.stateNode=n,i.return=e,e.child=i,$n=e,zn=null,!0):!1;default:return!1}}function oc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ac(e){if(wt){var n=zn;if(n){var i=n;if(!kf(e,n)){if(oc(e))throw Error(r(418));n=Vs(i.nextSibling);var c=$n;n&&kf(e,n)?wf(c,i):(e.flags=e.flags&-4097|2,wt=!1,$n=e)}}else{if(oc(e))throw Error(r(418));e.flags=e.flags&-4097|2,wt=!1,$n=e}}}function Sf(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;$n=e}function ea(e){if(e!==$n)return!1;if(!wt)return Sf(e),wt=!0,!1;var n;if((n=e.tag!==3)&&!(n=e.tag!==5)&&(n=e.type,n=n!=="head"&&n!=="body"&&!Zl(e.type,e.memoizedProps)),n&&(n=zn)){if(oc(e))throw bf(),Error(r(418));for(;n;)wf(e,n),n=Vs(n.nextSibling)}if(Sf(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));e:{for(e=e.nextSibling,n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(n===0){zn=Vs(e.nextSibling);break e}n--}else i!=="$"&&i!=="$!"&&i!=="$?"||n++}e=e.nextSibling}zn=null}}else zn=$n?Vs(e.stateNode.nextSibling):null;return!0}function bf(){for(var e=zn;e;)e=Vs(e.nextSibling)}function Jr(){zn=$n=null,wt=!1}function lc(e){is===null?is=[e]:is.push(e)}var yy=O.ReactCurrentBatchConfig;function Bi(e,n,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var c=i.stateNode}if(!c)throw Error(r(147,e));var d=c,p=""+e;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===p?n.ref:(n=function(y){var N=d.refs;y===null?delete N[p]:N[p]=y},n._stringRef=p,n)}if(typeof e!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,e))}return e}function ta(e,n){throw e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e))}function Tf(e){var n=e._init;return n(e._payload)}function Nf(e){function n(z,D){if(e){var F=z.deletions;F===null?(z.deletions=[D],z.flags|=16):F.push(D)}}function i(z,D){if(!e)return null;for(;D!==null;)n(z,D),D=D.sibling;return null}function c(z,D){for(z=new Map;D!==null;)D.key!==null?z.set(D.key,D):z.set(D.index,D),D=D.sibling;return z}function d(z,D){return z=nr(z,D),z.index=0,z.sibling=null,z}function p(z,D,F){return z.index=F,e?(F=z.alternate,F!==null?(F=F.index,F<D?(z.flags|=2,D):F):(z.flags|=2,D)):(z.flags|=1048576,D)}function y(z){return e&&z.alternate===null&&(z.flags|=2),z}function N(z,D,F,le){return D===null||D.tag!==6?(D=Jc(F,z.mode,le),D.return=z,D):(D=d(D,F),D.return=z,D)}function R(z,D,F,le){var Se=F.type;return Se===Y?ne(z,D,F.props.children,le,F.key):D!==null&&(D.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===G&&Tf(Se)===D.type)?(le=d(D,F.props),le.ref=Bi(z,D,F),le.return=z,le):(le=Na(F.type,F.key,F.props,null,z.mode,le),le.ref=Bi(z,D,F),le.return=z,le)}function B(z,D,F,le){return D===null||D.tag!==4||D.stateNode.containerInfo!==F.containerInfo||D.stateNode.implementation!==F.implementation?(D=eu(F,z.mode,le),D.return=z,D):(D=d(D,F.children||[]),D.return=z,D)}function ne(z,D,F,le,Se){return D===null||D.tag!==7?(D=Er(F,z.mode,le,Se),D.return=z,D):(D=d(D,F),D.return=z,D)}function re(z,D,F){if(typeof D=="string"&&D!==""||typeof D=="number")return D=Jc(""+D,z.mode,F),D.return=z,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case W:return F=Na(D.type,D.key,D.props,null,z.mode,F),F.ref=Bi(z,null,D),F.return=z,F;case Z:return D=eu(D,z.mode,F),D.return=z,D;case G:var le=D._init;return re(z,le(D._payload),F)}if(Mt(D)||J(D))return D=Er(D,z.mode,F,null),D.return=z,D;ta(z,D)}return null}function te(z,D,F,le){var Se=D!==null?D.key:null;if(typeof F=="string"&&F!==""||typeof F=="number")return Se!==null?null:N(z,D,""+F,le);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case W:return F.key===Se?R(z,D,F,le):null;case Z:return F.key===Se?B(z,D,F,le):null;case G:return Se=F._init,te(z,D,Se(F._payload),le)}if(Mt(F)||J(F))return Se!==null?null:ne(z,D,F,le,null);ta(z,F)}return null}function me(z,D,F,le,Se){if(typeof le=="string"&&le!==""||typeof le=="number")return z=z.get(F)||null,N(D,z,""+le,Se);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case W:return z=z.get(le.key===null?F:le.key)||null,R(D,z,le,Se);case Z:return z=z.get(le.key===null?F:le.key)||null,B(D,z,le,Se);case G:var Ae=le._init;return me(z,D,F,Ae(le._payload),Se)}if(Mt(le)||J(le))return z=z.get(F)||null,ne(D,z,le,Se,null);ta(D,le)}return null}function xe(z,D,F,le){for(var Se=null,Ae=null,Ie=D,Me=D=0,Xt=null;Ie!==null&&Me<F.length;Me++){Ie.index>Me?(Xt=Ie,Ie=null):Xt=Ie.sibling;var Ze=te(z,Ie,F[Me],le);if(Ze===null){Ie===null&&(Ie=Xt);break}e&&Ie&&Ze.alternate===null&&n(z,Ie),D=p(Ze,D,Me),Ae===null?Se=Ze:Ae.sibling=Ze,Ae=Ze,Ie=Xt}if(Me===F.length)return i(z,Ie),wt&&kr(z,Me),Se;if(Ie===null){for(;Me<F.length;Me++)Ie=re(z,F[Me],le),Ie!==null&&(D=p(Ie,D,Me),Ae===null?Se=Ie:Ae.sibling=Ie,Ae=Ie);return wt&&kr(z,Me),Se}for(Ie=c(z,Ie);Me<F.length;Me++)Xt=me(Ie,z,Me,F[Me],le),Xt!==null&&(e&&Xt.alternate!==null&&Ie.delete(Xt.key===null?Me:Xt.key),D=p(Xt,D,Me),Ae===null?Se=Xt:Ae.sibling=Xt,Ae=Xt);return e&&Ie.forEach(function(sr){return n(z,sr)}),wt&&kr(z,Me),Se}function ke(z,D,F,le){var Se=J(F);if(typeof Se!="function")throw Error(r(150));if(F=Se.call(F),F==null)throw Error(r(151));for(var Ae=Se=null,Ie=D,Me=D=0,Xt=null,Ze=F.next();Ie!==null&&!Ze.done;Me++,Ze=F.next()){Ie.index>Me?(Xt=Ie,Ie=null):Xt=Ie.sibling;var sr=te(z,Ie,Ze.value,le);if(sr===null){Ie===null&&(Ie=Xt);break}e&&Ie&&sr.alternate===null&&n(z,Ie),D=p(sr,D,Me),Ae===null?Se=sr:Ae.sibling=sr,Ae=sr,Ie=Xt}if(Ze.done)return i(z,Ie),wt&&kr(z,Me),Se;if(Ie===null){for(;!Ze.done;Me++,Ze=F.next())Ze=re(z,Ze.value,le),Ze!==null&&(D=p(Ze,D,Me),Ae===null?Se=Ze:Ae.sibling=Ze,Ae=Ze);return wt&&kr(z,Me),Se}for(Ie=c(z,Ie);!Ze.done;Me++,Ze=F.next())Ze=me(Ie,z,Me,Ze.value,le),Ze!==null&&(e&&Ze.alternate!==null&&Ie.delete(Ze.key===null?Me:Ze.key),D=p(Ze,D,Me),Ae===null?Se=Ze:Ae.sibling=Ze,Ae=Ze);return e&&Ie.forEach(function(Qy){return n(z,Qy)}),wt&&kr(z,Me),Se}function Pt(z,D,F,le){if(typeof F=="object"&&F!==null&&F.type===Y&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case W:e:{for(var Se=F.key,Ae=D;Ae!==null;){if(Ae.key===Se){if(Se=F.type,Se===Y){if(Ae.tag===7){i(z,Ae.sibling),D=d(Ae,F.props.children),D.return=z,z=D;break e}}else if(Ae.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===G&&Tf(Se)===Ae.type){i(z,Ae.sibling),D=d(Ae,F.props),D.ref=Bi(z,Ae,F),D.return=z,z=D;break e}i(z,Ae);break}else n(z,Ae);Ae=Ae.sibling}F.type===Y?(D=Er(F.props.children,z.mode,le,F.key),D.return=z,z=D):(le=Na(F.type,F.key,F.props,null,z.mode,le),le.ref=Bi(z,D,F),le.return=z,z=le)}return y(z);case Z:e:{for(Ae=F.key;D!==null;){if(D.key===Ae)if(D.tag===4&&D.stateNode.containerInfo===F.containerInfo&&D.stateNode.implementation===F.implementation){i(z,D.sibling),D=d(D,F.children||[]),D.return=z,z=D;break e}else{i(z,D);break}else n(z,D);D=D.sibling}D=eu(F,z.mode,le),D.return=z,z=D}return y(z);case G:return Ae=F._init,Pt(z,D,Ae(F._payload),le)}if(Mt(F))return xe(z,D,F,le);if(J(F))return ke(z,D,F,le);ta(z,F)}return typeof F=="string"&&F!==""||typeof F=="number"?(F=""+F,D!==null&&D.tag===6?(i(z,D.sibling),D=d(D,F),D.return=z,z=D):(i(z,D),D=Jc(F,z.mode,le),D.return=z,z=D),y(z)):i(z,D)}return Pt}var ei=Nf(!0),Cf=Nf(!1),na=qs(null),sa=null,ti=null,cc=null;function uc(){cc=ti=sa=null}function dc(e){var n=na.current;ft(na),e._currentValue=n}function fc(e,n,i){for(;e!==null;){var c=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),e===i)break;e=e.return}}function ni(e,n){sa=e,cc=ti=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(Tn=!0),e.firstContext=null)}function Gn(e){var n=e._currentValue;if(cc!==e)if(e={context:e,memoizedValue:n,next:null},ti===null){if(sa===null)throw Error(r(308));ti=e,sa.dependencies={lanes:0,firstContext:e}}else ti=ti.next=e;return n}var Sr=null;function pc(e){Sr===null?Sr=[e]:Sr.push(e)}function _f(e,n,i,c){var d=n.interleaved;return d===null?(i.next=i,pc(n)):(i.next=d.next,d.next=i),n.interleaved=i,Rs(e,c)}function Rs(e,n){e.lanes|=n;var i=e.alternate;for(i!==null&&(i.lanes|=n),i=e,e=e.return;e!==null;)e.childLanes|=n,i=e.alternate,i!==null&&(i.childLanes|=n),i=e,e=e.return;return i.tag===3?i.stateNode:null}var Ys=!1;function hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jf(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function As(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Xs(e,n,i){var c=e.updateQueue;if(c===null)return null;if(c=c.shared,(Ye&2)!==0){var d=c.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),c.pending=n,Rs(e,i)}return d=c.interleaved,d===null?(n.next=n,pc(c)):(n.next=d.next,d.next=n),c.interleaved=n,Rs(e,i)}function ra(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194240)!==0)){var c=n.lanes;c&=e.pendingLanes,i|=c,n.lanes=i,Us(e,i)}}function Ef(e,n){var i=e.updateQueue,c=e.alternate;if(c!==null&&(c=c.updateQueue,i===c)){var d=null,p=null;if(i=i.firstBaseUpdate,i!==null){do{var y={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};p===null?d=p=y:p=p.next=y,i=i.next}while(i!==null);p===null?d=p=n:p=p.next=n}else d=p=n;i={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:c.shared,effects:c.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}function ia(e,n,i,c){var d=e.updateQueue;Ys=!1;var p=d.firstBaseUpdate,y=d.lastBaseUpdate,N=d.shared.pending;if(N!==null){d.shared.pending=null;var R=N,B=R.next;R.next=null,y===null?p=B:y.next=B,y=R;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,N=ne.lastBaseUpdate,N!==y&&(N===null?ne.firstBaseUpdate=B:N.next=B,ne.lastBaseUpdate=R))}if(p!==null){var re=d.baseState;y=0,ne=B=R=null,N=p;do{var te=N.lane,me=N.eventTime;if((c&te)===te){ne!==null&&(ne=ne.next={eventTime:me,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var xe=e,ke=N;switch(te=n,me=i,ke.tag){case 1:if(xe=ke.payload,typeof xe=="function"){re=xe.call(me,re,te);break e}re=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=ke.payload,te=typeof xe=="function"?xe.call(me,re,te):xe,te==null)break e;re=q({},re,te);break e;case 2:Ys=!0}}N.callback!==null&&N.lane!==0&&(e.flags|=64,te=d.effects,te===null?d.effects=[N]:te.push(N))}else me={eventTime:me,lane:te,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ne===null?(B=ne=me,R=re):ne=ne.next=me,y|=te;if(N=N.next,N===null){if(N=d.shared.pending,N===null)break;te=N,N=te.next,te.next=null,d.lastBaseUpdate=te,d.shared.pending=null}}while(!0);if(ne===null&&(R=re),d.baseState=R,d.firstBaseUpdate=B,d.lastBaseUpdate=ne,n=d.shared.interleaved,n!==null){d=n;do y|=d.lane,d=d.next;while(d!==n)}else p===null&&(d.shared.lanes=0);Nr|=y,e.lanes=y,e.memoizedState=re}}function Rf(e,n,i){if(e=n.effects,n.effects=null,e!==null)for(n=0;n<e.length;n++){var c=e[n],d=c.callback;if(d!==null){if(c.callback=null,c=i,typeof d!="function")throw Error(r(191,d));d.call(c)}}}var Wi={},xs=qs(Wi),Hi=qs(Wi),Vi=qs(Wi);function br(e){if(e===Wi)throw Error(r(174));return e}function mc(e,n){switch(ct(Vi,n),ct(Hi,e),ct(xs,Wi),e=n.nodeType,e){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:mt(null,"");break;default:e=e===8?n.parentNode:n,n=e.namespaceURI||null,e=e.tagName,n=mt(n,e)}ft(xs),ct(xs,n)}function si(){ft(xs),ft(Hi),ft(Vi)}function Af(e){br(Vi.current);var n=br(xs.current),i=mt(n,e.type);n!==i&&(ct(Hi,e),ct(xs,i))}function gc(e){Hi.current===e&&(ft(xs),ft(Hi))}var jt=qs(0);function oa(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var vc=[];function yc(){for(var e=0;e<vc.length;e++)vc[e]._workInProgressVersionPrimary=null;vc.length=0}var aa=O.ReactCurrentDispatcher,xc=O.ReactCurrentBatchConfig,Tr=0,Et=null,Ut=null,Kt=null,la=!1,qi=!1,Gi=0,xy=0;function an(){throw Error(r(321))}function wc(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!rs(e[i],n[i]))return!1;return!0}function kc(e,n,i,c,d,p){if(Tr=p,Et=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,aa.current=e===null||e.memoizedState===null?by:Ty,e=i(c,d),qi){p=0;do{if(qi=!1,Gi=0,25<=p)throw Error(r(301));p+=1,Kt=Ut=null,n.updateQueue=null,aa.current=Ny,e=i(c,d)}while(qi)}if(aa.current=da,n=Ut!==null&&Ut.next!==null,Tr=0,Kt=Ut=Et=null,la=!1,n)throw Error(r(300));return e}function Sc(){var e=Gi!==0;return Gi=0,e}function ws(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kt===null?Et.memoizedState=Kt=e:Kt=Kt.next=e,Kt}function Kn(){if(Ut===null){var e=Et.alternate;e=e!==null?e.memoizedState:null}else e=Ut.next;var n=Kt===null?Et.memoizedState:Kt.next;if(n!==null)Kt=n,Ut=e;else{if(e===null)throw Error(r(310));Ut=e,e={memoizedState:Ut.memoizedState,baseState:Ut.baseState,baseQueue:Ut.baseQueue,queue:Ut.queue,next:null},Kt===null?Et.memoizedState=Kt=e:Kt=Kt.next=e}return Kt}function Ki(e,n){return typeof n=="function"?n(e):n}function bc(e){var n=Kn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var c=Ut,d=c.baseQueue,p=i.pending;if(p!==null){if(d!==null){var y=d.next;d.next=p.next,p.next=y}c.baseQueue=d=p,i.pending=null}if(d!==null){p=d.next,c=c.baseState;var N=y=null,R=null,B=p;do{var ne=B.lane;if((Tr&ne)===ne)R!==null&&(R=R.next={lane:0,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),c=B.hasEagerState?B.eagerState:e(c,B.action);else{var re={lane:ne,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null};R===null?(N=R=re,y=c):R=R.next=re,Et.lanes|=ne,Nr|=ne}B=B.next}while(B!==null&&B!==p);R===null?y=c:R.next=N,rs(c,n.memoizedState)||(Tn=!0),n.memoizedState=c,n.baseState=y,n.baseQueue=R,i.lastRenderedState=c}if(e=i.interleaved,e!==null){d=e;do p=d.lane,Et.lanes|=p,Nr|=p,d=d.next;while(d!==e)}else d===null&&(i.lanes=0);return[n.memoizedState,i.dispatch]}function Tc(e){var n=Kn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var c=i.dispatch,d=i.pending,p=n.memoizedState;if(d!==null){i.pending=null;var y=d=d.next;do p=e(p,y.action),y=y.next;while(y!==d);rs(p,n.memoizedState)||(Tn=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),i.lastRenderedState=p}return[p,c]}function If(){}function Df(e,n){var i=Et,c=Kn(),d=n(),p=!rs(c.memoizedState,d);if(p&&(c.memoizedState=d,Tn=!0),c=c.queue,Nc(Pf.bind(null,i,c,e),[e]),c.getSnapshot!==n||p||Kt!==null&&Kt.memoizedState.tag&1){if(i.flags|=2048,Yi(9,Lf.bind(null,i,c,d,n),void 0,null),Yt===null)throw Error(r(349));(Tr&30)!==0||Mf(i,n,d)}return d}function Mf(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Et.updateQueue,n===null?(n={lastEffect:null,stores:null},Et.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Lf(e,n,i,c){n.value=i,n.getSnapshot=c,Of(n)&&$f(e)}function Pf(e,n,i){return i(function(){Of(n)&&$f(e)})}function Of(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!rs(e,i)}catch{return!0}}function $f(e){var n=Rs(e,1);n!==null&&cs(n,e,1,-1)}function zf(e){var n=ws();return typeof e=="function"&&(e=e()),n.memoizedState=n.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:e},n.queue=e,e=e.dispatch=Sy.bind(null,Et,e),[n.memoizedState,e]}function Yi(e,n,i,c){return e={tag:e,create:n,destroy:i,deps:c,next:null},n=Et.updateQueue,n===null?(n={lastEffect:null,stores:null},Et.updateQueue=n,n.lastEffect=e.next=e):(i=n.lastEffect,i===null?n.lastEffect=e.next=e:(c=i.next,i.next=e,e.next=c,n.lastEffect=e)),e}function Ff(){return Kn().memoizedState}function ca(e,n,i,c){var d=ws();Et.flags|=e,d.memoizedState=Yi(1|n,i,void 0,c===void 0?null:c)}function ua(e,n,i,c){var d=Kn();c=c===void 0?null:c;var p=void 0;if(Ut!==null){var y=Ut.memoizedState;if(p=y.destroy,c!==null&&wc(c,y.deps)){d.memoizedState=Yi(n,i,p,c);return}}Et.flags|=e,d.memoizedState=Yi(1|n,i,p,c)}function Uf(e,n){return ca(8390656,8,e,n)}function Nc(e,n){return ua(2048,8,e,n)}function Bf(e,n){return ua(4,2,e,n)}function Wf(e,n){return ua(4,4,e,n)}function Hf(e,n){if(typeof n=="function")return e=e(),n(e),function(){n(null)};if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Vf(e,n,i){return i=i!=null?i.concat([e]):null,ua(4,4,Hf.bind(null,n,e),i)}function Cc(){}function qf(e,n){var i=Kn();n=n===void 0?null:n;var c=i.memoizedState;return c!==null&&n!==null&&wc(n,c[1])?c[0]:(i.memoizedState=[e,n],e)}function Gf(e,n){var i=Kn();n=n===void 0?null:n;var c=i.memoizedState;return c!==null&&n!==null&&wc(n,c[1])?c[0]:(e=e(),i.memoizedState=[e,n],e)}function Kf(e,n,i){return(Tr&21)===0?(e.baseState&&(e.baseState=!1,Tn=!0),e.memoizedState=i):(rs(i,n)||(i=Ni(),Et.lanes|=i,Nr|=i,e.baseState=!0),n)}function wy(e,n){var i=Ge;Ge=i!==0&&4>i?i:4,e(!0);var c=xc.transition;xc.transition={};try{e(!1),n()}finally{Ge=i,xc.transition=c}}function Yf(){return Kn().memoizedState}function ky(e,n,i){var c=er(e);if(i={lane:c,action:i,hasEagerState:!1,eagerState:null,next:null},Xf(e))Qf(n,i);else if(i=_f(e,n,i,c),i!==null){var d=vn();cs(i,e,c,d),Zf(i,n,c)}}function Sy(e,n,i){var c=er(e),d={lane:c,action:i,hasEagerState:!1,eagerState:null,next:null};if(Xf(e))Qf(n,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var y=n.lastRenderedState,N=p(y,i);if(d.hasEagerState=!0,d.eagerState=N,rs(N,y)){var R=n.interleaved;R===null?(d.next=d,pc(n)):(d.next=R.next,R.next=d),n.interleaved=d;return}}catch{}finally{}i=_f(e,n,d,c),i!==null&&(d=vn(),cs(i,e,c,d),Zf(i,n,c))}}function Xf(e){var n=e.alternate;return e===Et||n!==null&&n===Et}function Qf(e,n){qi=la=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function Zf(e,n,i){if((i&4194240)!==0){var c=n.lanes;c&=e.pendingLanes,i|=c,n.lanes=i,Us(e,i)}}var da={readContext:Gn,useCallback:an,useContext:an,useEffect:an,useImperativeHandle:an,useInsertionEffect:an,useLayoutEffect:an,useMemo:an,useReducer:an,useRef:an,useState:an,useDebugValue:an,useDeferredValue:an,useTransition:an,useMutableSource:an,useSyncExternalStore:an,useId:an,unstable_isNewReconciler:!1},by={readContext:Gn,useCallback:function(e,n){return ws().memoizedState=[e,n===void 0?null:n],e},useContext:Gn,useEffect:Uf,useImperativeHandle:function(e,n,i){return i=i!=null?i.concat([e]):null,ca(4194308,4,Hf.bind(null,n,e),i)},useLayoutEffect:function(e,n){return ca(4194308,4,e,n)},useInsertionEffect:function(e,n){return ca(4,2,e,n)},useMemo:function(e,n){var i=ws();return n=n===void 0?null:n,e=e(),i.memoizedState=[e,n],e},useReducer:function(e,n,i){var c=ws();return n=i!==void 0?i(n):n,c.memoizedState=c.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},c.queue=e,e=e.dispatch=ky.bind(null,Et,e),[c.memoizedState,e]},useRef:function(e){var n=ws();return e={current:e},n.memoizedState=e},useState:zf,useDebugValue:Cc,useDeferredValue:function(e){return ws().memoizedState=e},useTransition:function(){var e=zf(!1),n=e[0];return e=wy.bind(null,e[1]),ws().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,i){var c=Et,d=ws();if(wt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),Yt===null)throw Error(r(349));(Tr&30)!==0||Mf(c,n,i)}d.memoizedState=i;var p={value:i,getSnapshot:n};return d.queue=p,Uf(Pf.bind(null,c,p,e),[e]),c.flags|=2048,Yi(9,Lf.bind(null,c,p,i,n),void 0,null),i},useId:function(){var e=ws(),n=Yt.identifierPrefix;if(wt){var i=Es,c=js;i=(c&~(1<<32-hn(c)-1)).toString(32)+i,n=":"+n+"R"+i,i=Gi++,0<i&&(n+="H"+i.toString(32)),n+=":"}else i=xy++,n=":"+n+"r"+i.toString(32)+":";return e.memoizedState=n},unstable_isNewReconciler:!1},Ty={readContext:Gn,useCallback:qf,useContext:Gn,useEffect:Nc,useImperativeHandle:Vf,useInsertionEffect:Bf,useLayoutEffect:Wf,useMemo:Gf,useReducer:bc,useRef:Ff,useState:function(){return bc(Ki)},useDebugValue:Cc,useDeferredValue:function(e){var n=Kn();return Kf(n,Ut.memoizedState,e)},useTransition:function(){var e=bc(Ki)[0],n=Kn().memoizedState;return[e,n]},useMutableSource:If,useSyncExternalStore:Df,useId:Yf,unstable_isNewReconciler:!1},Ny={readContext:Gn,useCallback:qf,useContext:Gn,useEffect:Nc,useImperativeHandle:Vf,useInsertionEffect:Bf,useLayoutEffect:Wf,useMemo:Gf,useReducer:Tc,useRef:Ff,useState:function(){return Tc(Ki)},useDebugValue:Cc,useDeferredValue:function(e){var n=Kn();return Ut===null?n.memoizedState=e:Kf(n,Ut.memoizedState,e)},useTransition:function(){var e=Tc(Ki)[0],n=Kn().memoizedState;return[e,n]},useMutableSource:If,useSyncExternalStore:Df,useId:Yf,unstable_isNewReconciler:!1};function os(e,n){if(e&&e.defaultProps){n=q({},n),e=e.defaultProps;for(var i in e)n[i]===void 0&&(n[i]=e[i]);return n}return n}function _c(e,n,i,c){n=e.memoizedState,i=i(c,n),i=i==null?n:q({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var fa={isMounted:function(e){return(e=e._reactInternals)?He(e)===e:!1},enqueueSetState:function(e,n,i){e=e._reactInternals;var c=vn(),d=er(e),p=As(c,d);p.payload=n,i!=null&&(p.callback=i),n=Xs(e,p,d),n!==null&&(cs(n,e,d,c),ra(n,e,d))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var c=vn(),d=er(e),p=As(c,d);p.tag=1,p.payload=n,i!=null&&(p.callback=i),n=Xs(e,p,d),n!==null&&(cs(n,e,d,c),ra(n,e,d))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=vn(),c=er(e),d=As(i,c);d.tag=2,n!=null&&(d.callback=n),n=Xs(e,d,c),n!==null&&(cs(n,e,c,i),ra(n,e,c))}};function Jf(e,n,i,c,d,p,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(c,p,y):n.prototype&&n.prototype.isPureReactComponent?!Li(i,c)||!Li(d,p):!0}function ep(e,n,i){var c=!1,d=Gs,p=n.contextType;return typeof p=="object"&&p!==null?p=Gn(p):(d=bn(n)?xr:on.current,c=n.contextTypes,p=(c=c!=null)?Xr(e,d):Gs),n=new n(i,p),e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=fa,e.stateNode=n,n._reactInternals=e,c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=d,e.__reactInternalMemoizedMaskedChildContext=p),n}function tp(e,n,i,c){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,c),n.state!==e&&fa.enqueueReplaceState(n,n.state,null)}function jc(e,n,i,c){var d=e.stateNode;d.props=i,d.state=e.memoizedState,d.refs={},hc(e);var p=n.contextType;typeof p=="object"&&p!==null?d.context=Gn(p):(p=bn(n)?xr:on.current,d.context=Xr(e,p)),d.state=e.memoizedState,p=n.getDerivedStateFromProps,typeof p=="function"&&(_c(e,n,p,i),d.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(n=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),n!==d.state&&fa.enqueueReplaceState(d,d.state,null),ia(e,i,d,c),d.state=e.memoizedState),typeof d.componentDidMount=="function"&&(e.flags|=4194308)}function ri(e,n){try{var i="",c=n;do i+=ce(c),c=c.return;while(c);var d=i}catch(p){d=`
|
|
37
|
+
`+d[y].replace(" at new "," at ");return e.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",e.displayName)),R}while(1<=y&&0<=N);break}}}finally{de=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?L(e):""}function ce(e){switch(e.tag){case 5:return L(e.type);case 16:return L("Lazy");case 13:return L("Suspense");case 19:return L("SuspenseList");case 0:case 2:case 15:return e=K(e.type,!1),e;case 11:return e=K(e.type.render,!1),e;case 1:return e=K(e.type,!0),e;default:return""}}function fe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Y:return"Fragment";case Z:return"Portal";case ue:return"Profiler";case Q:return"StrictMode";case Ne:return"Suspense";case Le:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case H:return(e.displayName||"Context")+".Consumer";case he:return(e._context.displayName||"Context")+".Provider";case Te:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case se:return n=e.displayName||null,n!==null?n:fe(e.type)||"Memo";case G:n=e._payload,e=e._init;try{return fe(e(n))}catch{}}return null}function Pe(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(n);case 8:return n===Q?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Ce(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ee(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function _e(e){var n=Ee(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),c=""+e[n];if(!e.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var d=i.get,p=i.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(y){c=""+y,p.call(this,y)}}),Object.defineProperty(e,n,{enumerable:i.enumerable}),{getValue:function(){return c},setValue:function(y){c=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function it(e){e._valueTracker||(e._valueTracker=_e(e))}function je(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),c="";return e&&(c=Ee(e)?e.checked?"true":"false":e.value),e=c,e!==i?(n.setValue(e),!0):!1}function kt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ze(e,n){var i=n.checked;return q({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function It(e,n){var i=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;i=Ce(n.value!=null?n.value:i),e._wrapperState={initialChecked:c,initialValue:i,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Fe(e,n){n=n.checked,n!=null&&U(e,"checked",n,!1)}function Dt(e,n){Fe(e,n);var i=Ce(n.value),c=n.type;if(i!=null)c==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(c==="submit"||c==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?St(e,n.type,i):n.hasOwnProperty("defaultValue")&&St(e,n.type,Ce(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Rn(e,n,i){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,i||n===e.value||(e.value=n),e.defaultValue=n}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function St(e,n,i){(n!=="number"||kt(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var Mt=Array.isArray;function ht(e,n,i,c){if(e=e.options,n){n={};for(var d=0;d<i.length;d++)n["$"+i[d]]=!0;for(i=0;i<e.length;i++)d=n.hasOwnProperty("$"+e[i].value),e[i].selected!==d&&(e[i].selected=d),d&&c&&(e[i].defaultSelected=!0)}else{for(i=""+Ce(i),n=null,d=0;d<e.length;d++){if(e[d].value===i){e[d].selected=!0,c&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function en(e,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return q({},n,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function V(e,n){var i=n.value;if(i==null){if(i=n.children,n=n.defaultValue,i!=null){if(n!=null)throw Error(r(92));if(Mt(i)){if(1<i.length)throw Error(r(93));i=i[0]}n=i}n==null&&(n=""),i=n}e._wrapperState={initialValue:Ce(i)}}function pe(e,n){var i=Ce(n.value),c=Ce(n.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),n.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),c!=null&&(e.defaultValue=""+c)}function Ue(e){var n=e.textContent;n===e._wrapperState.initialValue&&n!==""&&n!==null&&(e.value=n)}function tt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function mt(e,n){return e==null||e==="http://www.w3.org/1999/xhtml"?tt(n):e==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var gt,Rt=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,i,c,d){MSApp.execUnsafeLocalFunction(function(){return e(n,i,c,d)})}:e})(function(e,n){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=n;else{for(gt=gt||document.createElement("div"),gt.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=gt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Ht(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var ut={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},An=["Webkit","ms","Moz","O"];Object.keys(ut).forEach(function(e){An.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),ut[n]=ut[e]})});function Hn(e,n,i){return n==null||typeof n=="boolean"||n===""?"":i||typeof n!="number"||n===0||ut.hasOwnProperty(e)&&ut[e]?(""+n).trim():n+"px"}function Ts(e,n){e=e.style;for(var i in n)if(n.hasOwnProperty(i)){var c=i.indexOf("--")===0,d=Hn(i,n[i],c);i==="float"&&(i="cssFloat"),c?e.setProperty(i,d):e[i]=d}}var ms=q({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function In(e,n){if(n){if(ms[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Dn(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pn=null;function wn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ft=null,Vt=null,st=null;function vt(e){if(e=Ui(e)){if(typeof Ft!="function")throw Error(r(280));var n=e.stateNode;n&&(n=Ko(n),Ft(e.stateNode,e.type,n))}}function yt(e){Vt?st?st.push(e):st=[e]:Vt=e}function qt(){if(Vt){var e=Vt,n=st;if(st=Vt=null,vt(e),n)for(e=0;e<n.length;e++)vt(n[e])}}function bt(e,n){return e(n)}function xt(){}var ot=!1;function Gt(e,n,i){if(ot)return e(n,i);ot=!0;try{return bt(e,n,i)}finally{ot=!1,(Vt!==null||st!==null)&&(xt(),qt())}}function Je(e,n){var i=e.stateNode;if(i===null)return null;var c=Ko(i);if(c===null)return null;i=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(e=e.type,c=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!c;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var _=!1;if(h)try{var oe={};Object.defineProperty(oe,"passive",{get:function(){_=!0}}),window.addEventListener("test",oe,oe),window.removeEventListener("test",oe,oe)}catch{_=!1}function ie(e,n,i,c,d,p,y,N,R){var B=Array.prototype.slice.call(arguments,3);try{n.apply(i,B)}catch(ne){this.onError(ne)}}var ge=!1,$e=null,Be=!1,De=null,at={onError:function(e){ge=!0,$e=e}};function Mn(e,n,i,c,d,p,y,N,R){ge=!1,$e=null,ie.apply(at,arguments)}function Ln(e,n,i,c,d,p,y,N,R){if(Mn.apply(this,arguments),ge){if(ge){var B=$e;ge=!1,$e=null}else throw Error(r(198));Be||(Be=!0,De=B)}}function He(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function kn(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function zs(e){if(He(e)!==e)throw Error(r(188))}function ts(e){var n=e.alternate;if(!n){if(n=He(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,c=n;;){var d=i.return;if(d===null)break;var p=d.alternate;if(p===null){if(c=d.return,c!==null){i=c;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===i)return zs(d),e;if(p===c)return zs(d),n;p=p.sibling}throw Error(r(188))}if(i.return!==c.return)i=d,c=p;else{for(var y=!1,N=d.child;N;){if(N===i){y=!0,i=d,c=p;break}if(N===c){y=!0,c=d,i=p;break}N=N.sibling}if(!y){for(N=p.child;N;){if(N===i){y=!0,i=p,c=d;break}if(N===c){y=!0,c=p,i=d;break}N=N.sibling}if(!y)throw Error(r(189))}}if(i.alternate!==c)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function ns(e){return e=ts(e),e!==null?Xe(e):null}function Xe(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var n=Xe(e);if(n!==null)return n;e=e.sibling}return null}var Tt=s.unstable_scheduleCallback,ss=s.unstable_cancelCallback,Al=s.unstable_shouldYield,Il=s.unstable_requestPaint,Nt=s.unstable_now,gs=s.unstable_getCurrentPriorityLevel,Fs=s.unstable_ImmediatePriority,vs=s.unstable_UserBlockingPriority,Or=s.unstable_NormalPriority,fr=s.unstable_LowPriority,Ro=s.unstable_IdlePriority,pr=null,Pn=null;function $r(e){if(Pn&&typeof Pn.onCommitFiberRoot=="function")try{Pn.onCommitFiberRoot(pr,e,void 0,(e.current.flags&128)===128)}catch{}}var hn=Math.clz32?Math.clz32:hr,zr=Math.log,Us=Math.LN2;function hr(e){return e>>>=0,e===0?32:31-(zr(e)/Us|0)|0}var mn=64,Fr=4194304;function mr(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function gr(e,n){var i=e.pendingLanes;if(i===0)return 0;var c=0,d=e.suspendedLanes,p=e.pingedLanes,y=i&268435455;if(y!==0){var N=y&~d;N!==0?c=mr(N):(p&=y,p!==0&&(c=mr(p)))}else y=i&~d,y!==0?c=mr(y):p!==0&&(c=mr(p));if(c===0)return 0;if(n!==0&&n!==c&&(n&d)===0&&(d=c&-c,p=n&-n,d>=p||d===16&&(p&4194240)!==0))return n;if((c&4)!==0&&(c|=i&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=c;0<n;)i=31-hn(n),d=1<<i,c|=e[i],n&=~d;return c}function Ao(e,n){switch(e){case 1:case 2:case 4:return n+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Io(e,n){for(var i=e.suspendedLanes,c=e.pingedLanes,d=e.expirationTimes,p=e.pendingLanes;0<p;){var y=31-hn(p),N=1<<y,R=d[y];R===-1?((N&i)===0||(N&c)!==0)&&(d[y]=Ao(N,n)):R<=n&&(e.expiredLanes|=N),p&=~N}}function Ti(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ni(){var e=mn;return mn<<=1,(mn&4194240)===0&&(mn=64),e}function Ci(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function vr(e,n,i){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-hn(n),e[n]=i}function Do(e,n){var i=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var c=e.eventTimes;for(e=e.expirationTimes;0<i;){var d=31-hn(i),p=1<<d;n[d]=0,c[d]=-1,e[d]=-1,i&=~p}}function Bs(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var c=31-hn(i),d=1<<c;d&n|e[c]&n&&(e[c]|=n),i&=~d}}var Ge=0;function ae(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var S,$,ee,we,be,Oe=!1,Ke=[],Qe=null,Ct=null,jt=null,Ns=new Map,Lt=new Map,Ws=[],kv="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 Ed(e,n){switch(e){case"focusin":case"focusout":Qe=null;break;case"dragenter":case"dragleave":Ct=null;break;case"mouseover":case"mouseout":jt=null;break;case"pointerover":case"pointerout":Ns.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lt.delete(n.pointerId)}}function ji(e,n,i,c,d,p){return e===null||e.nativeEvent!==p?(e={blockedOn:n,domEventName:i,eventSystemFlags:c,nativeEvent:p,targetContainers:[d]},n!==null&&(n=Ui(n),n!==null&&$(n)),e):(e.eventSystemFlags|=c,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function Sv(e,n,i,c,d){switch(n){case"focusin":return Qe=ji(Qe,e,n,i,c,d),!0;case"dragenter":return Ct=ji(Ct,e,n,i,c,d),!0;case"mouseover":return jt=ji(jt,e,n,i,c,d),!0;case"pointerover":var p=d.pointerId;return Ns.set(p,ji(Ns.get(p)||null,e,n,i,c,d)),!0;case"gotpointercapture":return p=d.pointerId,Lt.set(p,ji(Lt.get(p)||null,e,n,i,c,d)),!0}return!1}function Rd(e){var n=yr(e.target);if(n!==null){var i=He(n);if(i!==null){if(n=i.tag,n===13){if(n=kn(i),n!==null){e.blockedOn=n,be(e.priority,function(){ee(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Mo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=Ml(e.domEventName,e.eventSystemFlags,n[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var c=new i.constructor(i.type,i);pn=c,i.target.dispatchEvent(c),pn=null}else return n=Ui(i),n!==null&&$(n),e.blockedOn=i,!1;n.shift()}return!0}function Ad(e,n,i){Mo(e)&&i.delete(n)}function bv(){Oe=!1,Qe!==null&&Mo(Qe)&&(Qe=null),Ct!==null&&Mo(Ct)&&(Ct=null),jt!==null&&Mo(jt)&&(jt=null),Ns.forEach(Ad),Lt.forEach(Ad)}function _i(e,n){e.blockedOn===n&&(e.blockedOn=null,Oe||(Oe=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,bv)))}function Ei(e){function n(d){return _i(d,e)}if(0<Ke.length){_i(Ke[0],e);for(var i=1;i<Ke.length;i++){var c=Ke[i];c.blockedOn===e&&(c.blockedOn=null)}}for(Qe!==null&&_i(Qe,e),Ct!==null&&_i(Ct,e),jt!==null&&_i(jt,e),Ns.forEach(n),Lt.forEach(n),i=0;i<Ws.length;i++)c=Ws[i],c.blockedOn===e&&(c.blockedOn=null);for(;0<Ws.length&&(i=Ws[0],i.blockedOn===null);)Rd(i),i.blockedOn===null&&Ws.shift()}var Ur=O.ReactCurrentBatchConfig,Lo=!0;function Tv(e,n,i,c){var d=Ge,p=Ur.transition;Ur.transition=null;try{Ge=1,Dl(e,n,i,c)}finally{Ge=d,Ur.transition=p}}function Nv(e,n,i,c){var d=Ge,p=Ur.transition;Ur.transition=null;try{Ge=4,Dl(e,n,i,c)}finally{Ge=d,Ur.transition=p}}function Dl(e,n,i,c){if(Lo){var d=Ml(e,n,i,c);if(d===null)Ql(e,n,c,Po,i),Ed(e,c);else if(Sv(d,e,n,i,c))c.stopPropagation();else if(Ed(e,c),n&4&&-1<kv.indexOf(e)){for(;d!==null;){var p=Ui(d);if(p!==null&&S(p),p=Ml(e,n,i,c),p===null&&Ql(e,n,c,Po,i),p===d)break;d=p}d!==null&&c.stopPropagation()}else Ql(e,n,c,null,i)}}var Po=null;function Ml(e,n,i,c){if(Po=null,e=wn(c),e=yr(e),e!==null)if(n=He(e),n===null)e=null;else if(i=n.tag,i===13){if(e=kn(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null);return Po=e,null}function Id(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(gs()){case Fs:return 1;case vs:return 4;case Or:case fr:return 16;case Ro:return 536870912;default:return 16}default:return 16}}var Hs=null,Ll=null,Oo=null;function Dd(){if(Oo)return Oo;var e,n=Ll,i=n.length,c,d="value"in Hs?Hs.value:Hs.textContent,p=d.length;for(e=0;e<i&&n[e]===d[e];e++);var y=i-e;for(c=1;c<=y&&n[i-c]===d[p-c];c++);return Oo=d.slice(e,1<c?1-c:void 0)}function $o(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function zo(){return!0}function Md(){return!1}function On(e){function n(i,c,d,p,y){this._reactName=i,this._targetInst=d,this.type=c,this.nativeEvent=p,this.target=y,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(i=e[N],this[N]=i?i(p):p[N]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?zo:Md,this.isPropagationStopped=Md,this}return q(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=zo)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=zo)},persist:function(){},isPersistent:zo}),n}var Br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Pl=On(Br),Ri=q({},Br,{view:0,detail:0}),Cv=On(Ri),Ol,$l,Ai,Fo=q({},Ri,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fl,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ai&&(Ai&&e.type==="mousemove"?(Ol=e.screenX-Ai.screenX,$l=e.screenY-Ai.screenY):$l=Ol=0,Ai=e),Ol)},movementY:function(e){return"movementY"in e?e.movementY:$l}}),Ld=On(Fo),jv=q({},Fo,{dataTransfer:0}),_v=On(jv),Ev=q({},Ri,{relatedTarget:0}),zl=On(Ev),Rv=q({},Br,{animationName:0,elapsedTime:0,pseudoElement:0}),Av=On(Rv),Iv=q({},Br,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Dv=On(Iv),Mv=q({},Br,{data:0}),Pd=On(Mv),Lv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Pv={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"},Ov={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $v(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=Ov[e])?!!n[e]:!1}function Fl(){return $v}var zv=q({},Ri,{key:function(e){if(e.key){var n=Lv[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=$o(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Pv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fl,charCode:function(e){return e.type==="keypress"?$o(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?$o(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Fv=On(zv),Uv=q({},Fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Od=On(Uv),Bv=q({},Ri,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fl}),Wv=On(Bv),Hv=q({},Br,{propertyName:0,elapsedTime:0,pseudoElement:0}),Vv=On(Hv),qv=q({},Fo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Gv=On(qv),Kv=[9,13,27,32],Ul=h&&"CompositionEvent"in window,Ii=null;h&&"documentMode"in document&&(Ii=document.documentMode);var Yv=h&&"TextEvent"in window&&!Ii,$d=h&&(!Ul||Ii&&8<Ii&&11>=Ii),zd=" ",Fd=!1;function Ud(e,n){switch(e){case"keyup":return Kv.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wr=!1;function Xv(e,n){switch(e){case"compositionend":return Bd(n);case"keypress":return n.which!==32?null:(Fd=!0,zd);case"textInput":return e=n.data,e===zd&&Fd?null:e;default:return null}}function Qv(e,n){if(Wr)return e==="compositionend"||!Ul&&Ud(e,n)?(e=Dd(),Oo=Ll=Hs=null,Wr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return $d&&n.locale!=="ko"?null:n.data;default:return null}}var Zv={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 Wd(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!Zv[e.type]:n==="textarea"}function Hd(e,n,i,c){yt(c),n=Vo(n,"onChange"),0<n.length&&(i=new Pl("onChange","change",null,i,c),e.push({event:i,listeners:n}))}var Di=null,Mi=null;function Jv(e){cf(e,0)}function Uo(e){var n=Kr(e);if(je(n))return e}function ey(e,n){if(e==="change")return n}var Vd=!1;if(h){var Bl;if(h){var Wl="oninput"in document;if(!Wl){var qd=document.createElement("div");qd.setAttribute("oninput","return;"),Wl=typeof qd.oninput=="function"}Bl=Wl}else Bl=!1;Vd=Bl&&(!document.documentMode||9<document.documentMode)}function Gd(){Di&&(Di.detachEvent("onpropertychange",Kd),Mi=Di=null)}function Kd(e){if(e.propertyName==="value"&&Uo(Mi)){var n=[];Hd(n,Mi,e,wn(e)),Gt(Jv,n)}}function ty(e,n,i){e==="focusin"?(Gd(),Di=n,Mi=i,Di.attachEvent("onpropertychange",Kd)):e==="focusout"&&Gd()}function ny(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Uo(Mi)}function sy(e,n){if(e==="click")return Uo(n)}function ry(e,n){if(e==="input"||e==="change")return Uo(n)}function iy(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var rs=typeof Object.is=="function"?Object.is:iy;function Li(e,n){if(rs(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),c=Object.keys(n);if(i.length!==c.length)return!1;for(c=0;c<i.length;c++){var d=i[c];if(!g.call(n,d)||!rs(e[d],n[d]))return!1}return!0}function Yd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Xd(e,n){var i=Yd(e);e=0;for(var c;i;){if(i.nodeType===3){if(c=e+i.textContent.length,e<=n&&c>=n)return{node:i,offset:n-e};e=c}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Yd(i)}}function Qd(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Qd(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Zd(){for(var e=window,n=kt();n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=kt(e.document)}return n}function Hl(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function oy(e){var n=Zd(),i=e.focusedElem,c=e.selectionRange;if(n!==i&&i&&i.ownerDocument&&Qd(i.ownerDocument.documentElement,i)){if(c!==null&&Hl(i)){if(n=c.start,e=c.end,e===void 0&&(e=n),"selectionStart"in i)i.selectionStart=n,i.selectionEnd=Math.min(e,i.value.length);else if(e=(n=i.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var d=i.textContent.length,p=Math.min(c.start,d);c=c.end===void 0?p:Math.min(c.end,d),!e.extend&&p>c&&(d=c,c=p,p=d),d=Xd(i,p);var y=Xd(i,c);d&&y&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(d.node,d.offset),e.removeAllRanges(),p>c?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=i;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<n.length;i++)e=n[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var ay=h&&"documentMode"in document&&11>=document.documentMode,Hr=null,Vl=null,Pi=null,ql=!1;function Jd(e,n,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ql||Hr==null||Hr!==kt(c)||(c=Hr,"selectionStart"in c&&Hl(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Pi&&Li(Pi,c)||(Pi=c,c=Vo(Vl,"onSelect"),0<c.length&&(n=new Pl("onSelect","select",null,n,i),e.push({event:n,listeners:c}),n.target=Hr)))}function Bo(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var Vr={animationend:Bo("Animation","AnimationEnd"),animationiteration:Bo("Animation","AnimationIteration"),animationstart:Bo("Animation","AnimationStart"),transitionend:Bo("Transition","TransitionEnd")},Gl={},ef={};h&&(ef=document.createElement("div").style,"AnimationEvent"in window||(delete Vr.animationend.animation,delete Vr.animationiteration.animation,delete Vr.animationstart.animation),"TransitionEvent"in window||delete Vr.transitionend.transition);function Wo(e){if(Gl[e])return Gl[e];if(!Vr[e])return e;var n=Vr[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in ef)return Gl[e]=n[i];return e}var tf=Wo("animationend"),nf=Wo("animationiteration"),sf=Wo("animationstart"),rf=Wo("transitionend"),of=new Map,af="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Vs(e,n){of.set(e,n),u(n,[e])}for(var Kl=0;Kl<af.length;Kl++){var Yl=af[Kl],ly=Yl.toLowerCase(),cy=Yl[0].toUpperCase()+Yl.slice(1);Vs(ly,"on"+cy)}Vs(tf,"onAnimationEnd"),Vs(nf,"onAnimationIteration"),Vs(sf,"onAnimationStart"),Vs("dblclick","onDoubleClick"),Vs("focusin","onFocus"),Vs("focusout","onBlur"),Vs(rf,"onTransitionEnd"),f("onMouseEnter",["mouseout","mouseover"]),f("onMouseLeave",["mouseout","mouseover"]),f("onPointerEnter",["pointerout","pointerover"]),f("onPointerLeave",["pointerout","pointerover"]),u("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),u("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),u("onBeforeInput",["compositionend","keypress","textInput","paste"]),u("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oi="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(" "),uy=new Set("cancel close invalid load scroll toggle".split(" ").concat(Oi));function lf(e,n,i){var c=e.type||"unknown-event";e.currentTarget=i,Ln(c,n,void 0,e),e.currentTarget=null}function cf(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var c=e[i],d=c.event;c=c.listeners;e:{var p=void 0;if(n)for(var y=c.length-1;0<=y;y--){var N=c[y],R=N.instance,B=N.currentTarget;if(N=N.listener,R!==p&&d.isPropagationStopped())break e;lf(d,N,B),p=R}else for(y=0;y<c.length;y++){if(N=c[y],R=N.instance,B=N.currentTarget,N=N.listener,R!==p&&d.isPropagationStopped())break e;lf(d,N,B),p=R}}}if(Be)throw e=De,Be=!1,De=null,e}function dt(e,n){var i=n[sc];i===void 0&&(i=n[sc]=new Set);var c=e+"__bubble";i.has(c)||(uf(n,e,2,!1),i.add(c))}function Xl(e,n,i){var c=0;n&&(c|=4),uf(i,e,c,n)}var Ho="_reactListening"+Math.random().toString(36).slice(2);function $i(e){if(!e[Ho]){e[Ho]=!0,o.forEach(function(i){i!=="selectionchange"&&(uy.has(i)||Xl(i,!1,e),Xl(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Ho]||(n[Ho]=!0,Xl("selectionchange",!1,n))}}function uf(e,n,i,c){switch(Id(n)){case 1:var d=Tv;break;case 4:d=Nv;break;default:d=Dl}i=d.bind(null,n,i,e),d=void 0,!_||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),c?d!==void 0?e.addEventListener(n,i,{capture:!0,passive:d}):e.addEventListener(n,i,!0):d!==void 0?e.addEventListener(n,i,{passive:d}):e.addEventListener(n,i,!1)}function Ql(e,n,i,c,d){var p=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var y=c.tag;if(y===3||y===4){var N=c.stateNode.containerInfo;if(N===d||N.nodeType===8&&N.parentNode===d)break;if(y===4)for(y=c.return;y!==null;){var R=y.tag;if((R===3||R===4)&&(R=y.stateNode.containerInfo,R===d||R.nodeType===8&&R.parentNode===d))return;y=y.return}for(;N!==null;){if(y=yr(N),y===null)return;if(R=y.tag,R===5||R===6){c=p=y;continue e}N=N.parentNode}}c=c.return}Gt(function(){var B=p,ne=wn(i),re=[];e:{var te=of.get(e);if(te!==void 0){var me=Pl,xe=e;switch(e){case"keypress":if($o(i)===0)break e;case"keydown":case"keyup":me=Fv;break;case"focusin":xe="focus",me=zl;break;case"focusout":xe="blur",me=zl;break;case"beforeblur":case"afterblur":me=zl;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":me=Ld;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=_v;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=Wv;break;case tf:case nf:case sf:me=Av;break;case rf:me=Vv;break;case"scroll":me=Cv;break;case"wheel":me=Gv;break;case"copy":case"cut":case"paste":me=Dv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=Od}var ke=(n&4)!==0,Pt=!ke&&e==="scroll",z=ke?te!==null?te+"Capture":null:te;ke=[];for(var D=B,F;D!==null;){F=D;var le=F.stateNode;if(F.tag===5&&le!==null&&(F=le,z!==null&&(le=Je(D,z),le!=null&&ke.push(zi(D,le,F)))),Pt)break;D=D.return}0<ke.length&&(te=new me(te,xe,null,i,ne),re.push({event:te,listeners:ke}))}}if((n&7)===0){e:{if(te=e==="mouseover"||e==="pointerover",me=e==="mouseout"||e==="pointerout",te&&i!==pn&&(xe=i.relatedTarget||i.fromElement)&&(yr(xe)||xe[Cs]))break e;if((me||te)&&(te=ne.window===ne?ne:(te=ne.ownerDocument)?te.defaultView||te.parentWindow:window,me?(xe=i.relatedTarget||i.toElement,me=B,xe=xe?yr(xe):null,xe!==null&&(Pt=He(xe),xe!==Pt||xe.tag!==5&&xe.tag!==6)&&(xe=null)):(me=null,xe=B),me!==xe)){if(ke=Ld,le="onMouseLeave",z="onMouseEnter",D="mouse",(e==="pointerout"||e==="pointerover")&&(ke=Od,le="onPointerLeave",z="onPointerEnter",D="pointer"),Pt=me==null?te:Kr(me),F=xe==null?te:Kr(xe),te=new ke(le,D+"leave",me,i,ne),te.target=Pt,te.relatedTarget=F,le=null,yr(ne)===B&&(ke=new ke(z,D+"enter",xe,i,ne),ke.target=F,ke.relatedTarget=Pt,le=ke),Pt=le,me&&xe)t:{for(ke=me,z=xe,D=0,F=ke;F;F=qr(F))D++;for(F=0,le=z;le;le=qr(le))F++;for(;0<D-F;)ke=qr(ke),D--;for(;0<F-D;)z=qr(z),F--;for(;D--;){if(ke===z||z!==null&&ke===z.alternate)break t;ke=qr(ke),z=qr(z)}ke=null}else ke=null;me!==null&&df(re,te,me,ke,!1),xe!==null&&Pt!==null&&df(re,Pt,xe,ke,!0)}}e:{if(te=B?Kr(B):window,me=te.nodeName&&te.nodeName.toLowerCase(),me==="select"||me==="input"&&te.type==="file")var Se=ey;else if(Wd(te))if(Vd)Se=ry;else{Se=ny;var Ae=ty}else(me=te.nodeName)&&me.toLowerCase()==="input"&&(te.type==="checkbox"||te.type==="radio")&&(Se=sy);if(Se&&(Se=Se(e,B))){Hd(re,Se,i,ne);break e}Ae&&Ae(e,te,B),e==="focusout"&&(Ae=te._wrapperState)&&Ae.controlled&&te.type==="number"&&St(te,"number",te.value)}switch(Ae=B?Kr(B):window,e){case"focusin":(Wd(Ae)||Ae.contentEditable==="true")&&(Hr=Ae,Vl=B,Pi=null);break;case"focusout":Pi=Vl=Hr=null;break;case"mousedown":ql=!0;break;case"contextmenu":case"mouseup":case"dragend":ql=!1,Jd(re,i,ne);break;case"selectionchange":if(ay)break;case"keydown":case"keyup":Jd(re,i,ne)}var Ie;if(Ul)e:{switch(e){case"compositionstart":var Me="onCompositionStart";break e;case"compositionend":Me="onCompositionEnd";break e;case"compositionupdate":Me="onCompositionUpdate";break e}Me=void 0}else Wr?Ud(e,i)&&(Me="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Me="onCompositionStart");Me&&($d&&i.locale!=="ko"&&(Wr||Me!=="onCompositionStart"?Me==="onCompositionEnd"&&Wr&&(Ie=Dd()):(Hs=ne,Ll="value"in Hs?Hs.value:Hs.textContent,Wr=!0)),Ae=Vo(B,Me),0<Ae.length&&(Me=new Pd(Me,e,null,i,ne),re.push({event:Me,listeners:Ae}),Ie?Me.data=Ie:(Ie=Bd(i),Ie!==null&&(Me.data=Ie)))),(Ie=Yv?Xv(e,i):Qv(e,i))&&(B=Vo(B,"onBeforeInput"),0<B.length&&(ne=new Pd("onBeforeInput","beforeinput",null,i,ne),re.push({event:ne,listeners:B}),ne.data=Ie))}cf(re,n)})}function zi(e,n,i){return{instance:e,listener:n,currentTarget:i}}function Vo(e,n){for(var i=n+"Capture",c=[];e!==null;){var d=e,p=d.stateNode;d.tag===5&&p!==null&&(d=p,p=Je(e,i),p!=null&&c.unshift(zi(e,p,d)),p=Je(e,n),p!=null&&c.push(zi(e,p,d))),e=e.return}return c}function qr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function df(e,n,i,c,d){for(var p=n._reactName,y=[];i!==null&&i!==c;){var N=i,R=N.alternate,B=N.stateNode;if(R!==null&&R===c)break;N.tag===5&&B!==null&&(N=B,d?(R=Je(i,p),R!=null&&y.unshift(zi(i,R,N))):d||(R=Je(i,p),R!=null&&y.push(zi(i,R,N)))),i=i.return}y.length!==0&&e.push({event:n,listeners:y})}var dy=/\r\n?/g,fy=/\u0000|\uFFFD/g;function ff(e){return(typeof e=="string"?e:""+e).replace(dy,`
|
|
38
|
+
`).replace(fy,"")}function qo(e,n,i){if(n=ff(n),ff(e)!==n&&i)throw Error(r(425))}function Go(){}var Zl=null,Jl=null;function ec(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var tc=typeof setTimeout=="function"?setTimeout:void 0,py=typeof clearTimeout=="function"?clearTimeout:void 0,pf=typeof Promise=="function"?Promise:void 0,hy=typeof queueMicrotask=="function"?queueMicrotask:typeof pf<"u"?function(e){return pf.resolve(null).then(e).catch(my)}:tc;function my(e){setTimeout(function(){throw e})}function nc(e,n){var i=n,c=0;do{var d=i.nextSibling;if(e.removeChild(i),d&&d.nodeType===8)if(i=d.data,i==="/$"){if(c===0){e.removeChild(d),Ei(n);return}c--}else i!=="$"&&i!=="$?"&&i!=="$!"||c++;i=d}while(i);Ei(n)}function qs(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function hf(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(n===0)return e;n--}else i==="/$"&&n++}e=e.previousSibling}return null}var Gr=Math.random().toString(36).slice(2),ys="__reactFiber$"+Gr,Fi="__reactProps$"+Gr,Cs="__reactContainer$"+Gr,sc="__reactEvents$"+Gr,gy="__reactListeners$"+Gr,vy="__reactHandles$"+Gr;function yr(e){var n=e[ys];if(n)return n;for(var i=e.parentNode;i;){if(n=i[Cs]||i[ys]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=hf(e);e!==null;){if(i=e[ys])return i;e=hf(e)}return n}e=i,i=e.parentNode}return null}function Ui(e){return e=e[ys]||e[Cs],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Kr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ko(e){return e[Fi]||null}var rc=[],Yr=-1;function Gs(e){return{current:e}}function ft(e){0>Yr||(e.current=rc[Yr],rc[Yr]=null,Yr--)}function ct(e,n){Yr++,rc[Yr]=e.current,e.current=n}var Ks={},on=Gs(Ks),Sn=Gs(!1),xr=Ks;function Xr(e,n){var i=e.type.contextTypes;if(!i)return Ks;var c=e.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var d={},p;for(p in i)d[p]=n[p];return c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=d),d}function bn(e){return e=e.childContextTypes,e!=null}function Yo(){ft(Sn),ft(on)}function mf(e,n,i){if(on.current!==Ks)throw Error(r(168));ct(on,n),ct(Sn,i)}function gf(e,n,i){var c=e.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return i;c=c.getChildContext();for(var d in c)if(!(d in n))throw Error(r(108,Pe(e)||"Unknown",d));return q({},i,c)}function Xo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ks,xr=on.current,ct(on,e),ct(Sn,Sn.current),!0}function vf(e,n,i){var c=e.stateNode;if(!c)throw Error(r(169));i?(e=gf(e,n,xr),c.__reactInternalMemoizedMergedChildContext=e,ft(Sn),ft(on),ct(on,e)):ft(Sn),ct(Sn,i)}var js=null,Qo=!1,ic=!1;function yf(e){js===null?js=[e]:js.push(e)}function yy(e){Qo=!0,yf(e)}function Ys(){if(!ic&&js!==null){ic=!0;var e=0,n=Ge;try{var i=js;for(Ge=1;e<i.length;e++){var c=i[e];do c=c(!0);while(c!==null)}js=null,Qo=!1}catch(d){throw js!==null&&(js=js.slice(e+1)),Tt(Fs,Ys),d}finally{Ge=n,ic=!1}}return null}var Qr=[],Zr=0,Zo=null,Jo=0,Vn=[],qn=0,wr=null,_s=1,Es="";function kr(e,n){Qr[Zr++]=Jo,Qr[Zr++]=Zo,Zo=e,Jo=n}function xf(e,n,i){Vn[qn++]=_s,Vn[qn++]=Es,Vn[qn++]=wr,wr=e;var c=_s;e=Es;var d=32-hn(c)-1;c&=~(1<<d),i+=1;var p=32-hn(n)+d;if(30<p){var y=d-d%5;p=(c&(1<<y)-1).toString(32),c>>=y,d-=y,_s=1<<32-hn(n)+d|i<<d|c,Es=p+e}else _s=1<<p|i<<d|c,Es=e}function oc(e){e.return!==null&&(kr(e,1),xf(e,1,0))}function ac(e){for(;e===Zo;)Zo=Qr[--Zr],Qr[Zr]=null,Jo=Qr[--Zr],Qr[Zr]=null;for(;e===wr;)wr=Vn[--qn],Vn[qn]=null,Es=Vn[--qn],Vn[qn]=null,_s=Vn[--qn],Vn[qn]=null}var $n=null,zn=null,wt=!1,is=null;function wf(e,n){var i=Xn(5,null,null,0);i.elementType="DELETED",i.stateNode=n,i.return=e,n=e.deletions,n===null?(e.deletions=[i],e.flags|=16):n.push(i)}function kf(e,n){switch(e.tag){case 5:var i=e.type;return n=n.nodeType!==1||i.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,$n=e,zn=qs(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,$n=e,zn=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(i=wr!==null?{id:_s,overflow:Es}:null,e.memoizedState={dehydrated:n,treeContext:i,retryLane:1073741824},i=Xn(18,null,null,0),i.stateNode=n,i.return=e,e.child=i,$n=e,zn=null,!0):!1;default:return!1}}function lc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function cc(e){if(wt){var n=zn;if(n){var i=n;if(!kf(e,n)){if(lc(e))throw Error(r(418));n=qs(i.nextSibling);var c=$n;n&&kf(e,n)?wf(c,i):(e.flags=e.flags&-4097|2,wt=!1,$n=e)}}else{if(lc(e))throw Error(r(418));e.flags=e.flags&-4097|2,wt=!1,$n=e}}}function Sf(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;$n=e}function ea(e){if(e!==$n)return!1;if(!wt)return Sf(e),wt=!0,!1;var n;if((n=e.tag!==3)&&!(n=e.tag!==5)&&(n=e.type,n=n!=="head"&&n!=="body"&&!ec(e.type,e.memoizedProps)),n&&(n=zn)){if(lc(e))throw bf(),Error(r(418));for(;n;)wf(e,n),n=qs(n.nextSibling)}if(Sf(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));e:{for(e=e.nextSibling,n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(n===0){zn=qs(e.nextSibling);break e}n--}else i!=="$"&&i!=="$!"&&i!=="$?"||n++}e=e.nextSibling}zn=null}}else zn=$n?qs(e.stateNode.nextSibling):null;return!0}function bf(){for(var e=zn;e;)e=qs(e.nextSibling)}function Jr(){zn=$n=null,wt=!1}function uc(e){is===null?is=[e]:is.push(e)}var xy=O.ReactCurrentBatchConfig;function Bi(e,n,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var c=i.stateNode}if(!c)throw Error(r(147,e));var d=c,p=""+e;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===p?n.ref:(n=function(y){var N=d.refs;y===null?delete N[p]:N[p]=y},n._stringRef=p,n)}if(typeof e!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,e))}return e}function ta(e,n){throw e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e))}function Tf(e){var n=e._init;return n(e._payload)}function Nf(e){function n(z,D){if(e){var F=z.deletions;F===null?(z.deletions=[D],z.flags|=16):F.push(D)}}function i(z,D){if(!e)return null;for(;D!==null;)n(z,D),D=D.sibling;return null}function c(z,D){for(z=new Map;D!==null;)D.key!==null?z.set(D.key,D):z.set(D.index,D),D=D.sibling;return z}function d(z,D){return z=sr(z,D),z.index=0,z.sibling=null,z}function p(z,D,F){return z.index=F,e?(F=z.alternate,F!==null?(F=F.index,F<D?(z.flags|=2,D):F):(z.flags|=2,D)):(z.flags|=1048576,D)}function y(z){return e&&z.alternate===null&&(z.flags|=2),z}function N(z,D,F,le){return D===null||D.tag!==6?(D=tu(F,z.mode,le),D.return=z,D):(D=d(D,F),D.return=z,D)}function R(z,D,F,le){var Se=F.type;return Se===Y?ne(z,D,F.props.children,le,F.key):D!==null&&(D.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===G&&Tf(Se)===D.type)?(le=d(D,F.props),le.ref=Bi(z,D,F),le.return=z,le):(le=Na(F.type,F.key,F.props,null,z.mode,le),le.ref=Bi(z,D,F),le.return=z,le)}function B(z,D,F,le){return D===null||D.tag!==4||D.stateNode.containerInfo!==F.containerInfo||D.stateNode.implementation!==F.implementation?(D=nu(F,z.mode,le),D.return=z,D):(D=d(D,F.children||[]),D.return=z,D)}function ne(z,D,F,le,Se){return D===null||D.tag!==7?(D=Er(F,z.mode,le,Se),D.return=z,D):(D=d(D,F),D.return=z,D)}function re(z,D,F){if(typeof D=="string"&&D!==""||typeof D=="number")return D=tu(""+D,z.mode,F),D.return=z,D;if(typeof D=="object"&&D!==null){switch(D.$$typeof){case W:return F=Na(D.type,D.key,D.props,null,z.mode,F),F.ref=Bi(z,null,D),F.return=z,F;case Z:return D=nu(D,z.mode,F),D.return=z,D;case G:var le=D._init;return re(z,le(D._payload),F)}if(Mt(D)||J(D))return D=Er(D,z.mode,F,null),D.return=z,D;ta(z,D)}return null}function te(z,D,F,le){var Se=D!==null?D.key:null;if(typeof F=="string"&&F!==""||typeof F=="number")return Se!==null?null:N(z,D,""+F,le);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case W:return F.key===Se?R(z,D,F,le):null;case Z:return F.key===Se?B(z,D,F,le):null;case G:return Se=F._init,te(z,D,Se(F._payload),le)}if(Mt(F)||J(F))return Se!==null?null:ne(z,D,F,le,null);ta(z,F)}return null}function me(z,D,F,le,Se){if(typeof le=="string"&&le!==""||typeof le=="number")return z=z.get(F)||null,N(D,z,""+le,Se);if(typeof le=="object"&&le!==null){switch(le.$$typeof){case W:return z=z.get(le.key===null?F:le.key)||null,R(D,z,le,Se);case Z:return z=z.get(le.key===null?F:le.key)||null,B(D,z,le,Se);case G:var Ae=le._init;return me(z,D,F,Ae(le._payload),Se)}if(Mt(le)||J(le))return z=z.get(F)||null,ne(D,z,le,Se,null);ta(D,le)}return null}function xe(z,D,F,le){for(var Se=null,Ae=null,Ie=D,Me=D=0,Xt=null;Ie!==null&&Me<F.length;Me++){Ie.index>Me?(Xt=Ie,Ie=null):Xt=Ie.sibling;var Ze=te(z,Ie,F[Me],le);if(Ze===null){Ie===null&&(Ie=Xt);break}e&&Ie&&Ze.alternate===null&&n(z,Ie),D=p(Ze,D,Me),Ae===null?Se=Ze:Ae.sibling=Ze,Ae=Ze,Ie=Xt}if(Me===F.length)return i(z,Ie),wt&&kr(z,Me),Se;if(Ie===null){for(;Me<F.length;Me++)Ie=re(z,F[Me],le),Ie!==null&&(D=p(Ie,D,Me),Ae===null?Se=Ie:Ae.sibling=Ie,Ae=Ie);return wt&&kr(z,Me),Se}for(Ie=c(z,Ie);Me<F.length;Me++)Xt=me(Ie,z,Me,F[Me],le),Xt!==null&&(e&&Xt.alternate!==null&&Ie.delete(Xt.key===null?Me:Xt.key),D=p(Xt,D,Me),Ae===null?Se=Xt:Ae.sibling=Xt,Ae=Xt);return e&&Ie.forEach(function(rr){return n(z,rr)}),wt&&kr(z,Me),Se}function ke(z,D,F,le){var Se=J(F);if(typeof Se!="function")throw Error(r(150));if(F=Se.call(F),F==null)throw Error(r(151));for(var Ae=Se=null,Ie=D,Me=D=0,Xt=null,Ze=F.next();Ie!==null&&!Ze.done;Me++,Ze=F.next()){Ie.index>Me?(Xt=Ie,Ie=null):Xt=Ie.sibling;var rr=te(z,Ie,Ze.value,le);if(rr===null){Ie===null&&(Ie=Xt);break}e&&Ie&&rr.alternate===null&&n(z,Ie),D=p(rr,D,Me),Ae===null?Se=rr:Ae.sibling=rr,Ae=rr,Ie=Xt}if(Ze.done)return i(z,Ie),wt&&kr(z,Me),Se;if(Ie===null){for(;!Ze.done;Me++,Ze=F.next())Ze=re(z,Ze.value,le),Ze!==null&&(D=p(Ze,D,Me),Ae===null?Se=Ze:Ae.sibling=Ze,Ae=Ze);return wt&&kr(z,Me),Se}for(Ie=c(z,Ie);!Ze.done;Me++,Ze=F.next())Ze=me(Ie,z,Me,Ze.value,le),Ze!==null&&(e&&Ze.alternate!==null&&Ie.delete(Ze.key===null?Me:Ze.key),D=p(Ze,D,Me),Ae===null?Se=Ze:Ae.sibling=Ze,Ae=Ze);return e&&Ie.forEach(function(Zy){return n(z,Zy)}),wt&&kr(z,Me),Se}function Pt(z,D,F,le){if(typeof F=="object"&&F!==null&&F.type===Y&&F.key===null&&(F=F.props.children),typeof F=="object"&&F!==null){switch(F.$$typeof){case W:e:{for(var Se=F.key,Ae=D;Ae!==null;){if(Ae.key===Se){if(Se=F.type,Se===Y){if(Ae.tag===7){i(z,Ae.sibling),D=d(Ae,F.props.children),D.return=z,z=D;break e}}else if(Ae.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===G&&Tf(Se)===Ae.type){i(z,Ae.sibling),D=d(Ae,F.props),D.ref=Bi(z,Ae,F),D.return=z,z=D;break e}i(z,Ae);break}else n(z,Ae);Ae=Ae.sibling}F.type===Y?(D=Er(F.props.children,z.mode,le,F.key),D.return=z,z=D):(le=Na(F.type,F.key,F.props,null,z.mode,le),le.ref=Bi(z,D,F),le.return=z,z=le)}return y(z);case Z:e:{for(Ae=F.key;D!==null;){if(D.key===Ae)if(D.tag===4&&D.stateNode.containerInfo===F.containerInfo&&D.stateNode.implementation===F.implementation){i(z,D.sibling),D=d(D,F.children||[]),D.return=z,z=D;break e}else{i(z,D);break}else n(z,D);D=D.sibling}D=nu(F,z.mode,le),D.return=z,z=D}return y(z);case G:return Ae=F._init,Pt(z,D,Ae(F._payload),le)}if(Mt(F))return xe(z,D,F,le);if(J(F))return ke(z,D,F,le);ta(z,F)}return typeof F=="string"&&F!==""||typeof F=="number"?(F=""+F,D!==null&&D.tag===6?(i(z,D.sibling),D=d(D,F),D.return=z,z=D):(i(z,D),D=tu(F,z.mode,le),D.return=z,z=D),y(z)):i(z,D)}return Pt}var ei=Nf(!0),Cf=Nf(!1),na=Gs(null),sa=null,ti=null,dc=null;function fc(){dc=ti=sa=null}function pc(e){var n=na.current;ft(na),e._currentValue=n}function hc(e,n,i){for(;e!==null;){var c=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),e===i)break;e=e.return}}function ni(e,n){sa=e,dc=ti=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(Tn=!0),e.firstContext=null)}function Gn(e){var n=e._currentValue;if(dc!==e)if(e={context:e,memoizedValue:n,next:null},ti===null){if(sa===null)throw Error(r(308));ti=e,sa.dependencies={lanes:0,firstContext:e}}else ti=ti.next=e;return n}var Sr=null;function mc(e){Sr===null?Sr=[e]:Sr.push(e)}function jf(e,n,i,c){var d=n.interleaved;return d===null?(i.next=i,mc(n)):(i.next=d.next,d.next=i),n.interleaved=i,Rs(e,c)}function Rs(e,n){e.lanes|=n;var i=e.alternate;for(i!==null&&(i.lanes|=n),i=e,e=e.return;e!==null;)e.childLanes|=n,i=e.alternate,i!==null&&(i.childLanes|=n),i=e,e=e.return;return i.tag===3?i.stateNode:null}var Xs=!1;function gc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function _f(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function As(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Qs(e,n,i){var c=e.updateQueue;if(c===null)return null;if(c=c.shared,(Ye&2)!==0){var d=c.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),c.pending=n,Rs(e,i)}return d=c.interleaved,d===null?(n.next=n,mc(c)):(n.next=d.next,d.next=n),c.interleaved=n,Rs(e,i)}function ra(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194240)!==0)){var c=n.lanes;c&=e.pendingLanes,i|=c,n.lanes=i,Bs(e,i)}}function Ef(e,n){var i=e.updateQueue,c=e.alternate;if(c!==null&&(c=c.updateQueue,i===c)){var d=null,p=null;if(i=i.firstBaseUpdate,i!==null){do{var y={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};p===null?d=p=y:p=p.next=y,i=i.next}while(i!==null);p===null?d=p=n:p=p.next=n}else d=p=n;i={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:c.shared,effects:c.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}function ia(e,n,i,c){var d=e.updateQueue;Xs=!1;var p=d.firstBaseUpdate,y=d.lastBaseUpdate,N=d.shared.pending;if(N!==null){d.shared.pending=null;var R=N,B=R.next;R.next=null,y===null?p=B:y.next=B,y=R;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,N=ne.lastBaseUpdate,N!==y&&(N===null?ne.firstBaseUpdate=B:N.next=B,ne.lastBaseUpdate=R))}if(p!==null){var re=d.baseState;y=0,ne=B=R=null,N=p;do{var te=N.lane,me=N.eventTime;if((c&te)===te){ne!==null&&(ne=ne.next={eventTime:me,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var xe=e,ke=N;switch(te=n,me=i,ke.tag){case 1:if(xe=ke.payload,typeof xe=="function"){re=xe.call(me,re,te);break e}re=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=ke.payload,te=typeof xe=="function"?xe.call(me,re,te):xe,te==null)break e;re=q({},re,te);break e;case 2:Xs=!0}}N.callback!==null&&N.lane!==0&&(e.flags|=64,te=d.effects,te===null?d.effects=[N]:te.push(N))}else me={eventTime:me,lane:te,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ne===null?(B=ne=me,R=re):ne=ne.next=me,y|=te;if(N=N.next,N===null){if(N=d.shared.pending,N===null)break;te=N,N=te.next,te.next=null,d.lastBaseUpdate=te,d.shared.pending=null}}while(!0);if(ne===null&&(R=re),d.baseState=R,d.firstBaseUpdate=B,d.lastBaseUpdate=ne,n=d.shared.interleaved,n!==null){d=n;do y|=d.lane,d=d.next;while(d!==n)}else p===null&&(d.shared.lanes=0);Nr|=y,e.lanes=y,e.memoizedState=re}}function Rf(e,n,i){if(e=n.effects,n.effects=null,e!==null)for(n=0;n<e.length;n++){var c=e[n],d=c.callback;if(d!==null){if(c.callback=null,c=i,typeof d!="function")throw Error(r(191,d));d.call(c)}}}var Wi={},xs=Gs(Wi),Hi=Gs(Wi),Vi=Gs(Wi);function br(e){if(e===Wi)throw Error(r(174));return e}function vc(e,n){switch(ct(Vi,n),ct(Hi,e),ct(xs,Wi),e=n.nodeType,e){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:mt(null,"");break;default:e=e===8?n.parentNode:n,n=e.namespaceURI||null,e=e.tagName,n=mt(n,e)}ft(xs),ct(xs,n)}function si(){ft(xs),ft(Hi),ft(Vi)}function Af(e){br(Vi.current);var n=br(xs.current),i=mt(n,e.type);n!==i&&(ct(Hi,e),ct(xs,i))}function yc(e){Hi.current===e&&(ft(xs),ft(Hi))}var _t=Gs(0);function oa(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var xc=[];function wc(){for(var e=0;e<xc.length;e++)xc[e]._workInProgressVersionPrimary=null;xc.length=0}var aa=O.ReactCurrentDispatcher,kc=O.ReactCurrentBatchConfig,Tr=0,Et=null,Ut=null,Kt=null,la=!1,qi=!1,Gi=0,wy=0;function an(){throw Error(r(321))}function Sc(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!rs(e[i],n[i]))return!1;return!0}function bc(e,n,i,c,d,p){if(Tr=p,Et=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,aa.current=e===null||e.memoizedState===null?Ty:Ny,e=i(c,d),qi){p=0;do{if(qi=!1,Gi=0,25<=p)throw Error(r(301));p+=1,Kt=Ut=null,n.updateQueue=null,aa.current=Cy,e=i(c,d)}while(qi)}if(aa.current=da,n=Ut!==null&&Ut.next!==null,Tr=0,Kt=Ut=Et=null,la=!1,n)throw Error(r(300));return e}function Tc(){var e=Gi!==0;return Gi=0,e}function ws(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kt===null?Et.memoizedState=Kt=e:Kt=Kt.next=e,Kt}function Kn(){if(Ut===null){var e=Et.alternate;e=e!==null?e.memoizedState:null}else e=Ut.next;var n=Kt===null?Et.memoizedState:Kt.next;if(n!==null)Kt=n,Ut=e;else{if(e===null)throw Error(r(310));Ut=e,e={memoizedState:Ut.memoizedState,baseState:Ut.baseState,baseQueue:Ut.baseQueue,queue:Ut.queue,next:null},Kt===null?Et.memoizedState=Kt=e:Kt=Kt.next=e}return Kt}function Ki(e,n){return typeof n=="function"?n(e):n}function Nc(e){var n=Kn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var c=Ut,d=c.baseQueue,p=i.pending;if(p!==null){if(d!==null){var y=d.next;d.next=p.next,p.next=y}c.baseQueue=d=p,i.pending=null}if(d!==null){p=d.next,c=c.baseState;var N=y=null,R=null,B=p;do{var ne=B.lane;if((Tr&ne)===ne)R!==null&&(R=R.next={lane:0,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),c=B.hasEagerState?B.eagerState:e(c,B.action);else{var re={lane:ne,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null};R===null?(N=R=re,y=c):R=R.next=re,Et.lanes|=ne,Nr|=ne}B=B.next}while(B!==null&&B!==p);R===null?y=c:R.next=N,rs(c,n.memoizedState)||(Tn=!0),n.memoizedState=c,n.baseState=y,n.baseQueue=R,i.lastRenderedState=c}if(e=i.interleaved,e!==null){d=e;do p=d.lane,Et.lanes|=p,Nr|=p,d=d.next;while(d!==e)}else d===null&&(i.lanes=0);return[n.memoizedState,i.dispatch]}function Cc(e){var n=Kn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var c=i.dispatch,d=i.pending,p=n.memoizedState;if(d!==null){i.pending=null;var y=d=d.next;do p=e(p,y.action),y=y.next;while(y!==d);rs(p,n.memoizedState)||(Tn=!0),n.memoizedState=p,n.baseQueue===null&&(n.baseState=p),i.lastRenderedState=p}return[p,c]}function If(){}function Df(e,n){var i=Et,c=Kn(),d=n(),p=!rs(c.memoizedState,d);if(p&&(c.memoizedState=d,Tn=!0),c=c.queue,jc(Pf.bind(null,i,c,e),[e]),c.getSnapshot!==n||p||Kt!==null&&Kt.memoizedState.tag&1){if(i.flags|=2048,Yi(9,Lf.bind(null,i,c,d,n),void 0,null),Yt===null)throw Error(r(349));(Tr&30)!==0||Mf(i,n,d)}return d}function Mf(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Et.updateQueue,n===null?(n={lastEffect:null,stores:null},Et.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Lf(e,n,i,c){n.value=i,n.getSnapshot=c,Of(n)&&$f(e)}function Pf(e,n,i){return i(function(){Of(n)&&$f(e)})}function Of(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!rs(e,i)}catch{return!0}}function $f(e){var n=Rs(e,1);n!==null&&cs(n,e,1,-1)}function zf(e){var n=ws();return typeof e=="function"&&(e=e()),n.memoizedState=n.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ki,lastRenderedState:e},n.queue=e,e=e.dispatch=by.bind(null,Et,e),[n.memoizedState,e]}function Yi(e,n,i,c){return e={tag:e,create:n,destroy:i,deps:c,next:null},n=Et.updateQueue,n===null?(n={lastEffect:null,stores:null},Et.updateQueue=n,n.lastEffect=e.next=e):(i=n.lastEffect,i===null?n.lastEffect=e.next=e:(c=i.next,i.next=e,e.next=c,n.lastEffect=e)),e}function Ff(){return Kn().memoizedState}function ca(e,n,i,c){var d=ws();Et.flags|=e,d.memoizedState=Yi(1|n,i,void 0,c===void 0?null:c)}function ua(e,n,i,c){var d=Kn();c=c===void 0?null:c;var p=void 0;if(Ut!==null){var y=Ut.memoizedState;if(p=y.destroy,c!==null&&Sc(c,y.deps)){d.memoizedState=Yi(n,i,p,c);return}}Et.flags|=e,d.memoizedState=Yi(1|n,i,p,c)}function Uf(e,n){return ca(8390656,8,e,n)}function jc(e,n){return ua(2048,8,e,n)}function Bf(e,n){return ua(4,2,e,n)}function Wf(e,n){return ua(4,4,e,n)}function Hf(e,n){if(typeof n=="function")return e=e(),n(e),function(){n(null)};if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function Vf(e,n,i){return i=i!=null?i.concat([e]):null,ua(4,4,Hf.bind(null,n,e),i)}function _c(){}function qf(e,n){var i=Kn();n=n===void 0?null:n;var c=i.memoizedState;return c!==null&&n!==null&&Sc(n,c[1])?c[0]:(i.memoizedState=[e,n],e)}function Gf(e,n){var i=Kn();n=n===void 0?null:n;var c=i.memoizedState;return c!==null&&n!==null&&Sc(n,c[1])?c[0]:(e=e(),i.memoizedState=[e,n],e)}function Kf(e,n,i){return(Tr&21)===0?(e.baseState&&(e.baseState=!1,Tn=!0),e.memoizedState=i):(rs(i,n)||(i=Ni(),Et.lanes|=i,Nr|=i,e.baseState=!0),n)}function ky(e,n){var i=Ge;Ge=i!==0&&4>i?i:4,e(!0);var c=kc.transition;kc.transition={};try{e(!1),n()}finally{Ge=i,kc.transition=c}}function Yf(){return Kn().memoizedState}function Sy(e,n,i){var c=tr(e);if(i={lane:c,action:i,hasEagerState:!1,eagerState:null,next:null},Xf(e))Qf(n,i);else if(i=jf(e,n,i,c),i!==null){var d=vn();cs(i,e,c,d),Zf(i,n,c)}}function by(e,n,i){var c=tr(e),d={lane:c,action:i,hasEagerState:!1,eagerState:null,next:null};if(Xf(e))Qf(n,d);else{var p=e.alternate;if(e.lanes===0&&(p===null||p.lanes===0)&&(p=n.lastRenderedReducer,p!==null))try{var y=n.lastRenderedState,N=p(y,i);if(d.hasEagerState=!0,d.eagerState=N,rs(N,y)){var R=n.interleaved;R===null?(d.next=d,mc(n)):(d.next=R.next,R.next=d),n.interleaved=d;return}}catch{}finally{}i=jf(e,n,d,c),i!==null&&(d=vn(),cs(i,e,c,d),Zf(i,n,c))}}function Xf(e){var n=e.alternate;return e===Et||n!==null&&n===Et}function Qf(e,n){qi=la=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function Zf(e,n,i){if((i&4194240)!==0){var c=n.lanes;c&=e.pendingLanes,i|=c,n.lanes=i,Bs(e,i)}}var da={readContext:Gn,useCallback:an,useContext:an,useEffect:an,useImperativeHandle:an,useInsertionEffect:an,useLayoutEffect:an,useMemo:an,useReducer:an,useRef:an,useState:an,useDebugValue:an,useDeferredValue:an,useTransition:an,useMutableSource:an,useSyncExternalStore:an,useId:an,unstable_isNewReconciler:!1},Ty={readContext:Gn,useCallback:function(e,n){return ws().memoizedState=[e,n===void 0?null:n],e},useContext:Gn,useEffect:Uf,useImperativeHandle:function(e,n,i){return i=i!=null?i.concat([e]):null,ca(4194308,4,Hf.bind(null,n,e),i)},useLayoutEffect:function(e,n){return ca(4194308,4,e,n)},useInsertionEffect:function(e,n){return ca(4,2,e,n)},useMemo:function(e,n){var i=ws();return n=n===void 0?null:n,e=e(),i.memoizedState=[e,n],e},useReducer:function(e,n,i){var c=ws();return n=i!==void 0?i(n):n,c.memoizedState=c.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},c.queue=e,e=e.dispatch=Sy.bind(null,Et,e),[c.memoizedState,e]},useRef:function(e){var n=ws();return e={current:e},n.memoizedState=e},useState:zf,useDebugValue:_c,useDeferredValue:function(e){return ws().memoizedState=e},useTransition:function(){var e=zf(!1),n=e[0];return e=ky.bind(null,e[1]),ws().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,i){var c=Et,d=ws();if(wt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),Yt===null)throw Error(r(349));(Tr&30)!==0||Mf(c,n,i)}d.memoizedState=i;var p={value:i,getSnapshot:n};return d.queue=p,Uf(Pf.bind(null,c,p,e),[e]),c.flags|=2048,Yi(9,Lf.bind(null,c,p,i,n),void 0,null),i},useId:function(){var e=ws(),n=Yt.identifierPrefix;if(wt){var i=Es,c=_s;i=(c&~(1<<32-hn(c)-1)).toString(32)+i,n=":"+n+"R"+i,i=Gi++,0<i&&(n+="H"+i.toString(32)),n+=":"}else i=wy++,n=":"+n+"r"+i.toString(32)+":";return e.memoizedState=n},unstable_isNewReconciler:!1},Ny={readContext:Gn,useCallback:qf,useContext:Gn,useEffect:jc,useImperativeHandle:Vf,useInsertionEffect:Bf,useLayoutEffect:Wf,useMemo:Gf,useReducer:Nc,useRef:Ff,useState:function(){return Nc(Ki)},useDebugValue:_c,useDeferredValue:function(e){var n=Kn();return Kf(n,Ut.memoizedState,e)},useTransition:function(){var e=Nc(Ki)[0],n=Kn().memoizedState;return[e,n]},useMutableSource:If,useSyncExternalStore:Df,useId:Yf,unstable_isNewReconciler:!1},Cy={readContext:Gn,useCallback:qf,useContext:Gn,useEffect:jc,useImperativeHandle:Vf,useInsertionEffect:Bf,useLayoutEffect:Wf,useMemo:Gf,useReducer:Cc,useRef:Ff,useState:function(){return Cc(Ki)},useDebugValue:_c,useDeferredValue:function(e){var n=Kn();return Ut===null?n.memoizedState=e:Kf(n,Ut.memoizedState,e)},useTransition:function(){var e=Cc(Ki)[0],n=Kn().memoizedState;return[e,n]},useMutableSource:If,useSyncExternalStore:Df,useId:Yf,unstable_isNewReconciler:!1};function os(e,n){if(e&&e.defaultProps){n=q({},n),e=e.defaultProps;for(var i in e)n[i]===void 0&&(n[i]=e[i]);return n}return n}function Ec(e,n,i,c){n=e.memoizedState,i=i(c,n),i=i==null?n:q({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var fa={isMounted:function(e){return(e=e._reactInternals)?He(e)===e:!1},enqueueSetState:function(e,n,i){e=e._reactInternals;var c=vn(),d=tr(e),p=As(c,d);p.payload=n,i!=null&&(p.callback=i),n=Qs(e,p,d),n!==null&&(cs(n,e,d,c),ra(n,e,d))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var c=vn(),d=tr(e),p=As(c,d);p.tag=1,p.payload=n,i!=null&&(p.callback=i),n=Qs(e,p,d),n!==null&&(cs(n,e,d,c),ra(n,e,d))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=vn(),c=tr(e),d=As(i,c);d.tag=2,n!=null&&(d.callback=n),n=Qs(e,d,c),n!==null&&(cs(n,e,c,i),ra(n,e,c))}};function Jf(e,n,i,c,d,p,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(c,p,y):n.prototype&&n.prototype.isPureReactComponent?!Li(i,c)||!Li(d,p):!0}function ep(e,n,i){var c=!1,d=Ks,p=n.contextType;return typeof p=="object"&&p!==null?p=Gn(p):(d=bn(n)?xr:on.current,c=n.contextTypes,p=(c=c!=null)?Xr(e,d):Ks),n=new n(i,p),e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=fa,e.stateNode=n,n._reactInternals=e,c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=d,e.__reactInternalMemoizedMaskedChildContext=p),n}function tp(e,n,i,c){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,c),n.state!==e&&fa.enqueueReplaceState(n,n.state,null)}function Rc(e,n,i,c){var d=e.stateNode;d.props=i,d.state=e.memoizedState,d.refs={},gc(e);var p=n.contextType;typeof p=="object"&&p!==null?d.context=Gn(p):(p=bn(n)?xr:on.current,d.context=Xr(e,p)),d.state=e.memoizedState,p=n.getDerivedStateFromProps,typeof p=="function"&&(Ec(e,n,p,i),d.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(n=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),n!==d.state&&fa.enqueueReplaceState(d,d.state,null),ia(e,i,d,c),d.state=e.memoizedState),typeof d.componentDidMount=="function"&&(e.flags|=4194308)}function ri(e,n){try{var i="",c=n;do i+=ce(c),c=c.return;while(c);var d=i}catch(p){d=`
|
|
39
39
|
Error generating stack: `+p.message+`
|
|
40
|
-
`+p.stack}return{value:e,source:n,stack:d,digest:null}}function Ec(e,n,i){return{value:e,source:null,stack:i??null,digest:n??null}}function Rc(e,n){try{console.error(n.value)}catch(i){setTimeout(function(){throw i})}}var Cy=typeof WeakMap=="function"?WeakMap:Map;function np(e,n,i){i=As(-1,i),i.tag=3,i.payload={element:null};var c=n.value;return i.callback=function(){xa||(xa=!0,Vc=c),Rc(e,n)},i}function sp(e,n,i){i=As(-1,i),i.tag=3;var c=e.type.getDerivedStateFromError;if(typeof c=="function"){var d=n.value;i.payload=function(){return c(d)},i.callback=function(){Rc(e,n)}}var p=e.stateNode;return p!==null&&typeof p.componentDidCatch=="function"&&(i.callback=function(){Rc(e,n),typeof c!="function"&&(Zs===null?Zs=new Set([this]):Zs.add(this));var y=n.stack;this.componentDidCatch(n.value,{componentStack:y!==null?y:""})}),i}function rp(e,n,i){var c=e.pingCache;if(c===null){c=e.pingCache=new Cy;var d=new Set;c.set(n,d)}else d=c.get(n),d===void 0&&(d=new Set,c.set(n,d));d.has(i)||(d.add(i),e=Fy.bind(null,e,n,i),n.then(e,e))}function ip(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function op(e,n,i,c,d){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(n=As(-1,1),n.tag=2,Xs(i,n,1))),i.lanes|=1),e):(e.flags|=65536,e.lanes=d,e)}var _y=O.ReactCurrentOwner,Tn=!1;function gn(e,n,i,c){n.child=e===null?Cf(n,null,i,c):ei(n,e.child,i,c)}function ap(e,n,i,c,d){i=i.render;var p=n.ref;return ni(n,d),c=kc(e,n,i,c,p,d),i=Sc(),e!==null&&!Tn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~d,Is(e,n,d)):(wt&&i&&rc(n),n.flags|=1,gn(e,n,c,d),n.child)}function lp(e,n,i,c,d){if(e===null){var p=i.type;return typeof p=="function"&&!Zc(p)&&p.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(n.tag=15,n.type=p,cp(e,n,p,c,d)):(e=Na(i.type,null,c,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,(e.lanes&d)===0){var y=p.memoizedProps;if(i=i.compare,i=i!==null?i:Li,i(y,c)&&e.ref===n.ref)return Is(e,n,d)}return n.flags|=1,e=nr(p,c),e.ref=n.ref,e.return=n,n.child=e}function cp(e,n,i,c,d){if(e!==null){var p=e.memoizedProps;if(Li(p,c)&&e.ref===n.ref)if(Tn=!1,n.pendingProps=c=p,(e.lanes&d)!==0)(e.flags&131072)!==0&&(Tn=!0);else return n.lanes=e.lanes,Is(e,n,d)}return Ac(e,n,i,c,d)}function up(e,n,i){var c=n.pendingProps,d=c.children,p=e!==null?e.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},ct(oi,Fn),Fn|=i;else{if((i&1073741824)===0)return e=p!==null?p.baseLanes|i:i,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,ct(oi,Fn),Fn|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=p!==null?p.baseLanes:i,ct(oi,Fn),Fn|=c}else p!==null?(c=p.baseLanes|i,n.memoizedState=null):c=i,ct(oi,Fn),Fn|=c;return gn(e,n,d,i),n.child}function dp(e,n){var i=n.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(n.flags|=512,n.flags|=2097152)}function Ac(e,n,i,c,d){var p=bn(i)?xr:on.current;return p=Xr(n,p),ni(n,d),i=kc(e,n,i,c,p,d),c=Sc(),e!==null&&!Tn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~d,Is(e,n,d)):(wt&&c&&rc(n),n.flags|=1,gn(e,n,i,d),n.child)}function fp(e,n,i,c,d){if(bn(i)){var p=!0;Xo(n)}else p=!1;if(ni(n,d),n.stateNode===null)ha(e,n),ep(n,i,c),jc(n,i,c,d),c=!0;else if(e===null){var y=n.stateNode,N=n.memoizedProps;y.props=N;var R=y.context,B=i.contextType;typeof B=="object"&&B!==null?B=Gn(B):(B=bn(i)?xr:on.current,B=Xr(n,B));var ne=i.getDerivedStateFromProps,re=typeof ne=="function"||typeof y.getSnapshotBeforeUpdate=="function";re||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N!==c||R!==B)&&tp(n,y,c,B),Ys=!1;var te=n.memoizedState;y.state=te,ia(n,c,y,d),R=n.memoizedState,N!==c||te!==R||Sn.current||Ys?(typeof ne=="function"&&(_c(n,i,ne,c),R=n.memoizedState),(N=Ys||Jf(n,i,N,c,te,R,B))?(re||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(n.flags|=4194308)):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=R),y.props=c,y.state=R,y.context=B,c=N):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{y=n.stateNode,jf(e,n),N=n.memoizedProps,B=n.type===n.elementType?N:os(n.type,N),y.props=B,re=n.pendingProps,te=y.context,R=i.contextType,typeof R=="object"&&R!==null?R=Gn(R):(R=bn(i)?xr:on.current,R=Xr(n,R));var me=i.getDerivedStateFromProps;(ne=typeof me=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N!==re||te!==R)&&tp(n,y,c,R),Ys=!1,te=n.memoizedState,y.state=te,ia(n,c,y,d);var xe=n.memoizedState;N!==re||te!==xe||Sn.current||Ys?(typeof me=="function"&&(_c(n,i,me,c),xe=n.memoizedState),(B=Ys||Jf(n,i,B,c,te,xe,R)||!1)?(ne||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,xe,R),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,xe,R)),typeof y.componentDidUpdate=="function"&&(n.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof y.componentDidUpdate!="function"||N===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=xe),y.props=c,y.state=xe,y.context=R,c=B):(typeof y.componentDidUpdate!="function"||N===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),c=!1)}return Ic(e,n,i,c,p,d)}function Ic(e,n,i,c,d,p){dp(e,n);var y=(n.flags&128)!==0;if(!c&&!y)return d&&vf(n,i,!1),Is(e,n,p);c=n.stateNode,_y.current=n;var N=y&&typeof i.getDerivedStateFromError!="function"?null:c.render();return n.flags|=1,e!==null&&y?(n.child=ei(n,e.child,null,p),n.child=ei(n,null,N,p)):gn(e,n,N,p),n.memoizedState=c.state,d&&vf(n,i,!0),n.child}function pp(e){var n=e.stateNode;n.pendingContext?mf(e,n.pendingContext,n.pendingContext!==n.context):n.context&&mf(e,n.context,!1),mc(e,n.containerInfo)}function hp(e,n,i,c,d){return Jr(),lc(d),n.flags|=256,gn(e,n,i,c),n.child}var Dc={dehydrated:null,treeContext:null,retryLane:0};function Mc(e){return{baseLanes:e,cachePool:null,transitions:null}}function mp(e,n,i){var c=n.pendingProps,d=jt.current,p=!1,y=(n.flags&128)!==0,N;if((N=y)||(N=e!==null&&e.memoizedState===null?!1:(d&2)!==0),N?(p=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(d|=1),ct(jt,d&1),e===null)return ac(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((n.mode&1)===0?n.lanes=1:e.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(y=c.children,e=c.fallback,p?(c=n.mode,p=n.child,y={mode:"hidden",children:y},(c&1)===0&&p!==null?(p.childLanes=0,p.pendingProps=y):p=Ca(y,c,0,null),e=Er(e,c,i,null),p.return=n,e.return=n,p.sibling=e,n.child=p,n.child.memoizedState=Mc(i),n.memoizedState=Dc,e):Lc(n,y));if(d=e.memoizedState,d!==null&&(N=d.dehydrated,N!==null))return jy(e,n,y,c,N,d,i);if(p){p=c.fallback,y=n.mode,d=e.child,N=d.sibling;var R={mode:"hidden",children:c.children};return(y&1)===0&&n.child!==d?(c=n.child,c.childLanes=0,c.pendingProps=R,n.deletions=null):(c=nr(d,R),c.subtreeFlags=d.subtreeFlags&14680064),N!==null?p=nr(N,p):(p=Er(p,y,i,null),p.flags|=2),p.return=n,c.return=n,c.sibling=p,n.child=c,c=p,p=n.child,y=e.child.memoizedState,y=y===null?Mc(i):{baseLanes:y.baseLanes|i,cachePool:null,transitions:y.transitions},p.memoizedState=y,p.childLanes=e.childLanes&~i,n.memoizedState=Dc,c}return p=e.child,e=p.sibling,c=nr(p,{mode:"visible",children:c.children}),(n.mode&1)===0&&(c.lanes=i),c.return=n,c.sibling=null,e!==null&&(i=n.deletions,i===null?(n.deletions=[e],n.flags|=16):i.push(e)),n.child=c,n.memoizedState=null,c}function Lc(e,n){return n=Ca({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function pa(e,n,i,c){return c!==null&&lc(c),ei(n,e.child,null,i),e=Lc(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function jy(e,n,i,c,d,p,y){if(i)return n.flags&256?(n.flags&=-257,c=Ec(Error(r(422))),pa(e,n,y,c)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(p=c.fallback,d=n.mode,c=Ca({mode:"visible",children:c.children},d,0,null),p=Er(p,d,y,null),p.flags|=2,c.return=n,p.return=n,c.sibling=p,n.child=c,(n.mode&1)!==0&&ei(n,e.child,null,y),n.child.memoizedState=Mc(y),n.memoizedState=Dc,p);if((n.mode&1)===0)return pa(e,n,y,null);if(d.data==="$!"){if(c=d.nextSibling&&d.nextSibling.dataset,c)var N=c.dgst;return c=N,p=Error(r(419)),c=Ec(p,c,void 0),pa(e,n,y,c)}if(N=(y&e.childLanes)!==0,Tn||N){if(c=Yt,c!==null){switch(y&-y){case 4:d=2;break;case 16:d=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:d=32;break;case 536870912:d=268435456;break;default:d=0}d=(d&(c.suspendedLanes|y))!==0?0:d,d!==0&&d!==p.retryLane&&(p.retryLane=d,Rs(e,d),cs(c,e,d,-1))}return Qc(),c=Ec(Error(r(421))),pa(e,n,y,c)}return d.data==="$?"?(n.flags|=128,n.child=e.child,n=Uy.bind(null,e),d._reactRetry=n,null):(e=p.treeContext,zn=Vs(d.nextSibling),$n=n,wt=!0,is=null,e!==null&&(Vn[qn++]=js,Vn[qn++]=Es,Vn[qn++]=wr,js=e.id,Es=e.overflow,wr=n),n=Lc(n,c.children),n.flags|=4096,n)}function gp(e,n,i){e.lanes|=n;var c=e.alternate;c!==null&&(c.lanes|=n),fc(e.return,n,i)}function Pc(e,n,i,c,d){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:d}:(p.isBackwards=n,p.rendering=null,p.renderingStartTime=0,p.last=c,p.tail=i,p.tailMode=d)}function vp(e,n,i){var c=n.pendingProps,d=c.revealOrder,p=c.tail;if(gn(e,n,c.children,i),c=jt.current,(c&2)!==0)c=c&1|2,n.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gp(e,i,n);else if(e.tag===19)gp(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}c&=1}if(ct(jt,c),(n.mode&1)===0)n.memoizedState=null;else switch(d){case"forwards":for(i=n.child,d=null;i!==null;)e=i.alternate,e!==null&&oa(e)===null&&(d=i),i=i.sibling;i=d,i===null?(d=n.child,n.child=null):(d=i.sibling,i.sibling=null),Pc(n,!1,d,i,p);break;case"backwards":for(i=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&oa(e)===null){n.child=d;break}e=d.sibling,d.sibling=i,i=d,d=e}Pc(n,!0,i,null,p);break;case"together":Pc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function ha(e,n){(n.mode&1)===0&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Is(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Nr|=n.lanes,(i&n.childLanes)===0)return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=nr(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=nr(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function Ey(e,n,i){switch(n.tag){case 3:pp(n),Jr();break;case 5:Af(n);break;case 1:bn(n.type)&&Xo(n);break;case 4:mc(n,n.stateNode.containerInfo);break;case 10:var c=n.type._context,d=n.memoizedProps.value;ct(na,c._currentValue),c._currentValue=d;break;case 13:if(c=n.memoizedState,c!==null)return c.dehydrated!==null?(ct(jt,jt.current&1),n.flags|=128,null):(i&n.child.childLanes)!==0?mp(e,n,i):(ct(jt,jt.current&1),e=Is(e,n,i),e!==null?e.sibling:null);ct(jt,jt.current&1);break;case 19:if(c=(i&n.childLanes)!==0,(e.flags&128)!==0){if(c)return vp(e,n,i);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ct(jt,jt.current),c)break;return null;case 22:case 23:return n.lanes=0,up(e,n,i)}return Is(e,n,i)}var yp,Oc,xp,wp;yp=function(e,n){for(var i=n.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},Oc=function(){},xp=function(e,n,i,c){var d=e.memoizedProps;if(d!==c){e=n.stateNode,br(xs.current);var p=null;switch(i){case"input":d=ze(e,d),c=ze(e,c),p=[];break;case"select":d=q({},d,{value:void 0}),c=q({},c,{value:void 0}),p=[];break;case"textarea":d=en(e,d),c=en(e,c),p=[];break;default:typeof d.onClick!="function"&&typeof c.onClick=="function"&&(e.onclick=Go)}In(i,c);var y;i=null;for(B in d)if(!c.hasOwnProperty(B)&&d.hasOwnProperty(B)&&d[B]!=null)if(B==="style"){var N=d[B];for(y in N)N.hasOwnProperty(y)&&(i||(i={}),i[y]="")}else B!=="dangerouslySetInnerHTML"&&B!=="children"&&B!=="suppressContentEditableWarning"&&B!=="suppressHydrationWarning"&&B!=="autoFocus"&&(a.hasOwnProperty(B)?p||(p=[]):(p=p||[]).push(B,null));for(B in c){var R=c[B];if(N=d!=null?d[B]:void 0,c.hasOwnProperty(B)&&R!==N&&(R!=null||N!=null))if(B==="style")if(N){for(y in N)!N.hasOwnProperty(y)||R&&R.hasOwnProperty(y)||(i||(i={}),i[y]="");for(y in R)R.hasOwnProperty(y)&&N[y]!==R[y]&&(i||(i={}),i[y]=R[y])}else i||(p||(p=[]),p.push(B,i)),i=R;else B==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,N=N?N.__html:void 0,R!=null&&N!==R&&(p=p||[]).push(B,R)):B==="children"?typeof R!="string"&&typeof R!="number"||(p=p||[]).push(B,""+R):B!=="suppressContentEditableWarning"&&B!=="suppressHydrationWarning"&&(a.hasOwnProperty(B)?(R!=null&&B==="onScroll"&&dt("scroll",e),p||N===R||(p=[])):(p=p||[]).push(B,R))}i&&(p=p||[]).push("style",i);var B=p;(n.updateQueue=B)&&(n.flags|=4)}},wp=function(e,n,i,c){i!==c&&(n.flags|=4)};function Xi(e,n){if(!wt)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:c.sibling=null}}function ln(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,c=0;if(n)for(var d=e.child;d!==null;)i|=d.lanes|d.childLanes,c|=d.subtreeFlags&14680064,c|=d.flags&14680064,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)i|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=c,e.childLanes=i,n}function Ry(e,n,i){var c=n.pendingProps;switch(ic(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ln(n),null;case 1:return bn(n.type)&&Yo(),ln(n),null;case 3:return c=n.stateNode,si(),ft(Sn),ft(on),yc(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(e===null||e.child===null)&&(ea(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,is!==null&&(Kc(is),is=null))),Oc(e,n),ln(n),null;case 5:gc(n);var d=br(Vi.current);if(i=n.type,e!==null&&n.stateNode!=null)xp(e,n,i,c,d),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!c){if(n.stateNode===null)throw Error(r(166));return ln(n),null}if(e=br(xs.current),ea(n)){c=n.stateNode,i=n.type;var p=n.memoizedProps;switch(c[ys]=n,c[Fi]=p,e=(n.mode&1)!==0,i){case"dialog":dt("cancel",c),dt("close",c);break;case"iframe":case"object":case"embed":dt("load",c);break;case"video":case"audio":for(d=0;d<Oi.length;d++)dt(Oi[d],c);break;case"source":dt("error",c);break;case"img":case"image":case"link":dt("error",c),dt("load",c);break;case"details":dt("toggle",c);break;case"input":It(c,p),dt("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!p.multiple},dt("invalid",c);break;case"textarea":V(c,p),dt("invalid",c)}In(i,p),d=null;for(var y in p)if(p.hasOwnProperty(y)){var N=p[y];y==="children"?typeof N=="string"?c.textContent!==N&&(p.suppressHydrationWarning!==!0&&qo(c.textContent,N,e),d=["children",N]):typeof N=="number"&&c.textContent!==""+N&&(p.suppressHydrationWarning!==!0&&qo(c.textContent,N,e),d=["children",""+N]):a.hasOwnProperty(y)&&N!=null&&y==="onScroll"&&dt("scroll",c)}switch(i){case"input":it(c),Rn(c,p,!0);break;case"textarea":it(c),Ue(c);break;case"select":case"option":break;default:typeof p.onClick=="function"&&(c.onclick=Go)}c=d,n.updateQueue=c,c!==null&&(n.flags|=4)}else{y=d.nodeType===9?d:d.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=tt(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=y.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof c.is=="string"?e=y.createElement(i,{is:c.is}):(e=y.createElement(i),i==="select"&&(y=e,c.multiple?y.multiple=!0:c.size&&(y.size=c.size))):e=y.createElementNS(e,i),e[ys]=n,e[Fi]=c,yp(e,n,!1,!1),n.stateNode=e;e:{switch(y=Dn(i,c),i){case"dialog":dt("cancel",e),dt("close",e),d=c;break;case"iframe":case"object":case"embed":dt("load",e),d=c;break;case"video":case"audio":for(d=0;d<Oi.length;d++)dt(Oi[d],e);d=c;break;case"source":dt("error",e),d=c;break;case"img":case"image":case"link":dt("error",e),dt("load",e),d=c;break;case"details":dt("toggle",e),d=c;break;case"input":It(e,c),d=ze(e,c),dt("invalid",e);break;case"option":d=c;break;case"select":e._wrapperState={wasMultiple:!!c.multiple},d=q({},c,{value:void 0}),dt("invalid",e);break;case"textarea":V(e,c),d=en(e,c),dt("invalid",e);break;default:d=c}In(i,d),N=d;for(p in N)if(N.hasOwnProperty(p)){var R=N[p];p==="style"?Ts(e,R):p==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,R!=null&&Rt(e,R)):p==="children"?typeof R=="string"?(i!=="textarea"||R!=="")&&Ht(e,R):typeof R=="number"&&Ht(e,""+R):p!=="suppressContentEditableWarning"&&p!=="suppressHydrationWarning"&&p!=="autoFocus"&&(a.hasOwnProperty(p)?R!=null&&p==="onScroll"&&dt("scroll",e):R!=null&&U(e,p,R,y))}switch(i){case"input":it(e),Rn(e,c,!1);break;case"textarea":it(e),Ue(e);break;case"option":c.value!=null&&e.setAttribute("value",""+Ce(c.value));break;case"select":e.multiple=!!c.multiple,p=c.value,p!=null?ht(e,!!c.multiple,p,!1):c.defaultValue!=null&&ht(e,!!c.multiple,c.defaultValue,!0);break;default:typeof d.onClick=="function"&&(e.onclick=Go)}switch(i){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return ln(n),null;case 6:if(e&&n.stateNode!=null)wp(e,n,e.memoizedProps,c);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(i=br(Vi.current),br(xs.current),ea(n)){if(c=n.stateNode,i=n.memoizedProps,c[ys]=n,(p=c.nodeValue!==i)&&(e=$n,e!==null))switch(e.tag){case 3:qo(c.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&qo(c.nodeValue,i,(e.mode&1)!==0)}p&&(n.flags|=4)}else c=(i.nodeType===9?i:i.ownerDocument).createTextNode(c),c[ys]=n,n.stateNode=c}return ln(n),null;case 13:if(ft(jt),c=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wt&&zn!==null&&(n.mode&1)!==0&&(n.flags&128)===0)bf(),Jr(),n.flags|=98560,p=!1;else if(p=ea(n),c!==null&&c.dehydrated!==null){if(e===null){if(!p)throw Error(r(318));if(p=n.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[ys]=n}else Jr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ln(n),p=!1}else is!==null&&(Kc(is),is=null),p=!0;if(!p)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=i,n):(c=c!==null,c!==(e!==null&&e.memoizedState!==null)&&c&&(n.child.flags|=8192,(n.mode&1)!==0&&(e===null||(jt.current&1)!==0?Bt===0&&(Bt=3):Qc())),n.updateQueue!==null&&(n.flags|=4),ln(n),null);case 4:return si(),Oc(e,n),e===null&&$i(n.stateNode.containerInfo),ln(n),null;case 10:return dc(n.type._context),ln(n),null;case 17:return bn(n.type)&&Yo(),ln(n),null;case 19:if(ft(jt),p=n.memoizedState,p===null)return ln(n),null;if(c=(n.flags&128)!==0,y=p.rendering,y===null)if(c)Xi(p,!1);else{if(Bt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(y=oa(e),y!==null){for(n.flags|=128,Xi(p,!1),c=y.updateQueue,c!==null&&(n.updateQueue=c,n.flags|=4),n.subtreeFlags=0,c=i,i=n.child;i!==null;)p=i,e=c,p.flags&=14680066,y=p.alternate,y===null?(p.childLanes=0,p.lanes=e,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=y.childLanes,p.lanes=y.lanes,p.child=y.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=y.memoizedProps,p.memoizedState=y.memoizedState,p.updateQueue=y.updateQueue,p.type=y.type,e=y.dependencies,p.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return ct(jt,jt.current&1|2),n.child}e=e.sibling}p.tail!==null&&Nt()>ai&&(n.flags|=128,c=!0,Xi(p,!1),n.lanes=4194304)}else{if(!c)if(e=oa(y),e!==null){if(n.flags|=128,c=!0,i=e.updateQueue,i!==null&&(n.updateQueue=i,n.flags|=4),Xi(p,!0),p.tail===null&&p.tailMode==="hidden"&&!y.alternate&&!wt)return ln(n),null}else 2*Nt()-p.renderingStartTime>ai&&i!==1073741824&&(n.flags|=128,c=!0,Xi(p,!1),n.lanes=4194304);p.isBackwards?(y.sibling=n.child,n.child=y):(i=p.last,i!==null?i.sibling=y:n.child=y,p.last=y)}return p.tail!==null?(n=p.tail,p.rendering=n,p.tail=n.sibling,p.renderingStartTime=Nt(),n.sibling=null,i=jt.current,ct(jt,c?i&1|2:i&1),n):(ln(n),null);case 22:case 23:return Xc(),c=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==c&&(n.flags|=8192),c&&(n.mode&1)!==0?(Fn&1073741824)!==0&&(ln(n),n.subtreeFlags&6&&(n.flags|=8192)):ln(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Ay(e,n){switch(ic(n),n.tag){case 1:return bn(n.type)&&Yo(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return si(),ft(Sn),ft(on),yc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return gc(n),null;case 13:if(ft(jt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Jr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ft(jt),null;case 4:return si(),null;case 10:return dc(n.type._context),null;case 22:case 23:return Xc(),null;case 24:return null;default:return null}}var ma=!1,cn=!1,Iy=typeof WeakSet=="function"?WeakSet:Set,ye=null;function ii(e,n){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(c){At(e,n,c)}else i.current=null}function $c(e,n,i){try{i()}catch(c){At(e,n,c)}}var kp=!1;function Dy(e,n){if(Xl=Lo,e=Zd(),Bl(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var d=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{i.nodeType,p.nodeType}catch{i=null;break e}var y=0,N=-1,R=-1,B=0,ne=0,re=e,te=null;t:for(;;){for(var me;re!==i||d!==0&&re.nodeType!==3||(N=y+d),re!==p||c!==0&&re.nodeType!==3||(R=y+c),re.nodeType===3&&(y+=re.nodeValue.length),(me=re.firstChild)!==null;)te=re,re=me;for(;;){if(re===e)break t;if(te===i&&++B===d&&(N=y),te===p&&++ne===c&&(R=y),(me=re.nextSibling)!==null)break;re=te,te=re.parentNode}re=me}i=N===-1||R===-1?null:{start:N,end:R}}else i=null}i=i||{start:0,end:0}}else i=null;for(Ql={focusedElem:e,selectionRange:i},Lo=!1,ye=n;ye!==null;)if(n=ye,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ye=e;else for(;ye!==null;){n=ye;try{var xe=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var ke=xe.memoizedProps,Pt=xe.memoizedState,z=n.stateNode,D=z.getSnapshotBeforeUpdate(n.elementType===n.type?ke:os(n.type,ke),Pt);z.__reactInternalSnapshotBeforeUpdate=D}break;case 3:var F=n.stateNode.containerInfo;F.nodeType===1?F.textContent="":F.nodeType===9&&F.documentElement&&F.removeChild(F.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(le){At(n,n.return,le)}if(e=n.sibling,e!==null){e.return=n.return,ye=e;break}ye=n.return}return xe=kp,kp=!1,xe}function Qi(e,n,i){var c=n.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var d=c=c.next;do{if((d.tag&e)===e){var p=d.destroy;d.destroy=void 0,p!==void 0&&$c(n,i,p)}d=d.next}while(d!==c)}}function ga(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var c=i.create;i.destroy=c()}i=i.next}while(i!==n)}}function zc(e){var n=e.ref;if(n!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof n=="function"?n(e):n.current=e}}function Sp(e){var n=e.alternate;n!==null&&(e.alternate=null,Sp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ys],delete n[Fi],delete n[tc],delete n[my],delete n[gy])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bp(e){return e.tag===5||e.tag===3||e.tag===4}function Tp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Fc(e,n,i){var c=e.tag;if(c===5||c===6)e=e.stateNode,n?i.nodeType===8?i.parentNode.insertBefore(e,n):i.insertBefore(e,n):(i.nodeType===8?(n=i.parentNode,n.insertBefore(e,i)):(n=i,n.appendChild(e)),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Go));else if(c!==4&&(e=e.child,e!==null))for(Fc(e,n,i),e=e.sibling;e!==null;)Fc(e,n,i),e=e.sibling}function Uc(e,n,i){var c=e.tag;if(c===5||c===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(c!==4&&(e=e.child,e!==null))for(Uc(e,n,i),e=e.sibling;e!==null;)Uc(e,n,i),e=e.sibling}var tn=null,as=!1;function Qs(e,n,i){for(i=i.child;i!==null;)Np(e,n,i),i=i.sibling}function Np(e,n,i){if(Pn&&typeof Pn.onCommitFiberUnmount=="function")try{Pn.onCommitFiberUnmount(pr,i)}catch{}switch(i.tag){case 5:cn||ii(i,n);case 6:var c=tn,d=as;tn=null,Qs(e,n,i),tn=c,as=d,tn!==null&&(as?(e=tn,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):tn.removeChild(i.stateNode));break;case 18:tn!==null&&(as?(e=tn,i=i.stateNode,e.nodeType===8?ec(e.parentNode,i):e.nodeType===1&&ec(e,i),Ei(e)):ec(tn,i.stateNode));break;case 4:c=tn,d=as,tn=i.stateNode.containerInfo,as=!0,Qs(e,n,i),tn=c,as=d;break;case 0:case 11:case 14:case 15:if(!cn&&(c=i.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){d=c=c.next;do{var p=d,y=p.destroy;p=p.tag,y!==void 0&&((p&2)!==0||(p&4)!==0)&&$c(i,n,y),d=d.next}while(d!==c)}Qs(e,n,i);break;case 1:if(!cn&&(ii(i,n),c=i.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=i.memoizedProps,c.state=i.memoizedState,c.componentWillUnmount()}catch(N){At(i,n,N)}Qs(e,n,i);break;case 21:Qs(e,n,i);break;case 22:i.mode&1?(cn=(c=cn)||i.memoizedState!==null,Qs(e,n,i),cn=c):Qs(e,n,i);break;default:Qs(e,n,i)}}function Cp(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new Iy),n.forEach(function(c){var d=By.bind(null,e,c);i.has(c)||(i.add(c),c.then(d,d))})}}function ls(e,n){var i=n.deletions;if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];try{var p=e,y=n,N=y;e:for(;N!==null;){switch(N.tag){case 5:tn=N.stateNode,as=!1;break e;case 3:tn=N.stateNode.containerInfo,as=!0;break e;case 4:tn=N.stateNode.containerInfo,as=!0;break e}N=N.return}if(tn===null)throw Error(r(160));Np(p,y,d),tn=null,as=!1;var R=d.alternate;R!==null&&(R.return=null),d.return=null}catch(B){At(d,n,B)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)_p(n,e),n=n.sibling}function _p(e,n){var i=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ls(n,e),ks(e),c&4){try{Qi(3,e,e.return),ga(3,e)}catch(ke){At(e,e.return,ke)}try{Qi(5,e,e.return)}catch(ke){At(e,e.return,ke)}}break;case 1:ls(n,e),ks(e),c&512&&i!==null&&ii(i,i.return);break;case 5:if(ls(n,e),ks(e),c&512&&i!==null&&ii(i,i.return),e.flags&32){var d=e.stateNode;try{Ht(d,"")}catch(ke){At(e,e.return,ke)}}if(c&4&&(d=e.stateNode,d!=null)){var p=e.memoizedProps,y=i!==null?i.memoizedProps:p,N=e.type,R=e.updateQueue;if(e.updateQueue=null,R!==null)try{N==="input"&&p.type==="radio"&&p.name!=null&&Fe(d,p),Dn(N,y);var B=Dn(N,p);for(y=0;y<R.length;y+=2){var ne=R[y],re=R[y+1];ne==="style"?Ts(d,re):ne==="dangerouslySetInnerHTML"?Rt(d,re):ne==="children"?Ht(d,re):U(d,ne,re,B)}switch(N){case"input":Dt(d,p);break;case"textarea":pe(d,p);break;case"select":var te=d._wrapperState.wasMultiple;d._wrapperState.wasMultiple=!!p.multiple;var me=p.value;me!=null?ht(d,!!p.multiple,me,!1):te!==!!p.multiple&&(p.defaultValue!=null?ht(d,!!p.multiple,p.defaultValue,!0):ht(d,!!p.multiple,p.multiple?[]:"",!1))}d[Fi]=p}catch(ke){At(e,e.return,ke)}}break;case 6:if(ls(n,e),ks(e),c&4){if(e.stateNode===null)throw Error(r(162));d=e.stateNode,p=e.memoizedProps;try{d.nodeValue=p}catch(ke){At(e,e.return,ke)}}break;case 3:if(ls(n,e),ks(e),c&4&&i!==null&&i.memoizedState.isDehydrated)try{Ei(n.containerInfo)}catch(ke){At(e,e.return,ke)}break;case 4:ls(n,e),ks(e);break;case 13:ls(n,e),ks(e),d=e.child,d.flags&8192&&(p=d.memoizedState!==null,d.stateNode.isHidden=p,!p||d.alternate!==null&&d.alternate.memoizedState!==null||(Hc=Nt())),c&4&&Cp(e);break;case 22:if(ne=i!==null&&i.memoizedState!==null,e.mode&1?(cn=(B=cn)||ne,ls(n,e),cn=B):ls(n,e),ks(e),c&8192){if(B=e.memoizedState!==null,(e.stateNode.isHidden=B)&&!ne&&(e.mode&1)!==0)for(ye=e,ne=e.child;ne!==null;){for(re=ye=ne;ye!==null;){switch(te=ye,me=te.child,te.tag){case 0:case 11:case 14:case 15:Qi(4,te,te.return);break;case 1:ii(te,te.return);var xe=te.stateNode;if(typeof xe.componentWillUnmount=="function"){c=te,i=te.return;try{n=c,xe.props=n.memoizedProps,xe.state=n.memoizedState,xe.componentWillUnmount()}catch(ke){At(c,i,ke)}}break;case 5:ii(te,te.return);break;case 22:if(te.memoizedState!==null){Rp(re);continue}}me!==null?(me.return=te,ye=me):Rp(re)}ne=ne.sibling}e:for(ne=null,re=e;;){if(re.tag===5){if(ne===null){ne=re;try{d=re.stateNode,B?(p=d.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none"):(N=re.stateNode,R=re.memoizedProps.style,y=R!=null&&R.hasOwnProperty("display")?R.display:null,N.style.display=Hn("display",y))}catch(ke){At(e,e.return,ke)}}}else if(re.tag===6){if(ne===null)try{re.stateNode.nodeValue=B?"":re.memoizedProps}catch(ke){At(e,e.return,ke)}}else if((re.tag!==22&&re.tag!==23||re.memoizedState===null||re===e)&&re.child!==null){re.child.return=re,re=re.child;continue}if(re===e)break e;for(;re.sibling===null;){if(re.return===null||re.return===e)break e;ne===re&&(ne=null),re=re.return}ne===re&&(ne=null),re.sibling.return=re.return,re=re.sibling}}break;case 19:ls(n,e),ks(e),c&4&&Cp(e);break;case 21:break;default:ls(n,e),ks(e)}}function ks(e){var n=e.flags;if(n&2){try{e:{for(var i=e.return;i!==null;){if(bp(i)){var c=i;break e}i=i.return}throw Error(r(160))}switch(c.tag){case 5:var d=c.stateNode;c.flags&32&&(Ht(d,""),c.flags&=-33);var p=Tp(e);Uc(e,p,d);break;case 3:case 4:var y=c.stateNode.containerInfo,N=Tp(e);Fc(e,N,y);break;default:throw Error(r(161))}}catch(R){At(e,e.return,R)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function My(e,n,i){ye=e,jp(e)}function jp(e,n,i){for(var c=(e.mode&1)!==0;ye!==null;){var d=ye,p=d.child;if(d.tag===22&&c){var y=d.memoizedState!==null||ma;if(!y){var N=d.alternate,R=N!==null&&N.memoizedState!==null||cn;N=ma;var B=cn;if(ma=y,(cn=R)&&!B)for(ye=d;ye!==null;)y=ye,R=y.child,y.tag===22&&y.memoizedState!==null?Ap(d):R!==null?(R.return=y,ye=R):Ap(d);for(;p!==null;)ye=p,jp(p),p=p.sibling;ye=d,ma=N,cn=B}Ep(e)}else(d.subtreeFlags&8772)!==0&&p!==null?(p.return=d,ye=p):Ep(e)}}function Ep(e){for(;ye!==null;){var n=ye;if((n.flags&8772)!==0){var i=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:cn||ga(5,n);break;case 1:var c=n.stateNode;if(n.flags&4&&!cn)if(i===null)c.componentDidMount();else{var d=n.elementType===n.type?i.memoizedProps:os(n.type,i.memoizedProps);c.componentDidUpdate(d,i.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var p=n.updateQueue;p!==null&&Rf(n,p,c);break;case 3:var y=n.updateQueue;if(y!==null){if(i=null,n.child!==null)switch(n.child.tag){case 5:i=n.child.stateNode;break;case 1:i=n.child.stateNode}Rf(n,y,i)}break;case 5:var N=n.stateNode;if(i===null&&n.flags&4){i=N;var R=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":R.autoFocus&&i.focus();break;case"img":R.src&&(i.src=R.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var B=n.alternate;if(B!==null){var ne=B.memoizedState;if(ne!==null){var re=ne.dehydrated;re!==null&&Ei(re)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}cn||n.flags&512&&zc(n)}catch(te){At(n,n.return,te)}}if(n===e){ye=null;break}if(i=n.sibling,i!==null){i.return=n.return,ye=i;break}ye=n.return}}function Rp(e){for(;ye!==null;){var n=ye;if(n===e){ye=null;break}var i=n.sibling;if(i!==null){i.return=n.return,ye=i;break}ye=n.return}}function Ap(e){for(;ye!==null;){var n=ye;try{switch(n.tag){case 0:case 11:case 15:var i=n.return;try{ga(4,n)}catch(R){At(n,i,R)}break;case 1:var c=n.stateNode;if(typeof c.componentDidMount=="function"){var d=n.return;try{c.componentDidMount()}catch(R){At(n,d,R)}}var p=n.return;try{zc(n)}catch(R){At(n,p,R)}break;case 5:var y=n.return;try{zc(n)}catch(R){At(n,y,R)}}}catch(R){At(n,n.return,R)}if(n===e){ye=null;break}var N=n.sibling;if(N!==null){N.return=n.return,ye=N;break}ye=n.return}}var Ly=Math.ceil,va=O.ReactCurrentDispatcher,Bc=O.ReactCurrentOwner,Yn=O.ReactCurrentBatchConfig,Ye=0,Yt=null,$t=null,nn=0,Fn=0,oi=qs(0),Bt=0,Zi=null,Nr=0,ya=0,Wc=0,Ji=null,Nn=null,Hc=0,ai=1/0,Ds=null,xa=!1,Vc=null,Zs=null,wa=!1,Js=null,ka=0,eo=0,qc=null,Sa=-1,ba=0;function vn(){return(Ye&6)!==0?Nt():Sa!==-1?Sa:Sa=Nt()}function er(e){return(e.mode&1)===0?1:(Ye&2)!==0&&nn!==0?nn&-nn:yy.transition!==null?(ba===0&&(ba=Ni()),ba):(e=Ge,e!==0||(e=window.event,e=e===void 0?16:Id(e.type)),e)}function cs(e,n,i,c){if(50<eo)throw eo=0,qc=null,Error(r(185));vr(e,i,c),((Ye&2)===0||e!==Yt)&&(e===Yt&&((Ye&2)===0&&(ya|=i),Bt===4&&tr(e,nn)),Cn(e,c),i===1&&Ye===0&&(n.mode&1)===0&&(ai=Nt()+500,Qo&&Ks()))}function Cn(e,n){var i=e.callbackNode;Io(e,n);var c=gr(e,e===Yt?nn:0);if(c===0)i!==null&&ss(i),e.callbackNode=null,e.callbackPriority=0;else if(n=c&-c,e.callbackPriority!==n){if(i!=null&&ss(i),n===1)e.tag===0?vy(Dp.bind(null,e)):yf(Dp.bind(null,e)),py(function(){(Ye&6)===0&&Ks()}),i=null;else{switch(ae(c)){case 1:i=zs;break;case 4:i=vs;break;case 16:i=Or;break;case 536870912:i=Ro;break;default:i=Or}i=Up(i,Ip.bind(null,e))}e.callbackPriority=n,e.callbackNode=i}}function Ip(e,n){if(Sa=-1,ba=0,(Ye&6)!==0)throw Error(r(327));var i=e.callbackNode;if(li()&&e.callbackNode!==i)return null;var c=gr(e,e===Yt?nn:0);if(c===0)return null;if((c&30)!==0||(c&e.expiredLanes)!==0||n)n=Ta(e,c);else{n=c;var d=Ye;Ye|=2;var p=Lp();(Yt!==e||nn!==n)&&(Ds=null,ai=Nt()+500,_r(e,n));do try{$y();break}catch(N){Mp(e,N)}while(!0);uc(),va.current=p,Ye=d,$t!==null?n=0:(Yt=null,nn=0,n=Bt)}if(n!==0){if(n===2&&(d=Ti(e),d!==0&&(c=d,n=Gc(e,d))),n===1)throw i=Zi,_r(e,0),tr(e,c),Cn(e,Nt()),i;if(n===6)tr(e,c);else{if(d=e.current.alternate,(c&30)===0&&!Py(d)&&(n=Ta(e,c),n===2&&(p=Ti(e),p!==0&&(c=p,n=Gc(e,p))),n===1))throw i=Zi,_r(e,0),tr(e,c),Cn(e,Nt()),i;switch(e.finishedWork=d,e.finishedLanes=c,n){case 0:case 1:throw Error(r(345));case 2:jr(e,Nn,Ds);break;case 3:if(tr(e,c),(c&130023424)===c&&(n=Hc+500-Nt(),10<n)){if(gr(e,0)!==0)break;if(d=e.suspendedLanes,(d&c)!==c){vn(),e.pingedLanes|=e.suspendedLanes&d;break}e.timeoutHandle=Jl(jr.bind(null,e,Nn,Ds),n);break}jr(e,Nn,Ds);break;case 4:if(tr(e,c),(c&4194240)===c)break;for(n=e.eventTimes,d=-1;0<c;){var y=31-hn(c);p=1<<y,y=n[y],y>d&&(d=y),c&=~p}if(c=d,c=Nt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*Ly(c/1960))-c,10<c){e.timeoutHandle=Jl(jr.bind(null,e,Nn,Ds),c);break}jr(e,Nn,Ds);break;case 5:jr(e,Nn,Ds);break;default:throw Error(r(329))}}}return Cn(e,Nt()),e.callbackNode===i?Ip.bind(null,e):null}function Gc(e,n){var i=Ji;return e.current.memoizedState.isDehydrated&&(_r(e,n).flags|=256),e=Ta(e,n),e!==2&&(n=Nn,Nn=i,n!==null&&Kc(n)),e}function Kc(e){Nn===null?Nn=e:Nn.push.apply(Nn,e)}function Py(e){for(var n=e;;){if(n.flags&16384){var i=n.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var c=0;c<i.length;c++){var d=i[c],p=d.getSnapshot;d=d.value;try{if(!rs(p(),d))return!1}catch{return!1}}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function tr(e,n){for(n&=~Wc,n&=~ya,e.suspendedLanes|=n,e.pingedLanes&=~n,e=e.expirationTimes;0<n;){var i=31-hn(n),c=1<<i;e[i]=-1,n&=~c}}function Dp(e){if((Ye&6)!==0)throw Error(r(327));li();var n=gr(e,0);if((n&1)===0)return Cn(e,Nt()),null;var i=Ta(e,n);if(e.tag!==0&&i===2){var c=Ti(e);c!==0&&(n=c,i=Gc(e,c))}if(i===1)throw i=Zi,_r(e,0),tr(e,n),Cn(e,Nt()),i;if(i===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=n,jr(e,Nn,Ds),Cn(e,Nt()),null}function Yc(e,n){var i=Ye;Ye|=1;try{return e(n)}finally{Ye=i,Ye===0&&(ai=Nt()+500,Qo&&Ks())}}function Cr(e){Js!==null&&Js.tag===0&&(Ye&6)===0&&li();var n=Ye;Ye|=1;var i=Yn.transition,c=Ge;try{if(Yn.transition=null,Ge=1,e)return e()}finally{Ge=c,Yn.transition=i,Ye=n,(Ye&6)===0&&Ks()}}function Xc(){Fn=oi.current,ft(oi)}function _r(e,n){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,fy(i)),$t!==null)for(i=$t.return;i!==null;){var c=i;switch(ic(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&Yo();break;case 3:si(),ft(Sn),ft(on),yc();break;case 5:gc(c);break;case 4:si();break;case 13:ft(jt);break;case 19:ft(jt);break;case 10:dc(c.type._context);break;case 22:case 23:Xc()}i=i.return}if(Yt=e,$t=e=nr(e.current,null),nn=Fn=n,Bt=0,Zi=null,Wc=ya=Nr=0,Nn=Ji=null,Sr!==null){for(n=0;n<Sr.length;n++)if(i=Sr[n],c=i.interleaved,c!==null){i.interleaved=null;var d=c.next,p=i.pending;if(p!==null){var y=p.next;p.next=d,c.next=y}i.pending=c}Sr=null}return e}function Mp(e,n){do{var i=$t;try{if(uc(),aa.current=da,la){for(var c=Et.memoizedState;c!==null;){var d=c.queue;d!==null&&(d.pending=null),c=c.next}la=!1}if(Tr=0,Kt=Ut=Et=null,qi=!1,Gi=0,Bc.current=null,i===null||i.return===null){Bt=1,Zi=n,$t=null;break}e:{var p=e,y=i.return,N=i,R=n;if(n=nn,N.flags|=32768,R!==null&&typeof R=="object"&&typeof R.then=="function"){var B=R,ne=N,re=ne.tag;if((ne.mode&1)===0&&(re===0||re===11||re===15)){var te=ne.alternate;te?(ne.updateQueue=te.updateQueue,ne.memoizedState=te.memoizedState,ne.lanes=te.lanes):(ne.updateQueue=null,ne.memoizedState=null)}var me=ip(y);if(me!==null){me.flags&=-257,op(me,y,N,p,n),me.mode&1&&rp(p,B,n),n=me,R=B;var xe=n.updateQueue;if(xe===null){var ke=new Set;ke.add(R),n.updateQueue=ke}else xe.add(R);break e}else{if((n&1)===0){rp(p,B,n),Qc();break e}R=Error(r(426))}}else if(wt&&N.mode&1){var Pt=ip(y);if(Pt!==null){(Pt.flags&65536)===0&&(Pt.flags|=256),op(Pt,y,N,p,n),lc(ri(R,N));break e}}p=R=ri(R,N),Bt!==4&&(Bt=2),Ji===null?Ji=[p]:Ji.push(p),p=y;do{switch(p.tag){case 3:p.flags|=65536,n&=-n,p.lanes|=n;var z=np(p,R,n);Ef(p,z);break e;case 1:N=R;var D=p.type,F=p.stateNode;if((p.flags&128)===0&&(typeof D.getDerivedStateFromError=="function"||F!==null&&typeof F.componentDidCatch=="function"&&(Zs===null||!Zs.has(F)))){p.flags|=65536,n&=-n,p.lanes|=n;var le=sp(p,N,n);Ef(p,le);break e}}p=p.return}while(p!==null)}Op(i)}catch(Se){n=Se,$t===i&&i!==null&&($t=i=i.return);continue}break}while(!0)}function Lp(){var e=va.current;return va.current=da,e===null?da:e}function Qc(){(Bt===0||Bt===3||Bt===2)&&(Bt=4),Yt===null||(Nr&268435455)===0&&(ya&268435455)===0||tr(Yt,nn)}function Ta(e,n){var i=Ye;Ye|=2;var c=Lp();(Yt!==e||nn!==n)&&(Ds=null,_r(e,n));do try{Oy();break}catch(d){Mp(e,d)}while(!0);if(uc(),Ye=i,va.current=c,$t!==null)throw Error(r(261));return Yt=null,nn=0,Bt}function Oy(){for(;$t!==null;)Pp($t)}function $y(){for(;$t!==null&&!El();)Pp($t)}function Pp(e){var n=Fp(e.alternate,e,Fn);e.memoizedProps=e.pendingProps,n===null?Op(e):$t=n,Bc.current=null}function Op(e){var n=e;do{var i=n.alternate;if(e=n.return,(n.flags&32768)===0){if(i=Ry(i,n,Fn),i!==null){$t=i;return}}else{if(i=Ay(i,n),i!==null){i.flags&=32767,$t=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Bt=6,$t=null;return}}if(n=n.sibling,n!==null){$t=n;return}$t=n=e}while(n!==null);Bt===0&&(Bt=5)}function jr(e,n,i){var c=Ge,d=Yn.transition;try{Yn.transition=null,Ge=1,zy(e,n,i,c)}finally{Yn.transition=d,Ge=c}return null}function zy(e,n,i,c){do li();while(Js!==null);if((Ye&6)!==0)throw Error(r(327));i=e.finishedWork;var d=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var p=i.lanes|i.childLanes;if(Do(e,p),e===Yt&&($t=Yt=null,nn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||wa||(wa=!0,Up(Or,function(){return li(),null})),p=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||p){p=Yn.transition,Yn.transition=null;var y=Ge;Ge=1;var N=Ye;Ye|=4,Bc.current=null,Dy(e,i),_p(i,e),iy(Ql),Lo=!!Xl,Ql=Xl=null,e.current=i,My(i),Rl(),Ye=N,Ge=y,Yn.transition=p}else e.current=i;if(wa&&(wa=!1,Js=e,ka=d),p=e.pendingLanes,p===0&&(Zs=null),$r(i.stateNode),Cn(e,Nt()),n!==null)for(c=e.onRecoverableError,i=0;i<n.length;i++)d=n[i],c(d.value,{componentStack:d.stack,digest:d.digest});if(xa)throw xa=!1,e=Vc,Vc=null,e;return(ka&1)!==0&&e.tag!==0&&li(),p=e.pendingLanes,(p&1)!==0?e===qc?eo++:(eo=0,qc=e):eo=0,Ks(),null}function li(){if(Js!==null){var e=ae(ka),n=Yn.transition,i=Ge;try{if(Yn.transition=null,Ge=16>e?16:e,Js===null)var c=!1;else{if(e=Js,Js=null,ka=0,(Ye&6)!==0)throw Error(r(331));var d=Ye;for(Ye|=4,ye=e.current;ye!==null;){var p=ye,y=p.child;if((ye.flags&16)!==0){var N=p.deletions;if(N!==null){for(var R=0;R<N.length;R++){var B=N[R];for(ye=B;ye!==null;){var ne=ye;switch(ne.tag){case 0:case 11:case 15:Qi(8,ne,p)}var re=ne.child;if(re!==null)re.return=ne,ye=re;else for(;ye!==null;){ne=ye;var te=ne.sibling,me=ne.return;if(Sp(ne),ne===B){ye=null;break}if(te!==null){te.return=me,ye=te;break}ye=me}}}var xe=p.alternate;if(xe!==null){var ke=xe.child;if(ke!==null){xe.child=null;do{var Pt=ke.sibling;ke.sibling=null,ke=Pt}while(ke!==null)}}ye=p}}if((p.subtreeFlags&2064)!==0&&y!==null)y.return=p,ye=y;else e:for(;ye!==null;){if(p=ye,(p.flags&2048)!==0)switch(p.tag){case 0:case 11:case 15:Qi(9,p,p.return)}var z=p.sibling;if(z!==null){z.return=p.return,ye=z;break e}ye=p.return}}var D=e.current;for(ye=D;ye!==null;){y=ye;var F=y.child;if((y.subtreeFlags&2064)!==0&&F!==null)F.return=y,ye=F;else e:for(y=D;ye!==null;){if(N=ye,(N.flags&2048)!==0)try{switch(N.tag){case 0:case 11:case 15:ga(9,N)}}catch(Se){At(N,N.return,Se)}if(N===y){ye=null;break e}var le=N.sibling;if(le!==null){le.return=N.return,ye=le;break e}ye=N.return}}if(Ye=d,Ks(),Pn&&typeof Pn.onPostCommitFiberRoot=="function")try{Pn.onPostCommitFiberRoot(pr,e)}catch{}c=!0}return c}finally{Ge=i,Yn.transition=n}}return!1}function $p(e,n,i){n=ri(i,n),n=np(e,n,1),e=Xs(e,n,1),n=vn(),e!==null&&(vr(e,1,n),Cn(e,n))}function At(e,n,i){if(e.tag===3)$p(e,e,i);else for(;n!==null;){if(n.tag===3){$p(n,e,i);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Zs===null||!Zs.has(c))){e=ri(i,e),e=sp(n,e,1),n=Xs(n,e,1),e=vn(),n!==null&&(vr(n,1,e),Cn(n,e));break}}n=n.return}}function Fy(e,n,i){var c=e.pingCache;c!==null&&c.delete(n),n=vn(),e.pingedLanes|=e.suspendedLanes&i,Yt===e&&(nn&i)===i&&(Bt===4||Bt===3&&(nn&130023424)===nn&&500>Nt()-Hc?_r(e,0):Wc|=i),Cn(e,n)}function zp(e,n){n===0&&((e.mode&1)===0?n=1:(n=Fr,Fr<<=1,(Fr&130023424)===0&&(Fr=4194304)));var i=vn();e=Rs(e,n),e!==null&&(vr(e,n,i),Cn(e,i))}function Uy(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),zp(e,i)}function By(e,n){var i=0;switch(e.tag){case 13:var c=e.stateNode,d=e.memoizedState;d!==null&&(i=d.retryLane);break;case 19:c=e.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(n),zp(e,i)}var Fp;Fp=function(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps||Sn.current)Tn=!0;else{if((e.lanes&i)===0&&(n.flags&128)===0)return Tn=!1,Ey(e,n,i);Tn=(e.flags&131072)!==0}else Tn=!1,wt&&(n.flags&1048576)!==0&&xf(n,Jo,n.index);switch(n.lanes=0,n.tag){case 2:var c=n.type;ha(e,n),e=n.pendingProps;var d=Xr(n,on.current);ni(n,i),d=kc(null,n,c,e,d,i);var p=Sc();return n.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,bn(c)?(p=!0,Xo(n)):p=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,hc(n),d.updater=fa,n.stateNode=d,d._reactInternals=n,jc(n,c,e,i),n=Ic(null,n,c,!0,p,i)):(n.tag=0,wt&&p&&rc(n),gn(null,n,d,i),n=n.child),n;case 16:c=n.elementType;e:{switch(ha(e,n),e=n.pendingProps,d=c._init,c=d(c._payload),n.type=c,d=n.tag=Hy(c),e=os(c,e),d){case 0:n=Ac(null,n,c,e,i);break e;case 1:n=fp(null,n,c,e,i);break e;case 11:n=ap(null,n,c,e,i);break e;case 14:n=lp(null,n,c,os(c.type,e),i);break e}throw Error(r(306,c,""))}return n;case 0:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:os(c,d),Ac(e,n,c,d,i);case 1:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:os(c,d),fp(e,n,c,d,i);case 3:e:{if(pp(n),e===null)throw Error(r(387));c=n.pendingProps,p=n.memoizedState,d=p.element,jf(e,n),ia(n,c,null,i);var y=n.memoizedState;if(c=y.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){d=ri(Error(r(423)),n),n=hp(e,n,c,i,d);break e}else if(c!==d){d=ri(Error(r(424)),n),n=hp(e,n,c,i,d);break e}else for(zn=Vs(n.stateNode.containerInfo.firstChild),$n=n,wt=!0,is=null,i=Cf(n,null,c,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Jr(),c===d){n=Is(e,n,i);break e}gn(e,n,c,i)}n=n.child}return n;case 5:return Af(n),e===null&&ac(n),c=n.type,d=n.pendingProps,p=e!==null?e.memoizedProps:null,y=d.children,Zl(c,d)?y=null:p!==null&&Zl(c,p)&&(n.flags|=32),dp(e,n),gn(e,n,y,i),n.child;case 6:return e===null&&ac(n),null;case 13:return mp(e,n,i);case 4:return mc(n,n.stateNode.containerInfo),c=n.pendingProps,e===null?n.child=ei(n,null,c,i):gn(e,n,c,i),n.child;case 11:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:os(c,d),ap(e,n,c,d,i);case 7:return gn(e,n,n.pendingProps,i),n.child;case 8:return gn(e,n,n.pendingProps.children,i),n.child;case 12:return gn(e,n,n.pendingProps.children,i),n.child;case 10:e:{if(c=n.type._context,d=n.pendingProps,p=n.memoizedProps,y=d.value,ct(na,c._currentValue),c._currentValue=y,p!==null)if(rs(p.value,y)){if(p.children===d.children&&!Sn.current){n=Is(e,n,i);break e}}else for(p=n.child,p!==null&&(p.return=n);p!==null;){var N=p.dependencies;if(N!==null){y=p.child;for(var R=N.firstContext;R!==null;){if(R.context===c){if(p.tag===1){R=As(-1,i&-i),R.tag=2;var B=p.updateQueue;if(B!==null){B=B.shared;var ne=B.pending;ne===null?R.next=R:(R.next=ne.next,ne.next=R),B.pending=R}}p.lanes|=i,R=p.alternate,R!==null&&(R.lanes|=i),fc(p.return,i,n),N.lanes|=i;break}R=R.next}}else if(p.tag===10)y=p.type===n.type?null:p.child;else if(p.tag===18){if(y=p.return,y===null)throw Error(r(341));y.lanes|=i,N=y.alternate,N!==null&&(N.lanes|=i),fc(y,i,n),y=p.sibling}else y=p.child;if(y!==null)y.return=p;else for(y=p;y!==null;){if(y===n){y=null;break}if(p=y.sibling,p!==null){p.return=y.return,y=p;break}y=y.return}p=y}gn(e,n,d.children,i),n=n.child}return n;case 9:return d=n.type,c=n.pendingProps.children,ni(n,i),d=Gn(d),c=c(d),n.flags|=1,gn(e,n,c,i),n.child;case 14:return c=n.type,d=os(c,n.pendingProps),d=os(c.type,d),lp(e,n,c,d,i);case 15:return cp(e,n,n.type,n.pendingProps,i);case 17:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:os(c,d),ha(e,n),n.tag=1,bn(c)?(e=!0,Xo(n)):e=!1,ni(n,i),ep(n,c,d),jc(n,c,d,i),Ic(null,n,c,!0,e,i);case 19:return vp(e,n,i);case 22:return up(e,n,i)}throw Error(r(156,n.tag))};function Up(e,n){return Tt(e,n)}function Wy(e,n,i,c){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xn(e,n,i,c){return new Wy(e,n,i,c)}function Zc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Hy(e){if(typeof e=="function")return Zc(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Te)return 11;if(e===se)return 14}return 2}function nr(e,n){var i=e.alternate;return i===null?(i=Xn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Na(e,n,i,c,d,p){var y=2;if(c=e,typeof e=="function")Zc(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case Y:return Er(i.children,d,p,n);case Q:y=8,d|=8;break;case ue:return e=Xn(12,i,n,d|2),e.elementType=ue,e.lanes=p,e;case Ne:return e=Xn(13,i,n,d),e.elementType=Ne,e.lanes=p,e;case Le:return e=Xn(19,i,n,d),e.elementType=Le,e.lanes=p,e;case X:return Ca(i,d,p,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case he:y=10;break e;case H:y=9;break e;case Te:y=11;break e;case se:y=14;break e;case G:y=16,c=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Xn(y,i,n,d),n.elementType=e,n.type=c,n.lanes=p,n}function Er(e,n,i,c){return e=Xn(7,e,c,n),e.lanes=i,e}function Ca(e,n,i,c){return e=Xn(22,e,c,n),e.elementType=X,e.lanes=i,e.stateNode={isHidden:!1},e}function Jc(e,n,i){return e=Xn(6,e,null,n),e.lanes=i,e}function eu(e,n,i){return n=Xn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Vy(e,n,i,c,d){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ci(0),this.expirationTimes=Ci(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ci(0),this.identifierPrefix=c,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function tu(e,n,i,c,d,p,y,N,R){return e=new Vy(e,n,i,N,R),n===1?(n=1,p===!0&&(n|=8)):n=0,p=Xn(3,null,null,n),e.current=p,p.stateNode=e,p.memoizedState={element:c,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},hc(p),e}function qy(e,n,i){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Z,key:c==null?null:""+c,children:e,containerInfo:n,implementation:i}}function Bp(e){if(!e)return Gs;e=e._reactInternals;e:{if(He(e)!==e||e.tag!==1)throw Error(r(170));var n=e;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(bn(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(e.tag===1){var i=e.type;if(bn(i))return gf(e,i,n)}return n}function Wp(e,n,i,c,d,p,y,N,R){return e=tu(i,c,!0,e,d,p,y,N,R),e.context=Bp(null),i=e.current,c=vn(),d=er(i),p=As(c,d),p.callback=n??null,Xs(i,p,d),e.current.lanes=d,vr(e,d,c),Cn(e,c),e}function _a(e,n,i,c){var d=n.current,p=vn(),y=er(d);return i=Bp(i),n.context===null?n.context=i:n.pendingContext=i,n=As(p,y),n.payload={element:e},c=c===void 0?null:c,c!==null&&(n.callback=c),e=Xs(d,n,y),e!==null&&(cs(e,d,y,p),ra(e,d,y)),y}function ja(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Hp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function nu(e,n){Hp(e,n),(e=e.alternate)&&Hp(e,n)}function Gy(){return null}var Vp=typeof reportError=="function"?reportError:function(e){console.error(e)};function su(e){this._internalRoot=e}Ea.prototype.render=su.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));_a(e,n,null,null)},Ea.prototype.unmount=su.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Cr(function(){_a(null,e,null,null)}),n[Cs]=null}};function Ea(e){this._internalRoot=e}Ea.prototype.unstable_scheduleHydration=function(e){if(e){var n=we();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Bs.length&&n!==0&&n<Bs[i].priority;i++);Bs.splice(i,0,e),i===0&&Rd(e)}};function ru(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ra(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function qp(){}function Ky(e,n,i,c,d){if(d){if(typeof c=="function"){var p=c;c=function(){var B=ja(y);p.call(B)}}var y=Wp(n,c,e,0,null,!1,!1,"",qp);return e._reactRootContainer=y,e[Cs]=y.current,$i(e.nodeType===8?e.parentNode:e),Cr(),y}for(;d=e.lastChild;)e.removeChild(d);if(typeof c=="function"){var N=c;c=function(){var B=ja(R);N.call(B)}}var R=tu(e,0,!1,null,null,!1,!1,"",qp);return e._reactRootContainer=R,e[Cs]=R.current,$i(e.nodeType===8?e.parentNode:e),Cr(function(){_a(n,R,i,c)}),R}function Aa(e,n,i,c,d){var p=i._reactRootContainer;if(p){var y=p;if(typeof d=="function"){var N=d;d=function(){var R=ja(y);N.call(R)}}_a(n,y,e,d)}else y=Ky(i,n,e,d,c);return ja(y)}S=function(e){switch(e.tag){case 3:var n=e.stateNode;if(n.current.memoizedState.isDehydrated){var i=mr(n.pendingLanes);i!==0&&(Us(n,i|1),Cn(n,Nt()),(Ye&6)===0&&(ai=Nt()+500,Ks()))}break;case 13:Cr(function(){var c=Rs(e,1);if(c!==null){var d=vn();cs(c,e,1,d)}}),nu(e,1)}},$=function(e){if(e.tag===13){var n=Rs(e,134217728);if(n!==null){var i=vn();cs(n,e,134217728,i)}nu(e,134217728)}},ee=function(e){if(e.tag===13){var n=er(e),i=Rs(e,n);if(i!==null){var c=vn();cs(i,e,n,c)}nu(e,n)}},we=function(){return Ge},be=function(e,n){var i=Ge;try{return Ge=e,n()}finally{Ge=i}},Ft=function(e,n,i){switch(n){case"input":if(Dt(e,i),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<i.length;n++){var c=i[n];if(c!==e&&c.form===e.form){var d=Ko(c);if(!d)throw Error(r(90));_e(c),Dt(c,d)}}}break;case"textarea":pe(e,i);break;case"select":n=i.value,n!=null&&ht(e,!!i.multiple,n,!1)}},bt=Yc,xt=Cr;var Yy={usingClientEntryPoint:!1,Events:[Ui,Kr,Ko,yt,qt,Yc]},to={findFiberByHostInstance:yr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Xy={bundleType:to.bundleType,version:to.version,rendererPackageName:to.rendererPackageName,rendererConfig:to.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:O.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ns(e),e===null?null:e.stateNode},findFiberByHostInstance:to.findFiberByHostInstance||Gy,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 Ia=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ia.isDisabled&&Ia.supportsFiber)try{pr=Ia.inject(Xy),Pn=Ia}catch{}}return _n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Yy,_n.createPortal=function(e,n){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ru(n))throw Error(r(200));return qy(e,n,null,i)},_n.createRoot=function(e,n){if(!ru(e))throw Error(r(299));var i=!1,c="",d=Vp;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onRecoverableError!==void 0&&(d=n.onRecoverableError)),n=tu(e,1,!1,null,null,i,!1,c,d),e[Cs]=n.current,$i(e.nodeType===8?e.parentNode:e),new su(n)},_n.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=ns(n),e=e===null?null:e.stateNode,e},_n.flushSync=function(e){return Cr(e)},_n.hydrate=function(e,n,i){if(!Ra(n))throw Error(r(200));return Aa(null,e,n,!0,i)},_n.hydrateRoot=function(e,n,i){if(!ru(e))throw Error(r(405));var c=i!=null&&i.hydratedSources||null,d=!1,p="",y=Vp;if(i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onRecoverableError!==void 0&&(y=i.onRecoverableError)),n=Wp(n,null,e,1,i??null,d,!1,p,y),e[Cs]=n.current,$i(e),c)for(e=0;e<c.length;e++)i=c[e],d=i._getVersion,d=d(i._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[i,d]:n.mutableSourceEagerHydrationData.push(i,d);return new Ea(n)},_n.render=function(e,n,i){if(!Ra(n))throw Error(r(200));return Aa(null,e,n,!1,i)},_n.unmountComponentAtNode=function(e){if(!Ra(e))throw Error(r(40));return e._reactRootContainer?(Cr(function(){Aa(null,null,e,!1,function(){e._reactRootContainer=null,e[Cs]=null})}),!0):!1},_n.unstable_batchedUpdates=Yc,_n.unstable_renderSubtreeIntoContainer=function(e,n,i,c){if(!Ra(i))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Aa(e,n,i,!1,c)},_n.version="18.3.1-next-f1338f8080-20240426",_n}var eh;function Bm(){if(eh)return au.exports;eh=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),au.exports=ix(),au.exports}var th;function ox(){if(th)return Da;th=1;var t=Bm();return Da.createRoot=t.createRoot,Da.hydrateRoot=t.hydrateRoot,Da}var ax=ox();const lx=Um(ax),nh=t=>{let s;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(s):m;if(!Object.is(k,s)){const x=s;s=v??(typeof k!="object"||k===null)?k:Object.assign({},s,k),r.forEach(b=>b(s,x))}},a=()=>s,h={setState:o,getState:a,getInitialState:()=>g,subscribe:m=>(r.add(m),()=>r.delete(m))},g=s=t(o,a,h);return h},cx=(t=>t?nh(t):nh),ux=t=>t;function dx(t,s=ux){const r=rt.useSyncExternalStore(t.subscribe,rt.useCallback(()=>s(t.getState()),[t,s]),rt.useCallback(()=>s(t.getInitialState()),[t,s]));return rt.useDebugValue(r),r}const fx=t=>{const s=cx(t),r=o=>dx(s,o);return Object.assign(r,s),r},px=(t=>fx),Wm="agentpane:machines",Hm="agentpane:active-machine";function hx(t){return/^[a-z][a-z0-9-]{1,30}$/.test(t)}function Vm(t){return`${t}.repoburg.com`}function qm(t){const s=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(t);return s?s[1]:null}function Gm(t,s){try{const r=localStorage.getItem(t);return r==null?s:JSON.parse(r)}catch{return s}}function Km(t,s){try{localStorage.setItem(t,JSON.stringify(s))}catch{}}function Ym(){return Gm(Wm,[]).filter(s=>hx(s.mahlas)&&s.hostname===Vm(s.mahlas))}function mx(t){const s={mahlas:t,hostname:Vm(t),lastConnectedAt:new Date().toISOString()},r=Ym(),o=[s,...r.filter(a=>a.mahlas!==t)];return Km(Wm,o),s}function gx(){const t=Gm(Hm,null);return t?Ym().find(s=>s.mahlas===t)??null:null}function vx(t){Km(Hm,t)}function yx(){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search).get("host");if(!t)return;const s=qm(t);s&&(mx(s),vx(s))}const sh="http://localhost:9998",xx=["agent.repoburg.com"];function dn(){if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search),s=t.get("bport");if(s)return`http://localhost:${s}`;const r=t.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(xx.includes(o))return sh;if(qm(o))return"";const a=gx();return a?`https://${a.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":sh}const wx="/api";async function bo(t,s,r){const o=await fetch(`${dn()}${wx}${s}`,{method:t,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let a=`${o.status} ${o.statusText}`;try{const u=await o.json();u!=null&&u.error&&(a=`${a} — ${u.error}`)}catch{}throw new Error(`${t} ${s} failed: ${a}`)}return o.json()}function fn(t){return bo("GET",t)}function pt(t,s){return bo("POST",t,s)}function gl(t){return bo("DELETE",t)}function bs(t,s){return bo("PATCH",t,s)}function kx(t,s){return bo("PUT",t,s)}function Sx(){return fn("/sessions")}function so(t){return fn(`/sessions/${t}`)}function Zu(t){return pt("/sessions",t)}function rh(t){return gl(`/sessions/${t}`)}function Xm(t,s,r,o){return pt(`/sessions/${t}/turns`,{user_prompt:s,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function bx(t){return pt(`/sessions/${t}/cancel`)}function Tx(t,s){return pt(`/sessions/${t}/turns/${s}/resume`)}function Nx(t,s){return bs(`/sessions/${t}`,{title:s})}function ih(t){return bs(`/sessions/${t}`,{lifecycle:"finished"})}function oh(t){return bs(`/sessions/${t}`,{lifecycle:"working"})}function Cx(t,s){return bs(`/sessions/${t}`,{starred:s})}function ah(t){return bs(`/sessions/${t}`,{has_unreviewed:0})}function _x(t,s,r,o){const a={model:s,model_reasoning_effort:r};return o!==void 0&&(a.runtime_type=o),bs(`/sessions/${t}`,a)}function jx(t,s){return bs(`/sessions/${t}`,{runtime_config:s})}function Ex(t,s){return pt(`/sessions/${t}/rewind`,{turn_id:s})}function Rx(t){return pt(`/sessions/${t}/restore`,{})}function Ax(t,s,r){return pt(`/sessions/${t}/branch`,{turn_id:s,title:r})}function Qm(){return fn("/workspaces")}function Ix(t,s){return pt("/workspaces",{path:t,label:s})}function Dx(t){return pt("/workspaces/hide",{path:t})}async function Mx(){const t=await fetch(`${dn()}/api/pick-directory`);if(t.status===204)return{cancelled:!0};if(!t.ok)throw new Error(`GET /api/pick-directory failed: ${t.status} ${t.statusText}`);return t.json()}function Zm(){return fn("/folders")}function Lx(t,s){return pt("/folders",{workspace_path:t,name:s})}function lh(t,s){return bs(`/folders/${t}`,s)}function Px(t){return gl(`/folders/${t}`)}function Ox(t){return pt("/sessions/reorder",{moves:t})}function cr(t){return t.status==="pending"||t.status==="running"}function Jm(t){return!!(t!=null&&t.turns.some(cr))}function vl(t){return t?t.turns.some(cr)||(t.threads??[]).some(s=>(s.turns??[]).some(cr)):!1}const eg=1;function tg(){let t="";try{t=dn()}catch{}return`agentpane:tabs:${t||window.location.origin}`}function ch(t){return Array.isArray(t)&&t.every(s=>typeof s=="string")}function uh(t){return t===null||typeof t=="string"}function $x(t){if(t==null)return null;let s;try{s=JSON.parse(t)}catch{return null}if(typeof s!="object"||s===null)return null;const r=s;return r.v!==eg||!ch(r.openTabs)||!uh(r.activeSessionId)||!ch(r.openAppTabs)||!uh(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId}}const ng=[()=>window.sessionStorage,()=>window.localStorage];function zx(){const t=tg();for(const s of ng)try{const r=$x(s().getItem(t));if(r)return r}catch{}return null}function Fx(t){const s=tg(),r=JSON.stringify({v:eg,openTabs:t.openTabs,activeSessionId:t.activeSessionId,openAppTabs:t.openAppTabs,activeAppTabId:t.activeAppTabId});for(const o of ng)try{o().setItem(s,r)}catch{}}function Ux(t){return t.subscribe((s,r)=>{(s.openTabs!==r.openTabs||s.activeSessionId!==r.activeSessionId||s.openAppTabs!==r.openAppTabs||s.activeAppTabId!==r.activeAppTabId)&&Fx(s)})}function Ka(t){return[...new Set(t)]}function Bx(t,s,r,o){const a=m=>r===null||r.has(m),u=Ka(((t==null?void 0:t.openTabs)??[]).filter(m=>s.has(m))),f=Ka(((t==null?void 0:t.openAppTabs)??[]).filter(a));let h=(t==null?void 0:t.activeSessionId)??null;h!==null&&!s.has(h)&&(h=null),h!==null&&!u.includes(h)&&u.push(h),h??(h=u.at(-1)??null);let g=(t==null?void 0:t.activeAppTabId)??null;return g!==null&&!a(g)&&(g=null),g!==null&&!f.includes(g)&&f.push(g),o!==null&&s.has(o)&&(u.includes(o)||u.push(o),h=o,g=null),{openTabs:u,activeSessionId:h,openAppTabs:f,activeAppTabId:g}}function Wx(){const t=new URLSearchParams(window.location.search);return{session:t.get("session"),thread:t.get("thread")}}function Hx(){const t=new URL(window.location.href);!t.searchParams.has("session")&&!t.searchParams.has("thread")||(t.searchParams.delete("session"),t.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",t))}let uu=0;function dh(t){return t==="sidecar"?"sidecar":"turns"}async function Vx(t,s){const r=await Promise.allSettled(t.map(u=>s(u))),o=new Map;let a=null;return r.forEach((u,f)=>{var h;u.status==="fulfilled"?o.set(t[f],u.value):a===null&&(a=((h=u.reason)==null?void 0:h.message)??"Request failed")}),{updated:o,firstError:a}}function fh(t,s){const r={...t.sessionDetails};s.forEach(h=>delete r[h]);const o={...t.backgroundTasks};s.forEach(h=>delete o[h]);const a=t.openTabs.filter(h=>!s.has(h));let u=t.activeSessionId,f=t.activeTurnIndex;if(u&&s.has(u)){u=a.length>0?a[a.length-1]:null;const h=u?r[u]:null;f=h&&h.turns.length>0?h.turns.length-1:0}return{sessions:t.sessions.filter(h=>!s.has(h.id)),sessionDetails:r,backgroundTasks:o,openTabs:a,activeSessionId:u,activeTurnIndex:f}}function qx(t){const s={...t};return delete s.turns,delete s.threads,delete s.contextUsage,s}async function ph(t,s,r,o,a){if(r.length===0)return;t({error:null});const{updated:u,firstError:f}=await Vx(r,o);u.size>0&&t(g=>({sessions:g.sessions.map(m=>u.get(m.id)??m)}));const h=r.length-u.size;if(h===0)s().addToast("info",`${r.length} session${r.length===1?"":"s"} ${a}`);else{t({error:f});const g=a[0].toUpperCase()+a.slice(1);s().addToast(h===r.length?"error":"warn",`${g} ${u.size} of ${r.length} — ${h} failed`)}}const Gx=(t,s)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=Wx(),o=zx();try{const a=localStorage.getItem("agentpane:last-model-config");a&&t({lastModelConfig:JSON.parse(a)})}catch{}t({loading:!0,error:null});try{const a=s().loadApps(),[u,f,h]=await Promise.all([Sx(),Qm(),Zm()]);t({sessions:u,workspaces:f,folders:h,loading:!1}),Hx();const g=await a,m=Bx(o,new Set(u.map(v=>v.id)),g?new Set(s().apps.map(v=>v.id)):null,r.session);t(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:Ka([...m.openTabs,...v.openTabs]),openAppTabs:Ka([...m.openAppTabs,...v.openAppTabs]),activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!s().activeSessionId&&await s().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(t({deepLinkThreadId:r.thread}),s().switchRightTab("threads"))}catch(a){t({loading:!1,error:a.message})}},selectSession:async(r,o)=>{const a=++uu,u=o!=null&&o.keepAppView?{}:{activeAppTabId:null},f=h=>h.includes(r)?h:[...h,r];if(s().sessionDetails[r]){const h=s().sessionDetails[r];t({activeSessionId:r,activeTurnIndex:h.turns.length>0?h.turns.length-1:0,activeRightTab:dh(s().activeRightTab),...u,openTabs:f(s().openTabs)}),h.has_unreviewed===1&&(ah(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...h,has_unreviewed:0}}})));return}t({loading:!0,error:null});try{const h=await so(r);if(a!==uu){t(g=>({sessionDetails:{...g.sessionDetails,[r]:h},openTabs:f(g.openTabs),loading:!1}));return}t(g=>({sessionDetails:{...g.sessionDetails,[r]:h},activeSessionId:r,activeTurnIndex:h.turns.length>0?h.turns.length-1:0,activeRightTab:dh(g.activeRightTab),...u,openTabs:f(g.openTabs),loading:!1})),h.has_unreviewed===1&&(ah(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...h,has_unreviewed:0}}})))}catch(h){t(a===uu?{loading:!1,error:h.message}:{loading:!1})}},closeTab:r=>{t(o=>{const a=o.openTabs.filter(u=>u!==r);if(o.activeSessionId===r&&a.length>0){const u=a[a.length-1],f=o.sessionDetails[u];return{openTabs:a,activeSessionId:u,activeTurnIndex:f&&f.turns.length>0?f.turns.length-1:0}}return{openTabs:a,activeSessionId:o.activeSessionId===r?null:o.activeSessionId}})},updateModelConfig:async(r,o,a)=>{const u=s().activeSessionId;if(u){t({error:null});try{const f=await _x(u,r,o,a),h={provider:f.runtime_type,model:f.model??"",reasoning:f.model_reasoning_effort??""};t({lastModelConfig:h}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(h)),t(g=>({sessions:g.sessions.map(m=>m.id===u?f:m),sessionDetails:g.sessionDetails[u]?{...g.sessionDetails,[u]:{...g.sessionDetails[u],model:f.model,model_reasoning_effort:f.model_reasoning_effort,external_thread_id:f.external_thread_id}}:g.sessionDetails})),await s().refreshActiveSession()}catch(f){t({error:f.message}),s().addToast("error",`Failed to update model — ${f.message}`)}}},createSession:async r=>{t({error:null});try{const o=await Zu(r);t(u=>({sessions:[o,...u.sessions],showNewSessionDialog:!1}));const a={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};t({lastModelConfig:a}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(a)),await s().selectSession(o.id),s().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),s().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{t(o=>({sessions:o.sessions.some(a=>a.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=s().sessionDetails[r];if(!o){const a=await so(r);t(u=>({sessionDetails:{...u.sessionDetails,[r]:a}})),o=a}s().sessions.some(a=>a.id===r)||s().addSession(qx(o)),await s().selectSession(r)},deleteSession:async r=>{var a;t({error:null});const o=(a=s().sessions.find(u=>u.id===r))==null?void 0:a.title;try{await rh(r),t(u=>fh(u,new Set([r]))),s().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),s().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(u){t({error:u.message}),s().addToast("error",`Failed to delete session — ${u.message}`)}},renameSession:async(r,o)=>{t({error:null});try{const a=await Nx(r,o.trim());t(u=>({sessions:u.sessions.map(f=>f.id===r?a:f),sessionDetails:u.sessionDetails[r]?{...u.sessionDetails,[r]:{...u.sessionDetails[r],title:a.title}}:u.sessionDetails}))}catch(a){t({error:a.message}),s().addToast("error",`Failed to rename session — ${a.message}`)}},markFinished:async r=>{t({error:null});try{const o=await ih(r);t(a=>({sessions:a.sessions.map(u=>u.id===r?o:u)})),s().addToast("info","Session marked as finished")}catch(o){t({error:o.message}),s().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await ph(t,s,r,ih,"marked as finished")},toggleStar:async r=>{const o=s().sessions.find(a=>a.id===r);if(o){t({error:null});try{const a=await Cx(r,o.starred?0:1);t(u=>({sessions:u.sessions.map(f=>f.id===r?a:f),sessionDetails:u.sessionDetails[r]?{...u.sessionDetails,[r]:{...u.sessionDetails[r],starred:a.starred}}:u.sessionDetails}))}catch(a){t({error:a.message}),s().addToast("error",`Failed to star session — ${a.message}`)}}},reopenSession:async r=>{t({error:null});try{const o=await oh(r);t(a=>({sessions:a.sessions.map(u=>u.id===r?o:u)})),s().addToast("info","Session reopened")}catch(o){t({error:o.message}),s().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await ph(t,s,r,oh,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;t({error:null});const o=await Promise.allSettled(r.map(f=>rh(f))),a=new Set;if(o.forEach((f,h)=>{f.status==="fulfilled"&&a.add(r[h])}),a.size===0){t({error:"Failed to delete sessions"}),s().addToast("error","Failed to delete sessions");return}t(f=>fh(f,a)),s().addLogEntry("INFO",`${a.size} session${a.size===1?"":"s"} deleted`);const u=r.length-a.size;u===0?s().addToast("info",`${a.size} session${a.size===1?"":"s"} deleted`):(t({error:"One or more sessions failed to delete"}),s().addToast("warn",`Deleted ${a.size} of ${r.length} — ${u} failed`))},submitPrompt:async(r,o)=>{const a=s().activeSessionId;if(a){t({error:null,submittingPrompt:r}),t(u=>{const f=u.sessionDetails[a];return f?{sessionDetails:{...u.sessionDetails,[a]:{...f,is_running:1,status:"running"}},sessions:u.sessions.map(h=>h.id===a?{...h,is_running:1,status:"running"}:h)}:{}});try{const u=await Xm(a,r,o);s().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),t(f=>{const h=f.sessionDetails[a];if(!h)return{submittingPrompt:null};const g=h.turns.findIndex(v=>v.id===u.id);if(g>=0)return{submittingPrompt:null,activeTurnIndex:g};const m={...u,items:[]};return{submittingPrompt:null,sessionDetails:{...f.sessionDetails,[a]:{...h,turns:[...h.turns,m]}},activeTurnIndex:h.turns.length}})}catch(u){t({submittingPrompt:null,error:u.message}),s().addLogEntry("ERROR",`Turn failed — ${u.message}`),s().addToast("error",`Failed to send prompt — ${u.message}`),t(f=>{const h=f.sessionDetails[a];if(!h)return{};const g=vl(h)?1:0;return{sessionDetails:{...f.sessionDetails,[a]:{...h,is_running:g,status:g?"running":"active"}},sessions:f.sessions.map(m=>m.id===a?{...m,is_running:g,status:g?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=s().activeSessionId;if(r)try{await bx(r)}catch(o){t({error:o.message})}},rewindToTurn:async(r,o)=>{t({error:null});try{const a=await Ex(r,o),u=await so(r);t(f=>({sessionDetails:{...f.sessionDetails,[r]:u},sessions:f.sessions.map(h=>h.id===r?{...h,external_thread_id:a.external_thread_id,is_running:0,status:"active"}:h),activeTurnIndex:u.turns.length>0?u.turns.length-1:0})),s().addToast("info","Rewound to selected turn")}catch(a){t({error:a.message}),s().addToast("error",`Failed to rewind — ${a.message}`)}},restoreSession:async r=>{t({error:null});try{const o=await Rx(r),a=await so(r);t(u=>({sessionDetails:{...u.sessionDetails,[r]:a},sessions:u.sessions.map(f=>f.id===r?{...f,external_thread_id:o.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:a.turns.length>0?a.turns.length-1:0})),s().addToast("info","Restored rewound session")}catch(o){t({error:o.message}),s().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,a)=>{t({error:null});try{const u=await Ax(r,o,a);t(f=>({sessions:[u,...f.sessions]})),await s().selectSession(u.id),s().addToast("success","Branched from selected turn")}catch(u){t({error:u.message}),s().addToast("error",`Failed to branch — ${u.message}`)}},updateRuntimeConfig:async r=>{const o=s().activeSessionId;if(o){t({error:null});try{const a=await jx(o,JSON.stringify(r));t(u=>({sessions:u.sessions.map(f=>f.id===o?a:f),sessionDetails:u.sessionDetails[o]?{...u.sessionDetails,[o]:{...u.sessionDetails[o],runtime_config:a.runtime_config}}:u.sessionDetails}))}catch(a){t({error:a.message}),s().addToast("error",`Failed to update config — ${a.message}`)}}},refreshActiveSession:async()=>{const r=s().activeSessionId;if(r)try{const o=await so(r);t(a=>({sessionDetails:{...a.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(a.activeTurnIndex,o.turns.length-1):0,sessions:a.sessions.map(u=>u.id===r?{...u,is_running:o.is_running,status:o.status}:u)}))}catch(o){t({error:o.message})}}}),Kx=(t,s)=>({workspaces:[],addWorkspace:async r=>{t({error:null});try{const o=await Ix(r.trim());t(a=>({workspaces:[...a.workspaces,o]})),s().addToast("success",`Workspace added — ${o.path}`)}catch(o){s().addToast("error",`Failed to add workspace — ${o.message}`)}},removeWorkspace:async r=>{t({error:null});try{await Dx(r);const o=await Qm();t({workspaces:o}),s().addToast("info","Workspace hidden")}catch(o){s().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{t({error:null});try{const o=s().lastModelConfig,a=await Zu({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});t(u=>({sessions:[a,...u.sessions]})),await s().selectSession(a.id),s().addLogEntry("INFO",`Session created in ${r} — ${a.id.slice(0,8)}`),s().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{try{const r=await Mx();if(r.cancelled||!r.path)return;await s().addWorkspace(r.path)}catch(r){s().addToast("error",`Failed to pick directory — ${r.message}`)}}}),dr=new Map,yl=new Map,Ju=new Map,ed=new Map;function Yx(t,s){dr.set(t,s)}function Xx(t){dr.delete(t)}function du(t,s){yl.set(t,s)}function hh(t,s,r){const o=yl.get(t);if(!o)return;const a=dr.get(o);a&&a({source:"agentpane-host",event:s,payload:r})}function mh(t,s){const r=yl.get(t);if(!r)return;const o=dr.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:t,tasks:s}})}function Qx(t,s,r,o){const a=dr.get(t);a&&a({source:"agentpane-host",event:"tool_call",payload:{callId:s,tool:r,name:r,args:o}})}function Zx(t,s,r,o){const a=yl.get(t);if(!a)return;const u=dr.get(a);u&&u({source:"agentpane-host",event:"turn:delta",payload:{sessionId:t,turnId:s,itemId:r,delta:o}})}function Jx(t,s){Ju.set(t,s)}function e0(t){Ju.delete(t)}function t0(t,s){ed.set(t,s)}function n0(t){ed.delete(t)}function s0(t){var r;const s=dr.get(t);s&&s({source:"agentpane-host",event:"state_changed",payload:{}}),(r=ed.get(t))==null||r()}function r0(t){var r;const s=dr.get(t);s&&s({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Ju.get(t))==null||r()}const i0=(t,s)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},setWsConnected:r=>t({wsConnected:r}),onTurnCreated:(r,o)=>{t(a=>{const u=a.sessionDetails[r];return!u||o.thread_id?{}:u.turns.some(f=>f.id===o.id)?{}:{sessionDetails:{...a.sessionDetails,[r]:{...u,turns:[...u.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{s().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),t(a=>{const u=rr(a.sessions,r,()=>({is_running:1,status:"running"})),f=a.sessionDetails[r];if(!f)return{sessions:u};const h=f.turns.findIndex(g=>g.id===o);return{sessionDetails:{...a.sessionDetails,[r]:{...Qn(f,o,g=>({...g,status:"running"})),is_running:1,status:"running"}},sessions:u,activeTurnIndex:a.activeSessionId===r&&h>=0?h:a.activeTurnIndex}})},onItemStarted:(r,o,a)=>{s().addLogEntry("DEBUG",`item:started — ${a.type}`),t(u=>{const f=gh(a)?Rr(u.retryStates,o):u.retryStates,h=u.sessionDetails[r];return h?{sessionDetails:{...u.sessionDetails,[r]:Qn(h,o,g=>pu(g,a))},retryStates:f}:{retryStates:f}})},onItemUpdated:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:Qn(f,o,h=>pu(h,a))}}:{}})},onItemCompleted:(r,o,a)=>{if(s().addLogEntry("DEBUG",`item:completed — ${a.type}`),a.type==="background_task"&&(a.status==="completed"||a.status==="failed")){const u=a.data||{},f=u.task_type||"unknown",h=u.description||"background task",m=f==="local_agent"?"Subagent":f==="local_bash"?"Monitor":"Task";a.status==="completed"?s().addToast("success",`${m} completed: ${h}`):s().addToast("error",`${m} failed: ${h}`)}t(u=>{const f=gh(a)?Rr(u.retryStates,o):u.retryStates,h=u.sessionDetails[r];return h?{retryStates:f,sessionDetails:{...u.sessionDetails,[r]:Qn(h,o,g=>{var v,k;let m=pu(g,a);if(a.type==="agent_message"&&((v=a.data)!=null&&v.text)&&(m={...m,agent_response:a.data.text}),a.type==="reasoning"&&((k=a.data)!=null&&k.text)){const x=m.thoughts?m.thoughts+`
|
|
41
|
-
`+a.data.text:a.data.text;m={...m,thoughts:x}}return m})}}:{retryStates:f}})},onItemDelta:(r,o,a,u)=>{Zx(r,o,a,u),t(f=>{const h=Rr(f.retryStates,o),g=f.sessionDetails[r];return g?{sessionDetails:{...f.sessionDetails,[r]:Qn(g,o,m=>a0(m,a,u))},retryStates:h}:{retryStates:h}})},onTurnCompleted:(r,o,a,u,f)=>{const h=(a==null?void 0:a.input_tokens)??0,g=(a==null?void 0:a.output_tokens)??0;s().addLogEntry("INFO",`turn:completed — ${h} in / ${g} out`),hh(r,"turn:completed",{turnId:o,response:f??null}),s().refreshApps(),t(m=>{const v=m.sessionDetails[r],k=v?Qn(v,o,T=>({...T,status:"completed",token_usage:a??T.token_usage??null,...f&&!T.agent_response?{agent_response:f}:{}})):null,x=fu(k),b=x&&k?Ma(k):"active",_=rr(m.sessions,r,T=>({is_running:x,status:b,has_unreviewed:u?1:T.has_unreviewed})),C=Rr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:x,status:b,has_unreviewed:u?1:k.has_unreviewed}},sessions:_,retryStates:C}:{sessions:_,retryStates:C}})},onTokenUsageUpdated:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:Qn(f,o,h=>({...h,token_usage:a}))}}:{}})},onContextUsageUpdated:(r,o)=>{t(a=>{const u=a.sessionDetails[r];return u?{sessionDetails:{...a.sessionDetails,[r]:{...u,contextUsage:o}}}:{}})},onTurnFailed:(r,o,a,u)=>{s().addLogEntry("ERROR",`turn:failed — ${a}`),s().addToast("error",`Turn failed — ${a}`),hh(r,"turn:failed",{turnId:o,error:a}),t(f=>{const h=f.sessionDetails[r],g=a.includes("cancelled")||a.includes("aborted"),m=g?"aborted":"failed",v=h?Qn(h,o,C=>({...C,status:m,error:a,...u?{resume_state:u}:{},items:C.items.map(T=>T.status==="in_progress"?{...T,status:"failed"}:T)})):null,k=fu(v),x=k&&v?Ma(v):g?"active":"failed",b=rr(f.sessions,r,()=>({is_running:k,status:x})),_=Rr(f.retryStates,o);return v?{sessionDetails:{...f.sessionDetails,[r]:{...v,is_running:k,status:x}},sessions:b,retryStates:_}:{sessions:b,retryStates:_}})},onTurnCancelled:(r,o)=>{t(a=>{const u=a.sessionDetails[r],f=u?Qn(u,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,h=fu(f),g=h&&f?Ma(f):"active",m=rr(a.sessions,r,()=>({is_running:h,status:g})),v=Rr(a.retryStates,o);return f?{sessionDetails:{...a.sessionDetails,[r]:{...f,is_running:h,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,a)=>{s().addLogEntry("WARN",`turn:interrupted — ${a.reason}${a.detail?` (${a.detail})`:""}`),s().addToast("warn",o0(a.reason)),t(u=>{const f=u.sessionDetails[r],h=f?Qn(f,o,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:a.reason,interrupted_at:a.interruptedAt,resume_attempts:a.attempts})):null,g=h?Ma(h):"interrupted",m=rr(u.sessions,r,()=>({is_running:1,status:g})),v=Rr(u.retryStates,o);return h?{sessionDetails:{...u.sessionDetails,[r]:{...h,is_running:1,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,a)=>{s().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${a})`),t(u=>{const f=rr(u.sessions,r,()=>({is_running:1,status:"running"})),h=u.sessionDetails[r];return h?{sessionDetails:{...u.sessionDetails,[r]:{...Qn(h,o,g=>({...g,status:"running",error:null,resume_state:"resuming",resume_attempts:a})),is_running:1,status:"running"}},sessions:f}:{sessions:f}})},onTurnResumed:(r,o)=>{s().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),s().addToast("success","Interrupted turn resumed"),t(a=>{const u=a.sessionDetails[r];return u?{sessionDetails:{...a.sessionDetails,[r]:Qn(u,o,f=>({...f,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,a)=>{s().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}`:""})`),t(u=>({retryStates:{...u.retryStates,[o]:a}}))},onSessionTitle:(r,o)=>{t(a=>({sessions:a.sessions.map(u=>u.id===r?{...u,title:o}:u),sessionDetails:a.sessionDetails[r]?{...a.sessionDetails,[r]:{...a.sessionDetails[r],title:o}}:a.sessionDetails}))},onSessionTouched:r=>{t(o=>{const a=o.sessionDetails[r];return{sessions:rr(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,t(a=>{const u=a.sessionDetails[r.id];return{sessions:rr(a.sessions,r.id,()=>o),sessionDetails:u?{...a.sessionDetails,[r.id]:{...u,...o}}:a.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{mh(r,o),t(a=>{if(o.length===0&&!a.backgroundTasks[r])return{};const u={...a.backgroundTasks};return o.length>0?u[r]=o:delete u[r],{backgroundTasks:u}})},onBackgroundTasksSnapshot:r=>{for(const[a,u]of Object.entries(r))mh(a,u);const o={};for(const[a,u]of Object.entries(r))u.length>0&&(o[a]=u);t({backgroundTasks:o})}});function o0(t){switch(t){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";default:return"The agent host restarted — resuming the turn"}}function Ma(t){const s=[...t.turns,...(t.threads??[]).flatMap(r=>r.turns??[])].filter(cr);return s.length>0&&s.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function gh(t){return t.type!=="background_task"&&t.type!=="error"&&t.type!=="interruption"}function Rr(t,s){if(!(s in t))return t;const r={...t};return delete r[s],r}function fu(t){return t&&(t.turns.some(cr)||(t.threads??[]).some(r=>(r.turns??[]).some(cr)))?1:0}function rr(t,s,r){return t.some(o=>o.id===s)?t.map(o=>o.id===s?{...o,...r(o)}:o):t}function Qn(t,s,r){const o=(t.threads??[]).map(a=>(a.turns??[]).some(u=>u.id===s)?{...a,turns:(a.turns??[]).map(u=>u.id===s?r(u):u)}:a);return{...t,turns:t.turns.map(a=>a.id===s?r(a):a),threads:o}}function sg(t,s){for(let r=t.length-1;r>=0;r--)if(t[r].external_item_id===s)return r;return-1}function pu(t,s){const r=sg(t.items,s.external_item_id);if(r>=0){const o=[...t.items];return o[r]=s,{...t,items:o}}if(s.type==="agent_message"){const o=t.items.filter(a=>!(a.type==="agent_message"&&a.id.startsWith("delta-")));return{...t,items:[...o,s]}}return{...t,items:[...t.items,s]}}function a0(t,s,r){var u;const o=sg(t.items,s);if(o>=0){const f=t.items[o],g=(((u=f.data)==null?void 0:u.text)??"")+r,m=[...t.items];return m[o]={...f,data:{...f.data,text:g}},{...t,items:m,agent_response:g}}const a={id:`delta-${s}`,turn_id:t.id,external_item_id:s,type:"agent_message",data:{text:r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...t,items:[...t.items,a],agent_response:r}}function l0(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return fn(`/providers/${t}/models${r}`)}const c0="https://github.com/celalertug/repoburg-mac-app-release/releases/latest/download/repoburg-mac-app.zip",u0=2e3,rg="agentpane:daemon-seen";function d0(t=dn()){if(!t)return!1;try{const s=new URL(t);return s.protocol==="http:"&&(s.hostname==="localhost"||s.hostname==="127.0.0.1")}catch{return!1}}async function f0(t=dn()){try{return await fetch(`${t}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function p0(){try{return localStorage.getItem(rg)==="true"}catch{return!1}}function h0(){try{localStorage.setItem(rg,"true")}catch{}}function m0(t){let s=!1,r=!1,o=!1,a=null;function u(){a!==null&&(clearTimeout(a),a=null)}async function f(){if(s||r)return;u(),r=!0;const m=await f0();if(r=!1,!s){if(m){h0(),g(),t.onReady();return}o||(o=!0,t.onMissing()),a=setTimeout(()=>void f(),u0)}}function h(){document.visibilityState==="visible"&&f()}function g(){s=!0,u(),window.removeEventListener("focus",h),document.removeEventListener("visibilitychange",h)}return window.addEventListener("focus",h),document.addEventListener("visibilitychange",h),f(),g}const Au=160,Iu=480,g0=240,Ya=220,v0=300,y0=600,x0=36;function Xa(){return typeof window>"u"?y0:Math.max(Ya,Math.round(window.innerWidth*.7))}const vh="agentpane:sidebar-width",yh="agentpane:right-panel-width",hu="agentpane:right-panel-collapsed";function xh(t,s,r,o){try{const a=localStorage.getItem(t);if(a==null)return o;const u=Number(a);return Number.isFinite(u)?Math.min(r,Math.max(s,u)):o}catch{return o}}function w0(t){try{return localStorage.getItem(t)==="true"}catch{return!1}}function wh(t,s){try{localStorage.setItem(t,String(s))}catch{}}const kh=200,k0=(t,s)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:xh(vh,Au,Iu,g0),rightPanelWidth:xh(yh,Ya,Xa(),v0),rightPanelCollapsed:w0(hu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,daemonStatus:d0()?"checking":"ready",setActiveTurnIndex:r=>t({activeTurnIndex:r}),switchRightTab:r=>{s().rightPanelCollapsed&&wh(hu,!1),t({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>t({showNewSessionDialog:r}),setShowRemoteModal:r=>t({showRemoteModal:r}),setShowCommandPalette:r=>t({showCommandPalette:r}),setShowModelSelector:r=>t({showModelSelector:r}),setDeepLinkThreadId:r=>t({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(Iu,Math.max(Au,Math.round(r)));t({sidebarWidth:o});try{localStorage.setItem(vh,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(Xa(),Math.max(Ya,Math.round(r)));t({rightPanelWidth:o});try{localStorage.setItem(yh,String(o))}catch{}},setRightPanelCollapsed:r=>{t({rightPanelCollapsed:r}),wh(hu,r)},toggleRightPanel:()=>s().setRightPanelCollapsed(!s().rightPanelCollapsed),toggleVscodeView:()=>{if(s().vscodeViewOpen){t({vscodeViewOpen:!1});return}t({vscodeViewOpen:!0,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,a)=>t({vscodeState:r,vscodeId:o,vscodeToken:a}),toggleUsageView:()=>t({usageViewOpen:!s().usageViewOpen}),setDaemonStatus:r=>t({daemonStatus:r}),addToast:(r,o,a,u)=>{const f=Math.random().toString(36).slice(2,9);t(h=>({toasts:[...h.toasts,{id:f,type:r,message:o,undoAction:a,undoLabel:u}]}))},removeToast:r=>{t(o=>({toasts:o.toasts.filter(a=>a.id!==r)}))},addLogEntry:(r,o)=>{const a=new Date().toLocaleTimeString("en-GB",{hour12:!1});t(u=>{const f=[...u.eventLog,{time:a,level:r,message:o}];return f.length>kh&&f.splice(0,f.length-kh),{eventLog:f}})},loadModels:async(r,o)=>{if(!s().modelsLoading){t({modelsLoading:!0,models:[]});try{const a=await l0(r,o);t({models:a,modelsLoading:!1})}catch{t({modelsLoading:!1})}}}}),S0=(t,s)=>({createThread:async(r,o)=>{try{await pt(`/sessions/${r}/threads`,o),s().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(a){s().addToast("error",`Failed to create thread — ${a.message}`)}},followupThread:async(r,o,a)=>{try{await pt(`/sessions/${r}/threads/${o}/followup`,{message:a}),s().addLogEntry("INFO",`Thread follow-up — "${a.slice(0,40)}"`)}catch(u){s().addToast("error",`Failed to send follow-up — ${u.message}`)}},cancelThreadTurn:async(r,o)=>{try{await pt(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),s().addLogEntry("INFO","Thread turn cancelled")}catch(a){s().addToast("error",`Failed to cancel thread turn — ${a.message}`)}},resolveThread:async(r,o)=>{try{await bs(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(a){s().addToast("error",`Failed to resolve thread — ${a.message}`)}},reopenThread:async(r,o)=>{try{await bs(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(a){s().addToast("error",`Failed to reopen thread — ${a.message}`)}},shareThread:async(r,o,a)=>{try{const u=await pt(`/sessions/${r}/threads/${o}/summarize`,{directives:a}),f=`
|
|
40
|
+
`+p.stack}return{value:e,source:n,stack:d,digest:null}}function Ac(e,n,i){return{value:e,source:null,stack:i??null,digest:n??null}}function Ic(e,n){try{console.error(n.value)}catch(i){setTimeout(function(){throw i})}}var jy=typeof WeakMap=="function"?WeakMap:Map;function np(e,n,i){i=As(-1,i),i.tag=3,i.payload={element:null};var c=n.value;return i.callback=function(){xa||(xa=!0,Gc=c),Ic(e,n)},i}function sp(e,n,i){i=As(-1,i),i.tag=3;var c=e.type.getDerivedStateFromError;if(typeof c=="function"){var d=n.value;i.payload=function(){return c(d)},i.callback=function(){Ic(e,n)}}var p=e.stateNode;return p!==null&&typeof p.componentDidCatch=="function"&&(i.callback=function(){Ic(e,n),typeof c!="function"&&(Js===null?Js=new Set([this]):Js.add(this));var y=n.stack;this.componentDidCatch(n.value,{componentStack:y!==null?y:""})}),i}function rp(e,n,i){var c=e.pingCache;if(c===null){c=e.pingCache=new jy;var d=new Set;c.set(n,d)}else d=c.get(n),d===void 0&&(d=new Set,c.set(n,d));d.has(i)||(d.add(i),e=Uy.bind(null,e,n,i),n.then(e,e))}function ip(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function op(e,n,i,c,d){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(n=As(-1,1),n.tag=2,Qs(i,n,1))),i.lanes|=1),e):(e.flags|=65536,e.lanes=d,e)}var _y=O.ReactCurrentOwner,Tn=!1;function gn(e,n,i,c){n.child=e===null?Cf(n,null,i,c):ei(n,e.child,i,c)}function ap(e,n,i,c,d){i=i.render;var p=n.ref;return ni(n,d),c=bc(e,n,i,c,p,d),i=Tc(),e!==null&&!Tn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~d,Is(e,n,d)):(wt&&i&&oc(n),n.flags|=1,gn(e,n,c,d),n.child)}function lp(e,n,i,c,d){if(e===null){var p=i.type;return typeof p=="function"&&!eu(p)&&p.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(n.tag=15,n.type=p,cp(e,n,p,c,d)):(e=Na(i.type,null,c,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(p=e.child,(e.lanes&d)===0){var y=p.memoizedProps;if(i=i.compare,i=i!==null?i:Li,i(y,c)&&e.ref===n.ref)return Is(e,n,d)}return n.flags|=1,e=sr(p,c),e.ref=n.ref,e.return=n,n.child=e}function cp(e,n,i,c,d){if(e!==null){var p=e.memoizedProps;if(Li(p,c)&&e.ref===n.ref)if(Tn=!1,n.pendingProps=c=p,(e.lanes&d)!==0)(e.flags&131072)!==0&&(Tn=!0);else return n.lanes=e.lanes,Is(e,n,d)}return Dc(e,n,i,c,d)}function up(e,n,i){var c=n.pendingProps,d=c.children,p=e!==null?e.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},ct(oi,Fn),Fn|=i;else{if((i&1073741824)===0)return e=p!==null?p.baseLanes|i:i,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,ct(oi,Fn),Fn|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=p!==null?p.baseLanes:i,ct(oi,Fn),Fn|=c}else p!==null?(c=p.baseLanes|i,n.memoizedState=null):c=i,ct(oi,Fn),Fn|=c;return gn(e,n,d,i),n.child}function dp(e,n){var i=n.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(n.flags|=512,n.flags|=2097152)}function Dc(e,n,i,c,d){var p=bn(i)?xr:on.current;return p=Xr(n,p),ni(n,d),i=bc(e,n,i,c,p,d),c=Tc(),e!==null&&!Tn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~d,Is(e,n,d)):(wt&&c&&oc(n),n.flags|=1,gn(e,n,i,d),n.child)}function fp(e,n,i,c,d){if(bn(i)){var p=!0;Xo(n)}else p=!1;if(ni(n,d),n.stateNode===null)ha(e,n),ep(n,i,c),Rc(n,i,c,d),c=!0;else if(e===null){var y=n.stateNode,N=n.memoizedProps;y.props=N;var R=y.context,B=i.contextType;typeof B=="object"&&B!==null?B=Gn(B):(B=bn(i)?xr:on.current,B=Xr(n,B));var ne=i.getDerivedStateFromProps,re=typeof ne=="function"||typeof y.getSnapshotBeforeUpdate=="function";re||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N!==c||R!==B)&&tp(n,y,c,B),Xs=!1;var te=n.memoizedState;y.state=te,ia(n,c,y,d),R=n.memoizedState,N!==c||te!==R||Sn.current||Xs?(typeof ne=="function"&&(Ec(n,i,ne,c),R=n.memoizedState),(N=Xs||Jf(n,i,N,c,te,R,B))?(re||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(n.flags|=4194308)):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=R),y.props=c,y.state=R,y.context=B,c=N):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{y=n.stateNode,_f(e,n),N=n.memoizedProps,B=n.type===n.elementType?N:os(n.type,N),y.props=B,re=n.pendingProps,te=y.context,R=i.contextType,typeof R=="object"&&R!==null?R=Gn(R):(R=bn(i)?xr:on.current,R=Xr(n,R));var me=i.getDerivedStateFromProps;(ne=typeof me=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N!==re||te!==R)&&tp(n,y,c,R),Xs=!1,te=n.memoizedState,y.state=te,ia(n,c,y,d);var xe=n.memoizedState;N!==re||te!==xe||Sn.current||Xs?(typeof me=="function"&&(Ec(n,i,me,c),xe=n.memoizedState),(B=Xs||Jf(n,i,B,c,te,xe,R)||!1)?(ne||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,xe,R),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,xe,R)),typeof y.componentDidUpdate=="function"&&(n.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof y.componentDidUpdate!="function"||N===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=xe),y.props=c,y.state=xe,y.context=R,c=B):(typeof y.componentDidUpdate!="function"||N===e.memoizedProps&&te===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&te===e.memoizedState||(n.flags|=1024),c=!1)}return Mc(e,n,i,c,p,d)}function Mc(e,n,i,c,d,p){dp(e,n);var y=(n.flags&128)!==0;if(!c&&!y)return d&&vf(n,i,!1),Is(e,n,p);c=n.stateNode,_y.current=n;var N=y&&typeof i.getDerivedStateFromError!="function"?null:c.render();return n.flags|=1,e!==null&&y?(n.child=ei(n,e.child,null,p),n.child=ei(n,null,N,p)):gn(e,n,N,p),n.memoizedState=c.state,d&&vf(n,i,!0),n.child}function pp(e){var n=e.stateNode;n.pendingContext?mf(e,n.pendingContext,n.pendingContext!==n.context):n.context&&mf(e,n.context,!1),vc(e,n.containerInfo)}function hp(e,n,i,c,d){return Jr(),uc(d),n.flags|=256,gn(e,n,i,c),n.child}var Lc={dehydrated:null,treeContext:null,retryLane:0};function Pc(e){return{baseLanes:e,cachePool:null,transitions:null}}function mp(e,n,i){var c=n.pendingProps,d=_t.current,p=!1,y=(n.flags&128)!==0,N;if((N=y)||(N=e!==null&&e.memoizedState===null?!1:(d&2)!==0),N?(p=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(d|=1),ct(_t,d&1),e===null)return cc(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((n.mode&1)===0?n.lanes=1:e.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(y=c.children,e=c.fallback,p?(c=n.mode,p=n.child,y={mode:"hidden",children:y},(c&1)===0&&p!==null?(p.childLanes=0,p.pendingProps=y):p=Ca(y,c,0,null),e=Er(e,c,i,null),p.return=n,e.return=n,p.sibling=e,n.child=p,n.child.memoizedState=Pc(i),n.memoizedState=Lc,e):Oc(n,y));if(d=e.memoizedState,d!==null&&(N=d.dehydrated,N!==null))return Ey(e,n,y,c,N,d,i);if(p){p=c.fallback,y=n.mode,d=e.child,N=d.sibling;var R={mode:"hidden",children:c.children};return(y&1)===0&&n.child!==d?(c=n.child,c.childLanes=0,c.pendingProps=R,n.deletions=null):(c=sr(d,R),c.subtreeFlags=d.subtreeFlags&14680064),N!==null?p=sr(N,p):(p=Er(p,y,i,null),p.flags|=2),p.return=n,c.return=n,c.sibling=p,n.child=c,c=p,p=n.child,y=e.child.memoizedState,y=y===null?Pc(i):{baseLanes:y.baseLanes|i,cachePool:null,transitions:y.transitions},p.memoizedState=y,p.childLanes=e.childLanes&~i,n.memoizedState=Lc,c}return p=e.child,e=p.sibling,c=sr(p,{mode:"visible",children:c.children}),(n.mode&1)===0&&(c.lanes=i),c.return=n,c.sibling=null,e!==null&&(i=n.deletions,i===null?(n.deletions=[e],n.flags|=16):i.push(e)),n.child=c,n.memoizedState=null,c}function Oc(e,n){return n=Ca({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function pa(e,n,i,c){return c!==null&&uc(c),ei(n,e.child,null,i),e=Oc(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Ey(e,n,i,c,d,p,y){if(i)return n.flags&256?(n.flags&=-257,c=Ac(Error(r(422))),pa(e,n,y,c)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(p=c.fallback,d=n.mode,c=Ca({mode:"visible",children:c.children},d,0,null),p=Er(p,d,y,null),p.flags|=2,c.return=n,p.return=n,c.sibling=p,n.child=c,(n.mode&1)!==0&&ei(n,e.child,null,y),n.child.memoizedState=Pc(y),n.memoizedState=Lc,p);if((n.mode&1)===0)return pa(e,n,y,null);if(d.data==="$!"){if(c=d.nextSibling&&d.nextSibling.dataset,c)var N=c.dgst;return c=N,p=Error(r(419)),c=Ac(p,c,void 0),pa(e,n,y,c)}if(N=(y&e.childLanes)!==0,Tn||N){if(c=Yt,c!==null){switch(y&-y){case 4:d=2;break;case 16:d=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:d=32;break;case 536870912:d=268435456;break;default:d=0}d=(d&(c.suspendedLanes|y))!==0?0:d,d!==0&&d!==p.retryLane&&(p.retryLane=d,Rs(e,d),cs(c,e,d,-1))}return Jc(),c=Ac(Error(r(421))),pa(e,n,y,c)}return d.data==="$?"?(n.flags|=128,n.child=e.child,n=By.bind(null,e),d._reactRetry=n,null):(e=p.treeContext,zn=qs(d.nextSibling),$n=n,wt=!0,is=null,e!==null&&(Vn[qn++]=_s,Vn[qn++]=Es,Vn[qn++]=wr,_s=e.id,Es=e.overflow,wr=n),n=Oc(n,c.children),n.flags|=4096,n)}function gp(e,n,i){e.lanes|=n;var c=e.alternate;c!==null&&(c.lanes|=n),hc(e.return,n,i)}function $c(e,n,i,c,d){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:d}:(p.isBackwards=n,p.rendering=null,p.renderingStartTime=0,p.last=c,p.tail=i,p.tailMode=d)}function vp(e,n,i){var c=n.pendingProps,d=c.revealOrder,p=c.tail;if(gn(e,n,c.children,i),c=_t.current,(c&2)!==0)c=c&1|2,n.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&gp(e,i,n);else if(e.tag===19)gp(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}c&=1}if(ct(_t,c),(n.mode&1)===0)n.memoizedState=null;else switch(d){case"forwards":for(i=n.child,d=null;i!==null;)e=i.alternate,e!==null&&oa(e)===null&&(d=i),i=i.sibling;i=d,i===null?(d=n.child,n.child=null):(d=i.sibling,i.sibling=null),$c(n,!1,d,i,p);break;case"backwards":for(i=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&oa(e)===null){n.child=d;break}e=d.sibling,d.sibling=i,i=d,d=e}$c(n,!0,i,null,p);break;case"together":$c(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function ha(e,n){(n.mode&1)===0&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Is(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Nr|=n.lanes,(i&n.childLanes)===0)return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=sr(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=sr(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function Ry(e,n,i){switch(n.tag){case 3:pp(n),Jr();break;case 5:Af(n);break;case 1:bn(n.type)&&Xo(n);break;case 4:vc(n,n.stateNode.containerInfo);break;case 10:var c=n.type._context,d=n.memoizedProps.value;ct(na,c._currentValue),c._currentValue=d;break;case 13:if(c=n.memoizedState,c!==null)return c.dehydrated!==null?(ct(_t,_t.current&1),n.flags|=128,null):(i&n.child.childLanes)!==0?mp(e,n,i):(ct(_t,_t.current&1),e=Is(e,n,i),e!==null?e.sibling:null);ct(_t,_t.current&1);break;case 19:if(c=(i&n.childLanes)!==0,(e.flags&128)!==0){if(c)return vp(e,n,i);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ct(_t,_t.current),c)break;return null;case 22:case 23:return n.lanes=0,up(e,n,i)}return Is(e,n,i)}var yp,zc,xp,wp;yp=function(e,n){for(var i=n.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},zc=function(){},xp=function(e,n,i,c){var d=e.memoizedProps;if(d!==c){e=n.stateNode,br(xs.current);var p=null;switch(i){case"input":d=ze(e,d),c=ze(e,c),p=[];break;case"select":d=q({},d,{value:void 0}),c=q({},c,{value:void 0}),p=[];break;case"textarea":d=en(e,d),c=en(e,c),p=[];break;default:typeof d.onClick!="function"&&typeof c.onClick=="function"&&(e.onclick=Go)}In(i,c);var y;i=null;for(B in d)if(!c.hasOwnProperty(B)&&d.hasOwnProperty(B)&&d[B]!=null)if(B==="style"){var N=d[B];for(y in N)N.hasOwnProperty(y)&&(i||(i={}),i[y]="")}else B!=="dangerouslySetInnerHTML"&&B!=="children"&&B!=="suppressContentEditableWarning"&&B!=="suppressHydrationWarning"&&B!=="autoFocus"&&(a.hasOwnProperty(B)?p||(p=[]):(p=p||[]).push(B,null));for(B in c){var R=c[B];if(N=d!=null?d[B]:void 0,c.hasOwnProperty(B)&&R!==N&&(R!=null||N!=null))if(B==="style")if(N){for(y in N)!N.hasOwnProperty(y)||R&&R.hasOwnProperty(y)||(i||(i={}),i[y]="");for(y in R)R.hasOwnProperty(y)&&N[y]!==R[y]&&(i||(i={}),i[y]=R[y])}else i||(p||(p=[]),p.push(B,i)),i=R;else B==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,N=N?N.__html:void 0,R!=null&&N!==R&&(p=p||[]).push(B,R)):B==="children"?typeof R!="string"&&typeof R!="number"||(p=p||[]).push(B,""+R):B!=="suppressContentEditableWarning"&&B!=="suppressHydrationWarning"&&(a.hasOwnProperty(B)?(R!=null&&B==="onScroll"&&dt("scroll",e),p||N===R||(p=[])):(p=p||[]).push(B,R))}i&&(p=p||[]).push("style",i);var B=p;(n.updateQueue=B)&&(n.flags|=4)}},wp=function(e,n,i,c){i!==c&&(n.flags|=4)};function Xi(e,n){if(!wt)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:c.sibling=null}}function ln(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,c=0;if(n)for(var d=e.child;d!==null;)i|=d.lanes|d.childLanes,c|=d.subtreeFlags&14680064,c|=d.flags&14680064,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)i|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=c,e.childLanes=i,n}function Ay(e,n,i){var c=n.pendingProps;switch(ac(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ln(n),null;case 1:return bn(n.type)&&Yo(),ln(n),null;case 3:return c=n.stateNode,si(),ft(Sn),ft(on),wc(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(e===null||e.child===null)&&(ea(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,is!==null&&(Xc(is),is=null))),zc(e,n),ln(n),null;case 5:yc(n);var d=br(Vi.current);if(i=n.type,e!==null&&n.stateNode!=null)xp(e,n,i,c,d),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!c){if(n.stateNode===null)throw Error(r(166));return ln(n),null}if(e=br(xs.current),ea(n)){c=n.stateNode,i=n.type;var p=n.memoizedProps;switch(c[ys]=n,c[Fi]=p,e=(n.mode&1)!==0,i){case"dialog":dt("cancel",c),dt("close",c);break;case"iframe":case"object":case"embed":dt("load",c);break;case"video":case"audio":for(d=0;d<Oi.length;d++)dt(Oi[d],c);break;case"source":dt("error",c);break;case"img":case"image":case"link":dt("error",c),dt("load",c);break;case"details":dt("toggle",c);break;case"input":It(c,p),dt("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!p.multiple},dt("invalid",c);break;case"textarea":V(c,p),dt("invalid",c)}In(i,p),d=null;for(var y in p)if(p.hasOwnProperty(y)){var N=p[y];y==="children"?typeof N=="string"?c.textContent!==N&&(p.suppressHydrationWarning!==!0&&qo(c.textContent,N,e),d=["children",N]):typeof N=="number"&&c.textContent!==""+N&&(p.suppressHydrationWarning!==!0&&qo(c.textContent,N,e),d=["children",""+N]):a.hasOwnProperty(y)&&N!=null&&y==="onScroll"&&dt("scroll",c)}switch(i){case"input":it(c),Rn(c,p,!0);break;case"textarea":it(c),Ue(c);break;case"select":case"option":break;default:typeof p.onClick=="function"&&(c.onclick=Go)}c=d,n.updateQueue=c,c!==null&&(n.flags|=4)}else{y=d.nodeType===9?d:d.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=tt(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=y.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof c.is=="string"?e=y.createElement(i,{is:c.is}):(e=y.createElement(i),i==="select"&&(y=e,c.multiple?y.multiple=!0:c.size&&(y.size=c.size))):e=y.createElementNS(e,i),e[ys]=n,e[Fi]=c,yp(e,n,!1,!1),n.stateNode=e;e:{switch(y=Dn(i,c),i){case"dialog":dt("cancel",e),dt("close",e),d=c;break;case"iframe":case"object":case"embed":dt("load",e),d=c;break;case"video":case"audio":for(d=0;d<Oi.length;d++)dt(Oi[d],e);d=c;break;case"source":dt("error",e),d=c;break;case"img":case"image":case"link":dt("error",e),dt("load",e),d=c;break;case"details":dt("toggle",e),d=c;break;case"input":It(e,c),d=ze(e,c),dt("invalid",e);break;case"option":d=c;break;case"select":e._wrapperState={wasMultiple:!!c.multiple},d=q({},c,{value:void 0}),dt("invalid",e);break;case"textarea":V(e,c),d=en(e,c),dt("invalid",e);break;default:d=c}In(i,d),N=d;for(p in N)if(N.hasOwnProperty(p)){var R=N[p];p==="style"?Ts(e,R):p==="dangerouslySetInnerHTML"?(R=R?R.__html:void 0,R!=null&&Rt(e,R)):p==="children"?typeof R=="string"?(i!=="textarea"||R!=="")&&Ht(e,R):typeof R=="number"&&Ht(e,""+R):p!=="suppressContentEditableWarning"&&p!=="suppressHydrationWarning"&&p!=="autoFocus"&&(a.hasOwnProperty(p)?R!=null&&p==="onScroll"&&dt("scroll",e):R!=null&&U(e,p,R,y))}switch(i){case"input":it(e),Rn(e,c,!1);break;case"textarea":it(e),Ue(e);break;case"option":c.value!=null&&e.setAttribute("value",""+Ce(c.value));break;case"select":e.multiple=!!c.multiple,p=c.value,p!=null?ht(e,!!c.multiple,p,!1):c.defaultValue!=null&&ht(e,!!c.multiple,c.defaultValue,!0);break;default:typeof d.onClick=="function"&&(e.onclick=Go)}switch(i){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return ln(n),null;case 6:if(e&&n.stateNode!=null)wp(e,n,e.memoizedProps,c);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(i=br(Vi.current),br(xs.current),ea(n)){if(c=n.stateNode,i=n.memoizedProps,c[ys]=n,(p=c.nodeValue!==i)&&(e=$n,e!==null))switch(e.tag){case 3:qo(c.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&qo(c.nodeValue,i,(e.mode&1)!==0)}p&&(n.flags|=4)}else c=(i.nodeType===9?i:i.ownerDocument).createTextNode(c),c[ys]=n,n.stateNode=c}return ln(n),null;case 13:if(ft(_t),c=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wt&&zn!==null&&(n.mode&1)!==0&&(n.flags&128)===0)bf(),Jr(),n.flags|=98560,p=!1;else if(p=ea(n),c!==null&&c.dehydrated!==null){if(e===null){if(!p)throw Error(r(318));if(p=n.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(r(317));p[ys]=n}else Jr(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;ln(n),p=!1}else is!==null&&(Xc(is),is=null),p=!0;if(!p)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=i,n):(c=c!==null,c!==(e!==null&&e.memoizedState!==null)&&c&&(n.child.flags|=8192,(n.mode&1)!==0&&(e===null||(_t.current&1)!==0?Bt===0&&(Bt=3):Jc())),n.updateQueue!==null&&(n.flags|=4),ln(n),null);case 4:return si(),zc(e,n),e===null&&$i(n.stateNode.containerInfo),ln(n),null;case 10:return pc(n.type._context),ln(n),null;case 17:return bn(n.type)&&Yo(),ln(n),null;case 19:if(ft(_t),p=n.memoizedState,p===null)return ln(n),null;if(c=(n.flags&128)!==0,y=p.rendering,y===null)if(c)Xi(p,!1);else{if(Bt!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(y=oa(e),y!==null){for(n.flags|=128,Xi(p,!1),c=y.updateQueue,c!==null&&(n.updateQueue=c,n.flags|=4),n.subtreeFlags=0,c=i,i=n.child;i!==null;)p=i,e=c,p.flags&=14680066,y=p.alternate,y===null?(p.childLanes=0,p.lanes=e,p.child=null,p.subtreeFlags=0,p.memoizedProps=null,p.memoizedState=null,p.updateQueue=null,p.dependencies=null,p.stateNode=null):(p.childLanes=y.childLanes,p.lanes=y.lanes,p.child=y.child,p.subtreeFlags=0,p.deletions=null,p.memoizedProps=y.memoizedProps,p.memoizedState=y.memoizedState,p.updateQueue=y.updateQueue,p.type=y.type,e=y.dependencies,p.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return ct(_t,_t.current&1|2),n.child}e=e.sibling}p.tail!==null&&Nt()>ai&&(n.flags|=128,c=!0,Xi(p,!1),n.lanes=4194304)}else{if(!c)if(e=oa(y),e!==null){if(n.flags|=128,c=!0,i=e.updateQueue,i!==null&&(n.updateQueue=i,n.flags|=4),Xi(p,!0),p.tail===null&&p.tailMode==="hidden"&&!y.alternate&&!wt)return ln(n),null}else 2*Nt()-p.renderingStartTime>ai&&i!==1073741824&&(n.flags|=128,c=!0,Xi(p,!1),n.lanes=4194304);p.isBackwards?(y.sibling=n.child,n.child=y):(i=p.last,i!==null?i.sibling=y:n.child=y,p.last=y)}return p.tail!==null?(n=p.tail,p.rendering=n,p.tail=n.sibling,p.renderingStartTime=Nt(),n.sibling=null,i=_t.current,ct(_t,c?i&1|2:i&1),n):(ln(n),null);case 22:case 23:return Zc(),c=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==c&&(n.flags|=8192),c&&(n.mode&1)!==0?(Fn&1073741824)!==0&&(ln(n),n.subtreeFlags&6&&(n.flags|=8192)):ln(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Iy(e,n){switch(ac(n),n.tag){case 1:return bn(n.type)&&Yo(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return si(),ft(Sn),ft(on),wc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return yc(n),null;case 13:if(ft(_t),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));Jr()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ft(_t),null;case 4:return si(),null;case 10:return pc(n.type._context),null;case 22:case 23:return Zc(),null;case 24:return null;default:return null}}var ma=!1,cn=!1,Dy=typeof WeakSet=="function"?WeakSet:Set,ye=null;function ii(e,n){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(c){At(e,n,c)}else i.current=null}function Fc(e,n,i){try{i()}catch(c){At(e,n,c)}}var kp=!1;function My(e,n){if(Zl=Lo,e=Zd(),Hl(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var d=c.anchorOffset,p=c.focusNode;c=c.focusOffset;try{i.nodeType,p.nodeType}catch{i=null;break e}var y=0,N=-1,R=-1,B=0,ne=0,re=e,te=null;t:for(;;){for(var me;re!==i||d!==0&&re.nodeType!==3||(N=y+d),re!==p||c!==0&&re.nodeType!==3||(R=y+c),re.nodeType===3&&(y+=re.nodeValue.length),(me=re.firstChild)!==null;)te=re,re=me;for(;;){if(re===e)break t;if(te===i&&++B===d&&(N=y),te===p&&++ne===c&&(R=y),(me=re.nextSibling)!==null)break;re=te,te=re.parentNode}re=me}i=N===-1||R===-1?null:{start:N,end:R}}else i=null}i=i||{start:0,end:0}}else i=null;for(Jl={focusedElem:e,selectionRange:i},Lo=!1,ye=n;ye!==null;)if(n=ye,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ye=e;else for(;ye!==null;){n=ye;try{var xe=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var ke=xe.memoizedProps,Pt=xe.memoizedState,z=n.stateNode,D=z.getSnapshotBeforeUpdate(n.elementType===n.type?ke:os(n.type,ke),Pt);z.__reactInternalSnapshotBeforeUpdate=D}break;case 3:var F=n.stateNode.containerInfo;F.nodeType===1?F.textContent="":F.nodeType===9&&F.documentElement&&F.removeChild(F.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(le){At(n,n.return,le)}if(e=n.sibling,e!==null){e.return=n.return,ye=e;break}ye=n.return}return xe=kp,kp=!1,xe}function Qi(e,n,i){var c=n.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var d=c=c.next;do{if((d.tag&e)===e){var p=d.destroy;d.destroy=void 0,p!==void 0&&Fc(n,i,p)}d=d.next}while(d!==c)}}function ga(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var c=i.create;i.destroy=c()}i=i.next}while(i!==n)}}function Uc(e){var n=e.ref;if(n!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof n=="function"?n(e):n.current=e}}function Sp(e){var n=e.alternate;n!==null&&(e.alternate=null,Sp(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[ys],delete n[Fi],delete n[sc],delete n[gy],delete n[vy])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function bp(e){return e.tag===5||e.tag===3||e.tag===4}function Tp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||bp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Bc(e,n,i){var c=e.tag;if(c===5||c===6)e=e.stateNode,n?i.nodeType===8?i.parentNode.insertBefore(e,n):i.insertBefore(e,n):(i.nodeType===8?(n=i.parentNode,n.insertBefore(e,i)):(n=i,n.appendChild(e)),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Go));else if(c!==4&&(e=e.child,e!==null))for(Bc(e,n,i),e=e.sibling;e!==null;)Bc(e,n,i),e=e.sibling}function Wc(e,n,i){var c=e.tag;if(c===5||c===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(c!==4&&(e=e.child,e!==null))for(Wc(e,n,i),e=e.sibling;e!==null;)Wc(e,n,i),e=e.sibling}var tn=null,as=!1;function Zs(e,n,i){for(i=i.child;i!==null;)Np(e,n,i),i=i.sibling}function Np(e,n,i){if(Pn&&typeof Pn.onCommitFiberUnmount=="function")try{Pn.onCommitFiberUnmount(pr,i)}catch{}switch(i.tag){case 5:cn||ii(i,n);case 6:var c=tn,d=as;tn=null,Zs(e,n,i),tn=c,as=d,tn!==null&&(as?(e=tn,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):tn.removeChild(i.stateNode));break;case 18:tn!==null&&(as?(e=tn,i=i.stateNode,e.nodeType===8?nc(e.parentNode,i):e.nodeType===1&&nc(e,i),Ei(e)):nc(tn,i.stateNode));break;case 4:c=tn,d=as,tn=i.stateNode.containerInfo,as=!0,Zs(e,n,i),tn=c,as=d;break;case 0:case 11:case 14:case 15:if(!cn&&(c=i.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){d=c=c.next;do{var p=d,y=p.destroy;p=p.tag,y!==void 0&&((p&2)!==0||(p&4)!==0)&&Fc(i,n,y),d=d.next}while(d!==c)}Zs(e,n,i);break;case 1:if(!cn&&(ii(i,n),c=i.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=i.memoizedProps,c.state=i.memoizedState,c.componentWillUnmount()}catch(N){At(i,n,N)}Zs(e,n,i);break;case 21:Zs(e,n,i);break;case 22:i.mode&1?(cn=(c=cn)||i.memoizedState!==null,Zs(e,n,i),cn=c):Zs(e,n,i);break;default:Zs(e,n,i)}}function Cp(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new Dy),n.forEach(function(c){var d=Wy.bind(null,e,c);i.has(c)||(i.add(c),c.then(d,d))})}}function ls(e,n){var i=n.deletions;if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];try{var p=e,y=n,N=y;e:for(;N!==null;){switch(N.tag){case 5:tn=N.stateNode,as=!1;break e;case 3:tn=N.stateNode.containerInfo,as=!0;break e;case 4:tn=N.stateNode.containerInfo,as=!0;break e}N=N.return}if(tn===null)throw Error(r(160));Np(p,y,d),tn=null,as=!1;var R=d.alternate;R!==null&&(R.return=null),d.return=null}catch(B){At(d,n,B)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)jp(n,e),n=n.sibling}function jp(e,n){var i=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(ls(n,e),ks(e),c&4){try{Qi(3,e,e.return),ga(3,e)}catch(ke){At(e,e.return,ke)}try{Qi(5,e,e.return)}catch(ke){At(e,e.return,ke)}}break;case 1:ls(n,e),ks(e),c&512&&i!==null&&ii(i,i.return);break;case 5:if(ls(n,e),ks(e),c&512&&i!==null&&ii(i,i.return),e.flags&32){var d=e.stateNode;try{Ht(d,"")}catch(ke){At(e,e.return,ke)}}if(c&4&&(d=e.stateNode,d!=null)){var p=e.memoizedProps,y=i!==null?i.memoizedProps:p,N=e.type,R=e.updateQueue;if(e.updateQueue=null,R!==null)try{N==="input"&&p.type==="radio"&&p.name!=null&&Fe(d,p),Dn(N,y);var B=Dn(N,p);for(y=0;y<R.length;y+=2){var ne=R[y],re=R[y+1];ne==="style"?Ts(d,re):ne==="dangerouslySetInnerHTML"?Rt(d,re):ne==="children"?Ht(d,re):U(d,ne,re,B)}switch(N){case"input":Dt(d,p);break;case"textarea":pe(d,p);break;case"select":var te=d._wrapperState.wasMultiple;d._wrapperState.wasMultiple=!!p.multiple;var me=p.value;me!=null?ht(d,!!p.multiple,me,!1):te!==!!p.multiple&&(p.defaultValue!=null?ht(d,!!p.multiple,p.defaultValue,!0):ht(d,!!p.multiple,p.multiple?[]:"",!1))}d[Fi]=p}catch(ke){At(e,e.return,ke)}}break;case 6:if(ls(n,e),ks(e),c&4){if(e.stateNode===null)throw Error(r(162));d=e.stateNode,p=e.memoizedProps;try{d.nodeValue=p}catch(ke){At(e,e.return,ke)}}break;case 3:if(ls(n,e),ks(e),c&4&&i!==null&&i.memoizedState.isDehydrated)try{Ei(n.containerInfo)}catch(ke){At(e,e.return,ke)}break;case 4:ls(n,e),ks(e);break;case 13:ls(n,e),ks(e),d=e.child,d.flags&8192&&(p=d.memoizedState!==null,d.stateNode.isHidden=p,!p||d.alternate!==null&&d.alternate.memoizedState!==null||(qc=Nt())),c&4&&Cp(e);break;case 22:if(ne=i!==null&&i.memoizedState!==null,e.mode&1?(cn=(B=cn)||ne,ls(n,e),cn=B):ls(n,e),ks(e),c&8192){if(B=e.memoizedState!==null,(e.stateNode.isHidden=B)&&!ne&&(e.mode&1)!==0)for(ye=e,ne=e.child;ne!==null;){for(re=ye=ne;ye!==null;){switch(te=ye,me=te.child,te.tag){case 0:case 11:case 14:case 15:Qi(4,te,te.return);break;case 1:ii(te,te.return);var xe=te.stateNode;if(typeof xe.componentWillUnmount=="function"){c=te,i=te.return;try{n=c,xe.props=n.memoizedProps,xe.state=n.memoizedState,xe.componentWillUnmount()}catch(ke){At(c,i,ke)}}break;case 5:ii(te,te.return);break;case 22:if(te.memoizedState!==null){Rp(re);continue}}me!==null?(me.return=te,ye=me):Rp(re)}ne=ne.sibling}e:for(ne=null,re=e;;){if(re.tag===5){if(ne===null){ne=re;try{d=re.stateNode,B?(p=d.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none"):(N=re.stateNode,R=re.memoizedProps.style,y=R!=null&&R.hasOwnProperty("display")?R.display:null,N.style.display=Hn("display",y))}catch(ke){At(e,e.return,ke)}}}else if(re.tag===6){if(ne===null)try{re.stateNode.nodeValue=B?"":re.memoizedProps}catch(ke){At(e,e.return,ke)}}else if((re.tag!==22&&re.tag!==23||re.memoizedState===null||re===e)&&re.child!==null){re.child.return=re,re=re.child;continue}if(re===e)break e;for(;re.sibling===null;){if(re.return===null||re.return===e)break e;ne===re&&(ne=null),re=re.return}ne===re&&(ne=null),re.sibling.return=re.return,re=re.sibling}}break;case 19:ls(n,e),ks(e),c&4&&Cp(e);break;case 21:break;default:ls(n,e),ks(e)}}function ks(e){var n=e.flags;if(n&2){try{e:{for(var i=e.return;i!==null;){if(bp(i)){var c=i;break e}i=i.return}throw Error(r(160))}switch(c.tag){case 5:var d=c.stateNode;c.flags&32&&(Ht(d,""),c.flags&=-33);var p=Tp(e);Wc(e,p,d);break;case 3:case 4:var y=c.stateNode.containerInfo,N=Tp(e);Bc(e,N,y);break;default:throw Error(r(161))}}catch(R){At(e,e.return,R)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Ly(e,n,i){ye=e,_p(e)}function _p(e,n,i){for(var c=(e.mode&1)!==0;ye!==null;){var d=ye,p=d.child;if(d.tag===22&&c){var y=d.memoizedState!==null||ma;if(!y){var N=d.alternate,R=N!==null&&N.memoizedState!==null||cn;N=ma;var B=cn;if(ma=y,(cn=R)&&!B)for(ye=d;ye!==null;)y=ye,R=y.child,y.tag===22&&y.memoizedState!==null?Ap(d):R!==null?(R.return=y,ye=R):Ap(d);for(;p!==null;)ye=p,_p(p),p=p.sibling;ye=d,ma=N,cn=B}Ep(e)}else(d.subtreeFlags&8772)!==0&&p!==null?(p.return=d,ye=p):Ep(e)}}function Ep(e){for(;ye!==null;){var n=ye;if((n.flags&8772)!==0){var i=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:cn||ga(5,n);break;case 1:var c=n.stateNode;if(n.flags&4&&!cn)if(i===null)c.componentDidMount();else{var d=n.elementType===n.type?i.memoizedProps:os(n.type,i.memoizedProps);c.componentDidUpdate(d,i.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var p=n.updateQueue;p!==null&&Rf(n,p,c);break;case 3:var y=n.updateQueue;if(y!==null){if(i=null,n.child!==null)switch(n.child.tag){case 5:i=n.child.stateNode;break;case 1:i=n.child.stateNode}Rf(n,y,i)}break;case 5:var N=n.stateNode;if(i===null&&n.flags&4){i=N;var R=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":R.autoFocus&&i.focus();break;case"img":R.src&&(i.src=R.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var B=n.alternate;if(B!==null){var ne=B.memoizedState;if(ne!==null){var re=ne.dehydrated;re!==null&&Ei(re)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}cn||n.flags&512&&Uc(n)}catch(te){At(n,n.return,te)}}if(n===e){ye=null;break}if(i=n.sibling,i!==null){i.return=n.return,ye=i;break}ye=n.return}}function Rp(e){for(;ye!==null;){var n=ye;if(n===e){ye=null;break}var i=n.sibling;if(i!==null){i.return=n.return,ye=i;break}ye=n.return}}function Ap(e){for(;ye!==null;){var n=ye;try{switch(n.tag){case 0:case 11:case 15:var i=n.return;try{ga(4,n)}catch(R){At(n,i,R)}break;case 1:var c=n.stateNode;if(typeof c.componentDidMount=="function"){var d=n.return;try{c.componentDidMount()}catch(R){At(n,d,R)}}var p=n.return;try{Uc(n)}catch(R){At(n,p,R)}break;case 5:var y=n.return;try{Uc(n)}catch(R){At(n,y,R)}}}catch(R){At(n,n.return,R)}if(n===e){ye=null;break}var N=n.sibling;if(N!==null){N.return=n.return,ye=N;break}ye=n.return}}var Py=Math.ceil,va=O.ReactCurrentDispatcher,Hc=O.ReactCurrentOwner,Yn=O.ReactCurrentBatchConfig,Ye=0,Yt=null,$t=null,nn=0,Fn=0,oi=Gs(0),Bt=0,Zi=null,Nr=0,ya=0,Vc=0,Ji=null,Nn=null,qc=0,ai=1/0,Ds=null,xa=!1,Gc=null,Js=null,wa=!1,er=null,ka=0,eo=0,Kc=null,Sa=-1,ba=0;function vn(){return(Ye&6)!==0?Nt():Sa!==-1?Sa:Sa=Nt()}function tr(e){return(e.mode&1)===0?1:(Ye&2)!==0&&nn!==0?nn&-nn:xy.transition!==null?(ba===0&&(ba=Ni()),ba):(e=Ge,e!==0||(e=window.event,e=e===void 0?16:Id(e.type)),e)}function cs(e,n,i,c){if(50<eo)throw eo=0,Kc=null,Error(r(185));vr(e,i,c),((Ye&2)===0||e!==Yt)&&(e===Yt&&((Ye&2)===0&&(ya|=i),Bt===4&&nr(e,nn)),Cn(e,c),i===1&&Ye===0&&(n.mode&1)===0&&(ai=Nt()+500,Qo&&Ys()))}function Cn(e,n){var i=e.callbackNode;Io(e,n);var c=gr(e,e===Yt?nn:0);if(c===0)i!==null&&ss(i),e.callbackNode=null,e.callbackPriority=0;else if(n=c&-c,e.callbackPriority!==n){if(i!=null&&ss(i),n===1)e.tag===0?yy(Dp.bind(null,e)):yf(Dp.bind(null,e)),hy(function(){(Ye&6)===0&&Ys()}),i=null;else{switch(ae(c)){case 1:i=Fs;break;case 4:i=vs;break;case 16:i=Or;break;case 536870912:i=Ro;break;default:i=Or}i=Up(i,Ip.bind(null,e))}e.callbackPriority=n,e.callbackNode=i}}function Ip(e,n){if(Sa=-1,ba=0,(Ye&6)!==0)throw Error(r(327));var i=e.callbackNode;if(li()&&e.callbackNode!==i)return null;var c=gr(e,e===Yt?nn:0);if(c===0)return null;if((c&30)!==0||(c&e.expiredLanes)!==0||n)n=Ta(e,c);else{n=c;var d=Ye;Ye|=2;var p=Lp();(Yt!==e||nn!==n)&&(Ds=null,ai=Nt()+500,jr(e,n));do try{zy();break}catch(N){Mp(e,N)}while(!0);fc(),va.current=p,Ye=d,$t!==null?n=0:(Yt=null,nn=0,n=Bt)}if(n!==0){if(n===2&&(d=Ti(e),d!==0&&(c=d,n=Yc(e,d))),n===1)throw i=Zi,jr(e,0),nr(e,c),Cn(e,Nt()),i;if(n===6)nr(e,c);else{if(d=e.current.alternate,(c&30)===0&&!Oy(d)&&(n=Ta(e,c),n===2&&(p=Ti(e),p!==0&&(c=p,n=Yc(e,p))),n===1))throw i=Zi,jr(e,0),nr(e,c),Cn(e,Nt()),i;switch(e.finishedWork=d,e.finishedLanes=c,n){case 0:case 1:throw Error(r(345));case 2:_r(e,Nn,Ds);break;case 3:if(nr(e,c),(c&130023424)===c&&(n=qc+500-Nt(),10<n)){if(gr(e,0)!==0)break;if(d=e.suspendedLanes,(d&c)!==c){vn(),e.pingedLanes|=e.suspendedLanes&d;break}e.timeoutHandle=tc(_r.bind(null,e,Nn,Ds),n);break}_r(e,Nn,Ds);break;case 4:if(nr(e,c),(c&4194240)===c)break;for(n=e.eventTimes,d=-1;0<c;){var y=31-hn(c);p=1<<y,y=n[y],y>d&&(d=y),c&=~p}if(c=d,c=Nt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*Py(c/1960))-c,10<c){e.timeoutHandle=tc(_r.bind(null,e,Nn,Ds),c);break}_r(e,Nn,Ds);break;case 5:_r(e,Nn,Ds);break;default:throw Error(r(329))}}}return Cn(e,Nt()),e.callbackNode===i?Ip.bind(null,e):null}function Yc(e,n){var i=Ji;return e.current.memoizedState.isDehydrated&&(jr(e,n).flags|=256),e=Ta(e,n),e!==2&&(n=Nn,Nn=i,n!==null&&Xc(n)),e}function Xc(e){Nn===null?Nn=e:Nn.push.apply(Nn,e)}function Oy(e){for(var n=e;;){if(n.flags&16384){var i=n.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var c=0;c<i.length;c++){var d=i[c],p=d.getSnapshot;d=d.value;try{if(!rs(p(),d))return!1}catch{return!1}}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function nr(e,n){for(n&=~Vc,n&=~ya,e.suspendedLanes|=n,e.pingedLanes&=~n,e=e.expirationTimes;0<n;){var i=31-hn(n),c=1<<i;e[i]=-1,n&=~c}}function Dp(e){if((Ye&6)!==0)throw Error(r(327));li();var n=gr(e,0);if((n&1)===0)return Cn(e,Nt()),null;var i=Ta(e,n);if(e.tag!==0&&i===2){var c=Ti(e);c!==0&&(n=c,i=Yc(e,c))}if(i===1)throw i=Zi,jr(e,0),nr(e,n),Cn(e,Nt()),i;if(i===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=n,_r(e,Nn,Ds),Cn(e,Nt()),null}function Qc(e,n){var i=Ye;Ye|=1;try{return e(n)}finally{Ye=i,Ye===0&&(ai=Nt()+500,Qo&&Ys())}}function Cr(e){er!==null&&er.tag===0&&(Ye&6)===0&&li();var n=Ye;Ye|=1;var i=Yn.transition,c=Ge;try{if(Yn.transition=null,Ge=1,e)return e()}finally{Ge=c,Yn.transition=i,Ye=n,(Ye&6)===0&&Ys()}}function Zc(){Fn=oi.current,ft(oi)}function jr(e,n){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,py(i)),$t!==null)for(i=$t.return;i!==null;){var c=i;switch(ac(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&Yo();break;case 3:si(),ft(Sn),ft(on),wc();break;case 5:yc(c);break;case 4:si();break;case 13:ft(_t);break;case 19:ft(_t);break;case 10:pc(c.type._context);break;case 22:case 23:Zc()}i=i.return}if(Yt=e,$t=e=sr(e.current,null),nn=Fn=n,Bt=0,Zi=null,Vc=ya=Nr=0,Nn=Ji=null,Sr!==null){for(n=0;n<Sr.length;n++)if(i=Sr[n],c=i.interleaved,c!==null){i.interleaved=null;var d=c.next,p=i.pending;if(p!==null){var y=p.next;p.next=d,c.next=y}i.pending=c}Sr=null}return e}function Mp(e,n){do{var i=$t;try{if(fc(),aa.current=da,la){for(var c=Et.memoizedState;c!==null;){var d=c.queue;d!==null&&(d.pending=null),c=c.next}la=!1}if(Tr=0,Kt=Ut=Et=null,qi=!1,Gi=0,Hc.current=null,i===null||i.return===null){Bt=1,Zi=n,$t=null;break}e:{var p=e,y=i.return,N=i,R=n;if(n=nn,N.flags|=32768,R!==null&&typeof R=="object"&&typeof R.then=="function"){var B=R,ne=N,re=ne.tag;if((ne.mode&1)===0&&(re===0||re===11||re===15)){var te=ne.alternate;te?(ne.updateQueue=te.updateQueue,ne.memoizedState=te.memoizedState,ne.lanes=te.lanes):(ne.updateQueue=null,ne.memoizedState=null)}var me=ip(y);if(me!==null){me.flags&=-257,op(me,y,N,p,n),me.mode&1&&rp(p,B,n),n=me,R=B;var xe=n.updateQueue;if(xe===null){var ke=new Set;ke.add(R),n.updateQueue=ke}else xe.add(R);break e}else{if((n&1)===0){rp(p,B,n),Jc();break e}R=Error(r(426))}}else if(wt&&N.mode&1){var Pt=ip(y);if(Pt!==null){(Pt.flags&65536)===0&&(Pt.flags|=256),op(Pt,y,N,p,n),uc(ri(R,N));break e}}p=R=ri(R,N),Bt!==4&&(Bt=2),Ji===null?Ji=[p]:Ji.push(p),p=y;do{switch(p.tag){case 3:p.flags|=65536,n&=-n,p.lanes|=n;var z=np(p,R,n);Ef(p,z);break e;case 1:N=R;var D=p.type,F=p.stateNode;if((p.flags&128)===0&&(typeof D.getDerivedStateFromError=="function"||F!==null&&typeof F.componentDidCatch=="function"&&(Js===null||!Js.has(F)))){p.flags|=65536,n&=-n,p.lanes|=n;var le=sp(p,N,n);Ef(p,le);break e}}p=p.return}while(p!==null)}Op(i)}catch(Se){n=Se,$t===i&&i!==null&&($t=i=i.return);continue}break}while(!0)}function Lp(){var e=va.current;return va.current=da,e===null?da:e}function Jc(){(Bt===0||Bt===3||Bt===2)&&(Bt=4),Yt===null||(Nr&268435455)===0&&(ya&268435455)===0||nr(Yt,nn)}function Ta(e,n){var i=Ye;Ye|=2;var c=Lp();(Yt!==e||nn!==n)&&(Ds=null,jr(e,n));do try{$y();break}catch(d){Mp(e,d)}while(!0);if(fc(),Ye=i,va.current=c,$t!==null)throw Error(r(261));return Yt=null,nn=0,Bt}function $y(){for(;$t!==null;)Pp($t)}function zy(){for(;$t!==null&&!Al();)Pp($t)}function Pp(e){var n=Fp(e.alternate,e,Fn);e.memoizedProps=e.pendingProps,n===null?Op(e):$t=n,Hc.current=null}function Op(e){var n=e;do{var i=n.alternate;if(e=n.return,(n.flags&32768)===0){if(i=Ay(i,n,Fn),i!==null){$t=i;return}}else{if(i=Iy(i,n),i!==null){i.flags&=32767,$t=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Bt=6,$t=null;return}}if(n=n.sibling,n!==null){$t=n;return}$t=n=e}while(n!==null);Bt===0&&(Bt=5)}function _r(e,n,i){var c=Ge,d=Yn.transition;try{Yn.transition=null,Ge=1,Fy(e,n,i,c)}finally{Yn.transition=d,Ge=c}return null}function Fy(e,n,i,c){do li();while(er!==null);if((Ye&6)!==0)throw Error(r(327));i=e.finishedWork;var d=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var p=i.lanes|i.childLanes;if(Do(e,p),e===Yt&&($t=Yt=null,nn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||wa||(wa=!0,Up(Or,function(){return li(),null})),p=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||p){p=Yn.transition,Yn.transition=null;var y=Ge;Ge=1;var N=Ye;Ye|=4,Hc.current=null,My(e,i),jp(i,e),oy(Jl),Lo=!!Zl,Jl=Zl=null,e.current=i,Ly(i),Il(),Ye=N,Ge=y,Yn.transition=p}else e.current=i;if(wa&&(wa=!1,er=e,ka=d),p=e.pendingLanes,p===0&&(Js=null),$r(i.stateNode),Cn(e,Nt()),n!==null)for(c=e.onRecoverableError,i=0;i<n.length;i++)d=n[i],c(d.value,{componentStack:d.stack,digest:d.digest});if(xa)throw xa=!1,e=Gc,Gc=null,e;return(ka&1)!==0&&e.tag!==0&&li(),p=e.pendingLanes,(p&1)!==0?e===Kc?eo++:(eo=0,Kc=e):eo=0,Ys(),null}function li(){if(er!==null){var e=ae(ka),n=Yn.transition,i=Ge;try{if(Yn.transition=null,Ge=16>e?16:e,er===null)var c=!1;else{if(e=er,er=null,ka=0,(Ye&6)!==0)throw Error(r(331));var d=Ye;for(Ye|=4,ye=e.current;ye!==null;){var p=ye,y=p.child;if((ye.flags&16)!==0){var N=p.deletions;if(N!==null){for(var R=0;R<N.length;R++){var B=N[R];for(ye=B;ye!==null;){var ne=ye;switch(ne.tag){case 0:case 11:case 15:Qi(8,ne,p)}var re=ne.child;if(re!==null)re.return=ne,ye=re;else for(;ye!==null;){ne=ye;var te=ne.sibling,me=ne.return;if(Sp(ne),ne===B){ye=null;break}if(te!==null){te.return=me,ye=te;break}ye=me}}}var xe=p.alternate;if(xe!==null){var ke=xe.child;if(ke!==null){xe.child=null;do{var Pt=ke.sibling;ke.sibling=null,ke=Pt}while(ke!==null)}}ye=p}}if((p.subtreeFlags&2064)!==0&&y!==null)y.return=p,ye=y;else e:for(;ye!==null;){if(p=ye,(p.flags&2048)!==0)switch(p.tag){case 0:case 11:case 15:Qi(9,p,p.return)}var z=p.sibling;if(z!==null){z.return=p.return,ye=z;break e}ye=p.return}}var D=e.current;for(ye=D;ye!==null;){y=ye;var F=y.child;if((y.subtreeFlags&2064)!==0&&F!==null)F.return=y,ye=F;else e:for(y=D;ye!==null;){if(N=ye,(N.flags&2048)!==0)try{switch(N.tag){case 0:case 11:case 15:ga(9,N)}}catch(Se){At(N,N.return,Se)}if(N===y){ye=null;break e}var le=N.sibling;if(le!==null){le.return=N.return,ye=le;break e}ye=N.return}}if(Ye=d,Ys(),Pn&&typeof Pn.onPostCommitFiberRoot=="function")try{Pn.onPostCommitFiberRoot(pr,e)}catch{}c=!0}return c}finally{Ge=i,Yn.transition=n}}return!1}function $p(e,n,i){n=ri(i,n),n=np(e,n,1),e=Qs(e,n,1),n=vn(),e!==null&&(vr(e,1,n),Cn(e,n))}function At(e,n,i){if(e.tag===3)$p(e,e,i);else for(;n!==null;){if(n.tag===3){$p(n,e,i);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(Js===null||!Js.has(c))){e=ri(i,e),e=sp(n,e,1),n=Qs(n,e,1),e=vn(),n!==null&&(vr(n,1,e),Cn(n,e));break}}n=n.return}}function Uy(e,n,i){var c=e.pingCache;c!==null&&c.delete(n),n=vn(),e.pingedLanes|=e.suspendedLanes&i,Yt===e&&(nn&i)===i&&(Bt===4||Bt===3&&(nn&130023424)===nn&&500>Nt()-qc?jr(e,0):Vc|=i),Cn(e,n)}function zp(e,n){n===0&&((e.mode&1)===0?n=1:(n=Fr,Fr<<=1,(Fr&130023424)===0&&(Fr=4194304)));var i=vn();e=Rs(e,n),e!==null&&(vr(e,n,i),Cn(e,i))}function By(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),zp(e,i)}function Wy(e,n){var i=0;switch(e.tag){case 13:var c=e.stateNode,d=e.memoizedState;d!==null&&(i=d.retryLane);break;case 19:c=e.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(n),zp(e,i)}var Fp;Fp=function(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps||Sn.current)Tn=!0;else{if((e.lanes&i)===0&&(n.flags&128)===0)return Tn=!1,Ry(e,n,i);Tn=(e.flags&131072)!==0}else Tn=!1,wt&&(n.flags&1048576)!==0&&xf(n,Jo,n.index);switch(n.lanes=0,n.tag){case 2:var c=n.type;ha(e,n),e=n.pendingProps;var d=Xr(n,on.current);ni(n,i),d=bc(null,n,c,e,d,i);var p=Tc();return n.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,bn(c)?(p=!0,Xo(n)):p=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,gc(n),d.updater=fa,n.stateNode=d,d._reactInternals=n,Rc(n,c,e,i),n=Mc(null,n,c,!0,p,i)):(n.tag=0,wt&&p&&oc(n),gn(null,n,d,i),n=n.child),n;case 16:c=n.elementType;e:{switch(ha(e,n),e=n.pendingProps,d=c._init,c=d(c._payload),n.type=c,d=n.tag=Vy(c),e=os(c,e),d){case 0:n=Dc(null,n,c,e,i);break e;case 1:n=fp(null,n,c,e,i);break e;case 11:n=ap(null,n,c,e,i);break e;case 14:n=lp(null,n,c,os(c.type,e),i);break e}throw Error(r(306,c,""))}return n;case 0:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:os(c,d),Dc(e,n,c,d,i);case 1:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:os(c,d),fp(e,n,c,d,i);case 3:e:{if(pp(n),e===null)throw Error(r(387));c=n.pendingProps,p=n.memoizedState,d=p.element,_f(e,n),ia(n,c,null,i);var y=n.memoizedState;if(c=y.element,p.isDehydrated)if(p={element:c,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=p,n.memoizedState=p,n.flags&256){d=ri(Error(r(423)),n),n=hp(e,n,c,i,d);break e}else if(c!==d){d=ri(Error(r(424)),n),n=hp(e,n,c,i,d);break e}else for(zn=qs(n.stateNode.containerInfo.firstChild),$n=n,wt=!0,is=null,i=Cf(n,null,c,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(Jr(),c===d){n=Is(e,n,i);break e}gn(e,n,c,i)}n=n.child}return n;case 5:return Af(n),e===null&&cc(n),c=n.type,d=n.pendingProps,p=e!==null?e.memoizedProps:null,y=d.children,ec(c,d)?y=null:p!==null&&ec(c,p)&&(n.flags|=32),dp(e,n),gn(e,n,y,i),n.child;case 6:return e===null&&cc(n),null;case 13:return mp(e,n,i);case 4:return vc(n,n.stateNode.containerInfo),c=n.pendingProps,e===null?n.child=ei(n,null,c,i):gn(e,n,c,i),n.child;case 11:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:os(c,d),ap(e,n,c,d,i);case 7:return gn(e,n,n.pendingProps,i),n.child;case 8:return gn(e,n,n.pendingProps.children,i),n.child;case 12:return gn(e,n,n.pendingProps.children,i),n.child;case 10:e:{if(c=n.type._context,d=n.pendingProps,p=n.memoizedProps,y=d.value,ct(na,c._currentValue),c._currentValue=y,p!==null)if(rs(p.value,y)){if(p.children===d.children&&!Sn.current){n=Is(e,n,i);break e}}else for(p=n.child,p!==null&&(p.return=n);p!==null;){var N=p.dependencies;if(N!==null){y=p.child;for(var R=N.firstContext;R!==null;){if(R.context===c){if(p.tag===1){R=As(-1,i&-i),R.tag=2;var B=p.updateQueue;if(B!==null){B=B.shared;var ne=B.pending;ne===null?R.next=R:(R.next=ne.next,ne.next=R),B.pending=R}}p.lanes|=i,R=p.alternate,R!==null&&(R.lanes|=i),hc(p.return,i,n),N.lanes|=i;break}R=R.next}}else if(p.tag===10)y=p.type===n.type?null:p.child;else if(p.tag===18){if(y=p.return,y===null)throw Error(r(341));y.lanes|=i,N=y.alternate,N!==null&&(N.lanes|=i),hc(y,i,n),y=p.sibling}else y=p.child;if(y!==null)y.return=p;else for(y=p;y!==null;){if(y===n){y=null;break}if(p=y.sibling,p!==null){p.return=y.return,y=p;break}y=y.return}p=y}gn(e,n,d.children,i),n=n.child}return n;case 9:return d=n.type,c=n.pendingProps.children,ni(n,i),d=Gn(d),c=c(d),n.flags|=1,gn(e,n,c,i),n.child;case 14:return c=n.type,d=os(c,n.pendingProps),d=os(c.type,d),lp(e,n,c,d,i);case 15:return cp(e,n,n.type,n.pendingProps,i);case 17:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:os(c,d),ha(e,n),n.tag=1,bn(c)?(e=!0,Xo(n)):e=!1,ni(n,i),ep(n,c,d),Rc(n,c,d,i),Mc(null,n,c,!0,e,i);case 19:return vp(e,n,i);case 22:return up(e,n,i)}throw Error(r(156,n.tag))};function Up(e,n){return Tt(e,n)}function Hy(e,n,i,c){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Xn(e,n,i,c){return new Hy(e,n,i,c)}function eu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Vy(e){if(typeof e=="function")return eu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Te)return 11;if(e===se)return 14}return 2}function sr(e,n){var i=e.alternate;return i===null?(i=Xn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Na(e,n,i,c,d,p){var y=2;if(c=e,typeof e=="function")eu(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case Y:return Er(i.children,d,p,n);case Q:y=8,d|=8;break;case ue:return e=Xn(12,i,n,d|2),e.elementType=ue,e.lanes=p,e;case Ne:return e=Xn(13,i,n,d),e.elementType=Ne,e.lanes=p,e;case Le:return e=Xn(19,i,n,d),e.elementType=Le,e.lanes=p,e;case X:return Ca(i,d,p,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case he:y=10;break e;case H:y=9;break e;case Te:y=11;break e;case se:y=14;break e;case G:y=16,c=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Xn(y,i,n,d),n.elementType=e,n.type=c,n.lanes=p,n}function Er(e,n,i,c){return e=Xn(7,e,c,n),e.lanes=i,e}function Ca(e,n,i,c){return e=Xn(22,e,c,n),e.elementType=X,e.lanes=i,e.stateNode={isHidden:!1},e}function tu(e,n,i){return e=Xn(6,e,null,n),e.lanes=i,e}function nu(e,n,i){return n=Xn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function qy(e,n,i,c,d){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ci(0),this.expirationTimes=Ci(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ci(0),this.identifierPrefix=c,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function su(e,n,i,c,d,p,y,N,R){return e=new qy(e,n,i,N,R),n===1?(n=1,p===!0&&(n|=8)):n=0,p=Xn(3,null,null,n),e.current=p,p.stateNode=e,p.memoizedState={element:c,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},gc(p),e}function Gy(e,n,i){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Z,key:c==null?null:""+c,children:e,containerInfo:n,implementation:i}}function Bp(e){if(!e)return Ks;e=e._reactInternals;e:{if(He(e)!==e||e.tag!==1)throw Error(r(170));var n=e;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(bn(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(e.tag===1){var i=e.type;if(bn(i))return gf(e,i,n)}return n}function Wp(e,n,i,c,d,p,y,N,R){return e=su(i,c,!0,e,d,p,y,N,R),e.context=Bp(null),i=e.current,c=vn(),d=tr(i),p=As(c,d),p.callback=n??null,Qs(i,p,d),e.current.lanes=d,vr(e,d,c),Cn(e,c),e}function ja(e,n,i,c){var d=n.current,p=vn(),y=tr(d);return i=Bp(i),n.context===null?n.context=i:n.pendingContext=i,n=As(p,y),n.payload={element:e},c=c===void 0?null:c,c!==null&&(n.callback=c),e=Qs(d,n,y),e!==null&&(cs(e,d,y,p),ra(e,d,y)),y}function _a(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Hp(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function ru(e,n){Hp(e,n),(e=e.alternate)&&Hp(e,n)}function Ky(){return null}var Vp=typeof reportError=="function"?reportError:function(e){console.error(e)};function iu(e){this._internalRoot=e}Ea.prototype.render=iu.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));ja(e,n,null,null)},Ea.prototype.unmount=iu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;Cr(function(){ja(null,e,null,null)}),n[Cs]=null}};function Ea(e){this._internalRoot=e}Ea.prototype.unstable_scheduleHydration=function(e){if(e){var n=we();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Ws.length&&n!==0&&n<Ws[i].priority;i++);Ws.splice(i,0,e),i===0&&Rd(e)}};function ou(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ra(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function qp(){}function Yy(e,n,i,c,d){if(d){if(typeof c=="function"){var p=c;c=function(){var B=_a(y);p.call(B)}}var y=Wp(n,c,e,0,null,!1,!1,"",qp);return e._reactRootContainer=y,e[Cs]=y.current,$i(e.nodeType===8?e.parentNode:e),Cr(),y}for(;d=e.lastChild;)e.removeChild(d);if(typeof c=="function"){var N=c;c=function(){var B=_a(R);N.call(B)}}var R=su(e,0,!1,null,null,!1,!1,"",qp);return e._reactRootContainer=R,e[Cs]=R.current,$i(e.nodeType===8?e.parentNode:e),Cr(function(){ja(n,R,i,c)}),R}function Aa(e,n,i,c,d){var p=i._reactRootContainer;if(p){var y=p;if(typeof d=="function"){var N=d;d=function(){var R=_a(y);N.call(R)}}ja(n,y,e,d)}else y=Yy(i,n,e,d,c);return _a(y)}S=function(e){switch(e.tag){case 3:var n=e.stateNode;if(n.current.memoizedState.isDehydrated){var i=mr(n.pendingLanes);i!==0&&(Bs(n,i|1),Cn(n,Nt()),(Ye&6)===0&&(ai=Nt()+500,Ys()))}break;case 13:Cr(function(){var c=Rs(e,1);if(c!==null){var d=vn();cs(c,e,1,d)}}),ru(e,1)}},$=function(e){if(e.tag===13){var n=Rs(e,134217728);if(n!==null){var i=vn();cs(n,e,134217728,i)}ru(e,134217728)}},ee=function(e){if(e.tag===13){var n=tr(e),i=Rs(e,n);if(i!==null){var c=vn();cs(i,e,n,c)}ru(e,n)}},we=function(){return Ge},be=function(e,n){var i=Ge;try{return Ge=e,n()}finally{Ge=i}},Ft=function(e,n,i){switch(n){case"input":if(Dt(e,i),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<i.length;n++){var c=i[n];if(c!==e&&c.form===e.form){var d=Ko(c);if(!d)throw Error(r(90));je(c),Dt(c,d)}}}break;case"textarea":pe(e,i);break;case"select":n=i.value,n!=null&&ht(e,!!i.multiple,n,!1)}},bt=Qc,xt=Cr;var Xy={usingClientEntryPoint:!1,Events:[Ui,Kr,Ko,yt,qt,Qc]},to={findFiberByHostInstance:yr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Qy={bundleType:to.bundleType,version:to.version,rendererPackageName:to.rendererPackageName,rendererConfig:to.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:O.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ns(e),e===null?null:e.stateNode},findFiberByHostInstance:to.findFiberByHostInstance||Ky,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 Ia=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ia.isDisabled&&Ia.supportsFiber)try{pr=Ia.inject(Qy),Pn=Ia}catch{}}return jn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Xy,jn.createPortal=function(e,n){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!ou(n))throw Error(r(200));return Gy(e,n,null,i)},jn.createRoot=function(e,n){if(!ou(e))throw Error(r(299));var i=!1,c="",d=Vp;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onRecoverableError!==void 0&&(d=n.onRecoverableError)),n=su(e,1,!1,null,null,i,!1,c,d),e[Cs]=n.current,$i(e.nodeType===8?e.parentNode:e),new iu(n)},jn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=ns(n),e=e===null?null:e.stateNode,e},jn.flushSync=function(e){return Cr(e)},jn.hydrate=function(e,n,i){if(!Ra(n))throw Error(r(200));return Aa(null,e,n,!0,i)},jn.hydrateRoot=function(e,n,i){if(!ou(e))throw Error(r(405));var c=i!=null&&i.hydratedSources||null,d=!1,p="",y=Vp;if(i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(p=i.identifierPrefix),i.onRecoverableError!==void 0&&(y=i.onRecoverableError)),n=Wp(n,null,e,1,i??null,d,!1,p,y),e[Cs]=n.current,$i(e),c)for(e=0;e<c.length;e++)i=c[e],d=i._getVersion,d=d(i._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[i,d]:n.mutableSourceEagerHydrationData.push(i,d);return new Ea(n)},jn.render=function(e,n,i){if(!Ra(n))throw Error(r(200));return Aa(null,e,n,!1,i)},jn.unmountComponentAtNode=function(e){if(!Ra(e))throw Error(r(40));return e._reactRootContainer?(Cr(function(){Aa(null,null,e,!1,function(){e._reactRootContainer=null,e[Cs]=null})}),!0):!1},jn.unstable_batchedUpdates=Qc,jn.unstable_renderSubtreeIntoContainer=function(e,n,i,c){if(!Ra(i))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Aa(e,n,i,!1,c)},jn.version="18.3.1-next-f1338f8080-20240426",jn}var eh;function Wm(){if(eh)return cu.exports;eh=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),cu.exports=ox(),cu.exports}var th;function ax(){if(th)return Da;th=1;var t=Wm();return Da.createRoot=t.createRoot,Da.hydrateRoot=t.hydrateRoot,Da}var lx=ax();const cx=Bm(lx),nh=t=>{let s;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(s):m;if(!Object.is(k,s)){const x=s;s=v??(typeof k!="object"||k===null)?k:Object.assign({},s,k),r.forEach(b=>b(s,x))}},a=()=>s,h={setState:o,getState:a,getInitialState:()=>g,subscribe:m=>(r.add(m),()=>r.delete(m))},g=s=t(o,a,h);return h},ux=(t=>t?nh(t):nh),dx=t=>t;function fx(t,s=dx){const r=rt.useSyncExternalStore(t.subscribe,rt.useCallback(()=>s(t.getState()),[t,s]),rt.useCallback(()=>s(t.getInitialState()),[t,s]));return rt.useDebugValue(r),r}const px=t=>{const s=ux(t),r=o=>fx(s,o);return Object.assign(r,s),r},hx=(t=>px),Hm="agentpane:machines",Vm="agentpane:active-machine";function mx(t){return/^[a-z][a-z0-9-]{1,30}$/.test(t)}function qm(t){return`${t}.repoburg.com`}function Gm(t){const s=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(t);return s?s[1]:null}function Km(t,s){try{const r=localStorage.getItem(t);return r==null?s:JSON.parse(r)}catch{return s}}function Ym(t,s){try{localStorage.setItem(t,JSON.stringify(s))}catch{}}function Xm(){return Km(Hm,[]).filter(s=>mx(s.mahlas)&&s.hostname===qm(s.mahlas))}function gx(t){const s={mahlas:t,hostname:qm(t),lastConnectedAt:new Date().toISOString()},r=Xm(),o=[s,...r.filter(a=>a.mahlas!==t)];return Ym(Hm,o),s}function vx(){const t=Km(Vm,null);return t?Xm().find(s=>s.mahlas===t)??null:null}function yx(t){Ym(Vm,t)}function xx(){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search).get("host");if(!t)return;const s=Gm(t);s&&(gx(s),yx(s))}const sh="http://localhost:9998",wx=["agent.repoburg.com"];function dn(){if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search),s=t.get("bport");if(s)return`http://localhost:${s}`;const r=t.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(wx.includes(o))return sh;if(Gm(o))return"";const a=vx();return a?`https://${a.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":sh}const kx="/api";async function bo(t,s,r){const o=await fetch(`${dn()}${kx}${s}`,{method:t,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let a=`${o.status} ${o.statusText}`;try{const u=await o.json();u!=null&&u.error&&(a=`${a} — ${u.error}`)}catch{}throw new Error(`${t} ${s} failed: ${a}`)}return o.json()}function fn(t){return bo("GET",t)}function pt(t,s){return bo("POST",t,s)}function yl(t){return bo("DELETE",t)}function bs(t,s){return bo("PATCH",t,s)}function Sx(t,s){return bo("PUT",t,s)}function bx(){return fn("/sessions")}function so(t){return fn(`/sessions/${t}`)}function Zu(t){return pt("/sessions",t)}function rh(t){return yl(`/sessions/${t}`)}function Qm(t,s,r,o){return pt(`/sessions/${t}/turns`,{user_prompt:s,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function Tx(t){return pt(`/sessions/${t}/cancel`)}function Nx(t,s){return pt(`/sessions/${t}/turns/${s}/resume`)}function Cx(t,s){return bs(`/sessions/${t}`,{title:s})}function ih(t){return bs(`/sessions/${t}`,{lifecycle:"finished"})}function oh(t){return bs(`/sessions/${t}`,{lifecycle:"working"})}function jx(t,s){return bs(`/sessions/${t}`,{starred:s})}function ah(t){return bs(`/sessions/${t}`,{has_unreviewed:0})}function _x(t,s,r,o){const a={model:s,model_reasoning_effort:r};return o!==void 0&&(a.runtime_type=o),bs(`/sessions/${t}`,a)}function Ex(t,s){return bs(`/sessions/${t}`,{runtime_config:s})}function Rx(t,s){return pt(`/sessions/${t}/rewind`,{turn_id:s})}function Ax(t){return pt(`/sessions/${t}/restore`,{})}function Ix(t,s,r){return pt(`/sessions/${t}/branch`,{turn_id:s,title:r})}function Zm(){return fn("/workspaces")}function Dx(t,s){return pt("/workspaces",{path:t,label:s})}function Mx(t){return pt("/workspaces/hide",{path:t})}async function Lx(){const t=await fetch(`${dn()}/api/pick-directory`);if(t.status===204)return{cancelled:!0};if(!t.ok)throw new Error(`GET /api/pick-directory failed: ${t.status} ${t.statusText}`);return t.json()}function Jm(){return fn("/folders")}function Px(t,s){return pt("/folders",{workspace_path:t,name:s})}function lh(t,s){return bs(`/folders/${t}`,s)}function Ox(t){return yl(`/folders/${t}`)}function $x(t){return pt("/sessions/reorder",{moves:t})}function cr(t){return t.status==="pending"||t.status==="running"}function eg(t){return!!(t!=null&&t.turns.some(cr))}function xl(t){return t?t.turns.some(cr)||(t.threads??[]).some(s=>(s.turns??[]).some(cr)):!1}const tg=1;function ng(){let t="";try{t=dn()}catch{}return`agentpane:tabs:${t||window.location.origin}`}function ch(t){return Array.isArray(t)&&t.every(s=>typeof s=="string")}function uh(t){return t===null||typeof t=="string"}function zx(t){if(t==null)return null;let s;try{s=JSON.parse(t)}catch{return null}if(typeof s!="object"||s===null)return null;const r=s;return r.v!==tg||!ch(r.openTabs)||!uh(r.activeSessionId)||!ch(r.openAppTabs)||!uh(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId}}const sg=[()=>window.sessionStorage,()=>window.localStorage];function Fx(){const t=ng();for(const s of sg)try{const r=zx(s().getItem(t));if(r)return r}catch{}return null}function Ux(t){const s=ng(),r=JSON.stringify({v:tg,openTabs:t.openTabs,activeSessionId:t.activeSessionId,openAppTabs:t.openAppTabs,activeAppTabId:t.activeAppTabId});for(const o of sg)try{o().setItem(s,r)}catch{}}function Bx(t){return t.subscribe((s,r)=>{(s.openTabs!==r.openTabs||s.activeSessionId!==r.activeSessionId||s.openAppTabs!==r.openAppTabs||s.activeAppTabId!==r.activeAppTabId)&&Ux(s)})}function Ka(t){return[...new Set(t)]}function Wx(t,s,r,o){const a=m=>r===null||r.has(m),u=Ka(((t==null?void 0:t.openTabs)??[]).filter(m=>s.has(m))),f=Ka(((t==null?void 0:t.openAppTabs)??[]).filter(a));let h=(t==null?void 0:t.activeSessionId)??null;h!==null&&!s.has(h)&&(h=null),h!==null&&!u.includes(h)&&u.push(h),h??(h=u.at(-1)??null);let g=(t==null?void 0:t.activeAppTabId)??null;return g!==null&&!a(g)&&(g=null),g!==null&&!f.includes(g)&&f.push(g),o!==null&&s.has(o)&&(u.includes(o)||u.push(o),h=o,g=null),{openTabs:u,activeSessionId:h,openAppTabs:f,activeAppTabId:g}}function Hx(){const t=new URLSearchParams(window.location.search);return{session:t.get("session"),thread:t.get("thread")}}function Vx(){const t=new URL(window.location.href);!t.searchParams.has("session")&&!t.searchParams.has("thread")||(t.searchParams.delete("session"),t.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",t))}let fu=0;function dh(t){return t==="sidecar"?"sidecar":"turns"}async function qx(t,s){const r=await Promise.allSettled(t.map(u=>s(u))),o=new Map;let a=null;return r.forEach((u,f)=>{var h;u.status==="fulfilled"?o.set(t[f],u.value):a===null&&(a=((h=u.reason)==null?void 0:h.message)??"Request failed")}),{updated:o,firstError:a}}function fh(t,s){const r={...t.sessionDetails};s.forEach(h=>delete r[h]);const o={...t.backgroundTasks};s.forEach(h=>delete o[h]);const a=t.openTabs.filter(h=>!s.has(h));let u=t.activeSessionId,f=t.activeTurnIndex;if(u&&s.has(u)){u=a.length>0?a[a.length-1]:null;const h=u?r[u]:null;f=h&&h.turns.length>0?h.turns.length-1:0}return{sessions:t.sessions.filter(h=>!s.has(h.id)),sessionDetails:r,backgroundTasks:o,openTabs:a,activeSessionId:u,activeTurnIndex:f}}function Gx(t){const s={...t};return delete s.turns,delete s.threads,delete s.contextUsage,s}async function ph(t,s,r,o,a){if(r.length===0)return;t({error:null});const{updated:u,firstError:f}=await qx(r,o);u.size>0&&t(g=>({sessions:g.sessions.map(m=>u.get(m.id)??m)}));const h=r.length-u.size;if(h===0)s().addToast("info",`${r.length} session${r.length===1?"":"s"} ${a}`);else{t({error:f});const g=a[0].toUpperCase()+a.slice(1);s().addToast(h===r.length?"error":"warn",`${g} ${u.size} of ${r.length} — ${h} failed`)}}const Kx=(t,s)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=Hx(),o=Fx();try{const a=localStorage.getItem("agentpane:last-model-config");a&&t({lastModelConfig:JSON.parse(a)})}catch{}t({loading:!0,error:null});try{const a=s().loadApps(),[u,f,h]=await Promise.all([bx(),Zm(),Jm()]);t({sessions:u,workspaces:f,folders:h,loading:!1}),Vx();const g=await a,m=Wx(o,new Set(u.map(v=>v.id)),g?new Set(s().apps.map(v=>v.id)):null,r.session);t(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:Ka([...m.openTabs,...v.openTabs]),openAppTabs:Ka([...m.openAppTabs,...v.openAppTabs]),activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!s().activeSessionId&&await s().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(t({deepLinkThreadId:r.thread}),s().switchRightTab("threads"))}catch(a){t({loading:!1,error:a.message})}},selectSession:async(r,o)=>{const a=++fu,u=o!=null&&o.keepAppView?{}:{activeAppTabId:null},f=h=>h.includes(r)?h:[...h,r];if(s().sessionDetails[r]){const h=s().sessionDetails[r];t({activeSessionId:r,activeTurnIndex:h.turns.length>0?h.turns.length-1:0,activeRightTab:dh(s().activeRightTab),...u,openTabs:f(s().openTabs)}),h.has_unreviewed===1&&(ah(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...h,has_unreviewed:0}}})));return}t({loading:!0,error:null});try{const h=await so(r);if(a!==fu){t(g=>({sessionDetails:{...g.sessionDetails,[r]:h},openTabs:f(g.openTabs),loading:!1}));return}t(g=>({sessionDetails:{...g.sessionDetails,[r]:h},activeSessionId:r,activeTurnIndex:h.turns.length>0?h.turns.length-1:0,activeRightTab:dh(g.activeRightTab),...u,openTabs:f(g.openTabs),loading:!1})),h.has_unreviewed===1&&(ah(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...h,has_unreviewed:0}}})))}catch(h){t(a===fu?{loading:!1,error:h.message}:{loading:!1})}},closeTab:r=>{t(o=>{const a=o.openTabs.filter(u=>u!==r);if(o.activeSessionId===r&&a.length>0){const u=a[a.length-1],f=o.sessionDetails[u];return{openTabs:a,activeSessionId:u,activeTurnIndex:f&&f.turns.length>0?f.turns.length-1:0}}return{openTabs:a,activeSessionId:o.activeSessionId===r?null:o.activeSessionId}})},updateModelConfig:async(r,o,a)=>{const u=s().activeSessionId;if(u){t({error:null});try{const f=await _x(u,r,o,a),h={provider:f.runtime_type,model:f.model??"",reasoning:f.model_reasoning_effort??""};t({lastModelConfig:h}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(h)),t(g=>({sessions:g.sessions.map(m=>m.id===u?f:m),sessionDetails:g.sessionDetails[u]?{...g.sessionDetails,[u]:{...g.sessionDetails[u],model:f.model,model_reasoning_effort:f.model_reasoning_effort,external_thread_id:f.external_thread_id}}:g.sessionDetails})),await s().refreshActiveSession()}catch(f){t({error:f.message}),s().addToast("error",`Failed to update model — ${f.message}`)}}},createSession:async r=>{t({error:null});try{const o=await Zu(r);t(u=>({sessions:[o,...u.sessions],showNewSessionDialog:!1}));const a={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};t({lastModelConfig:a}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(a)),await s().selectSession(o.id),s().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),s().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{t(o=>({sessions:o.sessions.some(a=>a.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=s().sessionDetails[r];if(!o){const a=await so(r);t(u=>({sessionDetails:{...u.sessionDetails,[r]:a}})),o=a}s().sessions.some(a=>a.id===r)||s().addSession(Gx(o)),await s().selectSession(r)},deleteSession:async r=>{var a;t({error:null});const o=(a=s().sessions.find(u=>u.id===r))==null?void 0:a.title;try{await rh(r),t(u=>fh(u,new Set([r]))),s().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),s().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(u){t({error:u.message}),s().addToast("error",`Failed to delete session — ${u.message}`)}},renameSession:async(r,o)=>{t({error:null});try{const a=await Cx(r,o.trim());t(u=>({sessions:u.sessions.map(f=>f.id===r?a:f),sessionDetails:u.sessionDetails[r]?{...u.sessionDetails,[r]:{...u.sessionDetails[r],title:a.title}}:u.sessionDetails}))}catch(a){t({error:a.message}),s().addToast("error",`Failed to rename session — ${a.message}`)}},markFinished:async r=>{t({error:null});try{const o=await ih(r);t(a=>({sessions:a.sessions.map(u=>u.id===r?o:u)})),s().addToast("info","Session marked as finished")}catch(o){t({error:o.message}),s().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await ph(t,s,r,ih,"marked as finished")},toggleStar:async r=>{const o=s().sessions.find(a=>a.id===r);if(o){t({error:null});try{const a=await jx(r,o.starred?0:1);t(u=>({sessions:u.sessions.map(f=>f.id===r?a:f),sessionDetails:u.sessionDetails[r]?{...u.sessionDetails,[r]:{...u.sessionDetails[r],starred:a.starred}}:u.sessionDetails}))}catch(a){t({error:a.message}),s().addToast("error",`Failed to star session — ${a.message}`)}}},reopenSession:async r=>{t({error:null});try{const o=await oh(r);t(a=>({sessions:a.sessions.map(u=>u.id===r?o:u)})),s().addToast("info","Session reopened")}catch(o){t({error:o.message}),s().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await ph(t,s,r,oh,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;t({error:null});const o=await Promise.allSettled(r.map(f=>rh(f))),a=new Set;if(o.forEach((f,h)=>{f.status==="fulfilled"&&a.add(r[h])}),a.size===0){t({error:"Failed to delete sessions"}),s().addToast("error","Failed to delete sessions");return}t(f=>fh(f,a)),s().addLogEntry("INFO",`${a.size} session${a.size===1?"":"s"} deleted`);const u=r.length-a.size;u===0?s().addToast("info",`${a.size} session${a.size===1?"":"s"} deleted`):(t({error:"One or more sessions failed to delete"}),s().addToast("warn",`Deleted ${a.size} of ${r.length} — ${u} failed`))},submitPrompt:async(r,o)=>{const a=s().activeSessionId;if(a){t({error:null,submittingPrompt:r}),t(u=>{const f=u.sessionDetails[a];return f?{sessionDetails:{...u.sessionDetails,[a]:{...f,is_running:1,status:"running"}},sessions:u.sessions.map(h=>h.id===a?{...h,is_running:1,status:"running"}:h)}:{}});try{const u=await Qm(a,r,o);s().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),t(f=>{const h=f.sessionDetails[a];if(!h)return{submittingPrompt:null};const g=h.turns.findIndex(v=>v.id===u.id);if(g>=0)return{submittingPrompt:null,activeTurnIndex:g};const m={...u,items:[]};return{submittingPrompt:null,sessionDetails:{...f.sessionDetails,[a]:{...h,turns:[...h.turns,m]}},activeTurnIndex:h.turns.length}})}catch(u){t({submittingPrompt:null,error:u.message}),s().addLogEntry("ERROR",`Turn failed — ${u.message}`),s().addToast("error",`Failed to send prompt — ${u.message}`),t(f=>{const h=f.sessionDetails[a];if(!h)return{};const g=xl(h)?1:0;return{sessionDetails:{...f.sessionDetails,[a]:{...h,is_running:g,status:g?"running":"active"}},sessions:f.sessions.map(m=>m.id===a?{...m,is_running:g,status:g?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=s().activeSessionId;if(r)try{await Tx(r)}catch(o){t({error:o.message})}},rewindToTurn:async(r,o)=>{t({error:null});try{const a=await Rx(r,o),u=await so(r);t(f=>({sessionDetails:{...f.sessionDetails,[r]:u},sessions:f.sessions.map(h=>h.id===r?{...h,external_thread_id:a.external_thread_id,is_running:0,status:"active"}:h),activeTurnIndex:u.turns.length>0?u.turns.length-1:0})),s().addToast("info","Rewound to selected turn")}catch(a){t({error:a.message}),s().addToast("error",`Failed to rewind — ${a.message}`)}},restoreSession:async r=>{t({error:null});try{const o=await Ax(r),a=await so(r);t(u=>({sessionDetails:{...u.sessionDetails,[r]:a},sessions:u.sessions.map(f=>f.id===r?{...f,external_thread_id:o.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:a.turns.length>0?a.turns.length-1:0})),s().addToast("info","Restored rewound session")}catch(o){t({error:o.message}),s().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,a)=>{t({error:null});try{const u=await Ix(r,o,a);t(f=>({sessions:[u,...f.sessions]})),await s().selectSession(u.id),s().addToast("success","Branched from selected turn")}catch(u){t({error:u.message}),s().addToast("error",`Failed to branch — ${u.message}`)}},updateRuntimeConfig:async r=>{const o=s().activeSessionId;if(o){t({error:null});try{const a=await Ex(o,JSON.stringify(r));t(u=>({sessions:u.sessions.map(f=>f.id===o?a:f),sessionDetails:u.sessionDetails[o]?{...u.sessionDetails,[o]:{...u.sessionDetails[o],runtime_config:a.runtime_config}}:u.sessionDetails}))}catch(a){t({error:a.message}),s().addToast("error",`Failed to update config — ${a.message}`)}}},refreshActiveSession:async()=>{const r=s().activeSessionId;if(r)try{const o=await so(r);t(a=>({sessionDetails:{...a.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(a.activeTurnIndex,o.turns.length-1):0,sessions:a.sessions.map(u=>u.id===r?{...u,is_running:o.is_running,status:o.status}:u)}))}catch(o){t({error:o.message})}}}),Yx=(t,s)=>({workspaces:[],addWorkspace:async r=>{t({error:null});try{const o=await Dx(r.trim());t(a=>({workspaces:[...a.workspaces,o]})),s().addToast("success",`Workspace added — ${o.path}`)}catch(o){s().addToast("error",`Failed to add workspace — ${o.message}`)}},removeWorkspace:async r=>{t({error:null});try{await Mx(r);const o=await Zm();t({workspaces:o}),s().addToast("info","Workspace hidden")}catch(o){s().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{t({error:null});try{const o=s().lastModelConfig,a=await Zu({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});t(u=>({sessions:[a,...u.sessions]})),await s().selectSession(a.id),s().addLogEntry("INFO",`Session created in ${r} — ${a.id.slice(0,8)}`),s().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{try{const r=await Lx();if(r.cancelled||!r.path)return;await s().addWorkspace(r.path)}catch(r){s().addToast("error",`Failed to pick directory — ${r.message}`)}}}),dr=new Map,wl=new Map,Ju=new Map,ed=new Map;function Xx(t,s){dr.set(t,s)}function Qx(t){dr.delete(t)}function pu(t,s){wl.set(t,s)}function hh(t,s,r){const o=wl.get(t);if(!o)return;const a=dr.get(o);a&&a({source:"agentpane-host",event:s,payload:r})}function mh(t,s){const r=wl.get(t);if(!r)return;const o=dr.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:t,tasks:s}})}function Zx(t,s,r,o){const a=dr.get(t);a&&a({source:"agentpane-host",event:"tool_call",payload:{callId:s,tool:r,name:r,args:o}})}function Jx(t,s,r,o){const a=wl.get(t);if(!a)return;const u=dr.get(a);u&&u({source:"agentpane-host",event:"turn:delta",payload:{sessionId:t,turnId:s,itemId:r,delta:o}})}function e0(t,s){Ju.set(t,s)}function t0(t){Ju.delete(t)}function n0(t,s){ed.set(t,s)}function s0(t){ed.delete(t)}function r0(t){var r;const s=dr.get(t);s&&s({source:"agentpane-host",event:"state_changed",payload:{}}),(r=ed.get(t))==null||r()}function i0(t){var r;const s=dr.get(t);s&&s({source:"agentpane-host",event:"source:updated",payload:{}}),(r=Ju.get(t))==null||r()}const o0=(t,s)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},setWsConnected:r=>t({wsConnected:r}),onTurnCreated:(r,o)=>{t(a=>{const u=a.sessionDetails[r];return!u||o.thread_id?{}:u.turns.some(f=>f.id===o.id)?{}:{sessionDetails:{...a.sessionDetails,[r]:{...u,turns:[...u.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{s().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),t(a=>{const u=ir(a.sessions,r,()=>({is_running:1,status:"running"})),f=a.sessionDetails[r];if(!f)return{sessions:u};const h=f.turns.findIndex(g=>g.id===o);return{sessionDetails:{...a.sessionDetails,[r]:{...Qn(f,o,g=>({...g,status:"running"})),is_running:1,status:"running"}},sessions:u,activeTurnIndex:a.activeSessionId===r&&h>=0?h:a.activeTurnIndex}})},onItemStarted:(r,o,a)=>{s().addLogEntry("DEBUG",`item:started — ${a.type}`),t(u=>{const f=gh(a)?Rr(u.retryStates,o):u.retryStates,h=u.sessionDetails[r];return h?{sessionDetails:{...u.sessionDetails,[r]:Qn(h,o,g=>mu(g,a))},retryStates:f}:{retryStates:f}})},onItemUpdated:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:Qn(f,o,h=>mu(h,a))}}:{}})},onItemCompleted:(r,o,a)=>{if(s().addLogEntry("DEBUG",`item:completed — ${a.type}`),a.type==="background_task"&&(a.status==="completed"||a.status==="failed")){const u=a.data||{},f=u.task_type||"unknown",h=u.description||"background task",m=f==="local_agent"?"Subagent":f==="local_bash"?"Monitor":"Task";a.status==="completed"?s().addToast("success",`${m} completed: ${h}`):s().addToast("error",`${m} failed: ${h}`)}t(u=>{const f=gh(a)?Rr(u.retryStates,o):u.retryStates,h=u.sessionDetails[r];return h?{retryStates:f,sessionDetails:{...u.sessionDetails,[r]:Qn(h,o,g=>{var v,k;let m=mu(g,a);if(a.type==="agent_message"&&((v=a.data)!=null&&v.text)&&(m={...m,agent_response:a.data.text}),a.type==="reasoning"&&((k=a.data)!=null&&k.text)){const x=m.thoughts?m.thoughts+`
|
|
41
|
+
`+a.data.text:a.data.text;m={...m,thoughts:x}}return m})}}:{retryStates:f}})},onItemDelta:(r,o,a,u)=>{Jx(r,o,a,u),t(f=>{const h=Rr(f.retryStates,o),g=f.sessionDetails[r];return g?{sessionDetails:{...f.sessionDetails,[r]:Qn(g,o,m=>l0(m,a,u))},retryStates:h}:{retryStates:h}})},onTurnCompleted:(r,o,a,u,f)=>{const h=(a==null?void 0:a.input_tokens)??0,g=(a==null?void 0:a.output_tokens)??0;s().addLogEntry("INFO",`turn:completed — ${h} in / ${g} out`),hh(r,"turn:completed",{turnId:o,response:f??null}),s().refreshApps(),t(m=>{const v=m.sessionDetails[r],k=v?Qn(v,o,T=>({...T,status:"completed",token_usage:a??T.token_usage??null,...f&&!T.agent_response?{agent_response:f}:{}})):null,x=hu(k),b=x&&k?Ma(k):"active",j=ir(m.sessions,r,T=>({is_running:x,status:b,has_unreviewed:u?1:T.has_unreviewed})),C=Rr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:x,status:b,has_unreviewed:u?1:k.has_unreviewed}},sessions:j,retryStates:C}:{sessions:j,retryStates:C}})},onTokenUsageUpdated:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:Qn(f,o,h=>({...h,token_usage:a}))}}:{}})},onContextUsageUpdated:(r,o)=>{t(a=>{const u=a.sessionDetails[r];return u?{sessionDetails:{...a.sessionDetails,[r]:{...u,contextUsage:o}}}:{}})},onTurnFailed:(r,o,a,u)=>{s().addLogEntry("ERROR",`turn:failed — ${a}`),s().addToast("error",`Turn failed — ${a}`),hh(r,"turn:failed",{turnId:o,error:a}),t(f=>{const h=f.sessionDetails[r],g=a.includes("cancelled")||a.includes("aborted"),m=g?"aborted":"failed",v=h?Qn(h,o,C=>({...C,status:m,error:a,...u?{resume_state:u}:{},items:C.items.map(T=>T.status==="in_progress"?{...T,status:"failed"}:T)})):null,k=hu(v),x=k&&v?Ma(v):g?"active":"failed",b=ir(f.sessions,r,()=>({is_running:k,status:x})),j=Rr(f.retryStates,o);return v?{sessionDetails:{...f.sessionDetails,[r]:{...v,is_running:k,status:x}},sessions:b,retryStates:j}:{sessions:b,retryStates:j}})},onTurnCancelled:(r,o)=>{t(a=>{const u=a.sessionDetails[r],f=u?Qn(u,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,h=hu(f),g=h&&f?Ma(f):"active",m=ir(a.sessions,r,()=>({is_running:h,status:g})),v=Rr(a.retryStates,o);return f?{sessionDetails:{...a.sessionDetails,[r]:{...f,is_running:h,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,a)=>{s().addLogEntry("WARN",`turn:interrupted — ${a.reason}${a.detail?` (${a.detail})`:""}`),s().addToast("warn",a0(a.reason)),t(u=>{const f=u.sessionDetails[r],h=f?Qn(f,o,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:a.reason,interrupted_at:a.interruptedAt,resume_attempts:a.attempts})):null,g=h?Ma(h):"interrupted",m=ir(u.sessions,r,()=>({is_running:1,status:g})),v=Rr(u.retryStates,o);return h?{sessionDetails:{...u.sessionDetails,[r]:{...h,is_running:1,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,a)=>{s().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${a})`),t(u=>{const f=ir(u.sessions,r,()=>({is_running:1,status:"running"})),h=u.sessionDetails[r];return h?{sessionDetails:{...u.sessionDetails,[r]:{...Qn(h,o,g=>({...g,status:"running",error:null,resume_state:"resuming",resume_attempts:a})),is_running:1,status:"running"}},sessions:f}:{sessions:f}})},onTurnResumed:(r,o)=>{s().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),s().addToast("success","Interrupted turn resumed"),t(a=>{const u=a.sessionDetails[r];return u?{sessionDetails:{...a.sessionDetails,[r]:Qn(u,o,f=>({...f,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,a)=>{s().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}`:""})`),t(u=>({retryStates:{...u.retryStates,[o]:a}}))},onSessionTitle:(r,o)=>{t(a=>({sessions:a.sessions.map(u=>u.id===r?{...u,title:o}:u),sessionDetails:a.sessionDetails[r]?{...a.sessionDetails,[r]:{...a.sessionDetails[r],title:o}}:a.sessionDetails}))},onSessionTouched:r=>{t(o=>{const a=o.sessionDetails[r];return{sessions:ir(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,t(a=>{const u=a.sessionDetails[r.id];return{sessions:ir(a.sessions,r.id,()=>o),sessionDetails:u?{...a.sessionDetails,[r.id]:{...u,...o}}:a.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{mh(r,o),t(a=>{if(o.length===0&&!a.backgroundTasks[r])return{};const u={...a.backgroundTasks};return o.length>0?u[r]=o:delete u[r],{backgroundTasks:u}})},onBackgroundTasksSnapshot:r=>{for(const[a,u]of Object.entries(r))mh(a,u);const o={};for(const[a,u]of Object.entries(r))u.length>0&&(o[a]=u);t({backgroundTasks:o})}});function a0(t){switch(t){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";default:return"The agent host restarted — resuming the turn"}}function Ma(t){const s=[...t.turns,...(t.threads??[]).flatMap(r=>r.turns??[])].filter(cr);return s.length>0&&s.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function gh(t){return t.type!=="background_task"&&t.type!=="error"&&t.type!=="interruption"}function Rr(t,s){if(!(s in t))return t;const r={...t};return delete r[s],r}function hu(t){return t&&(t.turns.some(cr)||(t.threads??[]).some(r=>(r.turns??[]).some(cr)))?1:0}function ir(t,s,r){return t.some(o=>o.id===s)?t.map(o=>o.id===s?{...o,...r(o)}:o):t}function Qn(t,s,r){const o=(t.threads??[]).map(a=>(a.turns??[]).some(u=>u.id===s)?{...a,turns:(a.turns??[]).map(u=>u.id===s?r(u):u)}:a);return{...t,turns:t.turns.map(a=>a.id===s?r(a):a),threads:o}}function rg(t,s){for(let r=t.length-1;r>=0;r--)if(t[r].external_item_id===s)return r;return-1}function mu(t,s){const r=rg(t.items,s.external_item_id);if(r>=0){const o=[...t.items];return o[r]=s,{...t,items:o}}if(s.type==="agent_message"){const o=t.items.filter(a=>!(a.type==="agent_message"&&a.id.startsWith("delta-")));return{...t,items:[...o,s]}}return{...t,items:[...t.items,s]}}function l0(t,s,r){var u;const o=rg(t.items,s);if(o>=0){const f=t.items[o],g=(((u=f.data)==null?void 0:u.text)??"")+r,m=[...t.items];return m[o]={...f,data:{...f.data,text:g}},{...t,items:m,agent_response:g}}const a={id:`delta-${s}`,turn_id:t.id,external_item_id:s,type:"agent_message",data:{text:r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...t,items:[...t.items,a],agent_response:r}}function c0(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return fn(`/providers/${t}/models${r}`)}const vh="curl -fsSL https://repoburg.com/install.sh | bash",u0=2e3,ig="agentpane:daemon-seen";function d0(t=dn()){if(!t)return!1;try{const s=new URL(t);return s.protocol==="http:"&&(s.hostname==="localhost"||s.hostname==="127.0.0.1")}catch{return!1}}async function f0(t=dn()){try{return await fetch(`${t}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function p0(){try{return localStorage.getItem(ig)==="true"}catch{return!1}}function h0(){try{localStorage.setItem(ig,"true")}catch{}}function m0(t){let s=!1,r=!1,o=!1,a=null;function u(){a!==null&&(clearTimeout(a),a=null)}async function f(){if(s||r)return;u(),r=!0;const m=await f0();if(r=!1,!s){if(m){h0(),g(),t.onReady();return}o||(o=!0,t.onMissing()),a=setTimeout(()=>void f(),u0)}}function h(){document.visibilityState==="visible"&&f()}function g(){s=!0,u(),window.removeEventListener("focus",h),document.removeEventListener("visibilitychange",h)}return window.addEventListener("focus",h),document.addEventListener("visibilitychange",h),f(),g}const Du=160,Mu=480,g0=240,Ya=220,v0=300,y0=600,x0=36;function Xa(){return typeof window>"u"?y0:Math.max(Ya,Math.round(window.innerWidth*.7))}const yh="agentpane:sidebar-width",xh="agentpane:right-panel-width",gu="agentpane:right-panel-collapsed";function wh(t,s,r,o){try{const a=localStorage.getItem(t);if(a==null)return o;const u=Number(a);return Number.isFinite(u)?Math.min(r,Math.max(s,u)):o}catch{return o}}function w0(t){try{return localStorage.getItem(t)==="true"}catch{return!1}}function kh(t,s){try{localStorage.setItem(t,String(s))}catch{}}const Sh=200,k0=(t,s)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:wh(yh,Du,Mu,g0),rightPanelWidth:wh(xh,Ya,Xa(),v0),rightPanelCollapsed:w0(gu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,daemonStatus:d0()?"checking":"ready",setActiveTurnIndex:r=>t({activeTurnIndex:r}),switchRightTab:r=>{s().rightPanelCollapsed&&kh(gu,!1),t({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>t({showNewSessionDialog:r}),setShowRemoteModal:r=>t({showRemoteModal:r}),setShowCommandPalette:r=>t({showCommandPalette:r}),setShowModelSelector:r=>t({showModelSelector:r}),setDeepLinkThreadId:r=>t({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(Mu,Math.max(Du,Math.round(r)));t({sidebarWidth:o});try{localStorage.setItem(yh,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(Xa(),Math.max(Ya,Math.round(r)));t({rightPanelWidth:o});try{localStorage.setItem(xh,String(o))}catch{}},setRightPanelCollapsed:r=>{t({rightPanelCollapsed:r}),kh(gu,r)},toggleRightPanel:()=>s().setRightPanelCollapsed(!s().rightPanelCollapsed),toggleVscodeView:()=>{if(s().vscodeViewOpen){t({vscodeViewOpen:!1});return}t({vscodeViewOpen:!0,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,a)=>t({vscodeState:r,vscodeId:o,vscodeToken:a}),toggleUsageView:()=>t({usageViewOpen:!s().usageViewOpen}),setDaemonStatus:r=>t({daemonStatus:r}),addToast:(r,o,a,u)=>{const f=Math.random().toString(36).slice(2,9);t(h=>({toasts:[...h.toasts,{id:f,type:r,message:o,undoAction:a,undoLabel:u}]}))},removeToast:r=>{t(o=>({toasts:o.toasts.filter(a=>a.id!==r)}))},addLogEntry:(r,o)=>{const a=new Date().toLocaleTimeString("en-GB",{hour12:!1});t(u=>{const f=[...u.eventLog,{time:a,level:r,message:o}];return f.length>Sh&&f.splice(0,f.length-Sh),{eventLog:f}})},loadModels:async(r,o)=>{if(!s().modelsLoading){t({modelsLoading:!0,models:[]});try{const a=await c0(r,o);t({models:a,modelsLoading:!1})}catch{t({modelsLoading:!1})}}}}),S0=(t,s)=>({createThread:async(r,o)=>{try{await pt(`/sessions/${r}/threads`,o),s().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(a){s().addToast("error",`Failed to create thread — ${a.message}`)}},followupThread:async(r,o,a)=>{try{await pt(`/sessions/${r}/threads/${o}/followup`,{message:a}),s().addLogEntry("INFO",`Thread follow-up — "${a.slice(0,40)}"`)}catch(u){s().addToast("error",`Failed to send follow-up — ${u.message}`)}},cancelThreadTurn:async(r,o)=>{try{await pt(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),s().addLogEntry("INFO","Thread turn cancelled")}catch(a){s().addToast("error",`Failed to cancel thread turn — ${a.message}`)}},resolveThread:async(r,o)=>{try{await bs(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(a){s().addToast("error",`Failed to resolve thread — ${a.message}`)}},reopenThread:async(r,o)=>{try{await bs(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(a){s().addToast("error",`Failed to reopen thread — ${a.message}`)}},shareThread:async(r,o,a)=>{try{const u=await pt(`/sessions/${r}/threads/${o}/summarize`,{directives:a}),f=`
|
|
42
42
|
[Shared from a resolved discussion thread — summary of its findings]
|
|
43
43
|
|
|
44
44
|
\`\`\`QUOTE
|
|
45
45
|
${u.summary}
|
|
46
46
|
\`\`\`
|
|
47
47
|
|
|
48
|
-
`;return t({quotedText:f}),s().addLogEntry("INFO",`Thread shared to main session — "${u.summary.slice(0,40)}"`),s().addToast("success","Thread summary added to your input"),!0}catch(u){return s().addToast("error",`Failed to share thread — ${u.message}`),!1}},deleteThread:async(r,o)=>{try{await gl(`/sessions/${r}/threads/${o}`)}catch(a){s().addToast("error",`Failed to delete thread — ${a.message}`)}},askSidecar:async(r,o)=>{try{return await pt(`/sessions/${r}/sidecar`,{message:o}),s().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(a){return s().addToast("error",`Failed to ask the sidecar — ${a.message}`),!1}},onThreadCreated:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:[...f.threads??[],{...o,turns:[{...a,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:(f.threads??[]).map(h=>h.id===o?{...h,turns:[...h.turns??[],{...a,items:[]}]}:h)}}}:{}})},onThreadResolved:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];if(!f)return{};const h=(f.threads??[]).map(g=>g.id===o?{...g,status:a,resolved_at:a==="resolved"?new Date().toISOString():null}:g);return{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:h}}}})},onThreadDeleted:(r,o)=>{t(a=>{const u=a.sessionDetails[r];return u?{sessionDetails:{...a.sessionDetails,[r]:{...u,threads:(u.threads??[]).filter(f=>f.id!==o)}}}:{}})}}),b0=(t,s)=>({folders:[],loadFolders:async()=>{const r=await Zm();t({folders:r})},createSidebarFolder:async(r,o)=>{try{const a=await Lx(r,o);return t(u=>({folders:[...u.folders,a]})),a}catch(a){return s().addToast("error",`Failed to create folder — ${a.message}`),null}},renameFolder:async(r,o)=>{try{const a=await lh(r,{name:o});t(u=>({folders:u.folders.map(f=>f.id===r?a:f)}))}catch(a){s().addToast("error",`Failed to rename folder — ${a.message}`)}},deleteFolder:async r=>{const o=s().folders,a=s().sessions;t(u=>({folders:u.folders.filter(f=>f.id!==r),sessions:u.sessions.map(f=>f.folder_id===r?{...f,folder_id:null}:f)}));try{await Px(r)}catch(u){t({folders:o,sessions:a}),s().addToast("error",`Failed to delete folder — ${u.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=s().sessions,a=new Map(r.map(u=>[u.id,u]));t(u=>({sessions:u.sessions.map(f=>{const h=a.get(f.id);return h?{...f,folder_id:h.folder_id,sort_order:h.sort_order}:f})}));try{await Ox(r)}catch(u){t({sessions:o}),s().addToast("error",`Failed to save session order — ${u.message}`)}},reorderFolders:async r=>{const o=s().folders,a=new Map(r.map((u,f)=>[u,f]));t(u=>({folders:u.folders.map(f=>a.has(f.id)?{...f,sort_order:a.get(f.id)}:f)}));try{await Promise.all(r.map((u,f)=>lh(u,{sort_order:f})))}catch(u){t({folders:o}),s().addToast("error",`Failed to save folder order — ${u.message}`)}}});function Sh(){return fn("/apps")}function T0(){return fn("/apps/root")}function bh(t){return fn(`/apps/${t}/source`)}function Th(t,s=""){return fn(`/apps/${t}/state?workspace=${encodeURIComponent(s)}`)}function ig(t,s,r=""){return kx(`/apps/${t}/state?workspace=${encodeURIComponent(r)}`,s)}function N0(t){return gl(`/apps/${t}`)}function C0(t){return fn(`/apps/${t}/sessions`)}function _0(){return fn("/apps/examples")}function j0(t){return pt(`/apps/examples/${t}/install`,{})}function E0(t){return pt("/apps",t)}function R0(t,s){return pt("/apps/import",{id:t,files:s})}function A0(t,s,r){return pt(`/apps/mcp/calls/${t}/result`,{result:s,error:null})}function I0(t,s){return pt(`/apps/${t}/edit-session`,s)}function D0(t,s){return pt(`/apps/${t}/files`,s)}async function M0(t,s){const r=await fetch(`${dn()}/api/apps/${t}/files/${encodeURIComponent(s)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${t}/files/${s}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function L0(t,s){const r=await fetch(`${dn()}/api/apps/${t}/files/${encodeURIComponent(s)}`);if(!r.ok)throw new Error(`GET /apps/${t}/files/${s} failed: ${r.status} ${r.statusText}`);return r.blob()}const Wa=new Set;async function mu(t,s){Wa.add(s),await t().loadApps();const r=t().apps.find(o=>o.id===s);t().openAppTab(s),t().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??s}`)}const Du="agentpane:app-workspaces";function P0(){try{const t=JSON.parse(localStorage.getItem(Du)??"{}");return t&&typeof t=="object"?t:{}}catch{return{}}}const O0=(t,s)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:P0(),loadApps:async()=>{try{const[r,o]=await Promise.all([Sh(),T0().catch(()=>null)]);return r.forEach(a=>Wa.add(a.id)),t(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await Sh();for(const o of r)Wa.has(o.id)||(Wa.add(o.id),s().addToast("success",`New mini app discovered: ${o.title}`));t({apps:r})}catch{}},openAppTab:r=>{t(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>{t(o=>{const a=o.openAppTabs.filter(u=>u!==r);return{openAppTabs:a,activeAppTabId:o.activeAppTabId===r?a[a.length-1]??null:o.activeAppTabId}})},setActiveAppTab:r=>t({activeAppTabId:r}),openAppCatalog:()=>t({appCatalogOpen:!0}),closeAppCatalog:()=>t({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{t(a=>{const u={...a.appWorkspaces,[r]:o};try{localStorage.setItem(Du,JSON.stringify(u))}catch{}return{appWorkspaces:u}})},installExampleApp:async r=>{try{return await j0(r),await mu(s,r),!0}catch(o){return s().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await E0(r),await mu(s,r.id),!0}catch(o){return s().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppFolder:async(r,o)=>{try{return await R0(r,o),await mu(s,r),!0}catch(a){return s().addToast("error",`Failed to import app — ${a.message}`),!1}},startAppEdit:async r=>{try{const o=s().lastModelConfig,a=await I0(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});s().sessions.some(u=>u.id===a.id)||t(u=>({sessions:[a,...u.sessions]})),t({activeAppTabId:null}),await s().selectSession(a.id),s().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){s().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=s().apps.find(a=>a.id===r);if(o)try{await ig(r,{pinned:!o.pinned}),await s().loadApps()}catch(a){s().addToast("error",`Failed to pin app — ${a.message}`)}},deleteApp:async r=>{try{await N0(r),t(o=>{const a={...o.appWorkspaces};delete a[r];try{localStorage.setItem(Du,JSON.stringify(a))}catch{}return{apps:o.apps.filter(u=>u.id!==r),openAppTabs:o.openAppTabs.filter(u=>u!==r),activeAppTabId:o.activeAppTabId===r?null:o.activeAppTabId,appWorkspaces:a}}),s().addToast("success",`Mini app deleted: ${r}`)}catch(o){s().addToast("error",`Failed to delete app — ${o.message}`)}}}),Nh=3e3,Bn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Wn=[];let Qa=0,td=0,Za=0,nd=0,Ja=0,sd=0,rd=0;const yo=new Map,xo=new Map;let mi=new Map,pi=0,gi=new Map,gu=!1;function el(t,s,r){if(Wn.push({t:Date.now(),cat:t,msg:s,ms:r}),Wn.length>Nh){const o=Wn.length-Nh;Wn.splice(0,o),jn=Math.max(0,jn-o)}}function hi(t,s,r){el(t,s,r),console.log(`[perf:${t}] ${s}`)}function og(t){hi("note",t)}function ag(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function $0(t,s){let r=mi.get(t);r||mi.set(t,r={n:0,bytes:0}),r.n++,r.bytes+=s;let o=yo.get(t);o||yo.set(t,o={n:0,bytes:0}),o.n++,o.bytes+=s}function z0(){pi++,rd++}function F0(t){gi.set(t,(gi.get(t)??0)+1),xo.set(t,(xo.get(t)??0)+1)}let Ha=0;function U0(){Ha=performance.now()}function B0(){const t=performance.now(),s=Ha?t-Ha:null;Ha=0,requestAnimationFrame(()=>{if(s===null)return;const r=performance.now()-t+s;r>Bn.keypressMs&&hi("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(s)}ms, change→paint ${Math.round(performance.now()-t)}ms)`)})}const W0=5e3,lg=500,Ch=2e3;let jn=0,vu=!1;function H0(t){return pt("/perf-log",{entries:t}).then(()=>{jn+=t.length})}function V0(){if(vu||jn>=Wn.length)return;const t=Wn.slice(jn,jn+lg);t.length!==0&&(vu=!0,H0(t).catch(()=>{Wn.length-jn>Ch&&(jn=Math.max(jn,Wn.length-Ch))}).finally(()=>{vu=!1}))}function _h(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||jn>=Wn.length)return;const t=Wn.slice(jn,jn+lg);if(t.length!==0)try{const s=new Blob([JSON.stringify({entries:t})],{type:"application/json"});navigator.sendBeacon(`${dn()}/api/perf-log`,s),jn+=t.length}catch{}}function q0(){let t=0;for(const o of mi.values())t+=o.n;const s=[];if(t>0){const o=[...mi.entries()].sort((a,u)=>u[1].n-a[1].n).map(([a,u])=>`${a}×${u.n}(${ag(u.bytes)})`).join(", ");s.push(`ws ${t}/s [${o}]`)}pi>0&&s.push(`store ${pi}/s`);const r=[...gi.entries()].sort((o,a)=>a[1]-o[1]).map(([o,a])=>`${o}×${a}`);if(r.length>0&&s.push(`renders ${r.join(" ")}`),s.length>0){const o=s.join(" · ");el("stat",o);const a=[...gi.values()].some(u=>u>Bn.renderPerSecLog);(t>Bn.wsPerSecLog||pi>Bn.storePerSecLog||a)&&console.log(`[perf:stat] ${o}`)}mi=new Map,pi=0,gi=new Map}function G0(t){if(t instanceof Element){const s=t.id?`#${t.id}`:"",r=typeof t.className=="string"&&t.className?`.${t.className.trim().split(/\s+/)[0]}`:"";return`${t.tagName.toLowerCase()}${s}${r}`}return t?"window":"unknown"}function K0(){if(gu||typeof window>"u")return()=>{};gu=!0,Qa=Date.now();const t=[];let s=performance.now()+250;const r=window.setInterval(()=>{const u=performance.now(),f=u-s;s=u+250,f>Bn.lagMs&&(td++,Za=Math.max(Za,f),hi("lag",`event loop blocked ${Math.round(f)}ms`))},250);if(t.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let u=performance.now(),f=0;const h=g=>{const m=g-u;u=g,m>Bn.frameGapMs&&hi("lag",`frame gap ${Math.round(m)}ms`),f=window.requestAnimationFrame(h)};f=window.requestAnimationFrame(h),t.push(()=>window.cancelAnimationFrame(f))}if(typeof PerformanceObserver<"u"){try{const u=new PerformanceObserver(f=>{var h;for(const g of f.getEntries()){const m=g.duration;if(m<Bn.longtaskBufferMs)continue;nd++,Ja=Math.max(Ja,m);const v=(h=g.attribution)==null?void 0:h[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",x=`long task ${Math.round(m)}ms (${k})`;m>=Bn.longtaskLogMs?hi("longtask",x,m):el("longtask",x,m)}});u.observe({type:"longtask",buffered:!1}),t.push(()=>u.disconnect())}catch{}try{const u=new PerformanceObserver(f=>{for(const h of f.getEntries()){const g=h.duration,m=h.processingStart-h.startTime;sd++;const v=`${h.name} ${Math.round(g)}ms (input delay ${Math.round(m)}ms) on ${G0(h.target)}`;g>=Bn.eventLogMs?hi("input",v,g):el("input",v,g)}});u.observe({type:"event",durationThreshold:Bn.eventBufferMs}),t.push(()=>u.disconnect())}catch{}}const o=window.setInterval(q0,1e3);t.push(()=>window.clearInterval(o)),og("perf logger session started");const a=window.setInterval(V0,W0);return t.push(()=>window.clearInterval(a)),window.addEventListener("beforeunload",_h),t.push(()=>window.removeEventListener("beforeunload",_h)),window.__agentPanePerf={dump:cg,reset:ug},()=>{t.forEach(u=>u()),gu=!1}}function cg(){const t=[],s=Qa?Math.round((Date.now()-Qa)/1e3):0;if(t.push("=== agent-pane perf report ==="),t.push(`uptime ${s}s · ${Wn.length} buffered entries`),t.push(`event-loop lag: ${td} blocks >${Bn.lagMs}ms (max ${Math.round(Za)}ms)`),t.push(`long tasks: ${nd} ≥${Bn.longtaskBufferMs}ms (max ${Math.round(Ja)}ms)`),t.push(`slow input events (≥${Bn.eventBufferMs}ms): ${sd}`),t.push(`store updates: ${rd} total`),yo.size>0){t.push("ws messages by type (top 15):");for(const[r,o]of[...yo.entries()].sort((a,u)=>u[1].n-a[1].n).slice(0,15))t.push(` ${r}: ${o.n} msgs, ${ag(o.bytes)}`)}if(xo.size>0){t.push("render counts by component:");for(const[r,o]of[...xo.entries()].sort((a,u)=>u[1]-a[1]))t.push(` ${r}: ${o}`)}t.push("--- last 200 entries ---");for(const r of Wn.slice(-200))t.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return t.join(`
|
|
49
|
-
`)}function
|
|
48
|
+
`;return t({quotedText:f}),s().addLogEntry("INFO",`Thread shared to main session — "${u.summary.slice(0,40)}"`),s().addToast("success","Thread summary added to your input"),!0}catch(u){return s().addToast("error",`Failed to share thread — ${u.message}`),!1}},deleteThread:async(r,o)=>{try{await yl(`/sessions/${r}/threads/${o}`)}catch(a){s().addToast("error",`Failed to delete thread — ${a.message}`)}},askSidecar:async(r,o)=>{try{return await pt(`/sessions/${r}/sidecar`,{message:o}),s().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(a){return s().addToast("error",`Failed to ask the sidecar — ${a.message}`),!1}},onThreadCreated:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:[...f.threads??[],{...o,turns:[{...a,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:(f.threads??[]).map(h=>h.id===o?{...h,turns:[...h.turns??[],{...a,items:[]}]}:h)}}}:{}})},onThreadResolved:(r,o,a)=>{t(u=>{const f=u.sessionDetails[r];if(!f)return{};const h=(f.threads??[]).map(g=>g.id===o?{...g,status:a,resolved_at:a==="resolved"?new Date().toISOString():null}:g);return{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:h}}}})},onThreadDeleted:(r,o)=>{t(a=>{const u=a.sessionDetails[r];return u?{sessionDetails:{...a.sessionDetails,[r]:{...u,threads:(u.threads??[]).filter(f=>f.id!==o)}}}:{}})}}),b0=(t,s)=>({folders:[],loadFolders:async()=>{const r=await Jm();t({folders:r})},createSidebarFolder:async(r,o)=>{try{const a=await Px(r,o);return t(u=>({folders:[...u.folders,a]})),a}catch(a){return s().addToast("error",`Failed to create folder — ${a.message}`),null}},renameFolder:async(r,o)=>{try{const a=await lh(r,{name:o});t(u=>({folders:u.folders.map(f=>f.id===r?a:f)}))}catch(a){s().addToast("error",`Failed to rename folder — ${a.message}`)}},deleteFolder:async r=>{const o=s().folders,a=s().sessions;t(u=>({folders:u.folders.filter(f=>f.id!==r),sessions:u.sessions.map(f=>f.folder_id===r?{...f,folder_id:null}:f)}));try{await Ox(r)}catch(u){t({folders:o,sessions:a}),s().addToast("error",`Failed to delete folder — ${u.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=s().sessions,a=new Map(r.map(u=>[u.id,u]));t(u=>({sessions:u.sessions.map(f=>{const h=a.get(f.id);return h?{...f,folder_id:h.folder_id,sort_order:h.sort_order}:f})}));try{await $x(r)}catch(u){t({sessions:o}),s().addToast("error",`Failed to save session order — ${u.message}`)}},reorderFolders:async r=>{const o=s().folders,a=new Map(r.map((u,f)=>[u,f]));t(u=>({folders:u.folders.map(f=>a.has(f.id)?{...f,sort_order:a.get(f.id)}:f)}));try{await Promise.all(r.map((u,f)=>lh(u,{sort_order:f})))}catch(u){t({folders:o}),s().addToast("error",`Failed to save folder order — ${u.message}`)}}});function bh(){return fn("/apps")}function T0(){return fn("/apps/root")}function Th(t){return fn(`/apps/${t}/source`)}function Nh(t,s=""){return fn(`/apps/${t}/state?workspace=${encodeURIComponent(s)}`)}function og(t,s,r=""){return Sx(`/apps/${t}/state?workspace=${encodeURIComponent(r)}`,s)}function N0(t){return yl(`/apps/${t}`)}function C0(t){return fn(`/apps/${t}/sessions`)}function j0(){return fn("/apps/examples")}function _0(t){return pt(`/apps/examples/${t}/install`,{})}function E0(t){return pt("/apps",t)}function R0(t,s){return pt("/apps/import",{id:t,files:s})}function A0(t,s,r){return pt(`/apps/mcp/calls/${t}/result`,{result:s,error:null})}function I0(t,s){return pt(`/apps/${t}/edit-session`,s)}function D0(t,s){return pt(`/apps/${t}/files`,s)}async function M0(t,s){const r=await fetch(`${dn()}/api/apps/${t}/files/${encodeURIComponent(s)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${t}/files/${s}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function L0(t,s){const r=await fetch(`${dn()}/api/apps/${t}/files/${encodeURIComponent(s)}`);if(!r.ok)throw new Error(`GET /apps/${t}/files/${s} failed: ${r.status} ${r.statusText}`);return r.blob()}const Wa=new Set;async function vu(t,s){Wa.add(s),await t().loadApps();const r=t().apps.find(o=>o.id===s);t().openAppTab(s),t().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??s}`)}const Lu="agentpane:app-workspaces";function P0(){try{const t=JSON.parse(localStorage.getItem(Lu)??"{}");return t&&typeof t=="object"?t:{}}catch{return{}}}const O0=(t,s)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:P0(),loadApps:async()=>{try{const[r,o]=await Promise.all([bh(),T0().catch(()=>null)]);return r.forEach(a=>Wa.add(a.id)),t(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await bh();for(const o of r)Wa.has(o.id)||(Wa.add(o.id),s().addToast("success",`New mini app discovered: ${o.title}`));t({apps:r})}catch{}},openAppTab:r=>{t(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>{t(o=>{const a=o.openAppTabs.filter(u=>u!==r);return{openAppTabs:a,activeAppTabId:o.activeAppTabId===r?a[a.length-1]??null:o.activeAppTabId}})},setActiveAppTab:r=>t({activeAppTabId:r}),openAppCatalog:()=>t({appCatalogOpen:!0}),closeAppCatalog:()=>t({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{t(a=>{const u={...a.appWorkspaces,[r]:o};try{localStorage.setItem(Lu,JSON.stringify(u))}catch{}return{appWorkspaces:u}})},installExampleApp:async r=>{try{return await _0(r),await vu(s,r),!0}catch(o){return s().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await E0(r),await vu(s,r.id),!0}catch(o){return s().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppFolder:async(r,o)=>{try{return await R0(r,o),await vu(s,r),!0}catch(a){return s().addToast("error",`Failed to import app — ${a.message}`),!1}},startAppEdit:async r=>{try{const o=s().lastModelConfig,a=await I0(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});s().sessions.some(u=>u.id===a.id)||t(u=>({sessions:[a,...u.sessions]})),t({activeAppTabId:null}),await s().selectSession(a.id),s().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){s().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=s().apps.find(a=>a.id===r);if(o)try{await og(r,{pinned:!o.pinned}),await s().loadApps()}catch(a){s().addToast("error",`Failed to pin app — ${a.message}`)}},deleteApp:async r=>{try{await N0(r),t(o=>{const a={...o.appWorkspaces};delete a[r];try{localStorage.setItem(Lu,JSON.stringify(a))}catch{}return{apps:o.apps.filter(u=>u.id!==r),openAppTabs:o.openAppTabs.filter(u=>u!==r),activeAppTabId:o.activeAppTabId===r?null:o.activeAppTabId,appWorkspaces:a}}),s().addToast("success",`Mini app deleted: ${r}`)}catch(o){s().addToast("error",`Failed to delete app — ${o.message}`)}}}),Ch=3e3,Bn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Wn=[];let Qa=0,td=0,Za=0,nd=0,Ja=0,sd=0,rd=0;const yo=new Map,xo=new Map;let mi=new Map,pi=0,gi=new Map,yu=!1;function el(t,s,r){if(Wn.push({t:Date.now(),cat:t,msg:s,ms:r}),Wn.length>Ch){const o=Wn.length-Ch;Wn.splice(0,o),_n=Math.max(0,_n-o)}}function hi(t,s,r){el(t,s,r),console.log(`[perf:${t}] ${s}`)}function ag(t){hi("note",t)}function lg(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function $0(t,s){let r=mi.get(t);r||mi.set(t,r={n:0,bytes:0}),r.n++,r.bytes+=s;let o=yo.get(t);o||yo.set(t,o={n:0,bytes:0}),o.n++,o.bytes+=s}function z0(){pi++,rd++}function F0(t){gi.set(t,(gi.get(t)??0)+1),xo.set(t,(xo.get(t)??0)+1)}let Ha=0;function U0(){Ha=performance.now()}function B0(){const t=performance.now(),s=Ha?t-Ha:null;Ha=0,requestAnimationFrame(()=>{if(s===null)return;const r=performance.now()-t+s;r>Bn.keypressMs&&hi("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(s)}ms, change→paint ${Math.round(performance.now()-t)}ms)`)})}const W0=5e3,cg=500,jh=2e3;let _n=0,xu=!1;function H0(t){return pt("/perf-log",{entries:t}).then(()=>{_n+=t.length})}function V0(){if(xu||_n>=Wn.length)return;const t=Wn.slice(_n,_n+cg);t.length!==0&&(xu=!0,H0(t).catch(()=>{Wn.length-_n>jh&&(_n=Math.max(_n,Wn.length-jh))}).finally(()=>{xu=!1}))}function _h(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||_n>=Wn.length)return;const t=Wn.slice(_n,_n+cg);if(t.length!==0)try{const s=new Blob([JSON.stringify({entries:t})],{type:"application/json"});navigator.sendBeacon(`${dn()}/api/perf-log`,s),_n+=t.length}catch{}}function q0(){let t=0;for(const o of mi.values())t+=o.n;const s=[];if(t>0){const o=[...mi.entries()].sort((a,u)=>u[1].n-a[1].n).map(([a,u])=>`${a}×${u.n}(${lg(u.bytes)})`).join(", ");s.push(`ws ${t}/s [${o}]`)}pi>0&&s.push(`store ${pi}/s`);const r=[...gi.entries()].sort((o,a)=>a[1]-o[1]).map(([o,a])=>`${o}×${a}`);if(r.length>0&&s.push(`renders ${r.join(" ")}`),s.length>0){const o=s.join(" · ");el("stat",o);const a=[...gi.values()].some(u=>u>Bn.renderPerSecLog);(t>Bn.wsPerSecLog||pi>Bn.storePerSecLog||a)&&console.log(`[perf:stat] ${o}`)}mi=new Map,pi=0,gi=new Map}function G0(t){if(t instanceof Element){const s=t.id?`#${t.id}`:"",r=typeof t.className=="string"&&t.className?`.${t.className.trim().split(/\s+/)[0]}`:"";return`${t.tagName.toLowerCase()}${s}${r}`}return t?"window":"unknown"}function K0(){if(yu||typeof window>"u")return()=>{};yu=!0,Qa=Date.now();const t=[];let s=performance.now()+250;const r=window.setInterval(()=>{const u=performance.now(),f=u-s;s=u+250,f>Bn.lagMs&&(td++,Za=Math.max(Za,f),hi("lag",`event loop blocked ${Math.round(f)}ms`))},250);if(t.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let u=performance.now(),f=0;const h=g=>{const m=g-u;u=g,m>Bn.frameGapMs&&hi("lag",`frame gap ${Math.round(m)}ms`),f=window.requestAnimationFrame(h)};f=window.requestAnimationFrame(h),t.push(()=>window.cancelAnimationFrame(f))}if(typeof PerformanceObserver<"u"){try{const u=new PerformanceObserver(f=>{var h;for(const g of f.getEntries()){const m=g.duration;if(m<Bn.longtaskBufferMs)continue;nd++,Ja=Math.max(Ja,m);const v=(h=g.attribution)==null?void 0:h[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",x=`long task ${Math.round(m)}ms (${k})`;m>=Bn.longtaskLogMs?hi("longtask",x,m):el("longtask",x,m)}});u.observe({type:"longtask",buffered:!1}),t.push(()=>u.disconnect())}catch{}try{const u=new PerformanceObserver(f=>{for(const h of f.getEntries()){const g=h.duration,m=h.processingStart-h.startTime;sd++;const v=`${h.name} ${Math.round(g)}ms (input delay ${Math.round(m)}ms) on ${G0(h.target)}`;g>=Bn.eventLogMs?hi("input",v,g):el("input",v,g)}});u.observe({type:"event",durationThreshold:Bn.eventBufferMs}),t.push(()=>u.disconnect())}catch{}}const o=window.setInterval(q0,1e3);t.push(()=>window.clearInterval(o)),ag("perf logger session started");const a=window.setInterval(V0,W0);return t.push(()=>window.clearInterval(a)),window.addEventListener("beforeunload",_h),t.push(()=>window.removeEventListener("beforeunload",_h)),window.__agentPanePerf={dump:ug,reset:dg},()=>{t.forEach(u=>u()),yu=!1}}function ug(){const t=[],s=Qa?Math.round((Date.now()-Qa)/1e3):0;if(t.push("=== agent-pane perf report ==="),t.push(`uptime ${s}s · ${Wn.length} buffered entries`),t.push(`event-loop lag: ${td} blocks >${Bn.lagMs}ms (max ${Math.round(Za)}ms)`),t.push(`long tasks: ${nd} ≥${Bn.longtaskBufferMs}ms (max ${Math.round(Ja)}ms)`),t.push(`slow input events (≥${Bn.eventBufferMs}ms): ${sd}`),t.push(`store updates: ${rd} total`),yo.size>0){t.push("ws messages by type (top 15):");for(const[r,o]of[...yo.entries()].sort((a,u)=>u[1].n-a[1].n).slice(0,15))t.push(` ${r}: ${o.n} msgs, ${lg(o.bytes)}`)}if(xo.size>0){t.push("render counts by component:");for(const[r,o]of[...xo.entries()].sort((a,u)=>u[1]-a[1]))t.push(` ${r}: ${o}`)}t.push("--- last 200 entries ---");for(const r of Wn.slice(-200))t.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return t.join(`
|
|
49
|
+
`)}function dg(){Wn.length=0,_n=0,Qa=Date.now(),td=0,Za=0,nd=0,Ja=0,sd=0,rd=0,yo.clear(),xo.clear(),mi=new Map,pi=0,gi=new Map}const Ot={start:K0,note:ag,trackWsEvent:$0,trackStoreUpdate:z0,trackRender:F0,markKeystroke:U0,markInputChange:B0,dump:ug,reset:dg},M=hx()((...t)=>({...Kx(...t),...Yx(...t),...o0(...t),...k0(...t),...S0(...t),...b0(...t),...O0(...t)}));typeof window<"u"&&(M.subscribe(()=>Ot.trackStoreUpdate()),Bx(M));function Pu(t){switch(t){case"claude":return{iconClass:"ic-claude",iconText:"CL"};case"codex":return{iconClass:"ic-codex",iconText:"CX"};case"repoburg":return{iconClass:"ic-repoburg",iconText:"RB"};case"cursor":return{iconClass:"ic-cursor",iconText:"CR"};default:return{iconClass:"ic-codex",iconText:"CX"}}}function Y0(t,s,r=!1,o="working",a=0){if(o==="finished")return"";if(t==="interrupted")return"interrupted";if(s)return"running";if(a>0)return"background";if(r&&t!=="failed")return"queued";switch(t){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function X0(t,s,r=!1,o="working",a=0){if(o==="finished")return"Finished";if(t==="interrupted")return"Interrupted";if(s)return"Running";if(a>0)return"Background";if(r&&t!=="failed")return"Review Pending";switch(t){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return t}}function kl(t,s=0){const r=t.is_running===1,o=t.lifecycle==="finished",a=Pu(t.runtime_type),u=Y0(t.status,r,t.has_unreviewed===1,t.lifecycle,s),f=X0(t.status,r,t.has_unreviewed===1,t.lifecycle,s);return{dot:u,label:f,dotTitle:u==="background"?`${s} background task${s===1?"":"s"} running`:f,iconClass:a.iconClass,iconText:a.iconText,isRunning:r,isFinished:o,backgroundTaskCount:s}}function Sl(t,s,r=!0){w.useEffect(()=>{if(!r)return;function o(a){t.current&&!t.current.contains(a.target)&&s()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[t,s,r])}function id(t,s=!0){w.useEffect(()=>{if(!s)return;function r(o){o.key==="Escape"&&t()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,s])}function od({status:t,size:s=6,title:r}){return l.jsx("span",{className:`status-dot ${t}`,style:s!==6?{width:s,height:s}:void 0,title:r})}function ad({iconClass:t,iconText:s,size:r=20}){return l.jsx("span",{className:`runtime-icon ${t}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:s})}/**
|
|
50
50
|
* @license lucide-react v0.469.0 - ISC
|
|
51
51
|
*
|
|
52
52
|
* This source code is licensed under the ISC license.
|
|
53
53
|
* See the LICENSE file in the root directory of this source tree.
|
|
54
|
-
*/const Q0=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),
|
|
54
|
+
*/const Q0=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fg=(...t)=>t.filter((s,r,o)=>!!s&&s.trim()!==""&&o.indexOf(s)===r).join(" ").trim();/**
|
|
55
55
|
* @license lucide-react v0.469.0 - ISC
|
|
56
56
|
*
|
|
57
57
|
* This source code is licensed under the ISC license.
|
|
@@ -61,12 +61,12 @@ ${u.summary}
|
|
|
61
61
|
*
|
|
62
62
|
* This source code is licensed under the ISC license.
|
|
63
63
|
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
-
*/const
|
|
64
|
+
*/const pg=w.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:a="",children:u,iconNode:f,...h},g)=>w.createElement("svg",{ref:g,...Z0,width:s,height:s,stroke:t,strokeWidth:o?Number(r)*24/Number(s):r,className:fg("lucide",a),...h},[...f.map(([m,v])=>w.createElement(m,v)),...Array.isArray(u)?u:[u]]));/**
|
|
65
65
|
* @license lucide-react v0.469.0 - ISC
|
|
66
66
|
*
|
|
67
67
|
* This source code is licensed under the ISC license.
|
|
68
68
|
* See the LICENSE file in the root directory of this source tree.
|
|
69
|
-
*/const ve=(t,s)=>{const r=w.forwardRef(({className:o,...a},u)=>w.createElement(
|
|
69
|
+
*/const ve=(t,s)=>{const r=w.forwardRef(({className:o,...a},u)=>w.createElement(pg,{ref:u,iconNode:s,className:fg(`lucide-${Q0(t)}`,o),...a}));return r.displayName=`${t}`,r};/**
|
|
70
70
|
* @license lucide-react v0.469.0 - ISC
|
|
71
71
|
*
|
|
72
72
|
* This source code is licensed under the ISC license.
|
|
@@ -91,7 +91,7 @@ ${u.summary}
|
|
|
91
91
|
*
|
|
92
92
|
* This source code is licensed under the ISC license.
|
|
93
93
|
* See the LICENSE file in the root directory of this source tree.
|
|
94
|
-
*/const
|
|
94
|
+
*/const Os=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
95
95
|
* @license lucide-react v0.469.0 - ISC
|
|
96
96
|
*
|
|
97
97
|
* This source code is licensed under the ISC license.
|
|
@@ -106,7 +106,7 @@ ${u.summary}
|
|
|
106
106
|
*
|
|
107
107
|
* This source code is licensed under the ISC license.
|
|
108
108
|
* See the LICENSE file in the root directory of this source tree.
|
|
109
|
-
*/const
|
|
109
|
+
*/const bl=ve("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
110
110
|
* @license lucide-react v0.469.0 - ISC
|
|
111
111
|
*
|
|
112
112
|
* This source code is licensed under the ISC license.
|
|
@@ -136,17 +136,17 @@ ${u.summary}
|
|
|
136
136
|
*
|
|
137
137
|
* This source code is licensed under the ISC license.
|
|
138
138
|
* See the LICENSE file in the root directory of this source tree.
|
|
139
|
-
*/const
|
|
139
|
+
*/const hg=ve("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/**
|
|
140
140
|
* @license lucide-react v0.469.0 - ISC
|
|
141
141
|
*
|
|
142
142
|
* This source code is licensed under the ISC license.
|
|
143
143
|
* See the LICENSE file in the root directory of this source tree.
|
|
144
|
-
*/const
|
|
144
|
+
*/const Eh=ve("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/**
|
|
145
145
|
* @license lucide-react v0.469.0 - ISC
|
|
146
146
|
*
|
|
147
147
|
* This source code is licensed under the ISC license.
|
|
148
148
|
* See the LICENSE file in the root directory of this source tree.
|
|
149
|
-
*/const
|
|
149
|
+
*/const nl=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
150
150
|
* @license lucide-react v0.469.0 - ISC
|
|
151
151
|
*
|
|
152
152
|
* This source code is licensed under the ISC license.
|
|
@@ -156,77 +156,72 @@ ${u.summary}
|
|
|
156
156
|
*
|
|
157
157
|
* This source code is licensed under the ISC license.
|
|
158
158
|
* See the LICENSE file in the root directory of this source tree.
|
|
159
|
-
*/const aw=ve("
|
|
159
|
+
*/const aw=ve("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
160
160
|
* @license lucide-react v0.469.0 - ISC
|
|
161
161
|
*
|
|
162
162
|
* This source code is licensed under the ISC license.
|
|
163
163
|
* See the LICENSE file in the root directory of this source tree.
|
|
164
|
-
*/const lw=ve("
|
|
164
|
+
*/const lw=ve("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
|
|
165
165
|
* @license lucide-react v0.469.0 - ISC
|
|
166
166
|
*
|
|
167
167
|
* This source code is licensed under the ISC license.
|
|
168
168
|
* See the LICENSE file in the root directory of this source tree.
|
|
169
|
-
*/const
|
|
169
|
+
*/const mg=ve("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
170
170
|
* @license lucide-react v0.469.0 - ISC
|
|
171
171
|
*
|
|
172
172
|
* This source code is licensed under the ISC license.
|
|
173
173
|
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
-
*/const
|
|
174
|
+
*/const wu=ve("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
175
175
|
* @license lucide-react v0.469.0 - ISC
|
|
176
176
|
*
|
|
177
177
|
* This source code is licensed under the ISC license.
|
|
178
178
|
* See the LICENSE file in the root directory of this source tree.
|
|
179
|
-
*/const
|
|
179
|
+
*/const Ou=ve("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
180
180
|
* @license lucide-react v0.469.0 - ISC
|
|
181
181
|
*
|
|
182
182
|
* This source code is licensed under the ISC license.
|
|
183
183
|
* See the LICENSE file in the root directory of this source tree.
|
|
184
|
-
*/const
|
|
184
|
+
*/const gg=ve("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
|
|
185
185
|
* @license lucide-react v0.469.0 - ISC
|
|
186
186
|
*
|
|
187
187
|
* This source code is licensed under the ISC license.
|
|
188
188
|
* See the LICENSE file in the root directory of this source tree.
|
|
189
|
-
*/const
|
|
189
|
+
*/const cw=ve("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
190
190
|
* @license lucide-react v0.469.0 - ISC
|
|
191
191
|
*
|
|
192
192
|
* This source code is licensed under the ISC license.
|
|
193
193
|
* See the LICENSE file in the root directory of this source tree.
|
|
194
|
-
*/const uw=ve("
|
|
194
|
+
*/const uw=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
195
195
|
* @license lucide-react v0.469.0 - ISC
|
|
196
196
|
*
|
|
197
197
|
* This source code is licensed under the ISC license.
|
|
198
198
|
* See the LICENSE file in the root directory of this source tree.
|
|
199
|
-
*/const dw=ve("
|
|
199
|
+
*/const dw=ve("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
|
|
200
200
|
* @license lucide-react v0.469.0 - ISC
|
|
201
201
|
*
|
|
202
202
|
* This source code is licensed under the ISC license.
|
|
203
203
|
* See the LICENSE file in the root directory of this source tree.
|
|
204
|
-
*/const
|
|
204
|
+
*/const vg=ve("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
|
|
205
205
|
* @license lucide-react v0.469.0 - ISC
|
|
206
206
|
*
|
|
207
207
|
* This source code is licensed under the ISC license.
|
|
208
208
|
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
-
*/const
|
|
209
|
+
*/const fw=ve("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
210
210
|
* @license lucide-react v0.469.0 - ISC
|
|
211
211
|
*
|
|
212
212
|
* This source code is licensed under the ISC license.
|
|
213
213
|
* See the LICENSE file in the root directory of this source tree.
|
|
214
|
-
*/const pw=ve("
|
|
214
|
+
*/const pw=ve("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
|
|
215
215
|
* @license lucide-react v0.469.0 - ISC
|
|
216
216
|
*
|
|
217
217
|
* This source code is licensed under the ISC license.
|
|
218
218
|
* See the LICENSE file in the root directory of this source tree.
|
|
219
|
-
*/const hw=ve("
|
|
219
|
+
*/const hw=ve("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
220
220
|
* @license lucide-react v0.469.0 - ISC
|
|
221
221
|
*
|
|
222
222
|
* This source code is licensed under the ISC license.
|
|
223
223
|
* See the LICENSE file in the root directory of this source tree.
|
|
224
|
-
*/const mw=ve("
|
|
225
|
-
* @license lucide-react v0.469.0 - ISC
|
|
226
|
-
*
|
|
227
|
-
* This source code is licensed under the ISC license.
|
|
228
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
229
|
-
*/const gw=ve("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
224
|
+
*/const mw=ve("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
230
225
|
* @license lucide-react v0.469.0 - ISC
|
|
231
226
|
*
|
|
232
227
|
* This source code is licensed under the ISC license.
|
|
@@ -236,52 +231,52 @@ ${u.summary}
|
|
|
236
231
|
*
|
|
237
232
|
* This source code is licensed under the ISC license.
|
|
238
233
|
* See the LICENSE file in the root directory of this source tree.
|
|
239
|
-
*/const
|
|
234
|
+
*/const gw=ve("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
240
235
|
* @license lucide-react v0.469.0 - ISC
|
|
241
236
|
*
|
|
242
237
|
* This source code is licensed under the ISC license.
|
|
243
238
|
* See the LICENSE file in the root directory of this source tree.
|
|
244
|
-
*/const
|
|
239
|
+
*/const vw=ve("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
|
|
245
240
|
* @license lucide-react v0.469.0 - ISC
|
|
246
241
|
*
|
|
247
242
|
* This source code is licensed under the ISC license.
|
|
248
243
|
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
-
*/const
|
|
244
|
+
*/const yg=ve("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
250
245
|
* @license lucide-react v0.469.0 - ISC
|
|
251
246
|
*
|
|
252
247
|
* This source code is licensed under the ISC license.
|
|
253
248
|
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
-
*/const
|
|
249
|
+
*/const yw=ve("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
255
250
|
* @license lucide-react v0.469.0 - ISC
|
|
256
251
|
*
|
|
257
252
|
* This source code is licensed under the ISC license.
|
|
258
253
|
* See the LICENSE file in the root directory of this source tree.
|
|
259
|
-
*/const
|
|
254
|
+
*/const Rh=ve("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/**
|
|
260
255
|
* @license lucide-react v0.469.0 - ISC
|
|
261
256
|
*
|
|
262
257
|
* This source code is licensed under the ISC license.
|
|
263
258
|
* See the LICENSE file in the root directory of this source tree.
|
|
264
|
-
*/const
|
|
259
|
+
*/const xw=ve("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
|
|
265
260
|
* @license lucide-react v0.469.0 - ISC
|
|
266
261
|
*
|
|
267
262
|
* This source code is licensed under the ISC license.
|
|
268
263
|
* See the LICENSE file in the root directory of this source tree.
|
|
269
|
-
*/const
|
|
264
|
+
*/const ww=ve("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
|
|
270
265
|
* @license lucide-react v0.469.0 - ISC
|
|
271
266
|
*
|
|
272
267
|
* This source code is licensed under the ISC license.
|
|
273
268
|
* See the LICENSE file in the root directory of this source tree.
|
|
274
|
-
*/const
|
|
269
|
+
*/const kw=ve("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
|
|
275
270
|
* @license lucide-react v0.469.0 - ISC
|
|
276
271
|
*
|
|
277
272
|
* This source code is licensed under the ISC license.
|
|
278
273
|
* See the LICENSE file in the root directory of this source tree.
|
|
279
|
-
*/const
|
|
274
|
+
*/const Sw=ve("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
280
275
|
* @license lucide-react v0.469.0 - ISC
|
|
281
276
|
*
|
|
282
277
|
* This source code is licensed under the ISC license.
|
|
283
278
|
* See the LICENSE file in the root directory of this source tree.
|
|
284
|
-
*/const
|
|
279
|
+
*/const bw=ve("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
285
280
|
* @license lucide-react v0.469.0 - ISC
|
|
286
281
|
*
|
|
287
282
|
* This source code is licensed under the ISC license.
|
|
@@ -291,12 +286,12 @@ ${u.summary}
|
|
|
291
286
|
*
|
|
292
287
|
* This source code is licensed under the ISC license.
|
|
293
288
|
* See the LICENSE file in the root directory of this source tree.
|
|
294
|
-
*/const
|
|
289
|
+
*/const Tw=ve("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
295
290
|
* @license lucide-react v0.469.0 - ISC
|
|
296
291
|
*
|
|
297
292
|
* This source code is licensed under the ISC license.
|
|
298
293
|
* See the LICENSE file in the root directory of this source tree.
|
|
299
|
-
*/const
|
|
294
|
+
*/const Nw=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
|
|
300
295
|
* @license lucide-react v0.469.0 - ISC
|
|
301
296
|
*
|
|
302
297
|
* This source code is licensed under the ISC license.
|
|
@@ -306,12 +301,12 @@ ${u.summary}
|
|
|
306
301
|
*
|
|
307
302
|
* This source code is licensed under the ISC license.
|
|
308
303
|
* See the LICENSE file in the root directory of this source tree.
|
|
309
|
-
*/const
|
|
304
|
+
*/const xg=ve("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
|
|
310
305
|
* @license lucide-react v0.469.0 - ISC
|
|
311
306
|
*
|
|
312
307
|
* This source code is licensed under the ISC license.
|
|
313
308
|
* See the LICENSE file in the root directory of this source tree.
|
|
314
|
-
*/const
|
|
309
|
+
*/const Cw=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
315
310
|
* @license lucide-react v0.469.0 - ISC
|
|
316
311
|
*
|
|
317
312
|
* This source code is licensed under the ISC license.
|
|
@@ -326,17 +321,17 @@ ${u.summary}
|
|
|
326
321
|
*
|
|
327
322
|
* This source code is licensed under the ISC license.
|
|
328
323
|
* See the LICENSE file in the root directory of this source tree.
|
|
329
|
-
*/const
|
|
324
|
+
*/const wg=ve("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
|
|
330
325
|
* @license lucide-react v0.469.0 - ISC
|
|
331
326
|
*
|
|
332
327
|
* This source code is licensed under the ISC license.
|
|
333
328
|
* See the LICENSE file in the root directory of this source tree.
|
|
334
|
-
*/const
|
|
329
|
+
*/const kg=ve("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/**
|
|
335
330
|
* @license lucide-react v0.469.0 - ISC
|
|
336
331
|
*
|
|
337
332
|
* This source code is licensed under the ISC license.
|
|
338
333
|
* See the LICENSE file in the root directory of this source tree.
|
|
339
|
-
*/const
|
|
334
|
+
*/const _w=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
340
335
|
* @license lucide-react v0.469.0 - ISC
|
|
341
336
|
*
|
|
342
337
|
* This source code is licensed under the ISC license.
|
|
@@ -346,7 +341,7 @@ ${u.summary}
|
|
|
346
341
|
*
|
|
347
342
|
* This source code is licensed under the ISC license.
|
|
348
343
|
* See the LICENSE file in the root directory of this source tree.
|
|
349
|
-
*/const
|
|
344
|
+
*/const Ew=ve("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
|
|
350
345
|
* @license lucide-react v0.469.0 - ISC
|
|
351
346
|
*
|
|
352
347
|
* This source code is licensed under the ISC license.
|
|
@@ -356,12 +351,12 @@ ${u.summary}
|
|
|
356
351
|
*
|
|
357
352
|
* This source code is licensed under the ISC license.
|
|
358
353
|
* See the LICENSE file in the root directory of this source tree.
|
|
359
|
-
*/const
|
|
354
|
+
*/const sl=ve("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
|
|
360
355
|
* @license lucide-react v0.469.0 - ISC
|
|
361
356
|
*
|
|
362
357
|
* This source code is licensed under the ISC license.
|
|
363
358
|
* See the LICENSE file in the root directory of this source tree.
|
|
364
|
-
*/const
|
|
359
|
+
*/const Sg=ve("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
365
360
|
* @license lucide-react v0.469.0 - ISC
|
|
366
361
|
*
|
|
367
362
|
* This source code is licensed under the ISC license.
|
|
@@ -371,32 +366,32 @@ ${u.summary}
|
|
|
371
366
|
*
|
|
372
367
|
* This source code is licensed under the ISC license.
|
|
373
368
|
* See the LICENSE file in the root directory of this source tree.
|
|
374
|
-
*/const
|
|
369
|
+
*/const Rw=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
375
370
|
* @license lucide-react v0.469.0 - ISC
|
|
376
371
|
*
|
|
377
372
|
* This source code is licensed under the ISC license.
|
|
378
373
|
* See the LICENSE file in the root directory of this source tree.
|
|
379
|
-
*/const
|
|
374
|
+
*/const Aw=ve("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
|
|
380
375
|
* @license lucide-react v0.469.0 - ISC
|
|
381
376
|
*
|
|
382
377
|
* This source code is licensed under the ISC license.
|
|
383
378
|
* See the LICENSE file in the root directory of this source tree.
|
|
384
|
-
*/const
|
|
379
|
+
*/const Iw=ve("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
385
380
|
* @license lucide-react v0.469.0 - ISC
|
|
386
381
|
*
|
|
387
382
|
* This source code is licensed under the ISC license.
|
|
388
383
|
* See the LICENSE file in the root directory of this source tree.
|
|
389
|
-
*/const
|
|
384
|
+
*/const Dw=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
390
385
|
* @license lucide-react v0.469.0 - ISC
|
|
391
386
|
*
|
|
392
387
|
* This source code is licensed under the ISC license.
|
|
393
388
|
* See the LICENSE file in the root directory of this source tree.
|
|
394
|
-
*/const
|
|
389
|
+
*/const bg=ve("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
395
390
|
* @license lucide-react v0.469.0 - ISC
|
|
396
391
|
*
|
|
397
392
|
* This source code is licensed under the ISC license.
|
|
398
393
|
* See the LICENSE file in the root directory of this source tree.
|
|
399
|
-
*/const
|
|
394
|
+
*/const Mw=ve("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
400
395
|
* @license lucide-react v0.469.0 - ISC
|
|
401
396
|
*
|
|
402
397
|
* This source code is licensed under the ISC license.
|
|
@@ -406,36 +401,36 @@ ${u.summary}
|
|
|
406
401
|
*
|
|
407
402
|
* This source code is licensed under the ISC license.
|
|
408
403
|
* See the LICENSE file in the root directory of this source tree.
|
|
409
|
-
*/const
|
|
404
|
+
*/const Lw=ve("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),Pw=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),Ow=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function $w(t){return t.filter(([s])=>Pw.has(s)).map(([s,r],o)=>[s,{...Object.fromEntries(Object.entries(r).filter(([a])=>Ow.has(a))),key:String(o)}])}function wi({iconNode:t,size:s=14,className:r}){const o=w.useMemo(()=>t?$w(t):[],[t]);return o.length===0?l.jsx(vg,{size:s,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):l.jsx(pg,{iconNode:o,size:s,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var co=Wm();function zw(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return w.useMemo(()=>o=>{s.forEach(a=>a(o))},s)}const Tl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ki(t){const s=Object.prototype.toString.call(t);return s==="[object Window]"||s==="[object global]"}function cd(t){return"nodeType"in t}function xn(t){var s,r;return t?ki(t)?t:cd(t)&&(s=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?s:window:window}function ud(t){const{Document:s}=xn(t);return t instanceof s}function No(t){return ki(t)?!1:t instanceof xn(t).HTMLElement}function Tg(t){return t instanceof xn(t).SVGElement}function Si(t){return t?ki(t)?t.document:cd(t)?ud(t)?t:No(t)||Tg(t)?t.ownerDocument:document:document:document}const ps=Tl?w.useLayoutEffect:w.useEffect;function Nl(t){const s=w.useRef(t);return ps(()=>{s.current=t}),w.useCallback(function(){for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return s.current==null?void 0:s.current(...o)},[])}function Fw(){const t=w.useRef(null),s=w.useCallback((o,a)=>{t.current=setInterval(o,a)},[]),r=w.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[s,r]}function ko(t,s){s===void 0&&(s=[t]);const r=w.useRef(t);return ps(()=>{r.current!==t&&(r.current=t)},s),r}function Co(t,s){const r=w.useRef();return w.useMemo(()=>{const o=t(r.current);return r.current=o,o},[...s])}function rl(t){const s=Nl(t),r=w.useRef(null),o=w.useCallback(a=>{a!==r.current&&(s==null||s(a,r.current)),r.current=a},[]);return[r,o]}function il(t){const s=w.useRef();return w.useEffect(()=>{s.current=t},[t]),s.current}let ku={};function jo(t,s){return w.useMemo(()=>{if(s)return s;const r=ku[t]==null?0:ku[t]+1;return ku[t]=r,t+"-"+r},[t,s])}function Ng(t){return function(s){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((u,f)=>{const h=Object.entries(f);for(const[g,m]of h){const v=u[g];v!=null&&(u[g]=v+t*m)}return u},{...s})}}const yi=Ng(1),ol=Ng(-1);function Uw(t){return"clientX"in t&&"clientY"in t}function Cl(t){if(!t)return!1;const{KeyboardEvent:s}=xn(t.target);return s&&t instanceof s}function Bw(t){if(!t)return!1;const{TouchEvent:s}=xn(t.target);return s&&t instanceof s}function al(t){if(Bw(t)){if(t.touches&&t.touches.length){const{clientX:s,clientY:r}=t.touches[0];return{x:s,y:r}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:s,clientY:r}=t.changedTouches[0];return{x:s,y:r}}}return Uw(t)?{x:t.clientX,y:t.clientY}:null}const $s=Object.freeze({Translate:{toString(t){if(!t)return;const{x:s,y:r}=t;return"translate3d("+(s?Math.round(s):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:s,scaleY:r}=t;return"scaleX("+s+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[$s.Translate.toString(t),$s.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:s,duration:r,easing:o}=t;return s+" "+r+"ms "+o}}}),Ah="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Ww(t){return t.matches(Ah)?t:t.querySelector(Ah)}const Hw={display:"none"};function Vw(t){let{id:s,value:r}=t;return rt.createElement("div",{id:s,style:Hw},r)}function qw(t){let{id:s,announcement:r,ariaLiveType:o="assertive"}=t;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 rt.createElement("div",{id:s,style:a,role:"status","aria-live":o,"aria-atomic":!0},r)}function Gw(){const[t,s]=w.useState("");return{announce:w.useCallback(o=>{o!=null&&s(o)},[]),announcement:t}}const Cg=w.createContext(null);function Kw(t){const s=w.useContext(Cg);w.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(t)},[t,s])}function Yw(){const[t]=w.useState(()=>new Set),s=w.useCallback(o=>(t.add(o),()=>t.delete(o)),[t]);return[w.useCallback(o=>{let{type:a,event:u}=o;t.forEach(f=>{var h;return(h=f[a])==null?void 0:h.call(f,u)})},[t]),s]}const Xw={draggable:`
|
|
410
405
|
To pick up a draggable item, press the space bar.
|
|
411
406
|
While dragging, use the arrow keys to move the item.
|
|
412
407
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
413
|
-
`},Zw={onDragStart(t){let{active:s}=t;return"Picked up draggable item "+s.id+"."},onDragOver(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was moved over droppable area "+r.id+".":"Draggable item "+s.id+" is no longer over a droppable area."},onDragEnd(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was dropped over droppable area "+r.id:"Draggable item "+s.id+" was dropped."},onDragCancel(t){let{active:s}=t;return"Dragging was cancelled. Draggable item "+s.id+" was dropped."}};function Jw(t){let{announcements:s=Zw,container:r,hiddenTextDescribedById:o,screenReaderInstructions:a=Qw}=t;const{announce:u,announcement:f}=Kw(),h=_o("DndLiveRegion"),[g,m]=w.useState(!1);if(w.useEffect(()=>{m(!0)},[]),Yw(w.useMemo(()=>({onDragStart(k){let{active:x}=k;u(s.onDragStart({active:x}))},onDragMove(k){let{active:x,over:b}=k;s.onDragMove&&u(s.onDragMove({active:x,over:b}))},onDragOver(k){let{active:x,over:b}=k;u(s.onDragOver({active:x,over:b}))},onDragEnd(k){let{active:x,over:b}=k;u(s.onDragEnd({active:x,over:b}))},onDragCancel(k){let{active:x,over:b}=k;u(s.onDragCancel({active:x,over:b}))}}),[u,s])),!g)return null;const v=rt.createElement(rt.Fragment,null,rt.createElement(qw,{id:o,value:a.draggable}),rt.createElement(Gw,{id:h,announcement:f}));return r?co.createPortal(v,r):v}var Wt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Wt||(Wt={}));function al(){}function e1(t,s){return w.useMemo(()=>({sensor:t,options:s??{}}),[t,s])}function t1(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return w.useMemo(()=>[...s].filter(o=>o!=null),[...s])}const hs=Object.freeze({x:0,y:0});function n1(t,s){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function s1(t,s){const r=ol(t);if(!r)return"0 0";const o={x:(r.x-s.left)/s.width*100,y:(r.y-s.top)/s.height*100};return o.x+"% "+o.y+"%"}function r1(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return r-o}function i1(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return o-r}function o1(t,s){if(!t||t.length===0)return null;const[r]=t;return r[s]}function Ah(t,s,r){return s===void 0&&(s=t.left),r===void 0&&(r=t.top),{x:s+t.width*.5,y:r+t.height*.5}}const a1=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const a=Ah(s,s.left,s.top),u=[];for(const f of o){const{id:h}=f,g=r.get(h);if(g){const m=n1(Ah(g),a);u.push({id:h,data:{droppableContainer:f,value:m}})}}return u.sort(r1)};function l1(t,s){const r=Math.max(s.top,t.top),o=Math.max(s.left,t.left),a=Math.min(s.left+s.width,t.left+t.width),u=Math.min(s.top+s.height,t.top+t.height),f=a-o,h=u-r;if(o<a&&r<u){const g=s.width*s.height,m=t.width*t.height,v=f*h,k=v/(g+m-v);return Number(k.toFixed(4))}return 0}const c1=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const a=[];for(const u of o){const{id:f}=u,h=r.get(f);if(h){const g=l1(h,s);g>0&&a.push({id:f,data:{droppableContainer:u,value:g}})}}return a.sort(i1)};function u1(t,s,r){return{...t,scaleX:s&&r?s.width/r.width:1,scaleY:s&&r?s.height/r.height:1}}function Cg(t,s){return t&&s?{x:t.left-s.left,y:t.top-s.top}:hs}function d1(t){return function(r){for(var o=arguments.length,a=new Array(o>1?o-1:0),u=1;u<o;u++)a[u-1]=arguments[u];return a.reduce((f,h)=>({...f,top:f.top+t*h.y,bottom:f.bottom+t*h.y,left:f.left+t*h.x,right:f.right+t*h.x}),{...r})}}const f1=d1(1);function _g(t){if(t.startsWith("matrix3d(")){const s=t.slice(9,-1).split(/, /);return{x:+s[12],y:+s[13],scaleX:+s[0],scaleY:+s[5]}}else if(t.startsWith("matrix(")){const s=t.slice(7,-1).split(/, /);return{x:+s[4],y:+s[5],scaleX:+s[0],scaleY:+s[3]}}return null}function p1(t,s,r){const o=_g(s);if(!o)return t;const{scaleX:a,scaleY:u,x:f,y:h}=o,g=t.left-f-(1-a)*parseFloat(r),m=t.top-h-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),v=a?t.width/a:t.width,k=u?t.height/u:t.height;return{width:v,height:k,top:m,right:g+v,bottom:m+k,left:g}}const h1={ignoreTransform:!1};function bi(t,s){s===void 0&&(s=h1);let r=t.getBoundingClientRect();if(s.ignoreTransform){const{transform:m,transformOrigin:v}=xn(t).getComputedStyle(t);m&&(r=p1(r,m,v))}const{top:o,left:a,width:u,height:f,bottom:h,right:g}=r;return{top:o,left:a,width:u,height:f,bottom:h,right:g}}function Ih(t){return bi(t,{ignoreTransform:!0})}function m1(t){const s=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:s,bottom:r,width:s,height:r}}function g1(t,s){return s===void 0&&(s=xn(t).getComputedStyle(t)),s.position==="fixed"}function v1(t,s){s===void 0&&(s=xn(t).getComputedStyle(t));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const u=s[a];return typeof u=="string"?r.test(u):!1})}function dd(t,s){const r=[];function o(a){if(s!=null&&r.length>=s||!a)return r;if(ud(a)&&a.scrollingElement!=null&&!r.includes(a.scrollingElement))return r.push(a.scrollingElement),r;if(!No(a)||bg(a)||r.includes(a))return r;const u=xn(t).getComputedStyle(a);return a!==t&&v1(a,u)&&r.push(a),g1(a,u)?r:o(a.parentNode)}return t?o(t):r}function jg(t){const[s]=dd(t,1);return s??null}function wu(t){return!Sl||!t?null:ki(t)?t:cd(t)?ud(t)||t===Si(t).scrollingElement?window:No(t)?t:null:null}function Eg(t){return ki(t)?t.scrollX:t.scrollLeft}function Rg(t){return ki(t)?t.scrollY:t.scrollTop}function Ou(t){return{x:Eg(t),y:Rg(t)}}var Jt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Jt||(Jt={}));function Ag(t){return!Sl||!t?!1:t===document.scrollingElement}function Ig(t){const s={x:0,y:0},r=Ag(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},a=t.scrollTop<=s.y,u=t.scrollLeft<=s.x,f=t.scrollTop>=o.y,h=t.scrollLeft>=o.x;return{isTop:a,isLeft:u,isBottom:f,isRight:h,maxScroll:o,minScroll:s}}const y1={x:.2,y:.2};function x1(t,s,r,o,a){let{top:u,left:f,right:h,bottom:g}=r;o===void 0&&(o=10),a===void 0&&(a=y1);const{isTop:m,isBottom:v,isLeft:k,isRight:x}=Ig(t),b={x:0,y:0},_={x:0,y:0},C={height:s.height*a.y,width:s.width*a.x};return!m&&u<=s.top+C.height?(b.y=Jt.Backward,_.y=o*Math.abs((s.top+C.height-u)/C.height)):!v&&g>=s.bottom-C.height&&(b.y=Jt.Forward,_.y=o*Math.abs((s.bottom-C.height-g)/C.height)),!x&&h>=s.right-C.width?(b.x=Jt.Forward,_.x=o*Math.abs((s.right-C.width-h)/C.width)):!k&&f<=s.left+C.width&&(b.x=Jt.Backward,_.x=o*Math.abs((s.left+C.width-f)/C.width)),{direction:b,speed:_}}function w1(t){if(t===document.scrollingElement){const{innerWidth:u,innerHeight:f}=window;return{top:0,left:0,right:u,bottom:f,width:u,height:f}}const{top:s,left:r,right:o,bottom:a}=t.getBoundingClientRect();return{top:s,left:r,right:o,bottom:a,width:t.clientWidth,height:t.clientHeight}}function Dg(t){return t.reduce((s,r)=>yi(s,Ou(r)),hs)}function k1(t){return t.reduce((s,r)=>s+Eg(r),0)}function S1(t){return t.reduce((s,r)=>s+Rg(r),0)}function Mg(t,s){if(s===void 0&&(s=bi),!t)return;const{top:r,left:o,bottom:a,right:u}=s(t);jg(t)&&(a<=0||u<=0||r>=window.innerHeight||o>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const b1=[["x",["left","right"],k1],["y",["top","bottom"],S1]];class fd{constructor(s,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=dd(r),a=Dg(o);this.rect={...s},this.width=s.width,this.height=s.height;for(const[u,f,h]of b1)for(const g of f)Object.defineProperty(this,g,{get:()=>{const m=h(o),v=a[u]-m;return this.rect[g]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class po{constructor(s){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=s}add(s,r,o){var a;(a=this.target)==null||a.addEventListener(s,r,o),this.listeners.push([s,r,o])}}function T1(t){const{EventTarget:s}=xn(t);return t instanceof s?t:Si(t)}function ku(t,s){const r=Math.abs(t.x),o=Math.abs(t.y);return typeof s=="number"?Math.sqrt(r**2+o**2)>s:"x"in s&&"y"in s?r>s.x&&o>s.y:"x"in s?r>s.x:"y"in s?o>s.y:!1}var es;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(es||(es={}));function Dh(t){t.preventDefault()}function N1(t){t.stopPropagation()}var et;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(et||(et={}));const Lg={start:[et.Space,et.Enter],cancel:[et.Esc],end:[et.Space,et.Enter,et.Tab]},C1=(t,s)=>{let{currentCoordinates:r}=s;switch(t.code){case et.Right:return{...r,x:r.x+25};case et.Left:return{...r,x:r.x-25};case et.Down:return{...r,y:r.y+25};case et.Up:return{...r,y:r.y-25}}};class Pg{constructor(s){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=s;const{event:{target:r}}=s;this.props=s,this.listeners=new po(Si(r)),this.windowListeners=new po(xn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(es.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:s,onStart:r}=this.props,o=s.node.current;o&&Mg(o),r(hs)}handleKeyDown(s){if(Tl(s)){const{active:r,context:o,options:a}=this.props,{keyboardCodes:u=Lg,coordinateGetter:f=C1,scrollBehavior:h="smooth"}=a,{code:g}=s;if(u.end.includes(g)){this.handleEnd(s);return}if(u.cancel.includes(g)){this.handleCancel(s);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:hs;this.referenceCoordinates||(this.referenceCoordinates=v);const k=f(s,{active:r,context:o.current,currentCoordinates:v});if(k){const x=il(k,v),b={x:0,y:0},{scrollableAncestors:_}=o.current;for(const C of _){const T=s.code,{isTop:I,isRight:A,isLeft:U,isBottom:O,maxScroll:W,minScroll:Z}=Ig(C),Y=w1(C),Q={x:Math.min(T===et.Right?Y.right-Y.width/2:Y.right,Math.max(T===et.Right?Y.left:Y.left+Y.width/2,k.x)),y:Math.min(T===et.Down?Y.bottom-Y.height/2:Y.bottom,Math.max(T===et.Down?Y.top:Y.top+Y.height/2,k.y))},ue=T===et.Right&&!A||T===et.Left&&!U,he=T===et.Down&&!O||T===et.Up&&!I;if(ue&&Q.x!==k.x){const H=C.scrollLeft+x.x,Te=T===et.Right&&H<=W.x||T===et.Left&&H>=Z.x;if(Te&&!x.y){C.scrollTo({left:H,behavior:h});return}Te?b.x=C.scrollLeft-H:b.x=T===et.Right?C.scrollLeft-W.x:C.scrollLeft-Z.x,b.x&&C.scrollBy({left:-b.x,behavior:h});break}else if(he&&Q.y!==k.y){const H=C.scrollTop+x.y,Te=T===et.Down&&H<=W.y||T===et.Up&&H>=Z.y;if(Te&&!x.x){C.scrollTo({top:H,behavior:h});return}Te?b.y=C.scrollTop-H:b.y=T===et.Down?C.scrollTop-W.y:C.scrollTop-Z.y,b.y&&C.scrollBy({top:-b.y,behavior:h});break}}this.handleMove(s,yi(il(k,this.referenceCoordinates),b))}}}handleMove(s,r){const{onMove:o}=this.props;s.preventDefault(),o(r)}handleEnd(s){const{onEnd:r}=this.props;s.preventDefault(),this.detach(),r()}handleCancel(s){const{onCancel:r}=this.props;s.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Pg.activators=[{eventName:"onKeyDown",handler:(t,s,r)=>{let{keyboardCodes:o=Lg,onActivation:a}=s,{active:u}=r;const{code:f}=t.nativeEvent;if(o.start.includes(f)){const h=u.activatorNode.current;return h&&t.target!==h?!1:(t.preventDefault(),a==null||a({event:t.nativeEvent}),!0)}return!1}}];function Mh(t){return!!(t&&"distance"in t)}function Lh(t){return!!(t&&"delay"in t)}class pd{constructor(s,r,o){var a;o===void 0&&(o=T1(s.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=s,this.events=r;const{event:u}=s,{target:f}=u;this.props=s,this.events=r,this.document=Si(f),this.documentListeners=new po(this.document),this.listeners=new po(o),this.windowListeners=new po(xn(f)),this.initialCoordinates=(a=ol(u))!=null?a:hs,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:s,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(s.move.name,this.handleMove,{passive:!1}),this.listeners.add(s.end.name,this.handleEnd),s.cancel&&this.listeners.add(s.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,Dh),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,Dh),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(Lh(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Mh(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(s,r){const{active:o,onPending:a}=this.props;a(o,s,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:s}=this,{onStart:r}=this.props;s&&(this.activated=!0,this.documentListeners.add(es.Click,N1,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(s))}handleMove(s){var r;const{activated:o,initialCoordinates:a,props:u}=this,{onMove:f,options:{activationConstraint:h}}=u;if(!a)return;const g=(r=ol(s))!=null?r:hs,m=il(a,g);if(!o&&h){if(Mh(h)){if(h.tolerance!=null&&ku(m,h.tolerance))return this.handleCancel();if(ku(m,h.distance))return this.handleStart()}if(Lh(h)&&ku(m,h.tolerance))return this.handleCancel();this.handlePending(h,m);return}s.cancelable&&s.preventDefault(),f(g)}handleEnd(){const{onAbort:s,onEnd:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleCancel(){const{onAbort:s,onCancel:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleKeydown(s){s.code===et.Esc&&this.handleCancel()}removeTextSelection(){var s;(s=this.document.getSelection())==null||s.removeAllRanges()}}const _1={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class hd extends pd{constructor(s){const{event:r}=s,o=Si(r.target);super(s,_1,o)}}hd.activators=[{eventName:"onPointerDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const j1={move:{name:"mousemove"},end:{name:"mouseup"}};var $u;(function(t){t[t.RightClick=2]="RightClick"})($u||($u={}));class E1 extends pd{constructor(s){super(s,j1,Si(s.event.target))}}E1.activators=[{eventName:"onMouseDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return r.button===$u.RightClick?!1:(o==null||o({event:r}),!0)}}];const Su={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class R1 extends pd{constructor(s){super(s,Su)}static setup(){return window.addEventListener(Su.move.name,s,{capture:!1,passive:!1}),function(){window.removeEventListener(Su.move.name,s)};function s(){}}}R1.activators=[{eventName:"onTouchStart",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;const{touches:a}=r;return a.length>1?!1:(o==null||o({event:r}),!0)}}];var ho;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(ho||(ho={}));var ll;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(ll||(ll={}));function A1(t){let{acceleration:s,activator:r=ho.Pointer,canScroll:o,draggingRect:a,enabled:u,interval:f=5,order:h=ll.TreeOrder,pointerCoordinates:g,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:x}=t;const b=D1({delta:k,disabled:!u}),[_,C]=Uw(),T=w.useRef({x:0,y:0}),I=w.useRef({x:0,y:0}),A=w.useMemo(()=>{switch(r){case ho.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case ho.DraggableRect:return a}},[r,a,g]),U=w.useRef(null),O=w.useCallback(()=>{const Z=U.current;if(!Z)return;const Y=T.current.x*I.current.x,Q=T.current.y*I.current.y;Z.scrollBy(Y,Q)},[]),W=w.useMemo(()=>h===ll.TreeOrder?[...m].reverse():m,[h,m]);w.useEffect(()=>{if(!u||!m.length||!A){C();return}for(const Z of W){if((o==null?void 0:o(Z))===!1)continue;const Y=m.indexOf(Z),Q=v[Y];if(!Q)continue;const{direction:ue,speed:he}=x1(Z,Q,A,s,x);for(const H of["x","y"])b[H][ue[H]]||(he[H]=0,ue[H]=0);if(he.x>0||he.y>0){C(),U.current=Z,_(O,f),T.current=he,I.current=ue;return}}T.current={x:0,y:0},I.current={x:0,y:0},C()},[s,O,o,C,u,f,JSON.stringify(A),JSON.stringify(b),_,m,W,v,JSON.stringify(x)])}const I1={x:{[Jt.Backward]:!1,[Jt.Forward]:!1},y:{[Jt.Backward]:!1,[Jt.Forward]:!1}};function D1(t){let{delta:s,disabled:r}=t;const o=rl(s);return Co(a=>{if(r||!o||!a)return I1;const u={x:Math.sign(s.x-o.x),y:Math.sign(s.y-o.y)};return{x:{[Jt.Backward]:a.x[Jt.Backward]||u.x===-1,[Jt.Forward]:a.x[Jt.Forward]||u.x===1},y:{[Jt.Backward]:a.y[Jt.Backward]||u.y===-1,[Jt.Forward]:a.y[Jt.Forward]||u.y===1}}},[r,s,o])}function M1(t,s){const r=s!=null?t.get(s):void 0,o=r?r.node.current:null;return Co(a=>{var u;return s==null?null:(u=o??a)!=null?u:null},[o,s])}function L1(t,s){return w.useMemo(()=>t.reduce((r,o)=>{const{sensor:a}=o,u=a.activators.map(f=>({eventName:f.eventName,handler:s(f.handler,o)}));return[...r,...u]},[]),[t,s])}var So;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(So||(So={}));var zu;(function(t){t.Optimized="optimized"})(zu||(zu={}));const Ph=new Map;function P1(t,s){let{dragging:r,dependencies:o,config:a}=s;const[u,f]=w.useState(null),{frequency:h,measure:g,strategy:m}=a,v=w.useRef(t),k=T(),x=ko(k),b=w.useCallback(function(I){I===void 0&&(I=[]),!x.current&&f(A=>A===null?I:A.concat(I.filter(U=>!A.includes(U))))},[x]),_=w.useRef(null),C=Co(I=>{if(k&&!r)return Ph;if(!I||I===Ph||v.current!==t||u!=null){const A=new Map;for(let U of t){if(!U)continue;if(u&&u.length>0&&!u.includes(U.id)&&U.rect.current){A.set(U.id,U.rect.current);continue}const O=U.node.current,W=O?new fd(g(O),O):null;U.rect.current=W,W&&A.set(U.id,W)}return A}return I},[t,u,r,k,g]);return w.useEffect(()=>{v.current=t},[t]),w.useEffect(()=>{k||b()},[r,k]),w.useEffect(()=>{u&&u.length>0&&f(null)},[JSON.stringify(u)]),w.useEffect(()=>{k||typeof h!="number"||_.current!==null||(_.current=setTimeout(()=>{b(),_.current=null},h))},[h,k,b,...o]),{droppableRects:C,measureDroppableContainers:b,measuringScheduled:u!=null};function T(){switch(m){case So.Always:return!1;case So.BeforeDragging:return r;default:return!r}}}function md(t,s){return Co(r=>t?r||(typeof s=="function"?s(t):t):null,[s,t])}function O1(t,s){return md(t,s)}function $1(t){let{callback:s,disabled:r}=t;const o=bl(s),a=w.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(o)},[o,r]);return w.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Nl(t){let{callback:s,disabled:r}=t;const o=bl(s),a=w.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(o)},[r]);return w.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function z1(t){return new fd(bi(t),t)}function Oh(t,s,r){s===void 0&&(s=z1);const[o,a]=w.useState(null);function u(){a(g=>{if(!t)return null;if(t.isConnected===!1){var m;return(m=g??r)!=null?m:null}const v=s(t);return JSON.stringify(g)===JSON.stringify(v)?g:v})}const f=$1({callback(g){if(t)for(const m of g){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(t)){u();break}}}}),h=Nl({callback:u});return ps(()=>{u(),t?(h==null||h.observe(t),f==null||f.observe(document.body,{childList:!0,subtree:!0})):(h==null||h.disconnect(),f==null||f.disconnect())},[t]),o}function F1(t){const s=md(t);return Cg(t,s)}const $h=[];function U1(t){const s=w.useRef(t),r=Co(o=>t?o&&o!==$h&&t&&s.current&&t.parentNode===s.current.parentNode?o:dd(t):$h,[t]);return w.useEffect(()=>{s.current=t},[t]),r}function B1(t){const[s,r]=w.useState(null),o=w.useRef(t),a=w.useCallback(u=>{const f=wu(u.target);f&&r(h=>h?(h.set(f,Ou(f)),new Map(h)):null)},[]);return w.useEffect(()=>{const u=o.current;if(t!==u){f(u);const h=t.map(g=>{const m=wu(g);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,Ou(m)]):null}).filter(g=>g!=null);r(h.length?new Map(h):null),o.current=t}return()=>{f(t),f(u)};function f(h){h.forEach(g=>{const m=wu(g);m==null||m.removeEventListener("scroll",a)})}},[a,t]),w.useMemo(()=>t.length?s?Array.from(s.values()).reduce((u,f)=>yi(u,f),hs):Dg(t):hs,[t,s])}function zh(t,s){s===void 0&&(s=[]);const r=w.useRef(null);return w.useEffect(()=>{r.current=null},s),w.useEffect(()=>{const o=t!==hs;o&&!r.current&&(r.current=t),!o&&r.current&&(r.current=null)},[t]),r.current?il(t,r.current):hs}function W1(t){w.useEffect(()=>{if(!Sl)return;const s=t.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of s)r==null||r()}},t.map(s=>{let{sensor:r}=s;return r}))}function H1(t,s){return w.useMemo(()=>t.reduce((r,o)=>{let{eventName:a,handler:u}=o;return r[a]=f=>{u(f,s)},r},{}),[t,s])}function Og(t){return w.useMemo(()=>t?m1(t):null,[t])}const Fh=[];function V1(t,s){s===void 0&&(s=bi);const[r]=t,o=Og(r?xn(r):null),[a,u]=w.useState(Fh);function f(){u(()=>t.length?t.map(g=>Ag(g)?o:new fd(s(g),g)):Fh)}const h=Nl({callback:f});return ps(()=>{h==null||h.disconnect(),f(),t.forEach(g=>h==null?void 0:h.observe(g))},[t]),a}function $g(t){if(!t)return null;if(t.children.length>1)return t;const s=t.children[0];return No(s)?s:t}function q1(t){let{measure:s}=t;const[r,o]=w.useState(null),a=w.useCallback(m=>{for(const{target:v}of m)if(No(v)){o(k=>{const x=s(v);return k?{...k,width:x.width,height:x.height}:x});break}},[s]),u=Nl({callback:a}),f=w.useCallback(m=>{const v=$g(m);u==null||u.disconnect(),v&&(u==null||u.observe(v)),o(v?s(v):null)},[s,u]),[h,g]=sl(f);return w.useMemo(()=>({nodeRef:h,rect:r,setRef:g}),[r,h,g])}const G1=[{sensor:hd,options:{}},{sensor:Pg,options:{}}],K1={current:{}},qa={draggable:{measure:Ih},droppable:{measure:Ih,strategy:So.WhileDragging,frequency:zu.Optimized},dragOverlay:{measure:bi}};class mo extends Map{get(s){var r;return s!=null&&(r=super.get(s))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(s=>{let{disabled:r}=s;return!r})}getNodeFor(s){var r,o;return(r=(o=this.get(s))==null?void 0:o.node.current)!=null?r:void 0}}const Y1={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:al},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:al,windowRect:null,measuringScheduled:!1},zg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:al,draggableNodes:new Map,over:null,measureDroppableContainers:al},jo=w.createContext(zg),Fg=w.createContext(Y1);function X1(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mo}}}function Q1(t,s){switch(s.type){case Wt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:s.initialCoordinates,active:s.active}};case Wt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:s.coordinates.x-t.draggable.initialCoordinates.x,y:s.coordinates.y-t.draggable.initialCoordinates.y}}};case Wt.DragEnd:case Wt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Wt.RegisterDroppable:{const{element:r}=s,{id:o}=r,a=new mo(t.droppable.containers);return a.set(o,r),{...t,droppable:{...t.droppable,containers:a}}}case Wt.SetDroppableDisabled:{const{id:r,key:o,disabled:a}=s,u=t.droppable.containers.get(r);if(!u||o!==u.key)return t;const f=new mo(t.droppable.containers);return f.set(r,{...u,disabled:a}),{...t,droppable:{...t.droppable,containers:f}}}case Wt.UnregisterDroppable:{const{id:r,key:o}=s,a=t.droppable.containers.get(r);if(!a||o!==a.key)return t;const u=new mo(t.droppable.containers);return u.delete(r),{...t,droppable:{...t.droppable,containers:u}}}default:return t}}function Z1(t){let{disabled:s}=t;const{active:r,activatorEvent:o,draggableNodes:a}=w.useContext(jo),u=rl(o),f=rl(r==null?void 0:r.id);return w.useEffect(()=>{if(!s&&!o&&u&&f!=null){if(!Tl(u)||document.activeElement===u.target)return;const h=a.get(f);if(!h)return;const{activatorNode:g,node:m}=h;if(!g.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[g.current,m.current]){if(!v)continue;const k=Hw(v);if(k){k.focus();break}}})}},[o,s,a,f,u]),null}function Ug(t,s){let{transform:r,...o}=s;return t!=null&&t.length?t.reduce((a,u)=>u({transform:a,...o}),r):r}function J1(t){return w.useMemo(()=>({draggable:{...qa.draggable,...t==null?void 0:t.draggable},droppable:{...qa.droppable,...t==null?void 0:t.droppable},dragOverlay:{...qa.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function ek(t){let{activeNode:s,measure:r,initialRect:o,config:a=!0}=t;const u=w.useRef(!1),{x:f,y:h}=typeof a=="boolean"?{x:a,y:a}:a;ps(()=>{if(!f&&!h||!s){u.current=!1;return}if(u.current||!o)return;const m=s==null?void 0:s.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=Cg(v,o);if(f||(k.x=0),h||(k.y=0),u.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const x=jg(m);x&&x.scrollBy({top:k.y,left:k.x})}},[s,f,h,o,r])}const Cl=w.createContext({...hs,scaleX:1,scaleY:1});var or;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(or||(or={}));const tk=w.memo(function(s){var r,o,a,u;let{id:f,accessibility:h,autoScroll:g=!0,children:m,sensors:v=G1,collisionDetection:k=c1,measuring:x,modifiers:b,..._}=s;const C=w.useReducer(Q1,void 0,X1),[T,I]=C,[A,U]=Xw(),[O,W]=w.useState(or.Uninitialized),Z=O===or.Initialized,{draggable:{active:Y,nodes:Q,translate:ue},droppable:{containers:he}}=T,H=Y!=null?Q.get(Y):null,Te=w.useRef({initial:null,translated:null}),Ne=w.useMemo(()=>{var st;return Y!=null?{id:Y,data:(st=H==null?void 0:H.data)!=null?st:K1,rect:Te}:null},[Y,H]),Le=w.useRef(null),[se,G]=w.useState(null),[X,P]=w.useState(null),J=ko(_,Object.values(_)),q=_o("DndDescribedBy",f),E=w.useMemo(()=>he.getEnabled(),[he]),L=J1(x),{droppableRects:de,measureDroppableContainers:K,measuringScheduled:ce}=P1(E,{dragging:Z,dependencies:[ue.x,ue.y],config:L.droppable}),fe=M1(Q,Y),Pe=w.useMemo(()=>X?ol(X):null,[X]),Ce=Vt(),Ee=O1(fe,L.draggable.measure);ek({activeNode:Y!=null?Q.get(Y):null,config:Ce.layoutShiftCompensation,initialRect:Ee,measure:L.draggable.measure});const je=Oh(fe,L.draggable.measure,Ee),it=Oh(fe?fe.parentElement:null),_e=w.useRef({activatorEvent:null,active:null,activeNode:fe,collisionRect:null,collisions:null,droppableRects:de,draggableNodes:Q,draggingNode:null,draggingNodeRect:null,droppableContainers:he,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),kt=he.getNodeFor((r=_e.current.over)==null?void 0:r.id),ze=q1({measure:L.dragOverlay.measure}),It=(o=ze.nodeRef.current)!=null?o:fe,Fe=Z?(a=ze.rect)!=null?a:je:null,Dt=!!(ze.nodeRef.current&&ze.rect),Rn=F1(Dt?null:je),St=Og(It?xn(It):null),Mt=U1(Z?kt??fe:null),ht=V1(Mt),en=Ug(b,{transform:{x:ue.x-Rn.x,y:ue.y-Rn.y,scaleX:1,scaleY:1},activatorEvent:X,active:Ne,activeNodeRect:je,containerNodeRect:it,draggingNodeRect:Fe,over:_e.current.over,overlayNodeRect:ze.rect,scrollableAncestors:Mt,scrollableAncestorRects:ht,windowRect:St}),V=Pe?yi(Pe,ue):null,pe=B1(Mt),Ue=zh(pe),tt=zh(pe,[je]),mt=yi(en,Ue),gt=Fe?f1(Fe,en):null,Rt=Ne&>?k({active:Ne,collisionRect:gt,droppableRects:de,droppableContainers:E,pointerCoordinates:V}):null,Ht=o1(Rt,"id"),[ut,An]=w.useState(null),Hn=Dt?en:yi(en,tt),Ts=u1(Hn,(u=ut==null?void 0:ut.rect)!=null?u:null,je),ms=w.useRef(null),In=w.useCallback((st,vt)=>{let{sensor:yt,options:qt}=vt;if(Le.current==null)return;const bt=Q.get(Le.current);if(!bt)return;const xt=st.nativeEvent,ot=new yt({active:Le.current,activeNode:bt,event:xt,options:qt,context:_e,onAbort(Je){if(!Q.get(Je))return;const{onDragAbort:oe}=J.current,ie={id:Je};oe==null||oe(ie),A({type:"onDragAbort",event:ie})},onPending(Je,j,oe,ie){if(!Q.get(Je))return;const{onDragPending:$e}=J.current,Be={id:Je,constraint:j,initialCoordinates:oe,offset:ie};$e==null||$e(Be),A({type:"onDragPending",event:Be})},onStart(Je){const j=Le.current;if(j==null)return;const oe=Q.get(j);if(!oe)return;const{onDragStart:ie}=J.current,ge={activatorEvent:xt,active:{id:j,data:oe.data,rect:Te}};co.unstable_batchedUpdates(()=>{ie==null||ie(ge),W(or.Initializing),I({type:Wt.DragStart,initialCoordinates:Je,active:j}),A({type:"onDragStart",event:ge}),G(ms.current),P(xt)})},onMove(Je){I({type:Wt.DragMove,coordinates:Je})},onEnd:Gt(Wt.DragEnd),onCancel:Gt(Wt.DragCancel)});ms.current=ot;function Gt(Je){return async function(){const{active:oe,collisions:ie,over:ge,scrollAdjustedTranslate:$e}=_e.current;let Be=null;if(oe&&$e){const{cancelDrop:De}=J.current;Be={activatorEvent:xt,active:oe,collisions:ie,delta:$e,over:ge},Je===Wt.DragEnd&&typeof De=="function"&&await Promise.resolve(De(Be))&&(Je=Wt.DragCancel)}Le.current=null,co.unstable_batchedUpdates(()=>{I({type:Je}),W(or.Uninitialized),An(null),G(null),P(null),ms.current=null;const De=Je===Wt.DragEnd?"onDragEnd":"onDragCancel";if(Be){const at=J.current[De];at==null||at(Be),A({type:De,event:Be})}})}}},[Q]),Dn=w.useCallback((st,vt)=>(yt,qt)=>{const bt=yt.nativeEvent,xt=Q.get(qt);if(Le.current!==null||!xt||bt.dndKit||bt.defaultPrevented)return;const ot={active:xt};st(yt,vt.options,ot)===!0&&(bt.dndKit={capturedBy:vt.sensor},Le.current=qt,In(yt,vt))},[Q,In]),pn=L1(v,Dn);W1(v),ps(()=>{je&&O===or.Initializing&&W(or.Initialized)},[je,O]),w.useEffect(()=>{const{onDragMove:st}=J.current,{active:vt,activatorEvent:yt,collisions:qt,over:bt}=_e.current;if(!vt||!yt)return;const xt={active:vt,activatorEvent:yt,collisions:qt,delta:{x:mt.x,y:mt.y},over:bt};co.unstable_batchedUpdates(()=>{st==null||st(xt),A({type:"onDragMove",event:xt})})},[mt.x,mt.y]),w.useEffect(()=>{const{active:st,activatorEvent:vt,collisions:yt,droppableContainers:qt,scrollAdjustedTranslate:bt}=_e.current;if(!st||Le.current==null||!vt||!bt)return;const{onDragOver:xt}=J.current,ot=qt.get(Ht),Gt=ot&&ot.rect.current?{id:ot.id,rect:ot.rect.current,data:ot.data,disabled:ot.disabled}:null,Je={active:st,activatorEvent:vt,collisions:yt,delta:{x:bt.x,y:bt.y},over:Gt};co.unstable_batchedUpdates(()=>{An(Gt),xt==null||xt(Je),A({type:"onDragOver",event:Je})})},[Ht]),ps(()=>{_e.current={activatorEvent:X,active:Ne,activeNode:fe,collisionRect:gt,collisions:Rt,droppableRects:de,draggableNodes:Q,draggingNode:It,draggingNodeRect:Fe,droppableContainers:he,over:ut,scrollableAncestors:Mt,scrollAdjustedTranslate:mt},Te.current={initial:Fe,translated:gt}},[Ne,fe,Rt,gt,Q,It,Fe,de,he,ut,Mt,mt]),A1({...Ce,delta:ue,draggingRect:gt,pointerCoordinates:V,scrollableAncestors:Mt,scrollableAncestorRects:ht});const wn=w.useMemo(()=>({active:Ne,activeNode:fe,activeNodeRect:je,activatorEvent:X,collisions:Rt,containerNodeRect:it,dragOverlay:ze,draggableNodes:Q,droppableContainers:he,droppableRects:de,over:ut,measureDroppableContainers:K,scrollableAncestors:Mt,scrollableAncestorRects:ht,measuringConfiguration:L,measuringScheduled:ce,windowRect:St}),[Ne,fe,je,X,Rt,it,ze,Q,he,de,ut,K,Mt,ht,L,ce,St]),Ft=w.useMemo(()=>({activatorEvent:X,activators:pn,active:Ne,activeNodeRect:je,ariaDescribedById:{draggable:q},dispatch:I,draggableNodes:Q,over:ut,measureDroppableContainers:K}),[X,pn,Ne,je,I,q,Q,ut,K]);return rt.createElement(Ng.Provider,{value:U},rt.createElement(jo.Provider,{value:Ft},rt.createElement(Fg.Provider,{value:wn},rt.createElement(Cl.Provider,{value:Ts},m)),rt.createElement(Z1,{disabled:(h==null?void 0:h.restoreFocus)===!1})),rt.createElement(Jw,{...h,hiddenTextDescribedById:q}));function Vt(){const st=(se==null?void 0:se.autoScrollEnabled)===!1,vt=typeof g=="object"?g.enabled===!1:g===!1,yt=Z&&!st&&!vt;return typeof g=="object"?{...g,enabled:yt}:{enabled:yt}}}),nk=w.createContext(null),Uh="button",sk="Draggable";function rk(t){let{id:s,data:r,disabled:o=!1,attributes:a}=t;const u=_o(sk),{activators:f,activatorEvent:h,active:g,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:x}=w.useContext(jo),{role:b=Uh,roleDescription:_="draggable",tabIndex:C=0}=a??{},T=(g==null?void 0:g.id)===s,I=w.useContext(T?Cl:nk),[A,U]=sl(),[O,W]=sl(),Z=H1(f,s),Y=ko(r);ps(()=>(k.set(s,{id:s,key:u,node:A,activatorNode:O,data:Y}),()=>{const ue=k.get(s);ue&&ue.key===u&&k.delete(s)}),[k,s]);const Q=w.useMemo(()=>({role:b,tabIndex:C,"aria-disabled":o,"aria-pressed":T&&b===Uh?!0:void 0,"aria-roledescription":_,"aria-describedby":v.draggable}),[o,b,C,T,_,v.draggable]);return{active:g,activatorEvent:h,activeNodeRect:m,attributes:Q,isDragging:T,listeners:o?void 0:Z,node:A,over:x,setNodeRef:U,setActivatorNodeRef:W,transform:I}}function Bg(){return w.useContext(Fg)}const ik="Droppable",ok={timeout:25};function Wg(t){let{data:s,disabled:r=!1,id:o,resizeObserverConfig:a}=t;const u=_o(ik),{active:f,dispatch:h,over:g,measureDroppableContainers:m}=w.useContext(jo),v=w.useRef({disabled:r}),k=w.useRef(!1),x=w.useRef(null),b=w.useRef(null),{disabled:_,updateMeasurementsFor:C,timeout:T}={...ok,...a},I=ko(C??o),A=w.useCallback(()=>{if(!k.current){k.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(I.current)?I.current:[I.current]),b.current=null},T)},[T]),U=Nl({callback:A,disabled:_||!f}),O=w.useCallback((Q,ue)=>{U&&(ue&&(U.unobserve(ue),k.current=!1),Q&&U.observe(Q))},[U]),[W,Z]=sl(O),Y=ko(s);return w.useEffect(()=>{!U||!W.current||(U.disconnect(),k.current=!1,U.observe(W.current))},[W,U]),w.useEffect(()=>(h({type:Wt.RegisterDroppable,element:{id:o,key:u,disabled:r,node:W,rect:x,data:Y}}),()=>h({type:Wt.UnregisterDroppable,key:u,id:o})),[o]),w.useEffect(()=>{r!==v.current.disabled&&(h({type:Wt.SetDroppableDisabled,id:o,key:u,disabled:r}),v.current.disabled=r)},[o,u,r,h]),{active:f,rect:x,isOver:(g==null?void 0:g.id)===o,node:W,over:g,setNodeRef:Z}}function ak(t){let{animation:s,children:r}=t;const[o,a]=w.useState(null),[u,f]=w.useState(null),h=rl(r);return!r&&!o&&h&&a(h),ps(()=>{if(!u)return;const g=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(g==null||m==null){a(null);return}Promise.resolve(s(m,u)).then(()=>{a(null)})},[s,o,u]),rt.createElement(rt.Fragment,null,r,o?w.cloneElement(o,{ref:f}):null)}const lk={x:0,y:0,scaleX:1,scaleY:1};function ck(t){let{children:s}=t;return rt.createElement(jo.Provider,{value:zg},rt.createElement(Cl.Provider,{value:lk},s))}const uk={position:"fixed",touchAction:"none"},dk=t=>Tl(t)?"transform 250ms ease":void 0,fk=w.forwardRef((t,s)=>{let{as:r,activatorEvent:o,adjustScale:a,children:u,className:f,rect:h,style:g,transform:m,transition:v=dk}=t;if(!h)return null;const k=a?m:{...m,scaleX:1,scaleY:1},x={...uk,width:h.width,height:h.height,top:h.top,left:h.left,transform:Os.Transform.toString(k),transformOrigin:a&&o?s1(o,h):void 0,transition:typeof v=="function"?v(o):v,...g};return rt.createElement(r,{className:f,style:x,ref:s},u)}),pk=t=>s=>{let{active:r,dragOverlay:o}=s;const a={},{styles:u,className:f}=t;if(u!=null&&u.active)for(const[h,g]of Object.entries(u.active))g!==void 0&&(a[h]=r.node.style.getPropertyValue(h),r.node.style.setProperty(h,g));if(u!=null&&u.dragOverlay)for(const[h,g]of Object.entries(u.dragOverlay))g!==void 0&&o.node.style.setProperty(h,g);return f!=null&&f.active&&r.node.classList.add(f.active),f!=null&&f.dragOverlay&&o.node.classList.add(f.dragOverlay),function(){for(const[g,m]of Object.entries(a))r.node.style.setProperty(g,m);f!=null&&f.active&&r.node.classList.remove(f.active)}},hk=t=>{let{transform:{initial:s,final:r}}=t;return[{transform:Os.Transform.toString(s)},{transform:Os.Transform.toString(r)}]},mk={duration:250,easing:"ease",keyframes:hk,sideEffects:pk({styles:{active:{opacity:"0"}}})};function gk(t){let{config:s,draggableNodes:r,droppableContainers:o,measuringConfiguration:a}=t;return bl((u,f)=>{if(s===null)return;const h=r.get(u);if(!h)return;const g=h.node.current;if(!g)return;const m=$g(f);if(!m)return;const{transform:v}=xn(f).getComputedStyle(f),k=_g(v);if(!k)return;const x=typeof s=="function"?s:vk(s);return Mg(g,a.draggable.measure),x({active:{id:u,data:h.data,node:g,rect:a.draggable.measure(g)},draggableNodes:r,dragOverlay:{node:f,rect:a.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:a,transform:k})})}function vk(t){const{duration:s,easing:r,sideEffects:o,keyframes:a}={...mk,...t};return u=>{let{active:f,dragOverlay:h,transform:g,...m}=u;if(!s)return;const v={x:h.rect.left-f.rect.left,y:h.rect.top-f.rect.top},k={scaleX:g.scaleX!==1?f.rect.width*g.scaleX/h.rect.width:1,scaleY:g.scaleY!==1?f.rect.height*g.scaleY/h.rect.height:1},x={x:g.x-v.x,y:g.y-v.y,...k},b=a({...m,active:f,dragOverlay:h,transform:{initial:g,final:x}}),[_]=b,C=b[b.length-1];if(JSON.stringify(_)===JSON.stringify(C))return;const T=o==null?void 0:o({active:f,dragOverlay:h,...m}),I=h.node.animate(b,{duration:s,easing:r,fill:"forwards"});return new Promise(A=>{I.onfinish=()=>{T==null||T(),A()}})}}let Bh=0;function yk(t){return w.useMemo(()=>{if(t!=null)return Bh++,Bh},[t])}const xk=rt.memo(t=>{let{adjustScale:s=!1,children:r,dropAnimation:o,style:a,transition:u,modifiers:f,wrapperElement:h="div",className:g,zIndex:m=999}=t;const{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:b,draggableNodes:_,droppableContainers:C,dragOverlay:T,over:I,measuringConfiguration:A,scrollableAncestors:U,scrollableAncestorRects:O,windowRect:W}=Bg(),Z=w.useContext(Cl),Y=yk(k==null?void 0:k.id),Q=Ug(f,{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:b,draggingNodeRect:T.rect,over:I,overlayNodeRect:T.rect,scrollableAncestors:U,scrollableAncestorRects:O,transform:Z,windowRect:W}),ue=md(x),he=gk({config:o,draggableNodes:_,droppableContainers:C,measuringConfiguration:A}),H=ue?T.setRef:void 0;return rt.createElement(ck,null,rt.createElement(ak,{animation:he},k&&Y?rt.createElement(fk,{key:Y,id:k.id,ref:H,as:h,activatorEvent:v,adjustScale:s,className:g,transition:u,rect:ue,style:{zIndex:m,...a},transform:Q},r):null))});function Hg(t,s,r){const o=t.slice();return o.splice(r<0?o.length+r:r,0,o.splice(s,1)[0]),o}function wk(t,s){return t.reduce((r,o,a)=>{const u=s.get(o);return u&&(r[a]=u),r},Array(t.length))}function La(t){return t!==null&&t>=0}function kk(t,s){if(t===s)return!0;if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==s[r])return!1;return!0}function Sk(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const Vg=t=>{let{rects:s,activeIndex:r,overIndex:o,index:a}=t;const u=Hg(s,o,r),f=s[a],h=u[a];return!h||!f?null:{x:h.left-f.left,y:h.top-f.top,scaleX:h.width/f.width,scaleY:h.height/f.height}},Pa={scaleX:1,scaleY:1},Wh=t=>{var s;let{activeIndex:r,activeNodeRect:o,index:a,rects:u,overIndex:f}=t;const h=(s=u[r])!=null?s:o;if(!h)return null;if(a===r){const m=u[f];return m?{x:0,y:r<f?m.top+m.height-(h.top+h.height):m.top-h.top,...Pa}:null}const g=bk(u,a,r);return a>r&&a<=f?{x:0,y:-h.height-g,...Pa}:a<r&&a>=f?{x:0,y:h.height+g,...Pa}:{x:0,y:0,...Pa}};function bk(t,s,r){const o=t[s],a=t[s-1],u=t[s+1];return o?r<s?a?o.top-(a.top+a.height):u?u.top-(o.top+o.height):0:u?u.top-(o.top+o.height):a?o.top-(a.top+a.height):0:0}const qg="Sortable",Gg=rt.createContext({activeIndex:-1,containerId:qg,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Vg,disabled:{draggable:!1,droppable:!1}});function Hh(t){let{children:s,id:r,items:o,strategy:a=Vg,disabled:u=!1}=t;const{active:f,dragOverlay:h,droppableRects:g,over:m,measureDroppableContainers:v}=Bg(),k=_o(qg,r),x=h.rect!==null,b=w.useMemo(()=>o.map(Z=>typeof Z=="object"&&"id"in Z?Z.id:Z),[o]),_=f!=null,C=f?b.indexOf(f.id):-1,T=m?b.indexOf(m.id):-1,I=w.useRef(b),A=!kk(b,I.current),U=T!==-1&&C===-1||A,O=Sk(u);ps(()=>{A&&_&&v(b)},[A,b,_,v]),w.useEffect(()=>{I.current=b},[b]);const W=w.useMemo(()=>({activeIndex:C,containerId:k,disabled:O,disableTransforms:U,items:b,overIndex:T,useDragOverlay:x,sortedRects:wk(b,g),strategy:a}),[C,k,O.draggable,O.droppable,U,b,T,g,x,a]);return rt.createElement(Gg.Provider,{value:W},s)}const Tk=t=>{let{id:s,items:r,activeIndex:o,overIndex:a}=t;return Hg(r,o,a).indexOf(s)},Nk=t=>{let{containerId:s,isSorting:r,wasDragging:o,index:a,items:u,newIndex:f,previousItems:h,previousContainerId:g,transition:m}=t;return!m||!o||h!==u&&a===f?!1:r?!0:f!==a&&s===g},Ck={duration:200,easing:"ease"},Kg="transform",_k=Os.Transition.toString({property:Kg,duration:0,easing:"linear"}),jk={roleDescription:"sortable"};function Ek(t){let{disabled:s,index:r,node:o,rect:a}=t;const[u,f]=w.useState(null),h=w.useRef(r);return ps(()=>{if(!s&&r!==h.current&&o.current){const g=a.current;if(g){const m=bi(o.current,{ignoreTransform:!0}),v={x:g.left-m.left,y:g.top-m.top,scaleX:g.width/m.width,scaleY:g.height/m.height};(v.x||v.y)&&f(v)}}r!==h.current&&(h.current=r)},[s,r,o,a]),w.useEffect(()=>{u&&f(null)},[u]),u}function Yg(t){let{animateLayoutChanges:s=Nk,attributes:r,disabled:o,data:a,getNewIndex:u=Tk,id:f,strategy:h,resizeObserverConfig:g,transition:m=Ck}=t;const{items:v,containerId:k,activeIndex:x,disabled:b,disableTransforms:_,sortedRects:C,overIndex:T,useDragOverlay:I,strategy:A}=w.useContext(Gg),U=Rk(o,b),O=v.indexOf(f),W=w.useMemo(()=>({sortable:{containerId:k,index:O,items:v},...a}),[k,a,O,v]),Z=w.useMemo(()=>v.slice(v.indexOf(f)),[v,f]),{rect:Y,node:Q,isOver:ue,setNodeRef:he}=Wg({id:f,data:W,disabled:U.droppable,resizeObserverConfig:{updateMeasurementsFor:Z,...g}}),{active:H,activatorEvent:Te,activeNodeRect:Ne,attributes:Le,setNodeRef:se,listeners:G,isDragging:X,over:P,setActivatorNodeRef:J,transform:q}=rk({id:f,data:W,attributes:{...jk,...r},disabled:U.draggable}),E=Fw(he,se),L=!!H,de=L&&!_&&La(x)&&La(T),K=!I&&X,ce=K&&de?q:null,Pe=de?ce??(h??A)({rects:C,activeNodeRect:Ne,activeIndex:x,overIndex:T,index:O}):null,Ce=La(x)&&La(T)?u({id:f,items:v,activeIndex:x,overIndex:T}):O,Ee=H==null?void 0:H.id,je=w.useRef({activeId:Ee,items:v,newIndex:Ce,containerId:k}),it=v!==je.current.items,_e=s({active:H,containerId:k,isDragging:X,isSorting:L,id:f,index:O,items:v,newIndex:je.current.newIndex,previousItems:je.current.items,previousContainerId:je.current.containerId,transition:m,wasDragging:je.current.activeId!=null}),kt=Ek({disabled:!_e,index:O,node:Q,rect:Y});return w.useEffect(()=>{L&&je.current.newIndex!==Ce&&(je.current.newIndex=Ce),k!==je.current.containerId&&(je.current.containerId=k),v!==je.current.items&&(je.current.items=v)},[L,Ce,k,v]),w.useEffect(()=>{if(Ee===je.current.activeId)return;if(Ee!=null&&je.current.activeId==null){je.current.activeId=Ee;return}const It=setTimeout(()=>{je.current.activeId=Ee},50);return()=>clearTimeout(It)},[Ee]),{active:H,activeIndex:x,attributes:Le,data:W,rect:Y,index:O,newIndex:Ce,items:v,isOver:ue,isSorting:L,isDragging:X,listeners:G,node:Q,overIndex:T,over:P,setNodeRef:E,setActivatorNodeRef:J,setDroppableNodeRef:he,setDraggableNodeRef:se,transform:kt??Pe,transition:ze()};function ze(){if(kt||it&&je.current.newIndex===O)return _k;if(!(K&&!Tl(Te)||!m)&&(L||_e))return Os.Transition.toString({...m,property:Kg})}}function Rk(t,s){var r,o;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t==null?void 0:t.draggable)!=null?r:s.draggable,droppable:(o=t==null?void 0:t.droppable)!=null?o:s.droppable}}et.Down,et.Right,et.Up,et.Left;function Oa(t){const[s,r]=w.useState(()=>{try{const a=localStorage.getItem(t);if(a==null)return new Set;const u=JSON.parse(a);return Array.isArray(u)?new Set(u.filter(f=>typeof f=="string")):new Set}catch{return new Set}}),o=w.useCallback(a=>{r(u=>{const f=a(new Set(u));try{localStorage.setItem(t,JSON.stringify([...f]))}catch{}return f})},[t]);return[s,o]}function Ak(t,s=!1){const[r,o]=w.useState(()=>{try{const u=localStorage.getItem(t);return u==="1"?!0:u==="0"?!1:s}catch{return s}}),a=w.useCallback(u=>{o(u);try{localStorage.setItem(t,u?"1":"0")}catch{}},[t]);return[r,a]}async function Fu(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const s=document.createElement("textarea");s.value=t,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const r=document.execCommand("copy");return document.body.removeChild(s),r}catch{return!1}}}function Ik(t){return t.origin_app_id!=null&&!t.user_touched&&!t.starred}function cl(t){return t.replaceAll("\\","/").replace(/\/+$/,"")}function Vh(t,s){if(!s||!t.cwd)return!1;const r=cl(t.cwd),o=cl(s);return r.startsWith(`${o}/`)}function Dk(t,s){const r=new Map;for(const f of s){const h=f.cwd||"(no directory)",g=r.get(h)??[];g.push(f),r.set(h,g)}const o=new Set,a=new Set(t.filter(f=>f.deleted===1).map(f=>f.path)),u=[];for(const f of t){if(f.deleted===1){o.add(f.path);continue}o.add(f.path),u.push({path:f.path,label:f.label||f.path.split("/").pop()||f.path,sessions:r.get(f.path)??[],workspace:f})}for(const[f,h]of r)o.has(f)||a.has(f)||u.push({path:f,label:f==="(no directory)"?"Other":f.split("/").pop()||f,sessions:h,workspace:null});return u}function ul(t){return[...t].sort((s,r)=>r.sort_order-s.sort_order||(s.created_at<r.created_at?1:-1))}function qh(t,s,r,o){const a=s.map(u=>({folder:u,sessions:t.sessions.filter(f=>f.folder_id===u.id),finishedKey:`folder:${u.id}:finished`,hidden:o.has(u.id)}));return a.push({folder:null,sessions:t.sessions.filter(u=>!(u.folder_id&&r.has(u.folder_id))),finishedKey:`${t.path}:finished`,hidden:!1}),a}function Gh(t,s){return{working:ul(t.sessions.filter(r=>r.lifecycle!=="finished")),finished:ul(t.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:s.has(t.finishedKey)}}function $a(t,s){return t.folder_id&&s.has(t.folder_id)?t.folder_id:null}function Mk(t){const s=new Set(t.map(o=>o.name));if(!s.has("New Folder"))return"New Folder";let r=2;for(;s.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function Kh({id:t,children:s,className:r}){const{setNodeRef:o,isOver:a}=Wg({id:t});return l.jsx("div",{ref:o,className:`${r??""}${a?" drop-over":""}`,children:s})}function gd({inputRef:t,value:s,onChange:r,onConfirm:o,onCancel:a}){return l.jsx("input",{ref:t,className:"tree-rename-input",value:s,onChange:u=>r(u.target.value),onClick:u=>u.stopPropagation(),onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{u.key==="Enter"&&o(),u.key==="Escape"&&a()},onBlur:o})}function Lk({s:t,backgroundTaskCount:s,isActive:r,isSelected:o,originApp:a,renaming:u,renameValue:f,renameRef:h,onRenameValue:g,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:x,onToggleStar:b}){const{attributes:_,listeners:C,setNodeRef:T,transform:I,transition:A,isDragging:U}=Yg({id:`s:${t.id}`}),O=xl(t,s);return l.jsxs("div",{ref:T,style:{transform:Os.Transform.toString(I),transition:A},className:`tree-item ${r?"active":""}${o?" selected":""} ${O.isFinished?"tree-item-finished":""}${U?" dragging":""}${t.starred?" tree-item-starred":""}`,..._,...C,onClick:k,onContextMenu:x,children:[l.jsx(ad,{iconClass:O.iconClass,iconText:O.iconText,size:16}),a&&l.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:l.jsx(wi,{iconNode:a.iconNode,size:10})}),u?l.jsx(gd,{inputRef:h,value:f,onChange:g,onConfirm:m,onCancel:v}):l.jsx("span",{className:"tree-label",children:t.title||t.id.slice(0,8)}),!u&&l.jsx("button",{className:`star-btn${t.starred?" starred":""}`,title:t.starred?"Unstar session":"Star session",onClick:W=>{W.stopPropagation(),b()},onPointerDown:W=>W.stopPropagation(),children:l.jsx(nl,{size:10,fill:t.starred?"currentColor":"none"})}),O.dot&&l.jsx(od,{status:O.dot,title:O.dotTitle})]})}function Pk({folder:t,count:s,collapsed:r,renaming:o,renameValue:a,renameRef:u,onRenameValue:f,onRenameConfirm:h,onRenameCancel:g,onToggle:m,onCtxMenu:v,children:k}){const{attributes:x,listeners:b,setNodeRef:_,transform:C,transition:T,isDragging:I,over:A}=Yg({id:`f:${t.id}`}),U=A!=null&&String(A.id).startsWith("s:");return l.jsxs("div",{ref:_,style:{transform:Os.Transform.toString(C),transition:T},className:`tree-folder ${r?"collapsed":""}${I?" dragging":""}`,children:[l.jsx("div",{className:`tree-folder-header${U?" drop-over":""}`,...x,...b,onClick:()=>{o||m()},onContextMenu:v,children:o?l.jsx(gd,{inputRef:u,value:a,onChange:f,onConfirm:h,onCancel:g}):l.jsxs(l.Fragment,{children:[l.jsx(vi,{size:8,className:"tree-chevron"}),l.jsx(Pu,{size:12}),l.jsx("span",{className:"tree-folder-label",children:t.name}),l.jsx("span",{className:"tree-count",children:s})]})}),!r&&l.jsx("div",{className:"tree-folder-children",children:k})]})}function Ok(){const t=M(j=>j.sessions),s=M(j=>j.backgroundTasks),r=M(j=>j.workspaces),o=M(j=>j.folders),a=M(j=>j.activeSessionId),u=M(j=>j.selectSession),f=M(j=>j.deleteSession),h=M(j=>j.removeWorkspace),g=M(j=>j.createSessionInWorkspace),m=M(j=>j.pickAndAddWorkspace),v=M(j=>j.renameSession),k=M(j=>j.markFinished),x=M(j=>j.markFinishedMany),b=M(j=>j.toggleStar),_=M(j=>j.reopenSession),C=M(j=>j.reopenSessionMany),T=M(j=>j.deleteSessionMany),I=M(j=>j.createSidebarFolder),A=M(j=>j.renameFolder),U=M(j=>j.deleteFolder),O=M(j=>j.applyMoves),W=M(j=>j.reorderFolders),Z=M(j=>j.apps),Y=M(j=>j.appsRootPath),Q=M(j=>j.activeAppTabId),ue=M(j=>j.openAppTab),he=M(j=>j.startAppEdit),H=M(j=>j.toggleAppPin),Te=M(j=>j.deleteApp),Ne=M(j=>j.openAppCatalog),[Le,se]=Oa("agentpane:sidebar-ws-collapsed"),[G,X]=Oa("agentpane:sidebar-sub-collapsed"),[P,J]=Oa("agentpane:sidebar-folders-collapsed"),[q,E]=Oa("agentpane:sidebar-app-edits-collapsed"),[L,de]=Ak("agentpane:sidebar-hide-auto-sessions"),[K,ce]=w.useState(null),[fe,Pe]=w.useState(null),[Ce,Ee]=w.useState(""),[je,it]=w.useState(null),[_e,kt]=w.useState(new Set),[ze,It]=w.useState(null),Fe=w.useRef(null),Dt=w.useRef(null),Rn=w.useRef(null),St=w.useRef(!1),Mt=t1(e1(hd,{activationConstraint:{distance:5}}));function ht(){kt(new Set),It(null)}wl(Fe,()=>ce(null),!!K),id(()=>{ce(null),ht()},!!K||_e.size>0),w.useLayoutEffect(()=>{const j=Fe.current;if(!K||!j)return;const oe=8,{offsetWidth:ie,offsetHeight:ge}=j,$e=K.x+ie>window.innerWidth-oe?Math.max(oe,K.x-ie):K.x,Be=K.y+ge>window.innerHeight-oe?Math.max(oe,K.y-ge):K.y;j.style.left=`${$e}px`,j.style.top=`${Be}px`},[K]);const en=w.useMemo(()=>new Map(t.map(j=>[j.id,j])),[t]),V=w.useMemo(()=>new Map(o.map(j=>[j.id,j])),[o]),pe=w.useMemo(()=>{const j=new Map;for(const oe of[...o].sort((ie,ge)=>ie.sort_order-ge.sort_order)){const ie=j.get(oe.workspace_path)??[];ie.push(oe),j.set(oe.workspace_path,ie)}return j},[o]);function Ue(j){se(oe=>{const ie=new Set(oe);return ie.has(j)?ie.delete(j):ie.add(j),ie})}function tt(j){X(oe=>{const ie=new Set(oe);return ie.has(j)?ie.delete(j):ie.add(j),ie})}function mt(j){J(oe=>{const ie=new Set(oe);return ie.has(j)?ie.delete(j):ie.add(j),ie})}function gt(){de(!L),ht()}function Rt(j){E(oe=>{const ie=new Set(oe);return ie.has(j)?ie.delete(j):ie.add(j),ie})}w.useEffect(()=>{fe&&Dt.current&&(Dt.current.focus(),Dt.current.select())},[fe]),w.useEffect(()=>{var j,oe,ie;St.current||!a||(St.current=!0,(ie=(oe=(j=Rn.current)==null?void 0:j.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:oe.scrollIntoView)==null||ie.call(oe,{block:"nearest"}))},[a]);function Ht(j,oe,ie,ge=""){Pe({kind:j,id:oe}),Ee(ie||ge)}function ut(){if(fe){const j=Ce.trim();j&&(fe.kind==="session"?v(fe.id,j):A(fe.id,j))}Pe(null)}function An(){Pe(null),Ee("")}async function Hn(j){const oe=Mk(pe.get(j)??[]),ie=await I(j,oe);ie&&Ht("folder",ie.id,ie.name)}function Ts(j){const oe=String(j.active.id);if(oe.startsWith("s:")){const ie=en.get(oe.slice(2));ie&&it({kind:"session",label:ie.title||ie.id.slice(0,8)})}else if(oe.startsWith("f:")){const ie=V.get(oe.slice(2));ie&&it({kind:"folder",label:ie.name})}}function ms(j){it(null);const{active:oe,over:ie}=j;if(!ie)return;const ge=String(oe.id),$e=String(ie.id);if(ge.startsWith("s:")){const Be=en.get(ge.slice(2));if(!Be)return;const De=Be.cwd||"(no directory)",at=$a(Be,V);let Mn,Ln;if($e.startsWith("f:")){const Xe=V.get($e.slice(2));if(!Xe)return;Mn=Xe.workspace_path,Ln=Xe.id}else if($e.startsWith("s:")){const Xe=en.get($e.slice(2));if(!Xe)return;Mn=Xe.cwd||"(no directory)",Ln=$a(Xe,V)}else if($e.startsWith("c:")){const Xe=$e.slice(2),Tt=Xe.lastIndexOf("|");Mn=Xe.slice(0,Tt);const ss=Xe.slice(Tt+1);Ln=ss==="root"?null:ss}else return;if(Mn!==De)return;const He=ul(t.filter(Xe=>(Xe.cwd||"(no directory)")===Mn&&$a(Xe,V)===Ln)),kn=He.filter(Xe=>Xe.id!==Be.id);let $s=kn.length;if($e.startsWith("s:")){const Xe=kn.findIndex(Tt=>Tt.id===$e.slice(2));Xe>=0&&($s=Xe)}const ts=[...kn.slice(0,$s),Be,...kn.slice($s)],ns=[];if(Ln===at){if(ts.length===He.length&&ts.every((Xe,Tt)=>Xe.id===He[Tt].id))return;ts.forEach((Xe,Tt)=>ns.push({id:Xe.id,folder_id:Ln,sort_order:ts.length-1-Tt}))}else{const Xe=ul(t.filter(Tt=>(Tt.cwd||"(no directory)")===De&&$a(Tt,V)===at)).filter(Tt=>Tt.id!==Be.id);Xe.forEach((Tt,ss)=>ns.push({id:Tt.id,folder_id:at,sort_order:Xe.length-1-ss})),ts.forEach((Tt,ss)=>ns.push({id:Tt.id,folder_id:Ln,sort_order:ts.length-1-ss}))}O(ns);return}if(ge.startsWith("f:")){if(!$e.startsWith("f:"))return;const Be=V.get(ge.slice(2)),De=V.get($e.slice(2));if(!Be||!De||Be.id===De.id||Be.workspace_path!==De.workspace_path)return;const at=(pe.get(Be.workspace_path)??[]).map(He=>He.id),Mn=at.indexOf(Be.id),Ln=at.indexOf(De.id);at.splice(Ln,0,...at.splice(Mn,1)),W(at)}}const In=Y?t.filter(j=>!Vh(j,Y)):t,Dn=new Set(L?In.filter(j=>Ik(j)&&j.id!==a).map(j=>j.id):[]),pn=Dk(r,Dn.size>0?In.filter(j=>!Dn.has(j.id)):In),wn=w.useMemo(()=>{const j=new Map;if(!Y)return j;const oe=cl(Y);for(const ie of t){if(!Vh(ie,Y))continue;const ge=cl(ie.cwd).slice(oe.length+1).split("/")[0],$e=j.get(ge)??[];$e.push(ie),j.set(ge,$e)}return j},[t,Y]);function Ft(j){return{folder:null,sessions:wn.get(j)??[],finishedKey:`app:${j}:finished`,hidden:q.has(j)}}const Vt=[],st=j=>{if(j.hidden)return;const{working:oe,finished:ie,finishedCollapsed:ge}=Gh(j,G);Vt.push(...oe.map($e=>$e.id)),ge||Vt.push(...ie.map($e=>$e.id))};for(const j of pn){if(Le.has(j.path))continue;const oe=pe.get(j.path)??[],ie=new Set(oe.map(ge=>ge.id));qh(j,oe,ie,P).forEach(st)}Z.forEach(j=>st(Ft(j.id)));const vt=t.filter(j=>_e.has(j.id)),yt=vt.filter(j=>j.lifecycle!=="finished").map(j=>j.id),qt=vt.filter(j=>j.lifecycle==="finished").map(j=>j.id);function bt(j,oe){if(oe.metaKey||oe.ctrlKey){oe.preventDefault(),It(j.id),kt(ie=>{const ge=new Set(ie);return ge.has(j.id)?ge.delete(j.id):ge.add(j.id),ge});return}if(oe.shiftKey){oe.preventDefault();const ie=ze??j.id;It(ie);const ge=Vt.indexOf(ie),$e=Vt.indexOf(j.id);if(ge>=0&&$e>=0){const[Be,De]=ge<$e?[ge,$e]:[$e,ge];kt(new Set(Vt.slice(Be,De+1)))}return}ht(),It(j.id),u(j.id)}function xt(j,oe){oe.preventDefault();const ie=_e.has(j.id)&&_e.size>1;_e.has(j.id)||(kt(new Set),It(j.id)),ce({x:oe.clientX,y:oe.clientY,type:"session",sessionId:j.id,sessionTitle:j.title,sessionLifecycle:j.lifecycle,sessionExternalId:j.external_thread_id,multi:ie})}function ot(j){var ie;const oe=j.origin_app_id?Z.find(ge=>ge.id===j.origin_app_id):null;return l.jsx(Lk,{s:j,backgroundTaskCount:((ie=s[j.id])==null?void 0:ie.length)??0,isActive:a===j.id,isSelected:_e.has(j.id),originApp:oe??null,renaming:(fe==null?void 0:fe.kind)==="session"&&fe.id===j.id,renameValue:Ce,renameRef:Dt,onRenameValue:Ee,onRenameConfirm:ut,onRenameCancel:An,onSelect:ge=>bt(j,ge),onToggleStar:()=>b(j.id),onCtxMenu:ge=>xt(j,ge)},j.id)}function Gt(j){var ie;const oe=xl(j,((ie=s[j.id])==null?void 0:ie.length)??0);return l.jsxs("div",{className:`sidebar-app-edit-row${a===j.id?" active":""}${_e.has(j.id)?" selected":""}${oe.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:ge=>bt(j,ge),onContextMenu:ge=>xt(j,ge),children:[l.jsx(ad,{iconClass:oe.iconClass,iconText:oe.iconText,size:14}),(fe==null?void 0:fe.kind)==="session"&&fe.id===j.id?l.jsx(gd,{inputRef:Dt,value:Ce,onChange:Ee,onConfirm:ut,onCancel:An}):l.jsx("span",{className:"tree-label",children:j.title||j.id.slice(0,8)}),oe.dot&&l.jsx(od,{status:oe.dot,title:oe.dotTitle})]},j.id)}function Je(j,oe="workspace"){const{working:ie,finished:ge,finishedCollapsed:$e}=Gh(j,G),Be=oe==="workspace"?ot:Gt,De=l.jsxs(l.Fragment,{children:[ie.length===0&&ge.length===0?l.jsx("div",{className:"tree-empty",children:"No sessions"}):ie.map(Be),ge.length>0&&l.jsxs("div",{className:`tree-subgroup ${$e?"collapsed":""}`,children:[l.jsxs("div",{className:"tree-subgroup-header",onClick:()=>tt(j.finishedKey),children:[l.jsx(vi,{size:8,className:"tree-chevron"}),l.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),l.jsx("span",{className:"tree-subgroup-count",children:ge.length})]}),!$e&&l.jsx("div",{className:"tree-subgroup-items",children:ge.map(Be)})]})]});if(oe==="app")return De;const at=[...ie,...ge].map(Mn=>`s:${Mn.id}`);return l.jsx(Hh,{items:at,strategy:Wh,children:De})}return l.jsxs("div",{className:"ide-sidebar",ref:Rn,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${L?" active":""}`,title:L?`Show automatic sessions (${Dn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":L?"Show automatic sessions":"Hide automatic sessions","aria-pressed":L,onClick:gt,children:L?l.jsx(ew,{size:14}):l.jsx(ur,{size:14})}),l.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:l.jsx(Dr,{size:14})})]})]}),l.jsxs(tk,{sensors:Mt,collisionDetection:a1,onDragStart:Ts,onDragEnd:ms,children:[pn.length===0?l.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):pn.map(j=>{const oe=Le.has(j.path),ie=pe.get(j.path)??[],ge=new Set(ie.map(De=>De.id)),$e=qh(j,ie,ge,P),Be=$e[$e.length-1];return l.jsxs("div",{className:`tree-section ${oe?"collapsed":""}`,children:[l.jsxs("div",{className:"tree-section-header",onClick:()=>Ue(j.path),onContextMenu:De=>{De.preventDefault(),ce({x:De.clientX,y:De.clientY,type:"workspace",path:j.path})},children:[l.jsx(vi,{size:9,className:"tree-chevron"}),l.jsx(Pu,{size:14}),l.jsx("span",{className:"tree-section-label",children:j.label}),l.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:De=>{De.stopPropagation(),g(j.path)},children:l.jsx(Dr,{size:11})}),l.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:De=>{De.stopPropagation(),Hn(j.path)},children:l.jsx(yu,{size:11})}),l.jsx("span",{className:"tree-count",children:j.sessions.length})]}),!oe&&l.jsxs("div",{className:"tree-children",children:[l.jsx(Hh,{items:ie.map(De=>`f:${De.id}`),strategy:Wh,children:$e.filter(De=>De.folder).map(De=>l.jsx(Pk,{folder:De.folder,count:De.sessions.length,collapsed:De.hidden,renaming:(fe==null?void 0:fe.kind)==="folder"&&fe.id===De.folder.id,renameValue:Ce,renameRef:Dt,onRenameValue:Ee,onRenameConfirm:ut,onRenameCancel:An,onToggle:()=>mt(De.folder.id),onCtxMenu:at=>{at.preventDefault(),ce({x:at.clientX,y:at.clientY,type:"folder",folderId:De.folder.id,folderName:De.folder.name})},children:l.jsx(Kh,{id:`c:${j.path}|${De.folder.id}`,children:Je(De)})},De.folder.id))}),l.jsx(Kh,{id:`c:${j.path}|root`,children:Je(Be)})]})]},j.path)}),l.jsx(xk,{children:je&&l.jsxs("div",{className:"drag-overlay",children:[je.kind==="folder"&&l.jsx(Pu,{size:12}),l.jsx("span",{children:je.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:()=>Ne(),children:l.jsx(Dr,{size:14})})]}),Z.length===0&&l.jsx("div",{className:"tree-empty",children:"No apps yet"}),Z.map(j=>{const oe=Ft(j.id),ie=oe.sessions.length>0&&!oe.hidden;return l.jsxs("div",{className:"sidebar-app-block",children:[l.jsxs("div",{className:`sidebar-app-row${Q===j.id?" active":""}`,title:j.description??void 0,onClick:()=>ue(j.id),onContextMenu:ge=>{ge.preventDefault(),ce({x:ge.clientX,y:ge.clientY,type:"app",appId:j.id,appPinned:j.pinned})},children:[oe.sessions.length>0&&l.jsx("button",{className:`sidebar-app-chevron${ie?"":" closed"}`,title:"Edit sessions of this app",onClick:ge=>{ge.stopPropagation(),Rt(j.id)},children:l.jsx(vi,{size:10,className:"tree-chevron"})}),l.jsx(wi,{iconNode:j.iconNode,size:14,className:"sidebar-app-icon"}),l.jsx("span",{className:"tree-label",children:j.title}),oe.sessions.length>0&&l.jsx("span",{className:"sidebar-app-count",children:oe.sessions.length}),j.pinned&&l.jsx(nl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ie&&l.jsx("div",{className:"sidebar-app-edits",children:Je(oe,"app")})]},j.id)})]}),l.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[l.jsx(yu,{size:14}),l.jsx("span",{children:"Add workspace"})]}),K&&l.jsxs("div",{ref:Fe,className:"ctx-menu",style:{position:"fixed",left:K.x,top:K.y,zIndex:500},children:[K.type==="workspace"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{g(K.path),ce(null)},children:[l.jsx(Dr,{size:12})," New Session"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Hn(K.path),ce(null)},children:[l.jsx(yu,{size:12})," New Folder"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{h(K.path),ce(null)},children:[l.jsx(fs,{size:12})," Hide Workspace"]})]}),K.type==="folder"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Ht("folder",K.folderId,K.folderName??""),ce(null)},children:[l.jsx(Va,{size:12})," Rename Folder"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{U(K.folderId),ce(null)},children:[l.jsx(fs,{size:12})," Delete Folder"]})]}),K.type==="session"&&!K.multi&&l.jsx(l.Fragment,{children:K.sessionLifecycle!=="finished"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Ht("session",K.sessionId,K.sessionTitle??""),ce(null)},children:[l.jsx(Va,{size:12})," Rename"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{k(K.sessionId),ce(null)},children:[l.jsx(tl,{size:12})," Mark as Finished"]}),l.jsxs("div",{className:`ctx-menu-item${K.sessionExternalId?"":" ctx-disabled"}`,title:K.sessionExternalId?void 0:"Session not started",onClick:()=>{K.sessionExternalId&&(Fu(K.sessionExternalId),ce(null))},children:[l.jsx(Lu,{size:12})," Copy Session ID"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(K.sessionId),ce(null)},children:[l.jsx(fs,{size:12})," Delete Session"]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{_(K.sessionId),ce(null)},children:[l.jsx(wo,{size:12})," Reopen"]}),l.jsxs("div",{className:`ctx-menu-item${K.sessionExternalId?"":" ctx-disabled"}`,title:K.sessionExternalId?void 0:"Session not started",onClick:()=>{K.sessionExternalId&&(Fu(K.sessionExternalId),ce(null))},children:[l.jsx(Lu,{size:12})," Copy Session ID"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(K.sessionId),ce(null)},children:[l.jsx(fs,{size:12})," Delete Session"]})]})}),K.type==="session"&&K.multi&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-header",children:[vt.length," sessions selected"]}),yt.length>0&&l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{x(yt),ce(null),ht()},children:[l.jsx(tl,{size:12})," Mark ",yt.length," as Finished"]}),qt.length>0&&l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{C(qt),ce(null),ht()},children:[l.jsx(wo,{size:12})," Reopen ",qt.length]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{T([..._e]),ce(null),ht()},children:[l.jsx(fs,{size:12})," Delete ",vt.length," Sessions"]})]}),K.type==="app"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{he(K.appId),ce(null)},children:[l.jsx(Va,{size:12})," Edit App"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{H(K.appId),ce(null)},children:[l.jsx(nl,{size:12})," ",K.appPinned?"Unpin":"Pin"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{Te(K.appId),ce(null)},children:[l.jsx(fs,{size:12})," Delete App"]})]})]})]})}function $k(){const t=M(b=>b.openTabs),s=M(b=>b.activeSessionId),r=M(b=>b.sessions),o=M(b=>b.backgroundTasks),a=M(b=>b.selectSession),u=M(b=>b.closeTab),f=M(b=>b.setShowNewSessionDialog),h=M(b=>b.apps),g=M(b=>b.openAppTabs),m=M(b=>b.activeAppTabId),v=M(b=>b.openAppTab),k=M(b=>b.closeAppTab),x=M(b=>b.setActiveAppTab);return l.jsxs("div",{className:"ide-tabs",children:[t.map(b=>{var I;const _=r.find(A=>A.id===b);if(!_)return null;const C=xl(_,((I=o[b])==null?void 0:I.length)??0),T=s===b&&m==null;return l.jsxs("div",{className:`ide-tab ${T?"active":""}`,onClick:()=>{m!=null&&x(null),a(b)},children:[l.jsx(ad,{iconClass:C.iconClass,iconText:C.iconText,size:14}),_.title||b.slice(0,8),C.dot&&l.jsx(od,{status:C.dot,title:C.dotTitle}),l.jsx("span",{className:"ide-tab-close",onClick:A=>{A.stopPropagation(),u(b)},children:l.jsx(En,{size:12})})]},b)}),g.map(b=>{const _=h.find(T=>T.id===b),C=m===b;return l.jsxs("div",{className:`ide-tab ${C?"active":""}`,onClick:()=>v(b),children:[l.jsx(wi,{iconNode:_==null?void 0:_.iconNode,size:12,className:"miniapp-tab-icon"}),(_==null?void 0:_.title)??b,l.jsx("span",{className:"ide-tab-close",onClick:T=>{T.stopPropagation(),k(b)},children:l.jsx(En,{size:12})})]},b)}),l.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>f(!0),children:l.jsx(Dr,{size:14})})]})}function vd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Pr=vd();function Xg(t){Pr=t}var go={exec:()=>null};function nt(t,s=""){let r=typeof t=="string"?t:t.source;const o={replace:(a,u)=>{let f=typeof u=="string"?u:u.source;return f=f.replace(yn.caret,"$1"),r=r.replace(a,f),o},getRegex:()=>new RegExp(r,s)};return o}var yn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},zk=/^(?:[ \t]*(?:\n|$))+/,Fk=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Uk=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Eo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Bk=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yd=/(?:[*+-]|\d{1,9}[.)])/,Qg=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Zg=nt(Qg).replace(/bull/g,yd).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(),Wk=nt(Qg).replace(/bull/g,yd).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(),xd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Hk=/^[^\n]+/,wd=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Vk=nt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),qk=nt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,yd).getRegex(),_l="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",kd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Gk=nt("^ {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",kd).replace("tag",_l).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Jg=nt(xd).replace("hr",Eo).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",_l).getRegex(),Kk=nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Jg).getRegex(),Sd={blockquote:Kk,code:Fk,def:Vk,fences:Uk,heading:Bk,hr:Eo,html:Gk,lheading:Zg,list:qk,newline:zk,paragraph:Jg,table:go,text:Hk},Yh=nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Eo).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",_l).getRegex(),Yk={...Sd,lheading:Wk,table:Yh,paragraph:nt(xd).replace("hr",Eo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Yh).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",_l).getRegex()},Xk={...Sd,html:nt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",kd).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:go,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:nt(xd).replace("hr",Eo).replace("heading",` *#{1,6} *[^
|
|
414
|
-
]`).replace("lheading",
|
|
408
|
+
`},Qw={onDragStart(t){let{active:s}=t;return"Picked up draggable item "+s.id+"."},onDragOver(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was moved over droppable area "+r.id+".":"Draggable item "+s.id+" is no longer over a droppable area."},onDragEnd(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was dropped over droppable area "+r.id:"Draggable item "+s.id+" was dropped."},onDragCancel(t){let{active:s}=t;return"Dragging was cancelled. Draggable item "+s.id+" was dropped."}};function Zw(t){let{announcements:s=Qw,container:r,hiddenTextDescribedById:o,screenReaderInstructions:a=Xw}=t;const{announce:u,announcement:f}=Gw(),h=jo("DndLiveRegion"),[g,m]=w.useState(!1);if(w.useEffect(()=>{m(!0)},[]),Kw(w.useMemo(()=>({onDragStart(k){let{active:x}=k;u(s.onDragStart({active:x}))},onDragMove(k){let{active:x,over:b}=k;s.onDragMove&&u(s.onDragMove({active:x,over:b}))},onDragOver(k){let{active:x,over:b}=k;u(s.onDragOver({active:x,over:b}))},onDragEnd(k){let{active:x,over:b}=k;u(s.onDragEnd({active:x,over:b}))},onDragCancel(k){let{active:x,over:b}=k;u(s.onDragCancel({active:x,over:b}))}}),[u,s])),!g)return null;const v=rt.createElement(rt.Fragment,null,rt.createElement(Vw,{id:o,value:a.draggable}),rt.createElement(qw,{id:h,announcement:f}));return r?co.createPortal(v,r):v}var Wt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Wt||(Wt={}));function ll(){}function Jw(t,s){return w.useMemo(()=>({sensor:t,options:s??{}}),[t,s])}function e1(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return w.useMemo(()=>[...s].filter(o=>o!=null),[...s])}const hs=Object.freeze({x:0,y:0});function t1(t,s){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function n1(t,s){const r=al(t);if(!r)return"0 0";const o={x:(r.x-s.left)/s.width*100,y:(r.y-s.top)/s.height*100};return o.x+"% "+o.y+"%"}function s1(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return r-o}function r1(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return o-r}function i1(t,s){if(!t||t.length===0)return null;const[r]=t;return r[s]}function Ih(t,s,r){return s===void 0&&(s=t.left),r===void 0&&(r=t.top),{x:s+t.width*.5,y:r+t.height*.5}}const o1=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const a=Ih(s,s.left,s.top),u=[];for(const f of o){const{id:h}=f,g=r.get(h);if(g){const m=t1(Ih(g),a);u.push({id:h,data:{droppableContainer:f,value:m}})}}return u.sort(s1)};function a1(t,s){const r=Math.max(s.top,t.top),o=Math.max(s.left,t.left),a=Math.min(s.left+s.width,t.left+t.width),u=Math.min(s.top+s.height,t.top+t.height),f=a-o,h=u-r;if(o<a&&r<u){const g=s.width*s.height,m=t.width*t.height,v=f*h,k=v/(g+m-v);return Number(k.toFixed(4))}return 0}const l1=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const a=[];for(const u of o){const{id:f}=u,h=r.get(f);if(h){const g=a1(h,s);g>0&&a.push({id:f,data:{droppableContainer:u,value:g}})}}return a.sort(r1)};function c1(t,s,r){return{...t,scaleX:s&&r?s.width/r.width:1,scaleY:s&&r?s.height/r.height:1}}function jg(t,s){return t&&s?{x:t.left-s.left,y:t.top-s.top}:hs}function u1(t){return function(r){for(var o=arguments.length,a=new Array(o>1?o-1:0),u=1;u<o;u++)a[u-1]=arguments[u];return a.reduce((f,h)=>({...f,top:f.top+t*h.y,bottom:f.bottom+t*h.y,left:f.left+t*h.x,right:f.right+t*h.x}),{...r})}}const d1=u1(1);function _g(t){if(t.startsWith("matrix3d(")){const s=t.slice(9,-1).split(/, /);return{x:+s[12],y:+s[13],scaleX:+s[0],scaleY:+s[5]}}else if(t.startsWith("matrix(")){const s=t.slice(7,-1).split(/, /);return{x:+s[4],y:+s[5],scaleX:+s[0],scaleY:+s[3]}}return null}function f1(t,s,r){const o=_g(s);if(!o)return t;const{scaleX:a,scaleY:u,x:f,y:h}=o,g=t.left-f-(1-a)*parseFloat(r),m=t.top-h-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),v=a?t.width/a:t.width,k=u?t.height/u:t.height;return{width:v,height:k,top:m,right:g+v,bottom:m+k,left:g}}const p1={ignoreTransform:!1};function bi(t,s){s===void 0&&(s=p1);let r=t.getBoundingClientRect();if(s.ignoreTransform){const{transform:m,transformOrigin:v}=xn(t).getComputedStyle(t);m&&(r=f1(r,m,v))}const{top:o,left:a,width:u,height:f,bottom:h,right:g}=r;return{top:o,left:a,width:u,height:f,bottom:h,right:g}}function Dh(t){return bi(t,{ignoreTransform:!0})}function h1(t){const s=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:s,bottom:r,width:s,height:r}}function m1(t,s){return s===void 0&&(s=xn(t).getComputedStyle(t)),s.position==="fixed"}function g1(t,s){s===void 0&&(s=xn(t).getComputedStyle(t));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const u=s[a];return typeof u=="string"?r.test(u):!1})}function dd(t,s){const r=[];function o(a){if(s!=null&&r.length>=s||!a)return r;if(ud(a)&&a.scrollingElement!=null&&!r.includes(a.scrollingElement))return r.push(a.scrollingElement),r;if(!No(a)||Tg(a)||r.includes(a))return r;const u=xn(t).getComputedStyle(a);return a!==t&&g1(a,u)&&r.push(a),m1(a,u)?r:o(a.parentNode)}return t?o(t):r}function Eg(t){const[s]=dd(t,1);return s??null}function Su(t){return!Tl||!t?null:ki(t)?t:cd(t)?ud(t)||t===Si(t).scrollingElement?window:No(t)?t:null:null}function Rg(t){return ki(t)?t.scrollX:t.scrollLeft}function Ag(t){return ki(t)?t.scrollY:t.scrollTop}function $u(t){return{x:Rg(t),y:Ag(t)}}var Jt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Jt||(Jt={}));function Ig(t){return!Tl||!t?!1:t===document.scrollingElement}function Dg(t){const s={x:0,y:0},r=Ig(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},a=t.scrollTop<=s.y,u=t.scrollLeft<=s.x,f=t.scrollTop>=o.y,h=t.scrollLeft>=o.x;return{isTop:a,isLeft:u,isBottom:f,isRight:h,maxScroll:o,minScroll:s}}const v1={x:.2,y:.2};function y1(t,s,r,o,a){let{top:u,left:f,right:h,bottom:g}=r;o===void 0&&(o=10),a===void 0&&(a=v1);const{isTop:m,isBottom:v,isLeft:k,isRight:x}=Dg(t),b={x:0,y:0},j={x:0,y:0},C={height:s.height*a.y,width:s.width*a.x};return!m&&u<=s.top+C.height?(b.y=Jt.Backward,j.y=o*Math.abs((s.top+C.height-u)/C.height)):!v&&g>=s.bottom-C.height&&(b.y=Jt.Forward,j.y=o*Math.abs((s.bottom-C.height-g)/C.height)),!x&&h>=s.right-C.width?(b.x=Jt.Forward,j.x=o*Math.abs((s.right-C.width-h)/C.width)):!k&&f<=s.left+C.width&&(b.x=Jt.Backward,j.x=o*Math.abs((s.left+C.width-f)/C.width)),{direction:b,speed:j}}function x1(t){if(t===document.scrollingElement){const{innerWidth:u,innerHeight:f}=window;return{top:0,left:0,right:u,bottom:f,width:u,height:f}}const{top:s,left:r,right:o,bottom:a}=t.getBoundingClientRect();return{top:s,left:r,right:o,bottom:a,width:t.clientWidth,height:t.clientHeight}}function Mg(t){return t.reduce((s,r)=>yi(s,$u(r)),hs)}function w1(t){return t.reduce((s,r)=>s+Rg(r),0)}function k1(t){return t.reduce((s,r)=>s+Ag(r),0)}function Lg(t,s){if(s===void 0&&(s=bi),!t)return;const{top:r,left:o,bottom:a,right:u}=s(t);Eg(t)&&(a<=0||u<=0||r>=window.innerHeight||o>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const S1=[["x",["left","right"],w1],["y",["top","bottom"],k1]];class fd{constructor(s,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=dd(r),a=Mg(o);this.rect={...s},this.width=s.width,this.height=s.height;for(const[u,f,h]of S1)for(const g of f)Object.defineProperty(this,g,{get:()=>{const m=h(o),v=a[u]-m;return this.rect[g]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class po{constructor(s){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=s}add(s,r,o){var a;(a=this.target)==null||a.addEventListener(s,r,o),this.listeners.push([s,r,o])}}function b1(t){const{EventTarget:s}=xn(t);return t instanceof s?t:Si(t)}function bu(t,s){const r=Math.abs(t.x),o=Math.abs(t.y);return typeof s=="number"?Math.sqrt(r**2+o**2)>s:"x"in s&&"y"in s?r>s.x&&o>s.y:"x"in s?r>s.x:"y"in s?o>s.y:!1}var es;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(es||(es={}));function Mh(t){t.preventDefault()}function T1(t){t.stopPropagation()}var et;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(et||(et={}));const Pg={start:[et.Space,et.Enter],cancel:[et.Esc],end:[et.Space,et.Enter,et.Tab]},N1=(t,s)=>{let{currentCoordinates:r}=s;switch(t.code){case et.Right:return{...r,x:r.x+25};case et.Left:return{...r,x:r.x-25};case et.Down:return{...r,y:r.y+25};case et.Up:return{...r,y:r.y-25}}};class Og{constructor(s){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=s;const{event:{target:r}}=s;this.props=s,this.listeners=new po(Si(r)),this.windowListeners=new po(xn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(es.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:s,onStart:r}=this.props,o=s.node.current;o&&Lg(o),r(hs)}handleKeyDown(s){if(Cl(s)){const{active:r,context:o,options:a}=this.props,{keyboardCodes:u=Pg,coordinateGetter:f=N1,scrollBehavior:h="smooth"}=a,{code:g}=s;if(u.end.includes(g)){this.handleEnd(s);return}if(u.cancel.includes(g)){this.handleCancel(s);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:hs;this.referenceCoordinates||(this.referenceCoordinates=v);const k=f(s,{active:r,context:o.current,currentCoordinates:v});if(k){const x=ol(k,v),b={x:0,y:0},{scrollableAncestors:j}=o.current;for(const C of j){const T=s.code,{isTop:I,isRight:A,isLeft:U,isBottom:O,maxScroll:W,minScroll:Z}=Dg(C),Y=x1(C),Q={x:Math.min(T===et.Right?Y.right-Y.width/2:Y.right,Math.max(T===et.Right?Y.left:Y.left+Y.width/2,k.x)),y:Math.min(T===et.Down?Y.bottom-Y.height/2:Y.bottom,Math.max(T===et.Down?Y.top:Y.top+Y.height/2,k.y))},ue=T===et.Right&&!A||T===et.Left&&!U,he=T===et.Down&&!O||T===et.Up&&!I;if(ue&&Q.x!==k.x){const H=C.scrollLeft+x.x,Te=T===et.Right&&H<=W.x||T===et.Left&&H>=Z.x;if(Te&&!x.y){C.scrollTo({left:H,behavior:h});return}Te?b.x=C.scrollLeft-H:b.x=T===et.Right?C.scrollLeft-W.x:C.scrollLeft-Z.x,b.x&&C.scrollBy({left:-b.x,behavior:h});break}else if(he&&Q.y!==k.y){const H=C.scrollTop+x.y,Te=T===et.Down&&H<=W.y||T===et.Up&&H>=Z.y;if(Te&&!x.x){C.scrollTo({top:H,behavior:h});return}Te?b.y=C.scrollTop-H:b.y=T===et.Down?C.scrollTop-W.y:C.scrollTop-Z.y,b.y&&C.scrollBy({top:-b.y,behavior:h});break}}this.handleMove(s,yi(ol(k,this.referenceCoordinates),b))}}}handleMove(s,r){const{onMove:o}=this.props;s.preventDefault(),o(r)}handleEnd(s){const{onEnd:r}=this.props;s.preventDefault(),this.detach(),r()}handleCancel(s){const{onCancel:r}=this.props;s.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Og.activators=[{eventName:"onKeyDown",handler:(t,s,r)=>{let{keyboardCodes:o=Pg,onActivation:a}=s,{active:u}=r;const{code:f}=t.nativeEvent;if(o.start.includes(f)){const h=u.activatorNode.current;return h&&t.target!==h?!1:(t.preventDefault(),a==null||a({event:t.nativeEvent}),!0)}return!1}}];function Lh(t){return!!(t&&"distance"in t)}function Ph(t){return!!(t&&"delay"in t)}class pd{constructor(s,r,o){var a;o===void 0&&(o=b1(s.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=s,this.events=r;const{event:u}=s,{target:f}=u;this.props=s,this.events=r,this.document=Si(f),this.documentListeners=new po(this.document),this.listeners=new po(o),this.windowListeners=new po(xn(f)),this.initialCoordinates=(a=al(u))!=null?a:hs,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:s,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(s.move.name,this.handleMove,{passive:!1}),this.listeners.add(s.end.name,this.handleEnd),s.cancel&&this.listeners.add(s.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,Mh),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,Mh),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(Ph(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Lh(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(s,r){const{active:o,onPending:a}=this.props;a(o,s,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:s}=this,{onStart:r}=this.props;s&&(this.activated=!0,this.documentListeners.add(es.Click,T1,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(s))}handleMove(s){var r;const{activated:o,initialCoordinates:a,props:u}=this,{onMove:f,options:{activationConstraint:h}}=u;if(!a)return;const g=(r=al(s))!=null?r:hs,m=ol(a,g);if(!o&&h){if(Lh(h)){if(h.tolerance!=null&&bu(m,h.tolerance))return this.handleCancel();if(bu(m,h.distance))return this.handleStart()}if(Ph(h)&&bu(m,h.tolerance))return this.handleCancel();this.handlePending(h,m);return}s.cancelable&&s.preventDefault(),f(g)}handleEnd(){const{onAbort:s,onEnd:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleCancel(){const{onAbort:s,onCancel:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleKeydown(s){s.code===et.Esc&&this.handleCancel()}removeTextSelection(){var s;(s=this.document.getSelection())==null||s.removeAllRanges()}}const C1={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class hd extends pd{constructor(s){const{event:r}=s,o=Si(r.target);super(s,C1,o)}}hd.activators=[{eventName:"onPointerDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const j1={move:{name:"mousemove"},end:{name:"mouseup"}};var zu;(function(t){t[t.RightClick=2]="RightClick"})(zu||(zu={}));class _1 extends pd{constructor(s){super(s,j1,Si(s.event.target))}}_1.activators=[{eventName:"onMouseDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return r.button===zu.RightClick?!1:(o==null||o({event:r}),!0)}}];const Tu={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class E1 extends pd{constructor(s){super(s,Tu)}static setup(){return window.addEventListener(Tu.move.name,s,{capture:!1,passive:!1}),function(){window.removeEventListener(Tu.move.name,s)};function s(){}}}E1.activators=[{eventName:"onTouchStart",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;const{touches:a}=r;return a.length>1?!1:(o==null||o({event:r}),!0)}}];var ho;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(ho||(ho={}));var cl;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(cl||(cl={}));function R1(t){let{acceleration:s,activator:r=ho.Pointer,canScroll:o,draggingRect:a,enabled:u,interval:f=5,order:h=cl.TreeOrder,pointerCoordinates:g,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:x}=t;const b=I1({delta:k,disabled:!u}),[j,C]=Fw(),T=w.useRef({x:0,y:0}),I=w.useRef({x:0,y:0}),A=w.useMemo(()=>{switch(r){case ho.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case ho.DraggableRect:return a}},[r,a,g]),U=w.useRef(null),O=w.useCallback(()=>{const Z=U.current;if(!Z)return;const Y=T.current.x*I.current.x,Q=T.current.y*I.current.y;Z.scrollBy(Y,Q)},[]),W=w.useMemo(()=>h===cl.TreeOrder?[...m].reverse():m,[h,m]);w.useEffect(()=>{if(!u||!m.length||!A){C();return}for(const Z of W){if((o==null?void 0:o(Z))===!1)continue;const Y=m.indexOf(Z),Q=v[Y];if(!Q)continue;const{direction:ue,speed:he}=y1(Z,Q,A,s,x);for(const H of["x","y"])b[H][ue[H]]||(he[H]=0,ue[H]=0);if(he.x>0||he.y>0){C(),U.current=Z,j(O,f),T.current=he,I.current=ue;return}}T.current={x:0,y:0},I.current={x:0,y:0},C()},[s,O,o,C,u,f,JSON.stringify(A),JSON.stringify(b),j,m,W,v,JSON.stringify(x)])}const A1={x:{[Jt.Backward]:!1,[Jt.Forward]:!1},y:{[Jt.Backward]:!1,[Jt.Forward]:!1}};function I1(t){let{delta:s,disabled:r}=t;const o=il(s);return Co(a=>{if(r||!o||!a)return A1;const u={x:Math.sign(s.x-o.x),y:Math.sign(s.y-o.y)};return{x:{[Jt.Backward]:a.x[Jt.Backward]||u.x===-1,[Jt.Forward]:a.x[Jt.Forward]||u.x===1},y:{[Jt.Backward]:a.y[Jt.Backward]||u.y===-1,[Jt.Forward]:a.y[Jt.Forward]||u.y===1}}},[r,s,o])}function D1(t,s){const r=s!=null?t.get(s):void 0,o=r?r.node.current:null;return Co(a=>{var u;return s==null?null:(u=o??a)!=null?u:null},[o,s])}function M1(t,s){return w.useMemo(()=>t.reduce((r,o)=>{const{sensor:a}=o,u=a.activators.map(f=>({eventName:f.eventName,handler:s(f.handler,o)}));return[...r,...u]},[]),[t,s])}var So;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(So||(So={}));var Fu;(function(t){t.Optimized="optimized"})(Fu||(Fu={}));const Oh=new Map;function L1(t,s){let{dragging:r,dependencies:o,config:a}=s;const[u,f]=w.useState(null),{frequency:h,measure:g,strategy:m}=a,v=w.useRef(t),k=T(),x=ko(k),b=w.useCallback(function(I){I===void 0&&(I=[]),!x.current&&f(A=>A===null?I:A.concat(I.filter(U=>!A.includes(U))))},[x]),j=w.useRef(null),C=Co(I=>{if(k&&!r)return Oh;if(!I||I===Oh||v.current!==t||u!=null){const A=new Map;for(let U of t){if(!U)continue;if(u&&u.length>0&&!u.includes(U.id)&&U.rect.current){A.set(U.id,U.rect.current);continue}const O=U.node.current,W=O?new fd(g(O),O):null;U.rect.current=W,W&&A.set(U.id,W)}return A}return I},[t,u,r,k,g]);return w.useEffect(()=>{v.current=t},[t]),w.useEffect(()=>{k||b()},[r,k]),w.useEffect(()=>{u&&u.length>0&&f(null)},[JSON.stringify(u)]),w.useEffect(()=>{k||typeof h!="number"||j.current!==null||(j.current=setTimeout(()=>{b(),j.current=null},h))},[h,k,b,...o]),{droppableRects:C,measureDroppableContainers:b,measuringScheduled:u!=null};function T(){switch(m){case So.Always:return!1;case So.BeforeDragging:return r;default:return!r}}}function md(t,s){return Co(r=>t?r||(typeof s=="function"?s(t):t):null,[s,t])}function P1(t,s){return md(t,s)}function O1(t){let{callback:s,disabled:r}=t;const o=Nl(s),a=w.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(o)},[o,r]);return w.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function jl(t){let{callback:s,disabled:r}=t;const o=Nl(s),a=w.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(o)},[r]);return w.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function $1(t){return new fd(bi(t),t)}function $h(t,s,r){s===void 0&&(s=$1);const[o,a]=w.useState(null);function u(){a(g=>{if(!t)return null;if(t.isConnected===!1){var m;return(m=g??r)!=null?m:null}const v=s(t);return JSON.stringify(g)===JSON.stringify(v)?g:v})}const f=O1({callback(g){if(t)for(const m of g){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(t)){u();break}}}}),h=jl({callback:u});return ps(()=>{u(),t?(h==null||h.observe(t),f==null||f.observe(document.body,{childList:!0,subtree:!0})):(h==null||h.disconnect(),f==null||f.disconnect())},[t]),o}function z1(t){const s=md(t);return jg(t,s)}const zh=[];function F1(t){const s=w.useRef(t),r=Co(o=>t?o&&o!==zh&&t&&s.current&&t.parentNode===s.current.parentNode?o:dd(t):zh,[t]);return w.useEffect(()=>{s.current=t},[t]),r}function U1(t){const[s,r]=w.useState(null),o=w.useRef(t),a=w.useCallback(u=>{const f=Su(u.target);f&&r(h=>h?(h.set(f,$u(f)),new Map(h)):null)},[]);return w.useEffect(()=>{const u=o.current;if(t!==u){f(u);const h=t.map(g=>{const m=Su(g);return m?(m.addEventListener("scroll",a,{passive:!0}),[m,$u(m)]):null}).filter(g=>g!=null);r(h.length?new Map(h):null),o.current=t}return()=>{f(t),f(u)};function f(h){h.forEach(g=>{const m=Su(g);m==null||m.removeEventListener("scroll",a)})}},[a,t]),w.useMemo(()=>t.length?s?Array.from(s.values()).reduce((u,f)=>yi(u,f),hs):Mg(t):hs,[t,s])}function Fh(t,s){s===void 0&&(s=[]);const r=w.useRef(null);return w.useEffect(()=>{r.current=null},s),w.useEffect(()=>{const o=t!==hs;o&&!r.current&&(r.current=t),!o&&r.current&&(r.current=null)},[t]),r.current?ol(t,r.current):hs}function B1(t){w.useEffect(()=>{if(!Tl)return;const s=t.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of s)r==null||r()}},t.map(s=>{let{sensor:r}=s;return r}))}function W1(t,s){return w.useMemo(()=>t.reduce((r,o)=>{let{eventName:a,handler:u}=o;return r[a]=f=>{u(f,s)},r},{}),[t,s])}function $g(t){return w.useMemo(()=>t?h1(t):null,[t])}const Uh=[];function H1(t,s){s===void 0&&(s=bi);const[r]=t,o=$g(r?xn(r):null),[a,u]=w.useState(Uh);function f(){u(()=>t.length?t.map(g=>Ig(g)?o:new fd(s(g),g)):Uh)}const h=jl({callback:f});return ps(()=>{h==null||h.disconnect(),f(),t.forEach(g=>h==null?void 0:h.observe(g))},[t]),a}function zg(t){if(!t)return null;if(t.children.length>1)return t;const s=t.children[0];return No(s)?s:t}function V1(t){let{measure:s}=t;const[r,o]=w.useState(null),a=w.useCallback(m=>{for(const{target:v}of m)if(No(v)){o(k=>{const x=s(v);return k?{...k,width:x.width,height:x.height}:x});break}},[s]),u=jl({callback:a}),f=w.useCallback(m=>{const v=zg(m);u==null||u.disconnect(),v&&(u==null||u.observe(v)),o(v?s(v):null)},[s,u]),[h,g]=rl(f);return w.useMemo(()=>({nodeRef:h,rect:r,setRef:g}),[r,h,g])}const q1=[{sensor:hd,options:{}},{sensor:Og,options:{}}],G1={current:{}},qa={draggable:{measure:Dh},droppable:{measure:Dh,strategy:So.WhileDragging,frequency:Fu.Optimized},dragOverlay:{measure:bi}};class mo extends Map{get(s){var r;return s!=null&&(r=super.get(s))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(s=>{let{disabled:r}=s;return!r})}getNodeFor(s){var r,o;return(r=(o=this.get(s))==null?void 0:o.node.current)!=null?r:void 0}}const K1={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new mo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ll},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:qa,measureDroppableContainers:ll,windowRect:null,measuringScheduled:!1},Fg={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ll,draggableNodes:new Map,over:null,measureDroppableContainers:ll},_o=w.createContext(Fg),Ug=w.createContext(K1);function Y1(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new mo}}}function X1(t,s){switch(s.type){case Wt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:s.initialCoordinates,active:s.active}};case Wt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:s.coordinates.x-t.draggable.initialCoordinates.x,y:s.coordinates.y-t.draggable.initialCoordinates.y}}};case Wt.DragEnd:case Wt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Wt.RegisterDroppable:{const{element:r}=s,{id:o}=r,a=new mo(t.droppable.containers);return a.set(o,r),{...t,droppable:{...t.droppable,containers:a}}}case Wt.SetDroppableDisabled:{const{id:r,key:o,disabled:a}=s,u=t.droppable.containers.get(r);if(!u||o!==u.key)return t;const f=new mo(t.droppable.containers);return f.set(r,{...u,disabled:a}),{...t,droppable:{...t.droppable,containers:f}}}case Wt.UnregisterDroppable:{const{id:r,key:o}=s,a=t.droppable.containers.get(r);if(!a||o!==a.key)return t;const u=new mo(t.droppable.containers);return u.delete(r),{...t,droppable:{...t.droppable,containers:u}}}default:return t}}function Q1(t){let{disabled:s}=t;const{active:r,activatorEvent:o,draggableNodes:a}=w.useContext(_o),u=il(o),f=il(r==null?void 0:r.id);return w.useEffect(()=>{if(!s&&!o&&u&&f!=null){if(!Cl(u)||document.activeElement===u.target)return;const h=a.get(f);if(!h)return;const{activatorNode:g,node:m}=h;if(!g.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[g.current,m.current]){if(!v)continue;const k=Ww(v);if(k){k.focus();break}}})}},[o,s,a,f,u]),null}function Bg(t,s){let{transform:r,...o}=s;return t!=null&&t.length?t.reduce((a,u)=>u({transform:a,...o}),r):r}function Z1(t){return w.useMemo(()=>({draggable:{...qa.draggable,...t==null?void 0:t.draggable},droppable:{...qa.droppable,...t==null?void 0:t.droppable},dragOverlay:{...qa.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function J1(t){let{activeNode:s,measure:r,initialRect:o,config:a=!0}=t;const u=w.useRef(!1),{x:f,y:h}=typeof a=="boolean"?{x:a,y:a}:a;ps(()=>{if(!f&&!h||!s){u.current=!1;return}if(u.current||!o)return;const m=s==null?void 0:s.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=jg(v,o);if(f||(k.x=0),h||(k.y=0),u.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const x=Eg(m);x&&x.scrollBy({top:k.y,left:k.x})}},[s,f,h,o,r])}const _l=w.createContext({...hs,scaleX:1,scaleY:1});var ar;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(ar||(ar={}));const ek=w.memo(function(s){var r,o,a,u;let{id:f,accessibility:h,autoScroll:g=!0,children:m,sensors:v=q1,collisionDetection:k=l1,measuring:x,modifiers:b,...j}=s;const C=w.useReducer(X1,void 0,Y1),[T,I]=C,[A,U]=Yw(),[O,W]=w.useState(ar.Uninitialized),Z=O===ar.Initialized,{draggable:{active:Y,nodes:Q,translate:ue},droppable:{containers:he}}=T,H=Y!=null?Q.get(Y):null,Te=w.useRef({initial:null,translated:null}),Ne=w.useMemo(()=>{var st;return Y!=null?{id:Y,data:(st=H==null?void 0:H.data)!=null?st:G1,rect:Te}:null},[Y,H]),Le=w.useRef(null),[se,G]=w.useState(null),[X,P]=w.useState(null),J=ko(j,Object.values(j)),q=jo("DndDescribedBy",f),E=w.useMemo(()=>he.getEnabled(),[he]),L=Z1(x),{droppableRects:de,measureDroppableContainers:K,measuringScheduled:ce}=L1(E,{dragging:Z,dependencies:[ue.x,ue.y],config:L.droppable}),fe=D1(Q,Y),Pe=w.useMemo(()=>X?al(X):null,[X]),Ce=Vt(),Ee=P1(fe,L.draggable.measure);J1({activeNode:Y!=null?Q.get(Y):null,config:Ce.layoutShiftCompensation,initialRect:Ee,measure:L.draggable.measure});const _e=$h(fe,L.draggable.measure,Ee),it=$h(fe?fe.parentElement:null),je=w.useRef({activatorEvent:null,active:null,activeNode:fe,collisionRect:null,collisions:null,droppableRects:de,draggableNodes:Q,draggingNode:null,draggingNodeRect:null,droppableContainers:he,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),kt=he.getNodeFor((r=je.current.over)==null?void 0:r.id),ze=V1({measure:L.dragOverlay.measure}),It=(o=ze.nodeRef.current)!=null?o:fe,Fe=Z?(a=ze.rect)!=null?a:_e:null,Dt=!!(ze.nodeRef.current&&ze.rect),Rn=z1(Dt?null:_e),St=$g(It?xn(It):null),Mt=F1(Z?kt??fe:null),ht=H1(Mt),en=Bg(b,{transform:{x:ue.x-Rn.x,y:ue.y-Rn.y,scaleX:1,scaleY:1},activatorEvent:X,active:Ne,activeNodeRect:_e,containerNodeRect:it,draggingNodeRect:Fe,over:je.current.over,overlayNodeRect:ze.rect,scrollableAncestors:Mt,scrollableAncestorRects:ht,windowRect:St}),V=Pe?yi(Pe,ue):null,pe=U1(Mt),Ue=Fh(pe),tt=Fh(pe,[_e]),mt=yi(en,Ue),gt=Fe?d1(Fe,en):null,Rt=Ne&>?k({active:Ne,collisionRect:gt,droppableRects:de,droppableContainers:E,pointerCoordinates:V}):null,Ht=i1(Rt,"id"),[ut,An]=w.useState(null),Hn=Dt?en:yi(en,tt),Ts=c1(Hn,(u=ut==null?void 0:ut.rect)!=null?u:null,_e),ms=w.useRef(null),In=w.useCallback((st,vt)=>{let{sensor:yt,options:qt}=vt;if(Le.current==null)return;const bt=Q.get(Le.current);if(!bt)return;const xt=st.nativeEvent,ot=new yt({active:Le.current,activeNode:bt,event:xt,options:qt,context:je,onAbort(Je){if(!Q.get(Je))return;const{onDragAbort:oe}=J.current,ie={id:Je};oe==null||oe(ie),A({type:"onDragAbort",event:ie})},onPending(Je,_,oe,ie){if(!Q.get(Je))return;const{onDragPending:$e}=J.current,Be={id:Je,constraint:_,initialCoordinates:oe,offset:ie};$e==null||$e(Be),A({type:"onDragPending",event:Be})},onStart(Je){const _=Le.current;if(_==null)return;const oe=Q.get(_);if(!oe)return;const{onDragStart:ie}=J.current,ge={activatorEvent:xt,active:{id:_,data:oe.data,rect:Te}};co.unstable_batchedUpdates(()=>{ie==null||ie(ge),W(ar.Initializing),I({type:Wt.DragStart,initialCoordinates:Je,active:_}),A({type:"onDragStart",event:ge}),G(ms.current),P(xt)})},onMove(Je){I({type:Wt.DragMove,coordinates:Je})},onEnd:Gt(Wt.DragEnd),onCancel:Gt(Wt.DragCancel)});ms.current=ot;function Gt(Je){return async function(){const{active:oe,collisions:ie,over:ge,scrollAdjustedTranslate:$e}=je.current;let Be=null;if(oe&&$e){const{cancelDrop:De}=J.current;Be={activatorEvent:xt,active:oe,collisions:ie,delta:$e,over:ge},Je===Wt.DragEnd&&typeof De=="function"&&await Promise.resolve(De(Be))&&(Je=Wt.DragCancel)}Le.current=null,co.unstable_batchedUpdates(()=>{I({type:Je}),W(ar.Uninitialized),An(null),G(null),P(null),ms.current=null;const De=Je===Wt.DragEnd?"onDragEnd":"onDragCancel";if(Be){const at=J.current[De];at==null||at(Be),A({type:De,event:Be})}})}}},[Q]),Dn=w.useCallback((st,vt)=>(yt,qt)=>{const bt=yt.nativeEvent,xt=Q.get(qt);if(Le.current!==null||!xt||bt.dndKit||bt.defaultPrevented)return;const ot={active:xt};st(yt,vt.options,ot)===!0&&(bt.dndKit={capturedBy:vt.sensor},Le.current=qt,In(yt,vt))},[Q,In]),pn=M1(v,Dn);B1(v),ps(()=>{_e&&O===ar.Initializing&&W(ar.Initialized)},[_e,O]),w.useEffect(()=>{const{onDragMove:st}=J.current,{active:vt,activatorEvent:yt,collisions:qt,over:bt}=je.current;if(!vt||!yt)return;const xt={active:vt,activatorEvent:yt,collisions:qt,delta:{x:mt.x,y:mt.y},over:bt};co.unstable_batchedUpdates(()=>{st==null||st(xt),A({type:"onDragMove",event:xt})})},[mt.x,mt.y]),w.useEffect(()=>{const{active:st,activatorEvent:vt,collisions:yt,droppableContainers:qt,scrollAdjustedTranslate:bt}=je.current;if(!st||Le.current==null||!vt||!bt)return;const{onDragOver:xt}=J.current,ot=qt.get(Ht),Gt=ot&&ot.rect.current?{id:ot.id,rect:ot.rect.current,data:ot.data,disabled:ot.disabled}:null,Je={active:st,activatorEvent:vt,collisions:yt,delta:{x:bt.x,y:bt.y},over:Gt};co.unstable_batchedUpdates(()=>{An(Gt),xt==null||xt(Je),A({type:"onDragOver",event:Je})})},[Ht]),ps(()=>{je.current={activatorEvent:X,active:Ne,activeNode:fe,collisionRect:gt,collisions:Rt,droppableRects:de,draggableNodes:Q,draggingNode:It,draggingNodeRect:Fe,droppableContainers:he,over:ut,scrollableAncestors:Mt,scrollAdjustedTranslate:mt},Te.current={initial:Fe,translated:gt}},[Ne,fe,Rt,gt,Q,It,Fe,de,he,ut,Mt,mt]),R1({...Ce,delta:ue,draggingRect:gt,pointerCoordinates:V,scrollableAncestors:Mt,scrollableAncestorRects:ht});const wn=w.useMemo(()=>({active:Ne,activeNode:fe,activeNodeRect:_e,activatorEvent:X,collisions:Rt,containerNodeRect:it,dragOverlay:ze,draggableNodes:Q,droppableContainers:he,droppableRects:de,over:ut,measureDroppableContainers:K,scrollableAncestors:Mt,scrollableAncestorRects:ht,measuringConfiguration:L,measuringScheduled:ce,windowRect:St}),[Ne,fe,_e,X,Rt,it,ze,Q,he,de,ut,K,Mt,ht,L,ce,St]),Ft=w.useMemo(()=>({activatorEvent:X,activators:pn,active:Ne,activeNodeRect:_e,ariaDescribedById:{draggable:q},dispatch:I,draggableNodes:Q,over:ut,measureDroppableContainers:K}),[X,pn,Ne,_e,I,q,Q,ut,K]);return rt.createElement(Cg.Provider,{value:U},rt.createElement(_o.Provider,{value:Ft},rt.createElement(Ug.Provider,{value:wn},rt.createElement(_l.Provider,{value:Ts},m)),rt.createElement(Q1,{disabled:(h==null?void 0:h.restoreFocus)===!1})),rt.createElement(Zw,{...h,hiddenTextDescribedById:q}));function Vt(){const st=(se==null?void 0:se.autoScrollEnabled)===!1,vt=typeof g=="object"?g.enabled===!1:g===!1,yt=Z&&!st&&!vt;return typeof g=="object"?{...g,enabled:yt}:{enabled:yt}}}),tk=w.createContext(null),Bh="button",nk="Draggable";function sk(t){let{id:s,data:r,disabled:o=!1,attributes:a}=t;const u=jo(nk),{activators:f,activatorEvent:h,active:g,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:x}=w.useContext(_o),{role:b=Bh,roleDescription:j="draggable",tabIndex:C=0}=a??{},T=(g==null?void 0:g.id)===s,I=w.useContext(T?_l:tk),[A,U]=rl(),[O,W]=rl(),Z=W1(f,s),Y=ko(r);ps(()=>(k.set(s,{id:s,key:u,node:A,activatorNode:O,data:Y}),()=>{const ue=k.get(s);ue&&ue.key===u&&k.delete(s)}),[k,s]);const Q=w.useMemo(()=>({role:b,tabIndex:C,"aria-disabled":o,"aria-pressed":T&&b===Bh?!0:void 0,"aria-roledescription":j,"aria-describedby":v.draggable}),[o,b,C,T,j,v.draggable]);return{active:g,activatorEvent:h,activeNodeRect:m,attributes:Q,isDragging:T,listeners:o?void 0:Z,node:A,over:x,setNodeRef:U,setActivatorNodeRef:W,transform:I}}function Wg(){return w.useContext(Ug)}const rk="Droppable",ik={timeout:25};function Hg(t){let{data:s,disabled:r=!1,id:o,resizeObserverConfig:a}=t;const u=jo(rk),{active:f,dispatch:h,over:g,measureDroppableContainers:m}=w.useContext(_o),v=w.useRef({disabled:r}),k=w.useRef(!1),x=w.useRef(null),b=w.useRef(null),{disabled:j,updateMeasurementsFor:C,timeout:T}={...ik,...a},I=ko(C??o),A=w.useCallback(()=>{if(!k.current){k.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{m(Array.isArray(I.current)?I.current:[I.current]),b.current=null},T)},[T]),U=jl({callback:A,disabled:j||!f}),O=w.useCallback((Q,ue)=>{U&&(ue&&(U.unobserve(ue),k.current=!1),Q&&U.observe(Q))},[U]),[W,Z]=rl(O),Y=ko(s);return w.useEffect(()=>{!U||!W.current||(U.disconnect(),k.current=!1,U.observe(W.current))},[W,U]),w.useEffect(()=>(h({type:Wt.RegisterDroppable,element:{id:o,key:u,disabled:r,node:W,rect:x,data:Y}}),()=>h({type:Wt.UnregisterDroppable,key:u,id:o})),[o]),w.useEffect(()=>{r!==v.current.disabled&&(h({type:Wt.SetDroppableDisabled,id:o,key:u,disabled:r}),v.current.disabled=r)},[o,u,r,h]),{active:f,rect:x,isOver:(g==null?void 0:g.id)===o,node:W,over:g,setNodeRef:Z}}function ok(t){let{animation:s,children:r}=t;const[o,a]=w.useState(null),[u,f]=w.useState(null),h=il(r);return!r&&!o&&h&&a(h),ps(()=>{if(!u)return;const g=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(g==null||m==null){a(null);return}Promise.resolve(s(m,u)).then(()=>{a(null)})},[s,o,u]),rt.createElement(rt.Fragment,null,r,o?w.cloneElement(o,{ref:f}):null)}const ak={x:0,y:0,scaleX:1,scaleY:1};function lk(t){let{children:s}=t;return rt.createElement(_o.Provider,{value:Fg},rt.createElement(_l.Provider,{value:ak},s))}const ck={position:"fixed",touchAction:"none"},uk=t=>Cl(t)?"transform 250ms ease":void 0,dk=w.forwardRef((t,s)=>{let{as:r,activatorEvent:o,adjustScale:a,children:u,className:f,rect:h,style:g,transform:m,transition:v=uk}=t;if(!h)return null;const k=a?m:{...m,scaleX:1,scaleY:1},x={...ck,width:h.width,height:h.height,top:h.top,left:h.left,transform:$s.Transform.toString(k),transformOrigin:a&&o?n1(o,h):void 0,transition:typeof v=="function"?v(o):v,...g};return rt.createElement(r,{className:f,style:x,ref:s},u)}),fk=t=>s=>{let{active:r,dragOverlay:o}=s;const a={},{styles:u,className:f}=t;if(u!=null&&u.active)for(const[h,g]of Object.entries(u.active))g!==void 0&&(a[h]=r.node.style.getPropertyValue(h),r.node.style.setProperty(h,g));if(u!=null&&u.dragOverlay)for(const[h,g]of Object.entries(u.dragOverlay))g!==void 0&&o.node.style.setProperty(h,g);return f!=null&&f.active&&r.node.classList.add(f.active),f!=null&&f.dragOverlay&&o.node.classList.add(f.dragOverlay),function(){for(const[g,m]of Object.entries(a))r.node.style.setProperty(g,m);f!=null&&f.active&&r.node.classList.remove(f.active)}},pk=t=>{let{transform:{initial:s,final:r}}=t;return[{transform:$s.Transform.toString(s)},{transform:$s.Transform.toString(r)}]},hk={duration:250,easing:"ease",keyframes:pk,sideEffects:fk({styles:{active:{opacity:"0"}}})};function mk(t){let{config:s,draggableNodes:r,droppableContainers:o,measuringConfiguration:a}=t;return Nl((u,f)=>{if(s===null)return;const h=r.get(u);if(!h)return;const g=h.node.current;if(!g)return;const m=zg(f);if(!m)return;const{transform:v}=xn(f).getComputedStyle(f),k=_g(v);if(!k)return;const x=typeof s=="function"?s:gk(s);return Lg(g,a.draggable.measure),x({active:{id:u,data:h.data,node:g,rect:a.draggable.measure(g)},draggableNodes:r,dragOverlay:{node:f,rect:a.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:a,transform:k})})}function gk(t){const{duration:s,easing:r,sideEffects:o,keyframes:a}={...hk,...t};return u=>{let{active:f,dragOverlay:h,transform:g,...m}=u;if(!s)return;const v={x:h.rect.left-f.rect.left,y:h.rect.top-f.rect.top},k={scaleX:g.scaleX!==1?f.rect.width*g.scaleX/h.rect.width:1,scaleY:g.scaleY!==1?f.rect.height*g.scaleY/h.rect.height:1},x={x:g.x-v.x,y:g.y-v.y,...k},b=a({...m,active:f,dragOverlay:h,transform:{initial:g,final:x}}),[j]=b,C=b[b.length-1];if(JSON.stringify(j)===JSON.stringify(C))return;const T=o==null?void 0:o({active:f,dragOverlay:h,...m}),I=h.node.animate(b,{duration:s,easing:r,fill:"forwards"});return new Promise(A=>{I.onfinish=()=>{T==null||T(),A()}})}}let Wh=0;function vk(t){return w.useMemo(()=>{if(t!=null)return Wh++,Wh},[t])}const yk=rt.memo(t=>{let{adjustScale:s=!1,children:r,dropAnimation:o,style:a,transition:u,modifiers:f,wrapperElement:h="div",className:g,zIndex:m=999}=t;const{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:b,draggableNodes:j,droppableContainers:C,dragOverlay:T,over:I,measuringConfiguration:A,scrollableAncestors:U,scrollableAncestorRects:O,windowRect:W}=Wg(),Z=w.useContext(_l),Y=vk(k==null?void 0:k.id),Q=Bg(f,{activatorEvent:v,active:k,activeNodeRect:x,containerNodeRect:b,draggingNodeRect:T.rect,over:I,overlayNodeRect:T.rect,scrollableAncestors:U,scrollableAncestorRects:O,transform:Z,windowRect:W}),ue=md(x),he=mk({config:o,draggableNodes:j,droppableContainers:C,measuringConfiguration:A}),H=ue?T.setRef:void 0;return rt.createElement(lk,null,rt.createElement(ok,{animation:he},k&&Y?rt.createElement(dk,{key:Y,id:k.id,ref:H,as:h,activatorEvent:v,adjustScale:s,className:g,transition:u,rect:ue,style:{zIndex:m,...a},transform:Q},r):null))});function Vg(t,s,r){const o=t.slice();return o.splice(r<0?o.length+r:r,0,o.splice(s,1)[0]),o}function xk(t,s){return t.reduce((r,o,a)=>{const u=s.get(o);return u&&(r[a]=u),r},Array(t.length))}function La(t){return t!==null&&t>=0}function wk(t,s){if(t===s)return!0;if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==s[r])return!1;return!0}function kk(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const qg=t=>{let{rects:s,activeIndex:r,overIndex:o,index:a}=t;const u=Vg(s,o,r),f=s[a],h=u[a];return!h||!f?null:{x:h.left-f.left,y:h.top-f.top,scaleX:h.width/f.width,scaleY:h.height/f.height}},Pa={scaleX:1,scaleY:1},Hh=t=>{var s;let{activeIndex:r,activeNodeRect:o,index:a,rects:u,overIndex:f}=t;const h=(s=u[r])!=null?s:o;if(!h)return null;if(a===r){const m=u[f];return m?{x:0,y:r<f?m.top+m.height-(h.top+h.height):m.top-h.top,...Pa}:null}const g=Sk(u,a,r);return a>r&&a<=f?{x:0,y:-h.height-g,...Pa}:a<r&&a>=f?{x:0,y:h.height+g,...Pa}:{x:0,y:0,...Pa}};function Sk(t,s,r){const o=t[s],a=t[s-1],u=t[s+1];return o?r<s?a?o.top-(a.top+a.height):u?u.top-(o.top+o.height):0:u?u.top-(o.top+o.height):a?o.top-(a.top+a.height):0:0}const Gg="Sortable",Kg=rt.createContext({activeIndex:-1,containerId:Gg,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:qg,disabled:{draggable:!1,droppable:!1}});function Vh(t){let{children:s,id:r,items:o,strategy:a=qg,disabled:u=!1}=t;const{active:f,dragOverlay:h,droppableRects:g,over:m,measureDroppableContainers:v}=Wg(),k=jo(Gg,r),x=h.rect!==null,b=w.useMemo(()=>o.map(Z=>typeof Z=="object"&&"id"in Z?Z.id:Z),[o]),j=f!=null,C=f?b.indexOf(f.id):-1,T=m?b.indexOf(m.id):-1,I=w.useRef(b),A=!wk(b,I.current),U=T!==-1&&C===-1||A,O=kk(u);ps(()=>{A&&j&&v(b)},[A,b,j,v]),w.useEffect(()=>{I.current=b},[b]);const W=w.useMemo(()=>({activeIndex:C,containerId:k,disabled:O,disableTransforms:U,items:b,overIndex:T,useDragOverlay:x,sortedRects:xk(b,g),strategy:a}),[C,k,O.draggable,O.droppable,U,b,T,g,x,a]);return rt.createElement(Kg.Provider,{value:W},s)}const bk=t=>{let{id:s,items:r,activeIndex:o,overIndex:a}=t;return Vg(r,o,a).indexOf(s)},Tk=t=>{let{containerId:s,isSorting:r,wasDragging:o,index:a,items:u,newIndex:f,previousItems:h,previousContainerId:g,transition:m}=t;return!m||!o||h!==u&&a===f?!1:r?!0:f!==a&&s===g},Nk={duration:200,easing:"ease"},Yg="transform",Ck=$s.Transition.toString({property:Yg,duration:0,easing:"linear"}),jk={roleDescription:"sortable"};function _k(t){let{disabled:s,index:r,node:o,rect:a}=t;const[u,f]=w.useState(null),h=w.useRef(r);return ps(()=>{if(!s&&r!==h.current&&o.current){const g=a.current;if(g){const m=bi(o.current,{ignoreTransform:!0}),v={x:g.left-m.left,y:g.top-m.top,scaleX:g.width/m.width,scaleY:g.height/m.height};(v.x||v.y)&&f(v)}}r!==h.current&&(h.current=r)},[s,r,o,a]),w.useEffect(()=>{u&&f(null)},[u]),u}function Xg(t){let{animateLayoutChanges:s=Tk,attributes:r,disabled:o,data:a,getNewIndex:u=bk,id:f,strategy:h,resizeObserverConfig:g,transition:m=Nk}=t;const{items:v,containerId:k,activeIndex:x,disabled:b,disableTransforms:j,sortedRects:C,overIndex:T,useDragOverlay:I,strategy:A}=w.useContext(Kg),U=Ek(o,b),O=v.indexOf(f),W=w.useMemo(()=>({sortable:{containerId:k,index:O,items:v},...a}),[k,a,O,v]),Z=w.useMemo(()=>v.slice(v.indexOf(f)),[v,f]),{rect:Y,node:Q,isOver:ue,setNodeRef:he}=Hg({id:f,data:W,disabled:U.droppable,resizeObserverConfig:{updateMeasurementsFor:Z,...g}}),{active:H,activatorEvent:Te,activeNodeRect:Ne,attributes:Le,setNodeRef:se,listeners:G,isDragging:X,over:P,setActivatorNodeRef:J,transform:q}=sk({id:f,data:W,attributes:{...jk,...r},disabled:U.draggable}),E=zw(he,se),L=!!H,de=L&&!j&&La(x)&&La(T),K=!I&&X,ce=K&&de?q:null,Pe=de?ce??(h??A)({rects:C,activeNodeRect:Ne,activeIndex:x,overIndex:T,index:O}):null,Ce=La(x)&&La(T)?u({id:f,items:v,activeIndex:x,overIndex:T}):O,Ee=H==null?void 0:H.id,_e=w.useRef({activeId:Ee,items:v,newIndex:Ce,containerId:k}),it=v!==_e.current.items,je=s({active:H,containerId:k,isDragging:X,isSorting:L,id:f,index:O,items:v,newIndex:_e.current.newIndex,previousItems:_e.current.items,previousContainerId:_e.current.containerId,transition:m,wasDragging:_e.current.activeId!=null}),kt=_k({disabled:!je,index:O,node:Q,rect:Y});return w.useEffect(()=>{L&&_e.current.newIndex!==Ce&&(_e.current.newIndex=Ce),k!==_e.current.containerId&&(_e.current.containerId=k),v!==_e.current.items&&(_e.current.items=v)},[L,Ce,k,v]),w.useEffect(()=>{if(Ee===_e.current.activeId)return;if(Ee!=null&&_e.current.activeId==null){_e.current.activeId=Ee;return}const It=setTimeout(()=>{_e.current.activeId=Ee},50);return()=>clearTimeout(It)},[Ee]),{active:H,activeIndex:x,attributes:Le,data:W,rect:Y,index:O,newIndex:Ce,items:v,isOver:ue,isSorting:L,isDragging:X,listeners:G,node:Q,overIndex:T,over:P,setNodeRef:E,setActivatorNodeRef:J,setDroppableNodeRef:he,setDraggableNodeRef:se,transform:kt??Pe,transition:ze()};function ze(){if(kt||it&&_e.current.newIndex===O)return Ck;if(!(K&&!Cl(Te)||!m)&&(L||je))return $s.Transition.toString({...m,property:Yg})}}function Ek(t,s){var r,o;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t==null?void 0:t.draggable)!=null?r:s.draggable,droppable:(o=t==null?void 0:t.droppable)!=null?o:s.droppable}}et.Down,et.Right,et.Up,et.Left;function Oa(t){const[s,r]=w.useState(()=>{try{const a=localStorage.getItem(t);if(a==null)return new Set;const u=JSON.parse(a);return Array.isArray(u)?new Set(u.filter(f=>typeof f=="string")):new Set}catch{return new Set}}),o=w.useCallback(a=>{r(u=>{const f=a(new Set(u));try{localStorage.setItem(t,JSON.stringify([...f]))}catch{}return f})},[t]);return[s,o]}function Rk(t,s=!1){const[r,o]=w.useState(()=>{try{const u=localStorage.getItem(t);return u==="1"?!0:u==="0"?!1:s}catch{return s}}),a=w.useCallback(u=>{o(u);try{localStorage.setItem(t,u?"1":"0")}catch{}},[t]);return[r,a]}async function ul(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const s=document.createElement("textarea");s.value=t,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const r=document.execCommand("copy");return document.body.removeChild(s),r}catch{return!1}}}function Ak(t){return t.origin_app_id!=null&&!t.user_touched&&!t.starred}function dl(t){return t.replaceAll("\\","/").replace(/\/+$/,"")}function qh(t,s){if(!s||!t.cwd)return!1;const r=dl(t.cwd),o=dl(s);return r.startsWith(`${o}/`)}function Ik(t,s){const r=new Map;for(const f of s){const h=f.cwd||"(no directory)",g=r.get(h)??[];g.push(f),r.set(h,g)}const o=new Set,a=new Set(t.filter(f=>f.deleted===1).map(f=>f.path)),u=[];for(const f of t){if(f.deleted===1){o.add(f.path);continue}o.add(f.path),u.push({path:f.path,label:f.label||f.path.split("/").pop()||f.path,sessions:r.get(f.path)??[],workspace:f})}for(const[f,h]of r)o.has(f)||a.has(f)||u.push({path:f,label:f==="(no directory)"?"Other":f.split("/").pop()||f,sessions:h,workspace:null});return u}function fl(t){return[...t].sort((s,r)=>r.sort_order-s.sort_order||(s.created_at<r.created_at?1:-1))}function Gh(t,s,r,o){const a=s.map(u=>({folder:u,sessions:t.sessions.filter(f=>f.folder_id===u.id),finishedKey:`folder:${u.id}:finished`,hidden:o.has(u.id)}));return a.push({folder:null,sessions:t.sessions.filter(u=>!(u.folder_id&&r.has(u.folder_id))),finishedKey:`${t.path}:finished`,hidden:!1}),a}function Kh(t,s){return{working:fl(t.sessions.filter(r=>r.lifecycle!=="finished")),finished:fl(t.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:s.has(t.finishedKey)}}function $a(t,s){return t.folder_id&&s.has(t.folder_id)?t.folder_id:null}function Dk(t){const s=new Set(t.map(o=>o.name));if(!s.has("New Folder"))return"New Folder";let r=2;for(;s.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function Yh({id:t,children:s,className:r}){const{setNodeRef:o,isOver:a}=Hg({id:t});return l.jsx("div",{ref:o,className:`${r??""}${a?" drop-over":""}`,children:s})}function gd({inputRef:t,value:s,onChange:r,onConfirm:o,onCancel:a}){return l.jsx("input",{ref:t,className:"tree-rename-input",value:s,onChange:u=>r(u.target.value),onClick:u=>u.stopPropagation(),onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{u.key==="Enter"&&o(),u.key==="Escape"&&a()},onBlur:o})}function Mk({s:t,backgroundTaskCount:s,isActive:r,isSelected:o,originApp:a,renaming:u,renameValue:f,renameRef:h,onRenameValue:g,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:x,onToggleStar:b}){const{attributes:j,listeners:C,setNodeRef:T,transform:I,transition:A,isDragging:U}=Xg({id:`s:${t.id}`}),O=kl(t,s);return l.jsxs("div",{ref:T,style:{transform:$s.Transform.toString(I),transition:A},className:`tree-item ${r?"active":""}${o?" selected":""} ${O.isFinished?"tree-item-finished":""}${U?" dragging":""}${t.starred?" tree-item-starred":""}`,...j,...C,onClick:k,onContextMenu:x,children:[l.jsx(ad,{iconClass:O.iconClass,iconText:O.iconText,size:16}),a&&l.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:l.jsx(wi,{iconNode:a.iconNode,size:10})}),u?l.jsx(gd,{inputRef:h,value:f,onChange:g,onConfirm:m,onCancel:v}):l.jsx("span",{className:"tree-label",children:t.title||t.id.slice(0,8)}),!u&&l.jsx("button",{className:`star-btn${t.starred?" starred":""}`,title:t.starred?"Unstar session":"Star session",onClick:W=>{W.stopPropagation(),b()},onPointerDown:W=>W.stopPropagation(),children:l.jsx(sl,{size:10,fill:t.starred?"currentColor":"none"})}),O.dot&&l.jsx(od,{status:O.dot,title:O.dotTitle})]})}function Lk({folder:t,count:s,collapsed:r,renaming:o,renameValue:a,renameRef:u,onRenameValue:f,onRenameConfirm:h,onRenameCancel:g,onToggle:m,onCtxMenu:v,children:k}){const{attributes:x,listeners:b,setNodeRef:j,transform:C,transition:T,isDragging:I,over:A}=Xg({id:`f:${t.id}`}),U=A!=null&&String(A.id).startsWith("s:");return l.jsxs("div",{ref:j,style:{transform:$s.Transform.toString(C),transition:T},className:`tree-folder ${r?"collapsed":""}${I?" dragging":""}`,children:[l.jsx("div",{className:`tree-folder-header${U?" drop-over":""}`,...x,...b,onClick:()=>{o||m()},onContextMenu:v,children:o?l.jsx(gd,{inputRef:u,value:a,onChange:f,onConfirm:h,onCancel:g}):l.jsxs(l.Fragment,{children:[l.jsx(vi,{size:8,className:"tree-chevron"}),l.jsx(Ou,{size:12}),l.jsx("span",{className:"tree-folder-label",children:t.name}),l.jsx("span",{className:"tree-count",children:s})]})}),!r&&l.jsx("div",{className:"tree-folder-children",children:k})]})}function Pk(){const t=M(_=>_.sessions),s=M(_=>_.backgroundTasks),r=M(_=>_.workspaces),o=M(_=>_.folders),a=M(_=>_.activeSessionId),u=M(_=>_.selectSession),f=M(_=>_.deleteSession),h=M(_=>_.removeWorkspace),g=M(_=>_.createSessionInWorkspace),m=M(_=>_.pickAndAddWorkspace),v=M(_=>_.renameSession),k=M(_=>_.markFinished),x=M(_=>_.markFinishedMany),b=M(_=>_.toggleStar),j=M(_=>_.reopenSession),C=M(_=>_.reopenSessionMany),T=M(_=>_.deleteSessionMany),I=M(_=>_.createSidebarFolder),A=M(_=>_.renameFolder),U=M(_=>_.deleteFolder),O=M(_=>_.applyMoves),W=M(_=>_.reorderFolders),Z=M(_=>_.apps),Y=M(_=>_.appsRootPath),Q=M(_=>_.activeAppTabId),ue=M(_=>_.openAppTab),he=M(_=>_.startAppEdit),H=M(_=>_.toggleAppPin),Te=M(_=>_.deleteApp),Ne=M(_=>_.openAppCatalog),[Le,se]=Oa("agentpane:sidebar-ws-collapsed"),[G,X]=Oa("agentpane:sidebar-sub-collapsed"),[P,J]=Oa("agentpane:sidebar-folders-collapsed"),[q,E]=Oa("agentpane:sidebar-app-edits-collapsed"),[L,de]=Rk("agentpane:sidebar-hide-auto-sessions"),[K,ce]=w.useState(null),[fe,Pe]=w.useState(null),[Ce,Ee]=w.useState(""),[_e,it]=w.useState(null),[je,kt]=w.useState(new Set),[ze,It]=w.useState(null),Fe=w.useRef(null),Dt=w.useRef(null),Rn=w.useRef(null),St=w.useRef(!1),Mt=e1(Jw(hd,{activationConstraint:{distance:5}}));function ht(){kt(new Set),It(null)}Sl(Fe,()=>ce(null),!!K),id(()=>{ce(null),ht()},!!K||je.size>0),w.useLayoutEffect(()=>{const _=Fe.current;if(!K||!_)return;const oe=8,{offsetWidth:ie,offsetHeight:ge}=_,$e=K.x+ie>window.innerWidth-oe?Math.max(oe,K.x-ie):K.x,Be=K.y+ge>window.innerHeight-oe?Math.max(oe,K.y-ge):K.y;_.style.left=`${$e}px`,_.style.top=`${Be}px`},[K]);const en=w.useMemo(()=>new Map(t.map(_=>[_.id,_])),[t]),V=w.useMemo(()=>new Map(o.map(_=>[_.id,_])),[o]),pe=w.useMemo(()=>{const _=new Map;for(const oe of[...o].sort((ie,ge)=>ie.sort_order-ge.sort_order)){const ie=_.get(oe.workspace_path)??[];ie.push(oe),_.set(oe.workspace_path,ie)}return _},[o]);function Ue(_){se(oe=>{const ie=new Set(oe);return ie.has(_)?ie.delete(_):ie.add(_),ie})}function tt(_){X(oe=>{const ie=new Set(oe);return ie.has(_)?ie.delete(_):ie.add(_),ie})}function mt(_){J(oe=>{const ie=new Set(oe);return ie.has(_)?ie.delete(_):ie.add(_),ie})}function gt(){de(!L),ht()}function Rt(_){E(oe=>{const ie=new Set(oe);return ie.has(_)?ie.delete(_):ie.add(_),ie})}w.useEffect(()=>{fe&&Dt.current&&(Dt.current.focus(),Dt.current.select())},[fe]),w.useEffect(()=>{var _,oe,ie;St.current||!a||(St.current=!0,(ie=(oe=(_=Rn.current)==null?void 0:_.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:oe.scrollIntoView)==null||ie.call(oe,{block:"nearest"}))},[a]);function Ht(_,oe,ie,ge=""){Pe({kind:_,id:oe}),Ee(ie||ge)}function ut(){if(fe){const _=Ce.trim();_&&(fe.kind==="session"?v(fe.id,_):A(fe.id,_))}Pe(null)}function An(){Pe(null),Ee("")}async function Hn(_){const oe=Dk(pe.get(_)??[]),ie=await I(_,oe);ie&&Ht("folder",ie.id,ie.name)}function Ts(_){const oe=String(_.active.id);if(oe.startsWith("s:")){const ie=en.get(oe.slice(2));ie&&it({kind:"session",label:ie.title||ie.id.slice(0,8)})}else if(oe.startsWith("f:")){const ie=V.get(oe.slice(2));ie&&it({kind:"folder",label:ie.name})}}function ms(_){it(null);const{active:oe,over:ie}=_;if(!ie)return;const ge=String(oe.id),$e=String(ie.id);if(ge.startsWith("s:")){const Be=en.get(ge.slice(2));if(!Be)return;const De=Be.cwd||"(no directory)",at=$a(Be,V);let Mn,Ln;if($e.startsWith("f:")){const Xe=V.get($e.slice(2));if(!Xe)return;Mn=Xe.workspace_path,Ln=Xe.id}else if($e.startsWith("s:")){const Xe=en.get($e.slice(2));if(!Xe)return;Mn=Xe.cwd||"(no directory)",Ln=$a(Xe,V)}else if($e.startsWith("c:")){const Xe=$e.slice(2),Tt=Xe.lastIndexOf("|");Mn=Xe.slice(0,Tt);const ss=Xe.slice(Tt+1);Ln=ss==="root"?null:ss}else return;if(Mn!==De)return;const He=fl(t.filter(Xe=>(Xe.cwd||"(no directory)")===Mn&&$a(Xe,V)===Ln)),kn=He.filter(Xe=>Xe.id!==Be.id);let zs=kn.length;if($e.startsWith("s:")){const Xe=kn.findIndex(Tt=>Tt.id===$e.slice(2));Xe>=0&&(zs=Xe)}const ts=[...kn.slice(0,zs),Be,...kn.slice(zs)],ns=[];if(Ln===at){if(ts.length===He.length&&ts.every((Xe,Tt)=>Xe.id===He[Tt].id))return;ts.forEach((Xe,Tt)=>ns.push({id:Xe.id,folder_id:Ln,sort_order:ts.length-1-Tt}))}else{const Xe=fl(t.filter(Tt=>(Tt.cwd||"(no directory)")===De&&$a(Tt,V)===at)).filter(Tt=>Tt.id!==Be.id);Xe.forEach((Tt,ss)=>ns.push({id:Tt.id,folder_id:at,sort_order:Xe.length-1-ss})),ts.forEach((Tt,ss)=>ns.push({id:Tt.id,folder_id:Ln,sort_order:ts.length-1-ss}))}O(ns);return}if(ge.startsWith("f:")){if(!$e.startsWith("f:"))return;const Be=V.get(ge.slice(2)),De=V.get($e.slice(2));if(!Be||!De||Be.id===De.id||Be.workspace_path!==De.workspace_path)return;const at=(pe.get(Be.workspace_path)??[]).map(He=>He.id),Mn=at.indexOf(Be.id),Ln=at.indexOf(De.id);at.splice(Ln,0,...at.splice(Mn,1)),W(at)}}const In=Y?t.filter(_=>!qh(_,Y)):t,Dn=new Set(L?In.filter(_=>Ak(_)&&_.id!==a).map(_=>_.id):[]),pn=Ik(r,Dn.size>0?In.filter(_=>!Dn.has(_.id)):In),wn=w.useMemo(()=>{const _=new Map;if(!Y)return _;const oe=dl(Y);for(const ie of t){if(!qh(ie,Y))continue;const ge=dl(ie.cwd).slice(oe.length+1).split("/")[0],$e=_.get(ge)??[];$e.push(ie),_.set(ge,$e)}return _},[t,Y]);function Ft(_){return{folder:null,sessions:wn.get(_)??[],finishedKey:`app:${_}:finished`,hidden:q.has(_)}}const Vt=[],st=_=>{if(_.hidden)return;const{working:oe,finished:ie,finishedCollapsed:ge}=Kh(_,G);Vt.push(...oe.map($e=>$e.id)),ge||Vt.push(...ie.map($e=>$e.id))};for(const _ of pn){if(Le.has(_.path))continue;const oe=pe.get(_.path)??[],ie=new Set(oe.map(ge=>ge.id));Gh(_,oe,ie,P).forEach(st)}Z.forEach(_=>st(Ft(_.id)));const vt=t.filter(_=>je.has(_.id)),yt=vt.filter(_=>_.lifecycle!=="finished").map(_=>_.id),qt=vt.filter(_=>_.lifecycle==="finished").map(_=>_.id);function bt(_,oe){if(oe.metaKey||oe.ctrlKey){oe.preventDefault(),It(_.id),kt(ie=>{const ge=new Set(ie);return ge.has(_.id)?ge.delete(_.id):ge.add(_.id),ge});return}if(oe.shiftKey){oe.preventDefault();const ie=ze??_.id;It(ie);const ge=Vt.indexOf(ie),$e=Vt.indexOf(_.id);if(ge>=0&&$e>=0){const[Be,De]=ge<$e?[ge,$e]:[$e,ge];kt(new Set(Vt.slice(Be,De+1)))}return}ht(),It(_.id),u(_.id)}function xt(_,oe){oe.preventDefault();const ie=je.has(_.id)&&je.size>1;je.has(_.id)||(kt(new Set),It(_.id)),ce({x:oe.clientX,y:oe.clientY,type:"session",sessionId:_.id,sessionTitle:_.title,sessionLifecycle:_.lifecycle,sessionExternalId:_.external_thread_id,multi:ie})}function ot(_){var ie;const oe=_.origin_app_id?Z.find(ge=>ge.id===_.origin_app_id):null;return l.jsx(Mk,{s:_,backgroundTaskCount:((ie=s[_.id])==null?void 0:ie.length)??0,isActive:a===_.id,isSelected:je.has(_.id),originApp:oe??null,renaming:(fe==null?void 0:fe.kind)==="session"&&fe.id===_.id,renameValue:Ce,renameRef:Dt,onRenameValue:Ee,onRenameConfirm:ut,onRenameCancel:An,onSelect:ge=>bt(_,ge),onToggleStar:()=>b(_.id),onCtxMenu:ge=>xt(_,ge)},_.id)}function Gt(_){var ie;const oe=kl(_,((ie=s[_.id])==null?void 0:ie.length)??0);return l.jsxs("div",{className:`sidebar-app-edit-row${a===_.id?" active":""}${je.has(_.id)?" selected":""}${oe.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:ge=>bt(_,ge),onContextMenu:ge=>xt(_,ge),children:[l.jsx(ad,{iconClass:oe.iconClass,iconText:oe.iconText,size:14}),(fe==null?void 0:fe.kind)==="session"&&fe.id===_.id?l.jsx(gd,{inputRef:Dt,value:Ce,onChange:Ee,onConfirm:ut,onCancel:An}):l.jsx("span",{className:"tree-label",children:_.title||_.id.slice(0,8)}),oe.dot&&l.jsx(od,{status:oe.dot,title:oe.dotTitle})]},_.id)}function Je(_,oe="workspace"){const{working:ie,finished:ge,finishedCollapsed:$e}=Kh(_,G),Be=oe==="workspace"?ot:Gt,De=l.jsxs(l.Fragment,{children:[ie.length===0&&ge.length===0?l.jsx("div",{className:"tree-empty",children:"No sessions"}):ie.map(Be),ge.length>0&&l.jsxs("div",{className:`tree-subgroup ${$e?"collapsed":""}`,children:[l.jsxs("div",{className:"tree-subgroup-header",onClick:()=>tt(_.finishedKey),children:[l.jsx(vi,{size:8,className:"tree-chevron"}),l.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),l.jsx("span",{className:"tree-subgroup-count",children:ge.length})]}),!$e&&l.jsx("div",{className:"tree-subgroup-items",children:ge.map(Be)})]})]});if(oe==="app")return De;const at=[...ie,...ge].map(Mn=>`s:${Mn.id}`);return l.jsx(Vh,{items:at,strategy:Hh,children:De})}return l.jsxs("div",{className:"ide-sidebar",ref:Rn,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${L?" active":""}`,title:L?`Show automatic sessions (${Dn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":L?"Show automatic sessions":"Hide automatic sessions","aria-pressed":L,onClick:gt,children:L?l.jsx(ew,{size:14}):l.jsx(ur,{size:14})}),l.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:l.jsx(Dr,{size:14})})]})]}),l.jsxs(ek,{sensors:Mt,collisionDetection:o1,onDragStart:Ts,onDragEnd:ms,children:[pn.length===0?l.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):pn.map(_=>{const oe=Le.has(_.path),ie=pe.get(_.path)??[],ge=new Set(ie.map(De=>De.id)),$e=Gh(_,ie,ge,P),Be=$e[$e.length-1];return l.jsxs("div",{className:`tree-section ${oe?"collapsed":""}`,children:[l.jsxs("div",{className:"tree-section-header",onClick:()=>Ue(_.path),onContextMenu:De=>{De.preventDefault(),ce({x:De.clientX,y:De.clientY,type:"workspace",path:_.path})},children:[l.jsx(vi,{size:9,className:"tree-chevron"}),l.jsx(Ou,{size:14}),l.jsx("span",{className:"tree-section-label",children:_.label}),l.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:De=>{De.stopPropagation(),g(_.path)},children:l.jsx(Dr,{size:11})}),l.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:De=>{De.stopPropagation(),Hn(_.path)},children:l.jsx(wu,{size:11})}),l.jsx("span",{className:"tree-count",children:_.sessions.length})]}),!oe&&l.jsxs("div",{className:"tree-children",children:[l.jsx(Vh,{items:ie.map(De=>`f:${De.id}`),strategy:Hh,children:$e.filter(De=>De.folder).map(De=>l.jsx(Lk,{folder:De.folder,count:De.sessions.length,collapsed:De.hidden,renaming:(fe==null?void 0:fe.kind)==="folder"&&fe.id===De.folder.id,renameValue:Ce,renameRef:Dt,onRenameValue:Ee,onRenameConfirm:ut,onRenameCancel:An,onToggle:()=>mt(De.folder.id),onCtxMenu:at=>{at.preventDefault(),ce({x:at.clientX,y:at.clientY,type:"folder",folderId:De.folder.id,folderName:De.folder.name})},children:l.jsx(Yh,{id:`c:${_.path}|${De.folder.id}`,children:Je(De)})},De.folder.id))}),l.jsx(Yh,{id:`c:${_.path}|root`,children:Je(Be)})]})]},_.path)}),l.jsx(yk,{children:_e&&l.jsxs("div",{className:"drag-overlay",children:[_e.kind==="folder"&&l.jsx(Ou,{size:12}),l.jsx("span",{children:_e.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:()=>Ne(),children:l.jsx(Dr,{size:14})})]}),Z.length===0&&l.jsx("div",{className:"tree-empty",children:"No apps yet"}),Z.map(_=>{const oe=Ft(_.id),ie=oe.sessions.length>0&&!oe.hidden;return l.jsxs("div",{className:"sidebar-app-block",children:[l.jsxs("div",{className:`sidebar-app-row${Q===_.id?" active":""}`,title:_.description??void 0,onClick:()=>ue(_.id),onContextMenu:ge=>{ge.preventDefault(),ce({x:ge.clientX,y:ge.clientY,type:"app",appId:_.id,appPinned:_.pinned})},children:[oe.sessions.length>0&&l.jsx("button",{className:`sidebar-app-chevron${ie?"":" closed"}`,title:"Edit sessions of this app",onClick:ge=>{ge.stopPropagation(),Rt(_.id)},children:l.jsx(vi,{size:10,className:"tree-chevron"})}),l.jsx(wi,{iconNode:_.iconNode,size:14,className:"sidebar-app-icon"}),l.jsx("span",{className:"tree-label",children:_.title}),oe.sessions.length>0&&l.jsx("span",{className:"sidebar-app-count",children:oe.sessions.length}),_.pinned&&l.jsx(sl,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ie&&l.jsx("div",{className:"sidebar-app-edits",children:Je(oe,"app")})]},_.id)})]}),l.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[l.jsx(wu,{size:14}),l.jsx("span",{children:"Add workspace"})]}),K&&l.jsxs("div",{ref:Fe,className:"ctx-menu",style:{position:"fixed",left:K.x,top:K.y,zIndex:500},children:[K.type==="workspace"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{g(K.path),ce(null)},children:[l.jsx(Dr,{size:12})," New Session"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Hn(K.path),ce(null)},children:[l.jsx(wu,{size:12})," New Folder"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{h(K.path),ce(null)},children:[l.jsx(fs,{size:12})," Hide Workspace"]})]}),K.type==="folder"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Ht("folder",K.folderId,K.folderName??""),ce(null)},children:[l.jsx(Va,{size:12})," Rename Folder"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{U(K.folderId),ce(null)},children:[l.jsx(fs,{size:12})," Delete Folder"]})]}),K.type==="session"&&!K.multi&&l.jsx(l.Fragment,{children:K.sessionLifecycle!=="finished"?l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Ht("session",K.sessionId,K.sessionTitle??""),ce(null)},children:[l.jsx(Va,{size:12})," Rename"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{k(K.sessionId),ce(null)},children:[l.jsx(tl,{size:12})," Mark as Finished"]}),l.jsxs("div",{className:`ctx-menu-item${K.sessionExternalId?"":" ctx-disabled"}`,title:K.sessionExternalId?void 0:"Session not started",onClick:()=>{K.sessionExternalId&&(ul(K.sessionExternalId),ce(null))},children:[l.jsx(nl,{size:12})," Copy Session ID"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(K.sessionId),ce(null)},children:[l.jsx(fs,{size:12})," Delete Session"]})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{j(K.sessionId),ce(null)},children:[l.jsx(wo,{size:12})," Reopen"]}),l.jsxs("div",{className:`ctx-menu-item${K.sessionExternalId?"":" ctx-disabled"}`,title:K.sessionExternalId?void 0:"Session not started",onClick:()=>{K.sessionExternalId&&(ul(K.sessionExternalId),ce(null))},children:[l.jsx(nl,{size:12})," Copy Session ID"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(K.sessionId),ce(null)},children:[l.jsx(fs,{size:12})," Delete Session"]})]})}),K.type==="session"&&K.multi&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-header",children:[vt.length," sessions selected"]}),yt.length>0&&l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{x(yt),ce(null),ht()},children:[l.jsx(tl,{size:12})," Mark ",yt.length," as Finished"]}),qt.length>0&&l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{C(qt),ce(null),ht()},children:[l.jsx(wo,{size:12})," Reopen ",qt.length]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{T([...je]),ce(null),ht()},children:[l.jsx(fs,{size:12})," Delete ",vt.length," Sessions"]})]}),K.type==="app"&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{he(K.appId),ce(null)},children:[l.jsx(Va,{size:12})," Edit App"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{H(K.appId),ce(null)},children:[l.jsx(sl,{size:12})," ",K.appPinned?"Unpin":"Pin"]}),l.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{Te(K.appId),ce(null)},children:[l.jsx(fs,{size:12})," Delete App"]})]})]})]})}function Ok(){const t=M(b=>b.openTabs),s=M(b=>b.activeSessionId),r=M(b=>b.sessions),o=M(b=>b.backgroundTasks),a=M(b=>b.selectSession),u=M(b=>b.closeTab),f=M(b=>b.setShowNewSessionDialog),h=M(b=>b.apps),g=M(b=>b.openAppTabs),m=M(b=>b.activeAppTabId),v=M(b=>b.openAppTab),k=M(b=>b.closeAppTab),x=M(b=>b.setActiveAppTab);return l.jsxs("div",{className:"ide-tabs",children:[t.map(b=>{var I;const j=r.find(A=>A.id===b);if(!j)return null;const C=kl(j,((I=o[b])==null?void 0:I.length)??0),T=s===b&&m==null;return l.jsxs("div",{className:`ide-tab ${T?"active":""}`,onClick:()=>{m!=null&&x(null),a(b)},children:[l.jsx(ad,{iconClass:C.iconClass,iconText:C.iconText,size:14}),j.title||b.slice(0,8),C.dot&&l.jsx(od,{status:C.dot,title:C.dotTitle}),l.jsx("span",{className:"ide-tab-close",onClick:A=>{A.stopPropagation(),u(b)},children:l.jsx(En,{size:12})})]},b)}),g.map(b=>{const j=h.find(T=>T.id===b),C=m===b;return l.jsxs("div",{className:`ide-tab ${C?"active":""}`,onClick:()=>v(b),children:[l.jsx(wi,{iconNode:j==null?void 0:j.iconNode,size:12,className:"miniapp-tab-icon"}),(j==null?void 0:j.title)??b,l.jsx("span",{className:"ide-tab-close",onClick:T=>{T.stopPropagation(),k(b)},children:l.jsx(En,{size:12})})]},b)}),l.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>f(!0),children:l.jsx(Dr,{size:14})})]})}function vd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Pr=vd();function Qg(t){Pr=t}var go={exec:()=>null};function nt(t,s=""){let r=typeof t=="string"?t:t.source;const o={replace:(a,u)=>{let f=typeof u=="string"?u:u.source;return f=f.replace(yn.caret,"$1"),r=r.replace(a,f),o},getRegex:()=>new RegExp(r,s)};return o}var yn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},$k=/^(?:[ \t]*(?:\n|$))+/,zk=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Fk=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Eo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Uk=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yd=/(?:[*+-]|\d{1,9}[.)])/,Zg=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Jg=nt(Zg).replace(/bull/g,yd).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(),Bk=nt(Zg).replace(/bull/g,yd).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(),xd=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Wk=/^[^\n]+/,wd=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Hk=nt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",wd).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Vk=nt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,yd).getRegex(),El="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",kd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qk=nt("^ {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",kd).replace("tag",El).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ev=nt(xd).replace("hr",Eo).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",El).getRegex(),Gk=nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ev).getRegex(),Sd={blockquote:Gk,code:zk,def:Hk,fences:Fk,heading:Uk,hr:Eo,html:qk,lheading:Jg,list:Vk,newline:$k,paragraph:ev,table:go,text:Wk},Xh=nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Eo).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",El).getRegex(),Kk={...Sd,lheading:Bk,table:Xh,paragraph:nt(xd).replace("hr",Eo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Xh).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",El).getRegex()},Yk={...Sd,html:nt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",kd).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:go,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:nt(xd).replace("hr",Eo).replace("heading",` *#{1,6} *[^
|
|
409
|
+
]`).replace("lheading",Jg).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Xk=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Qk=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,tv=/^( {2,}|\\)\n(?!\s*$)/,Zk=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Rl=/[\p{P}\p{S}]/u,bd=/[\s\p{P}\p{S}]/u,nv=/[^\s\p{P}\p{S}]/u,Jk=nt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,bd).getRegex(),sv=/(?!~)[\p{P}\p{S}]/u,eS=/(?!~)[\s\p{P}\p{S}]/u,tS=/(?:[^\s\p{P}\p{S}]|~)/u,nS=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,rv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,sS=nt(rv,"u").replace(/punct/g,Rl).getRegex(),rS=nt(rv,"u").replace(/punct/g,sv).getRegex(),iv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",iS=nt(iv,"gu").replace(/notPunctSpace/g,nv).replace(/punctSpace/g,bd).replace(/punct/g,Rl).getRegex(),oS=nt(iv,"gu").replace(/notPunctSpace/g,tS).replace(/punctSpace/g,eS).replace(/punct/g,sv).getRegex(),aS=nt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,nv).replace(/punctSpace/g,bd).replace(/punct/g,Rl).getRegex(),lS=nt(/\\(punct)/,"gu").replace(/punct/g,Rl).getRegex(),cS=nt(/^<(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(),uS=nt(kd).replace("(?:-->|$)","-->").getRegex(),dS=nt("^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",uS).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pl=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fS=nt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",pl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ov=nt(/^!?\[(label)\]\[(ref)\]/).replace("label",pl).replace("ref",wd).getRegex(),av=nt(/^!?\[(ref)\](?:\[\])?/).replace("ref",wd).getRegex(),pS=nt("reflink|nolink(?!\\()","g").replace("reflink",ov).replace("nolink",av).getRegex(),Td={_backpedal:go,anyPunctuation:lS,autolink:cS,blockSkip:nS,br:tv,code:Qk,del:go,emStrongLDelim:sS,emStrongRDelimAst:iS,emStrongRDelimUnd:aS,escape:Xk,link:fS,nolink:av,punctuation:Jk,reflink:ov,reflinkSearch:pS,tag:dS,text:Zk,url:go},hS={...Td,link:nt(/^!?\[(label)\]\((.*?)\)/).replace("label",pl).getRegex(),reflink:nt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pl).getRegex()},Uu={...Td,emStrongRDelimAst:oS,emStrongLDelim:rS,url:nt(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},mS={...Uu,br:nt(tv).replace("{2,}","*").getRegex(),text:nt(Uu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},za={normal:Sd,gfm:Kk,pedantic:Yk},ro={normal:Td,gfm:Uu,breaks:mS,pedantic:hS},gS={"&":"&","<":"<",">":">",'"':""","'":"'"},Qh=t=>gS[t];function Ss(t,s){if(s){if(yn.escapeTest.test(t))return t.replace(yn.escapeReplace,Qh)}else if(yn.escapeTestNoEncode.test(t))return t.replace(yn.escapeReplaceNoEncode,Qh);return t}function Zh(t){try{t=encodeURI(t).replace(yn.percentDecode,"%")}catch{return null}return t}function Jh(t,s){var u;const r=t.replace(yn.findPipe,(f,h,g)=>{let m=!1,v=h;for(;--v>=0&&g[v]==="\\";)m=!m;return m?"|":" |"}),o=r.split(yn.splitPipe);let a=0;if(o[0].trim()||o.shift(),o.length>0&&!((u=o.at(-1))!=null&&u.trim())&&o.pop(),s)if(o.length>s)o.splice(s);else for(;o.length<s;)o.push("");for(;a<o.length;a++)o[a]=o[a].trim().replace(yn.slashPipe,"|");return o}function io(t,s,r){const o=t.length;if(o===0)return"";let a=0;for(;a<o&&t.charAt(o-a-1)===s;)a++;return t.slice(0,o-a)}function vS(t,s){if(t.indexOf(s[1])===-1)return-1;let r=0;for(let o=0;o<t.length;o++)if(t[o]==="\\")o++;else if(t[o]===s[0])r++;else if(t[o]===s[1]&&(r--,r<0))return o;return r>0?-2:-1}function em(t,s,r,o,a){const u=s.href,f=s.title||null,h=t[1].replace(a.other.outputLinkReplace,"$1");o.state.inLink=!0;const g={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:u,title:f,text:h,tokens:o.inlineTokens(h)};return o.state.inLink=!1,g}function yS(t,s,r){const o=t.match(r.other.indentCodeCompensation);if(o===null)return s;const a=o[1];return s.split(`
|
|
415
410
|
`).map(u=>{const f=u.match(r.other.beginningSpace);if(f===null)return u;const[h]=f;return h.length>=a.length?u.slice(a.length):u}).join(`
|
|
416
|
-
`)}var
|
|
417
|
-
`)}}}fences(t){const s=this.rules.block.fences.exec(t);if(s){const r=s[0],o=
|
|
411
|
+
`)}var hl=class{constructor(t){lt(this,"options");lt(this,"rules");lt(this,"lexer");this.options=t||Pr}space(t){const s=this.rules.block.newline.exec(t);if(s&&s[0].length>0)return{type:"space",raw:s[0]}}code(t){const s=this.rules.block.code.exec(t);if(s){const r=s[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s[0],codeBlockStyle:"indented",text:this.options.pedantic?r:io(r,`
|
|
412
|
+
`)}}}fences(t){const s=this.rules.block.fences.exec(t);if(s){const r=s[0],o=yS(r,s[3]||"",this.rules);return{type:"code",raw:r,lang:s[2]?s[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):s[2],text:o}}}heading(t){const s=this.rules.block.heading.exec(t);if(s){let r=s[2].trim();if(this.rules.other.endingHash.test(r)){const o=io(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:s[0],depth:s[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const s=this.rules.block.hr.exec(t);if(s)return{type:"hr",raw:io(s[0],`
|
|
418
413
|
`)}}blockquote(t){const s=this.rules.block.blockquote.exec(t);if(s){let r=io(s[0],`
|
|
419
414
|
`).split(`
|
|
420
415
|
`),o="",a="";const u=[];for(;r.length>0;){let f=!1;const h=[];let g;for(g=0;g<r.length;g++)if(this.rules.other.blockquoteStart.test(r[g]))h.push(r[g]),f=!0;else if(!f)h.push(r[g]);else break;r=r.slice(g);const m=h.join(`
|
|
421
416
|
`),v=m.replace(this.rules.other.blockquoteSetextReplace,`
|
|
422
417
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");o=o?`${o}
|
|
423
418
|
${m}`:m,a=a?`${a}
|
|
424
|
-
${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,u,!0),this.lexer.state.top=k,r.length===0)break;const x=u.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){const b=x,
|
|
419
|
+
${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,u,!0),this.lexer.state.top=k,r.length===0)break;const x=u.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){const b=x,j=b.raw+`
|
|
425
420
|
`+r.join(`
|
|
426
|
-
`),C=this.blockquote(
|
|
421
|
+
`),C=this.blockquote(j);u[u.length-1]=C,o=o.substring(0,o.length-b.raw.length)+C.raw,a=a.substring(0,a.length-b.text.length)+C.text;break}else if((x==null?void 0:x.type)==="list"){const b=x,j=b.raw+`
|
|
427
422
|
`+r.join(`
|
|
428
|
-
`),C=this.list(
|
|
423
|
+
`),C=this.list(j);u[u.length-1]=C,o=o.substring(0,o.length-x.raw.length)+C.raw,a=a.substring(0,a.length-b.raw.length)+C.raw,r=j.substring(u.at(-1).raw.length).split(`
|
|
429
424
|
`);continue}}return{type:"blockquote",raw:o,tokens:u,text:a}}}list(t){let s=this.rules.block.list.exec(t);if(s){let r=s[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 u=this.rules.other.listItemRegex(r);let f=!1;for(;t;){let g=!1,m="",v="";if(!(s=u.exec(t))||this.rules.block.hr.test(t))break;m=s[0],t=t.substring(m.length);let k=s[2].split(`
|
|
430
425
|
`,1)[0].replace(this.rules.other.listReplaceTabs,I=>" ".repeat(3*I.length)),x=t.split(`
|
|
431
|
-
`,1)[0],b=!k.trim(),
|
|
432
|
-
`,t=t.substring(x.length+1),g=!0),!g){const I=this.rules.other.nextBulletRegex(
|
|
433
|
-
`,1)[0];let Y;if(x=Z,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),Y=x):Y=x.replace(this.rules.other.tabCharGlobal," "),U.test(x)||O.test(x)||W.test(x)||I.test(x)||A.test(x))break;if(Y.search(this.rules.other.nonSpaceChar)>=
|
|
434
|
-
`+Y.slice(
|
|
426
|
+
`,1)[0],b=!k.trim(),j=0;if(this.options.pedantic?(j=2,v=k.trimStart()):b?j=s[1].length+1:(j=s[2].search(this.rules.other.nonSpaceChar),j=j>4?1:j,v=k.slice(j),j+=s[1].length),b&&this.rules.other.blankLine.test(x)&&(m+=x+`
|
|
427
|
+
`,t=t.substring(x.length+1),g=!0),!g){const I=this.rules.other.nextBulletRegex(j),A=this.rules.other.hrRegex(j),U=this.rules.other.fencesBeginRegex(j),O=this.rules.other.headingBeginRegex(j),W=this.rules.other.htmlBeginRegex(j);for(;t;){const Z=t.split(`
|
|
428
|
+
`,1)[0];let Y;if(x=Z,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),Y=x):Y=x.replace(this.rules.other.tabCharGlobal," "),U.test(x)||O.test(x)||W.test(x)||I.test(x)||A.test(x))break;if(Y.search(this.rules.other.nonSpaceChar)>=j||!x.trim())v+=`
|
|
429
|
+
`+Y.slice(j);else{if(b||k.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||U.test(k)||O.test(k)||A.test(k))break;v+=`
|
|
435
430
|
`+x}!b&&!x.trim()&&(b=!0),m+=Z+`
|
|
436
|
-
`,t=t.substring(Z.length+1),k=Y.slice(
|
|
437
|
-
`):[],u={type:"table",raw:s[0],header:[],align:[],rows:[]};if(r.length===o.length){for(const h of o)this.rules.other.tableAlignRight.test(h)?u.align.push("right"):this.rules.other.tableAlignCenter.test(h)?u.align.push("center"):this.rules.other.tableAlignLeft.test(h)?u.align.push("left"):u.align.push(null);for(let h=0;h<r.length;h++)u.header.push({text:r[h],tokens:this.lexer.inline(r[h]),header:!0,align:u.align[h]});for(const h of a)u.rows.push(
|
|
438
|
-
`?s[1].slice(0,-1):s[1];return{type:"paragraph",raw:s[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const s=this.rules.block.text.exec(t);if(s)return{type:"text",raw:s[0],text:s[0],tokens:this.lexer.inline(s[0])}}escape(t){const s=this.rules.inline.escape.exec(t);if(s)return{type:"escape",raw:s[0],text:s[1]}}tag(t){const s=this.rules.inline.tag.exec(t);if(s)return!this.lexer.state.inLink&&this.rules.other.startATag.test(s[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(s[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(s[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(s[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:s[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:s[0]}}link(t){const s=this.rules.inline.link.exec(t);if(s){const r=s[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const u=io(r.slice(0,-1),"\\");if((r.length-u.length)%2===0)return}else{const u=
|
|
431
|
+
`,t=t.substring(Z.length+1),k=Y.slice(j)}}a.loose||(f?a.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(f=!0));let C=null,T;this.options.gfm&&(C=this.rules.other.listIsTask.exec(v),C&&(T=C[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),a.items.push({type:"list_item",raw:m,task:!!C,checked:T,loose:!1,text:v,tokens:[]}),a.raw+=m}const h=a.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let g=0;g<a.items.length;g++)if(this.lexer.state.top=!1,a.items[g].tokens=this.lexer.blockTokens(a.items[g].text,[]),!a.loose){const m=a.items[g].tokens.filter(k=>k.type==="space"),v=m.length>0&&m.some(k=>this.rules.other.anyLine.test(k.raw));a.loose=v}if(a.loose)for(let g=0;g<a.items.length;g++)a.items[g].loose=!0;return a}}html(t){const s=this.rules.block.html.exec(t);if(s)return{type:"html",block:!0,raw:s[0],pre:s[1]==="pre"||s[1]==="script"||s[1]==="style",text:s[0]}}def(t){const s=this.rules.block.def.exec(t);if(s){const r=s[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=s[2]?s[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",a=s[3]?s[3].substring(1,s[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):s[3];return{type:"def",tag:r,raw:s[0],href:o,title:a}}}table(t){var f;const s=this.rules.block.table.exec(t);if(!s||!this.rules.other.tableDelimiter.test(s[2]))return;const r=Jh(s[1]),o=s[2].replace(this.rules.other.tableAlignChars,"").split("|"),a=(f=s[3])!=null&&f.trim()?s[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
432
|
+
`):[],u={type:"table",raw:s[0],header:[],align:[],rows:[]};if(r.length===o.length){for(const h of o)this.rules.other.tableAlignRight.test(h)?u.align.push("right"):this.rules.other.tableAlignCenter.test(h)?u.align.push("center"):this.rules.other.tableAlignLeft.test(h)?u.align.push("left"):u.align.push(null);for(let h=0;h<r.length;h++)u.header.push({text:r[h],tokens:this.lexer.inline(r[h]),header:!0,align:u.align[h]});for(const h of a)u.rows.push(Jh(h,u.header.length).map((g,m)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:u.align[m]})));return u}}lheading(t){const s=this.rules.block.lheading.exec(t);if(s)return{type:"heading",raw:s[0],depth:s[2].charAt(0)==="="?1:2,text:s[1],tokens:this.lexer.inline(s[1])}}paragraph(t){const s=this.rules.block.paragraph.exec(t);if(s){const r=s[1].charAt(s[1].length-1)===`
|
|
433
|
+
`?s[1].slice(0,-1):s[1];return{type:"paragraph",raw:s[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const s=this.rules.block.text.exec(t);if(s)return{type:"text",raw:s[0],text:s[0],tokens:this.lexer.inline(s[0])}}escape(t){const s=this.rules.inline.escape.exec(t);if(s)return{type:"escape",raw:s[0],text:s[1]}}tag(t){const s=this.rules.inline.tag.exec(t);if(s)return!this.lexer.state.inLink&&this.rules.other.startATag.test(s[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(s[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(s[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(s[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:s[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:s[0]}}link(t){const s=this.rules.inline.link.exec(t);if(s){const r=s[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const u=io(r.slice(0,-1),"\\");if((r.length-u.length)%2===0)return}else{const u=vS(s[2],"()");if(u===-2)return;if(u>-1){const h=(s[0].indexOf("!")===0?5:4)+s[1].length+u;s[2]=s[2].substring(0,u),s[0]=s[0].substring(0,h).trim(),s[3]=""}}let o=s[2],a="";if(this.options.pedantic){const u=this.rules.other.pedanticHrefTitle.exec(o);u&&(o=u[1],a=u[3])}else a=s[3]?s[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),em(s,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},s[0],this.lexer,this.rules)}}reflink(t,s){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),a=s[o.toLowerCase()];if(!a){const u=r[0].charAt(0);return{type:"text",raw:u,text:u}}return em(r,a,r[0],this.lexer,this.rules)}}emStrong(t,s,r=""){let o=this.rules.inline.emStrongLDelim.exec(t);if(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const u=[...o[0]].length-1;let f,h,g=u,m=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,s=s.slice(-1*t.length+u);(o=v.exec(s))!=null;){if(f=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!f)continue;if(h=[...f].length,o[3]||o[4]){g+=h;continue}else if((o[5]||o[6])&&u%3&&!((u+h)%3)){m+=h;continue}if(g-=h,g>0)continue;h=Math.min(h,h+g+m);const k=[...o[0]][0].length,x=t.slice(0,u+o.index+k+h);if(Math.min(u,h)%2){const j=x.slice(1,-1);return{type:"em",raw:x,text:j,tokens:this.lexer.inlineTokens(j)}}const b=x.slice(2,-2);return{type:"strong",raw:x,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(t){const s=this.rules.inline.code.exec(t);if(s){let r=s[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(r),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:s[0],text:r}}}br(t){const s=this.rules.inline.br.exec(t);if(s)return{type:"br",raw:s[0]}}del(t){const s=this.rules.inline.del.exec(t);if(s)return{type:"del",raw:s[0],text:s[2],tokens:this.lexer.inlineTokens(s[2])}}autolink(t){const s=this.rules.inline.autolink.exec(t);if(s){let r,o;return s[2]==="@"?(r=s[1],o="mailto:"+r):(r=s[1],o=r),{type:"link",raw:s[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let s;if(s=this.rules.inline.url.exec(t)){let o,a;if(s[2]==="@")o=s[0],a="mailto:"+o;else{let u;do u=s[0],s[0]=((r=this.rules.inline._backpedal.exec(s[0]))==null?void 0:r[0])??"";while(u!==s[0]);o=s[0],s[1]==="www."?a="http://"+s[0]:a=s[0]}return{type:"link",raw:s[0],text:o,href:a,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(t){const s=this.rules.inline.text.exec(t);if(s){const r=this.lexer.state.inRawBlock;return{type:"text",raw:s[0],text:s[0],escaped:r}}}},Ls=class Bu{constructor(s){lt(this,"tokens");lt(this,"options");lt(this,"state");lt(this,"tokenizer");lt(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=s||Pr,this.options.tokenizer=this.options.tokenizer||new hl,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:yn,block:za.normal,inline:ro.normal};this.options.pedantic?(r.block=za.pedantic,r.inline=ro.pedantic):this.options.gfm&&(r.block=za.gfm,this.options.breaks?r.inline=ro.breaks:r.inline=ro.gfm),this.tokenizer.rules=r}static get rules(){return{block:za,inline:ro}}static lex(s,r){return new Bu(r).lex(s)}static lexInline(s,r){return new Bu(r).inlineTokens(s)}lex(s){s=s.replace(yn.carriageReturn,`
|
|
439
434
|
`),this.blockTokens(s,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const o=this.inlineQueue[r];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(s,r=[],o=!1){var a,u,f;for(this.options.pedantic&&(s=s.replace(yn.tabCharGlobal," ").replace(yn.spaceLine,""));s;){let h;if((u=(a=this.options.extensions)==null?void 0:a.block)!=null&&u.some(m=>(h=m.call({lexer:this},s,r))?(s=s.substring(h.raw.length),r.push(h),!0):!1))continue;if(h=this.tokenizer.space(s)){s=s.substring(h.raw.length);const m=r.at(-1);h.raw.length===1&&m!==void 0?m.raw+=`
|
|
440
435
|
`:r.push(h);continue}if(h=this.tokenizer.code(s)){s=s.substring(h.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
441
436
|
`+h.raw,m.text+=`
|
|
@@ -445,7 +440,7 @@ ${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
|
|
|
445
440
|
`+h.raw,m.text+=`
|
|
446
441
|
`+h.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(h),o=g.length!==s.length,s=s.substring(h.raw.length);continue}if(h=this.tokenizer.text(s)){s=s.substring(h.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
447
442
|
`+h.raw,m.text+=`
|
|
448
|
-
`+h.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(h);continue}if(s){const m="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,r}inline(s,r=[]){return this.inlineQueue.push({src:s,tokens:r}),r}inlineTokens(s,r=[]){var h,g,m;let o=s,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 u=!1,f="";for(;s;){u||(f=""),u=!1;let v;if((g=(h=this.options.extensions)==null?void 0:h.inline)!=null&&g.some(x=>(v=x.call({lexer:this},s,r))?(s=s.substring(v.raw.length),r.push(v),!0):!1))continue;if(v=this.tokenizer.escape(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.tag(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.link(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.reflink(s,this.tokens.links)){s=s.substring(v.raw.length);const 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(s,o,f)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.codespan(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.br(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.del(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.autolink(s)){s=s.substring(v.raw.length),r.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(s))){s=s.substring(v.raw.length),r.push(v);continue}let k=s;if((m=this.options.extensions)!=null&&m.startInline){let x=1/0;const b=s.slice(1);let
|
|
443
|
+
`+h.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=m.text):r.push(h);continue}if(s){const m="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return this.state.top=!0,r}inline(s,r=[]){return this.inlineQueue.push({src:s,tokens:r}),r}inlineTokens(s,r=[]){var h,g,m;let o=s,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 u=!1,f="";for(;s;){u||(f=""),u=!1;let v;if((g=(h=this.options.extensions)==null?void 0:h.inline)!=null&&g.some(x=>(v=x.call({lexer:this},s,r))?(s=s.substring(v.raw.length),r.push(v),!0):!1))continue;if(v=this.tokenizer.escape(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.tag(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.link(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.reflink(s,this.tokens.links)){s=s.substring(v.raw.length);const 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(s,o,f)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.codespan(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.br(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.del(s)){s=s.substring(v.raw.length),r.push(v);continue}if(v=this.tokenizer.autolink(s)){s=s.substring(v.raw.length),r.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(s))){s=s.substring(v.raw.length),r.push(v);continue}let k=s;if((m=this.options.extensions)!=null&&m.startInline){let x=1/0;const b=s.slice(1);let j;this.options.extensions.startInline.forEach(C=>{j=C.call({lexer:this},b),typeof j=="number"&&j>=0&&(x=Math.min(x,j))}),x<1/0&&x>=0&&(k=s.substring(0,x+1))}if(v=this.tokenizer.inlineText(k)){s=s.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(f=v.raw.slice(-1)),u=!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(s){const x="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},ml=class{constructor(t){lt(this,"options");lt(this,"parser");this.options=t||Pr}space(t){return""}code({text:t,lang:s,escaped:r}){var u;const o=(u=(s||"").match(yn.notSpaceStart))==null?void 0:u[0],a=t.replace(yn.endingNewline,"")+`
|
|
449
444
|
`;return o?'<pre><code class="language-'+Ss(o)+'">'+(r?a:Ss(a,!0))+`</code></pre>
|
|
450
445
|
`:"<pre><code>"+(r?a:Ss(a,!0))+`</code></pre>
|
|
451
446
|
`}blockquote({tokens:t}){return`<blockquote>
|
|
@@ -463,30 +458,30 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
463
458
|
`}tablerow({text:t}){return`<tr>
|
|
464
459
|
${t}</tr>
|
|
465
460
|
`}tablecell(t){const s=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+s+`</${r}>
|
|
466
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Ss(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:s,tokens:r}){const o=this.parser.parseInline(r),a=
|
|
467
|
-
`+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(s,r=this.renderer){var a,u;let o="";for(let f=0;f<s.length;f++){const h=s[f];if((u=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&u[h.type]){const m=this.options.extensions.renderers[h.type].call({parser:this},h);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(h.type)){o+=m||"";continue}}const g=h;switch(g.type){case"escape":{o+=r.text(g);break}case"html":{o+=r.html(g);break}case"link":{o+=r.link(g);break}case"image":{o+=r.image(g);break}case"strong":{o+=r.strong(g);break}case"em":{o+=r.em(g);break}case"codespan":{o+=r.codespan(g);break}case"br":{o+=r.br(g);break}case"del":{o+=r.del(g);break}case"text":{o+=r.text(g);break}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},
|
|
468
|
-
Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+Ss(r.message+"",!0)+"</pre>";return s?Promise.resolve(o):o}if(s)return Promise.reject(r);throw r}}},Mr=new
|
|
469
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TS(t,s){return kS(t)||SS(t,s)||NS(t,s)||bS()}function NS(t,s){if(t){if(typeof t=="string")return em(t,s);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?em(t,s):void 0}}const av=Object.entries,tm=Object.setPrototypeOf,CS=Object.isFrozen,_S=Object.getPrototypeOf,jS=Object.getOwnPropertyDescriptor;let sn=Object.freeze,rn=Object.seal,fi=Object.create,lv=typeof Reflect<"u"&&Reflect,Hu=lv.apply,Vu=lv.construct;sn||(sn=function(s){return s});rn||(rn=function(s){return s});Hu||(Hu=function(s,r){for(var o=arguments.length,a=new Array(o>2?o-2:0),u=2;u<o;u++)a[u-2]=arguments[u];return s.apply(r,a)});Vu||(Vu=function(s){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 s(...o)});const ci=zt(Array.prototype.forEach),ES=zt(Array.prototype.lastIndexOf),nm=zt(Array.prototype.pop),ui=zt(Array.prototype.push),RS=zt(Array.prototype.splice),ar=Array.isArray,uo=zt(String.prototype.toLowerCase),bu=zt(String.prototype.toString),sm=zt(String.prototype.match),oo=zt(String.prototype.replace),rm=zt(String.prototype.indexOf),AS=zt(String.prototype.trim),IS=zt(Number.prototype.toString),DS=zt(Boolean.prototype.toString),im=typeof BigInt>"u"?null:zt(BigInt.prototype.toString),om=typeof Symbol>"u"?null:zt(Symbol.prototype.toString),Zt=zt(Object.prototype.hasOwnProperty),ao=zt(Object.prototype.toString),Qt=zt(RegExp.prototype.test),Ar=MS(TypeError);function zt(t){return function(s){s instanceof RegExp&&(s.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 Hu(t,s,o)}}function MS(t){return function(){for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return Vu(t,r)}}function Ve(t,s){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:uo;if(tm&&tm(t,null),!ar(s))return t;let o=s.length;for(;o--;){let a=s[o];if(typeof a=="string"){const u=r(a);u!==a&&(CS(s)||(s[o]=u),a=u)}t[a]=!0}return t}function LS(t){for(let s=0;s<t.length;s++)Zt(t,s)||(t[s]=null);return t}function un(t){const s=fi(null);for(const o of av(t)){var r=TS(o,2);const a=r[0],u=r[1];Zt(t,a)&&(ar(u)?s[a]=LS(u):u&&typeof u=="object"&&u.constructor===Object?s[a]=un(u):s[a]=u)}return s}function PS(t){switch(typeof t){case"string":return t;case"number":return IS(t);case"boolean":return DS(t);case"bigint":return im?im(t):"0";case"symbol":return om?om(t):"Symbol()";case"undefined":return ao(t);case"function":case"object":{if(t===null)return ao(t);const s=t,r=us(s,"toString");if(typeof r=="function"){const o=r(s);return typeof o=="string"?o:ao(o)}return ao(t)}default:return ao(t)}}function us(t,s){for(;t!==null;){const o=jS(t,s);if(o){if(o.get)return zt(o.get);if(typeof o.value=="function")return zt(o.value)}t=_S(t)}function r(){return null}return r}function OS(t){try{return Qt(t,""),!0}catch{return!1}}const am=sn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Tu=sn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Nu=sn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),$S=sn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Cu=sn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),zS=sn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),lm=sn(["#text"]),cm=sn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),_u=sn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),um=sn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Fa=sn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),FS=rn(/{{[\w\W]*|^[\w\W]*}}/g),US=rn(/<%[\w\W]*|^[\w\W]*%>/g),BS=rn(/\${[\w\W]*/g),WS=rn(/^data-[\-\w.\u00B7-\uFFFF]+$/),HS=rn(/^aria-[\-\w]+$/),dm=rn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),VS=rn(/^(?:\w+script|data):/i),qS=rn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),GS=rn(/^html$/i),KS=rn(/^[a-z][.\w]*(-[.\w]+)+$/i),fm=rn(/<[/\w!]/g),pm=rn(/<[/\w]/g),YS=rn(/<\/no(script|embed|frames)/i),XS=rn(/\/>/i),Un={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},QS=function(){return typeof window>"u"?null:window},ZS=function(s,r){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let o=null;const a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(o=r.getAttribute(a));const u="dompurify"+(o?"#"+o:"");try{return s.createPolicy(u,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},hm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ir=function(s,r,o,a){return Zt(s,r)&&ar(s[r])?Ve(a.base?un(a.base):{},s[r],a.transform):o};function cv(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:QS();const s=ae=>cv(ae);if(s.version="3.4.13",s.removed=[],!t||!t.document||t.document.nodeType!==Un.document||!t.Element)return s.isSupported=!1,s;let r=t.document;const o=r,a=o.currentScript;t.DocumentFragment;const u=t.HTMLTemplateElement,f=t.Node,h=t.Element,g=t.NodeFilter,m=t.NamedNodeMap;m===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const v=t.DOMParser,k=t.trustedTypes,x=h.prototype,b=us(x,"cloneNode"),_=us(x,"remove"),C=us(x,"nextSibling"),T=us(x,"childNodes"),I=us(x,"parentNode"),A=us(x,"shadowRoot"),U=us(x,"attributes"),O=f&&f.prototype?us(f.prototype,"nodeType"):null,W=f&&f.prototype?us(f.prototype,"nodeName"):null,Z=f&&f.prototype?us(f.prototype,"ownerDocument"):null;if(typeof u=="function"){const ae=r.createElement("template");ae.content&&ae.content.ownerDocument&&(r=ae.content.ownerDocument)}let Y,Q="",ue,he=!1,H=0;const Te=function(){if(H>0)throw Ar('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(S){Te(),H++;try{return Y.createHTML(S)}finally{H--}},Le=function(S){Te(),H++;try{return Y.createScriptURL(S)}finally{H--}},se=function(){return he||(ue=ZS(k,a),he=!0),ue},G=r,X=G.implementation,P=G.createNodeIterator,J=G.createDocumentFragment,q=G.getElementsByTagName,E=o.importNode;let L=hm();s.isSupported=typeof av=="function"&&typeof I=="function"&&X&&X.createHTMLDocument!==void 0;const de=FS,K=US,ce=BS,fe=WS,Pe=HS,Ce=VS,Ee=qS,je=KS;let it=dm,_e=null;const kt=Ve({},[...am,...Tu,...Nu,...Cu,...lm]);let ze=null;const It=Ve({},[...cm,..._u,...um,...Fa]);let Fe=Object.seal(fi(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}})),Dt=null,Rn=null;const St=Object.seal(fi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Mt=!0,ht=!0,en=!1,V=!0,pe=!1,Ue=!0,tt=!1,mt=!1,gt=null,Rt=null,Ht=!1,ut=!1,An=!1,Hn=!1,Ts=!0,ms=!1;const In="user-content-";let Dn=!0,pn=!1,wn={},Ft=null;const Vt=Ve({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let st=null;const vt=Ve({},["audio","video","img","source","image","track"]);let yt=null;const qt=Ve({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),bt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",ot="http://www.w3.org/1999/xhtml";let Gt=ot,Je=!1,j=null;const oe=Ve({},[bt,xt,ot],bu),ie=sn(["mi","mo","mn","ms","mtext"]);let ge=Ve({},ie);const $e=sn(["annotation-xml"]);let Be=Ve({},$e);const De=Ve({},["title","style","font","a","script"]);let at=null;const Mn=["application/xhtml+xml","text/html"],Ln="text/html";let He=null,kn=null;const $s=r.createElement("form"),ts=function(S){return S instanceof RegExp||S instanceof Function},ns=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(kn&&kn===S)return;(!S||typeof S!="object")&&(S={}),S=un(S),at=Mn.indexOf(S.PARSER_MEDIA_TYPE)===-1?Ln:S.PARSER_MEDIA_TYPE,He=at==="application/xhtml+xml"?bu:uo,_e=ir(S,"ALLOWED_TAGS",kt,{transform:He}),ze=ir(S,"ALLOWED_ATTR",It,{transform:He}),j=ir(S,"ALLOWED_NAMESPACES",oe,{transform:bu}),yt=ir(S,"ADD_URI_SAFE_ATTR",qt,{transform:He,base:qt}),st=ir(S,"ADD_DATA_URI_TAGS",vt,{transform:He,base:vt}),Ft=ir(S,"FORBID_CONTENTS",Vt,{transform:He}),Dt=ir(S,"FORBID_TAGS",un({}),{transform:He}),Rn=ir(S,"FORBID_ATTR",un({}),{transform:He}),wn=Zt(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES=="object"?un(S.USE_PROFILES):S.USE_PROFILES:!1,Mt=S.ALLOW_ARIA_ATTR!==!1,ht=S.ALLOW_DATA_ATTR!==!1,en=S.ALLOW_UNKNOWN_PROTOCOLS||!1,V=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=S.SAFE_FOR_TEMPLATES||!1,Ue=S.SAFE_FOR_XML!==!1,tt=S.WHOLE_DOCUMENT||!1,ut=S.RETURN_DOM||!1,An=S.RETURN_DOM_FRAGMENT||!1,Hn=S.RETURN_TRUSTED_TYPE||!1,Ht=S.FORCE_BODY||!1,Ts=S.SANITIZE_DOM!==!1,ms=S.SANITIZE_NAMED_PROPS||!1,Dn=S.KEEP_CONTENT!==!1,pn=S.IN_PLACE||!1,it=OS(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:dm,Gt=typeof S.NAMESPACE=="string"?S.NAMESPACE:ot,ge=Zt(S,"MATHML_TEXT_INTEGRATION_POINTS")&&S.MATHML_TEXT_INTEGRATION_POINTS&&typeof S.MATHML_TEXT_INTEGRATION_POINTS=="object"?un(S.MATHML_TEXT_INTEGRATION_POINTS):Ve({},ie),Be=Zt(S,"HTML_INTEGRATION_POINTS")&&S.HTML_INTEGRATION_POINTS&&typeof S.HTML_INTEGRATION_POINTS=="object"?un(S.HTML_INTEGRATION_POINTS):Ve({},$e);const $=Zt(S,"CUSTOM_ELEMENT_HANDLING")&&S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING=="object"?un(S.CUSTOM_ELEMENT_HANDLING):fi(null);if(Fe=fi(null),Zt($,"tagNameCheck")&&ts($.tagNameCheck)&&(Fe.tagNameCheck=$.tagNameCheck),Zt($,"attributeNameCheck")&&ts($.attributeNameCheck)&&(Fe.attributeNameCheck=$.attributeNameCheck),Zt($,"allowCustomizedBuiltInElements")&&typeof $.allowCustomizedBuiltInElements=="boolean"&&(Fe.allowCustomizedBuiltInElements=$.allowCustomizedBuiltInElements),rn(Fe),pe&&(ht=!1),An&&(ut=!0),wn&&(_e=Ve({},lm),ze=fi(null),wn.html===!0&&(Ve(_e,am),Ve(ze,cm)),wn.svg===!0&&(Ve(_e,Tu),Ve(ze,_u),Ve(ze,Fa)),wn.svgFilters===!0&&(Ve(_e,Nu),Ve(ze,_u),Ve(ze,Fa)),wn.mathMl===!0&&(Ve(_e,Cu),Ve(ze,um),Ve(ze,Fa))),St.tagCheck=null,St.attributeCheck=null,Zt(S,"ADD_TAGS")&&(typeof S.ADD_TAGS=="function"?St.tagCheck=S.ADD_TAGS:ar(S.ADD_TAGS)&&(_e===kt&&(_e=un(_e)),Ve(_e,S.ADD_TAGS,He))),Zt(S,"ADD_ATTR")&&(typeof S.ADD_ATTR=="function"?St.attributeCheck=S.ADD_ATTR:ar(S.ADD_ATTR)&&(ze===It&&(ze=un(ze)),Ve(ze,S.ADD_ATTR,He))),Zt(S,"ADD_URI_SAFE_ATTR")&&ar(S.ADD_URI_SAFE_ATTR)&&Ve(yt,S.ADD_URI_SAFE_ATTR,He),Zt(S,"FORBID_CONTENTS")&&ar(S.FORBID_CONTENTS)&&(Ft===Vt&&(Ft=un(Ft)),Ve(Ft,S.FORBID_CONTENTS,He)),Zt(S,"ADD_FORBID_CONTENTS")&&ar(S.ADD_FORBID_CONTENTS)&&(Ft===Vt&&(Ft=un(Ft)),Ve(Ft,S.ADD_FORBID_CONTENTS,He)),Dn&&(_e["#text"]=!0),tt&&Ve(_e,["html","head","body"]),_e.table&&(Ve(_e,["tbody"]),delete Dt.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ee=Y;Y=S.TRUSTED_TYPES_POLICY;try{Q=Ne("")}catch(we){throw Y=ee,we}}else S.TRUSTED_TYPES_POLICY===null?(Y=void 0,Q=""):(Y===void 0&&(Y=se()),Y&&typeof Q=="string"&&(Q=Ne("")));sn&&sn(S),kn=S},Xe=Ve({},[...Tu,...Nu,...$S]),Tt=Ve({},[...Cu,...zS]),ss=function(S,$,ee){return $.namespaceURI===ot?S==="svg":$.namespaceURI===bt?S==="svg"&&(ee==="annotation-xml"||ge[ee]):!!Xe[S]},El=function(S,$,ee){return $.namespaceURI===ot?S==="math":$.namespaceURI===xt?S==="math"&&Be[ee]:!!Tt[S]},Rl=function(S,$,ee){return $.namespaceURI===xt&&!Be[ee]||$.namespaceURI===bt&&!ge[ee]?!1:!Tt[S]&&(De[S]||!Xe[S])},Nt=function(S){let $=I(S);(!$||!$.tagName)&&($={namespaceURI:Gt,tagName:"template"});const ee=uo(S.tagName),we=uo($.tagName);return j[S.namespaceURI]?S.namespaceURI===xt?ss(ee,$,we):S.namespaceURI===bt?El(ee,$,we):S.namespaceURI===ot?Rl(ee,$,we):!!(at==="application/xhtml+xml"&&j[S.namespaceURI]):!1},gs=function(S){ui(s.removed,{element:S});try{I(S).removeChild(S)}catch{if(_(S),!I(S))throw Ar("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},zs=function(S){fr(S);const $=T(S);if($){const we=[];ci($,be=>{ui(we,be)}),ci(we,be=>{try{_(be)}catch{}})}const ee=U(S);if(ee)for(let we=ee.length-1;we>=0;--we){const be=ee[we],Oe=be&&be.name;if(typeof Oe=="string")try{S.removeAttribute(Oe)}catch{}}},vs=function(S,$){try{ui(s.removed,{attribute:$.getAttributeNode(S),from:$})}catch{ui(s.removed,{attribute:null,from:$})}if($.removeAttribute(S),S==="is")if(ut||An)try{gs($)}catch{}else try{$.setAttribute(S,"")}catch{}},Or=function(S){const $=U(S);if($)for(let ee=$.length-1;ee>=0;--ee){const we=$[ee],be=we&&we.name;if(!(typeof be!="string"||ze[He(be)]))try{S.removeAttribute(be)}catch{}}},fr=function(S){const $=[S];for(;$.length>0;){const ee=$.pop();(O?O(ee):ee.nodeType)===Un.element&&Or(ee);const be=T(ee);if(be)for(let Oe=be.length-1;Oe>=0;--Oe)$.push(be[Oe])}},Ro=function(S){if(!Ue)return;const $=[S];for(;$.length>0;){const ee=$.pop(),we=O?O(ee):ee.nodeType;if(we===Un.processingInstruction||we===Un.comment&&Qt(pm,ee.data)){try{_(ee)}catch{}continue}if(we===Un.element){const Oe=ee,Ke=He(W?W(ee):ee.nodeName);try{Oe.hasAttribute&&Oe.hasAttribute("patchsrc")&&Oe.removeAttribute("patchsrc"),Oe.hasAttribute&&Oe.hasAttribute("for")&&Ke!=="label"&&Ke!=="output"&&Oe.removeAttribute("for")}catch{}}const be=T(ee);if(be)for(let Oe=be.length-1;Oe>=0;--Oe)$.push(be[Oe])}},pr=function(S){let $=null,ee=null;if(Ht)S="<remove></remove>"+S;else{const Oe=sm(S,/^[\r\n\t ]+/);ee=Oe&&Oe[0]}at==="application/xhtml+xml"&&Gt===ot&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const we=Y?Ne(S):S;if(Gt===ot)try{$=new v().parseFromString(we,at)}catch{}if(!$||!$.documentElement){$=X.createDocument(Gt,"template",null);try{$.documentElement.innerHTML=Je?Q:we}catch{}}const be=$.body||$.documentElement;return S&&ee&&be.insertBefore(r.createTextNode(ee),be.childNodes[0]||null),Gt===ot?q.call($,tt?"html":"body")[0]:tt?$.documentElement:be},Pn=function(S){const $=Z?Z(S):S.ownerDocument;return P.call($||S,S,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},$r=function(S){return S=oo(S,de," "),S=oo(S,K," "),S=oo(S,ce," "),S},hn=function(S){var $;S.normalize();const ee=Z?Z(S):S.ownerDocument,we=P.call(ee||S,S,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let be=we.nextNode();for(;be;)be.data=$r(be.data),be=we.nextNode();const Oe=($=S.querySelectorAll)===null||$===void 0?void 0:$.call(S,"template");Oe&&ci(Oe,Ke=>{Fs(Ke.content)&&hn(Ke.content)})},zr=function(S){const $=W?W(S):null;return typeof $!="string"||He($)!=="form"?!1:typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||S.attributes!==U(S)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function"||S.nodeType!==O(S)||S.childNodes!==T(S)},Fs=function(S){if(!O||typeof S!="object"||S===null)return!1;try{return O(S)===Un.documentFragment}catch{return!1}},hr=function(S){if(!O||typeof S!="object"||S===null)return!1;try{return typeof O(S)=="number"}catch{return!1}};function mn(ae,S,$){ae.length!==0&&ci(ae,ee=>{ee.call(s,S,$,kn)})}const Fr=function(S,$){return!!(Ue&&S.hasChildNodes()&&!hr(S.firstElementChild)&&Qt(fm,S.textContent)&&Qt(fm,S.innerHTML)||Ue&&S.namespaceURI===ot&&$==="style"&&hr(S.firstElementChild)||S.nodeType===Un.processingInstruction||Ue&&S.nodeType===Un.comment&&Qt(pm,S.data))},mr=function(S,$,ee){if(!Dt[$]&&Ni($)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,$)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck($)))return!1;if(Dn&&!Ft[$]){const we=I(S),be=T(S);if(be&&we){const Oe=be.length;for(let Ke=Oe-1;Ke>=0;--Ke){const Qe=S===ee?b(be[Ke],!0):be[Ke];we.insertBefore(Qe,C(S))}}}return gs(S),!0},gr=function(S,$,ee,we){return S.length===0?$:$===ee||$===we?un($):$},Ao=function(S,$){if(mn(L.beforeSanitizeElements,S,null),S!==$&&I(S)===null)return pn&&fr(S),!0;if(zr(S))return gs(S),!0;const ee=He(W?W(S):S.nodeName);if(_e=gr(L.uponSanitizeElement,_e,kt,gt),mn(L.uponSanitizeElement,S,{tagName:ee,allowedTags:_e}),S!==$&&I(S)===null)return pn&&fr(S),!0;if(Fr(S,ee))return gs(S),!0;if(Dt[ee]||!(St.tagCheck instanceof Function&&St.tagCheck(ee))&&!_e[ee]){const be=mr(S,ee,$);return be===!1&&mn(L.afterSanitizeElements,S,null),be}if((O?O(S):S.nodeType)===Un.element&&!Nt(S)||(ee==="noscript"||ee==="noembed"||ee==="noframes")&&Qt(YS,S.innerHTML))return gs(S),!0;if(pe&&S.nodeType===Un.text){const be=$r(S.textContent);S.textContent!==be&&(ui(s.removed,{element:S.cloneNode()}),S.textContent=be)}return mn(L.afterSanitizeElements,S,null),!1},Io=function(S,$,ee){if(Rn[$]||Ue&&$==="patchsrc"||Ue&&$==="for"&&S!=="label"&&S!=="output"||Ts&&($==="id"||$==="name")&&(ee in r||ee in $s))return!1;const we=ze[$]||St.attributeCheck instanceof Function&&St.attributeCheck($,S);if(!(ht&&Qt(fe,$))){if(!(Mt&&Qt(Pe,$))){if(we){if(!yt[$]){if(!Qt(it,oo(ee,Ee,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&S!=="script"&&rm(ee,"data:")===0&&st[S])){if(!(en&&!Qt(Ce,oo(ee,Ee,"")))){if(ee)return!1}}}}}else if(!(Ni(S)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,S)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(S))&&(Fe.attributeNameCheck instanceof RegExp&&Qt(Fe.attributeNameCheck,$)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck($,S))||$==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,ee)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(ee))))return!1}}return!0},Ti=Ve({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ni=function(S){return!Ti[uo(S)]&&Qt(je,S)},Ci=function(S,$,ee,we){if(Y&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!ee)switch(k.getAttributeType(S,$)){case"TrustedHTML":return Ne(we);case"TrustedScriptURL":return Le(we)}return we},vr=function(S,$,ee,we){try{ee?S.setAttributeNS(ee,$,we):S.setAttribute($,we),zr(S)?gs(S):nm(s.removed)}catch{vs($,S)}},Do=function(S){mn(L.beforeSanitizeAttributes,S,null);const $=S.attributes;if(!$||zr(S))return;ze=gr(L.uponSanitizeAttribute,ze,It,Rt);const ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ze,forceKeepAttr:void 0};let we=$.length;const be=He(S.nodeName);for(;we--;){const Oe=$[we],Ke=Oe.name,Qe=Oe.namespaceURI,Ct=Oe.value,_t=He(Ke),Ns=Ct;let Lt=Ke==="value"?Ns:AS(Ns);if(ee.attrName=_t,ee.attrValue=Lt,ee.keepAttr=!0,ee.forceKeepAttr=void 0,mn(L.uponSanitizeAttribute,S,ee),Lt=ee.attrValue,ms&&(_t==="id"||_t==="name")&&rm(Lt,In)!==0&&(vs(Ke,S),Lt=In+Lt),Ue&&Qt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Lt)){vs(Ke,S);continue}if(_t==="attributename"&&sm(Lt,"href")){vs(Ke,S);continue}if(!ee.forceKeepAttr){if(!ee.keepAttr){vs(Ke,S);continue}if(!V&&Qt(XS,Lt)){vs(Ke,S);continue}if(pe&&(Lt=$r(Lt)),!Io(be,_t,Lt)){vs(Ke,S);continue}Lt=Ci(be,_t,Qe,Lt),Lt!==Ns&&vr(S,Ke,Qe,Lt)}}mn(L.afterSanitizeAttributes,S,null)},Us=function(S){let $=null;const ee=Pn(S);for(mn(L.beforeSanitizeShadowDOM,S,null);$=ee.nextNode();)if(mn(L.uponSanitizeShadowNode,$,null),Ao($,S),Do($),Fs($.content)&&Us($.content),(O?O($):$.nodeType)===Un.element){const be=A($);Fs(be)&&(Ge(be),Us(be))}mn(L.afterSanitizeShadowDOM,S,null)},Ge=function(S){const $=[{node:S,shadow:null}];for(;$.length>0;){const ee=$.pop();if(ee.shadow){Us(ee.shadow);continue}const we=ee.node,Oe=(O?O(we):we.nodeType)===Un.element,Ke=T(we);if(Ke)for(let Qe=Ke.length-1;Qe>=0;--Qe)$.push({node:Ke[Qe],shadow:null});if(Oe){const Qe=W?W(we):null;if(typeof Qe=="string"&&He(Qe)==="template"){const Ct=we.content;Fs(Ct)&&$.push({node:Ct,shadow:null})}}if(Oe){const Qe=A(we);Fs(Qe)&&$.push({node:null,shadow:Qe},{node:Qe,shadow:null})}}};return s.sanitize=function(ae){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,ee=null,we=null,be=null;if(Je=!ae,Je&&(ae="<!-->"),typeof ae!="string"&&!hr(ae)&&(ae=PS(ae),typeof ae!="string"))throw Ar("dirty is not a string, aborting");if(!s.isSupported)return ae;mt?(_e=gt,ze=Rt):ns(S),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(_e=un(_e)),L.uponSanitizeAttribute.length>0&&(ze=un(ze)),s.removed=[];const Oe=pn&&typeof ae!="string"&&hr(ae);if(Oe){Ro(ae);const Ct=W?W(ae):ae.nodeName;if(typeof Ct=="string"){const _t=He(Ct);if(!_e[_t]||Dt[_t])throw zs(ae),Ar("root node is forbidden and cannot be sanitized in-place")}if(zr(ae))throw zs(ae),Ar("root node is clobbered and cannot be sanitized in-place");try{Ge(ae)}catch(_t){throw zs(ae),_t}}else if(hr(ae))$=pr("<!---->"),ee=$.ownerDocument.importNode(ae,!0),ee.nodeType===Un.element&&ee.nodeName==="BODY"||ee.nodeName==="HTML"?$=ee:$.appendChild(ee),Ge(ee);else{if(!ut&&!pe&&!tt&&ae.indexOf("<")===-1)return Y&&Hn?Ne(ae):ae;if($=pr(ae),!$)return ut?null:Hn?Q:""}$&&Ht&&gs($.firstChild);const Ke=Oe?ae:$;try{const Ct=Pn(Ke);for(;we=Ct.nextNode();)Ao(we,Ke),Do(we),Fs(we.content)&&Us(we.content)}catch(Ct){throw Oe&&(zs(ae),ci(s.removed,_t=>{_t.element&&fr(_t.element)})),Ct}if(Oe)return ci(s.removed,Ct=>{Ct.element&&fr(Ct.element)}),pe&&hn(ae),ae;if(ut){if(pe&&hn($),An)for(be=J.call($.ownerDocument);$.firstChild;)be.appendChild($.firstChild);else be=$;return(ze.shadowroot||ze.shadowrootmode)&&(be=E.call(o,be,!0)),be}let Qe=tt?$.outerHTML:$.innerHTML;return tt&&_e["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&Qt(GS,$.ownerDocument.doctype.name)&&(Qe="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
|
|
470
|
-
`+Qe),pe&&(Qe=$r(Qe)),Y&&Hn?Ne(Qe):Qe},s.setConfig=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ns(ae),mt=!0,gt=
|
|
461
|
+
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Ss(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:s,tokens:r}){const o=this.parser.parseInline(r),a=Zh(t);if(a===null)return o;t=a;let u='<a href="'+t+'"';return s&&(u+=' title="'+Ss(s)+'"'),u+=">"+o+"</a>",u}image({href:t,title:s,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));const a=Zh(t);if(a===null)return Ss(r);t=a;let u=`<img src="${t}" alt="${r}"`;return s&&(u+=` title="${Ss(s)}"`),u+=">",u}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Ss(t.text)}},Nd=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Ps=class Wu{constructor(s){lt(this,"options");lt(this,"renderer");lt(this,"textRenderer");this.options=s||Pr,this.options.renderer=this.options.renderer||new ml,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Nd}static parse(s,r){return new Wu(r).parse(s)}static parseInline(s,r){return new Wu(r).parseInline(s)}parse(s,r=!0){var a,u;let o="";for(let f=0;f<s.length;f++){const h=s[f];if((u=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&u[h.type]){const m=h,v=this.options.extensions.renderers[m.type].call({parser:this},m);if(v!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){o+=v||"";continue}}const g=h;switch(g.type){case"space":{o+=this.renderer.space(g);continue}case"hr":{o+=this.renderer.hr(g);continue}case"heading":{o+=this.renderer.heading(g);continue}case"code":{o+=this.renderer.code(g);continue}case"table":{o+=this.renderer.table(g);continue}case"blockquote":{o+=this.renderer.blockquote(g);continue}case"list":{o+=this.renderer.list(g);continue}case"html":{o+=this.renderer.html(g);continue}case"paragraph":{o+=this.renderer.paragraph(g);continue}case"text":{let m=g,v=this.renderer.text(m);for(;f+1<s.length&&s[f+1].type==="text";)m=s[++f],v+=`
|
|
462
|
+
`+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(s,r=this.renderer){var a,u;let o="";for(let f=0;f<s.length;f++){const h=s[f];if((u=(a=this.options.extensions)==null?void 0:a.renderers)!=null&&u[h.type]){const m=this.options.extensions.renderers[h.type].call({parser:this},h);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(h.type)){o+=m||"";continue}}const g=h;switch(g.type){case"escape":{o+=r.text(g);break}case"html":{o+=r.html(g);break}case"link":{o+=r.link(g);break}case"image":{o+=r.image(g);break}case"strong":{o+=r.strong(g);break}case"em":{o+=r.em(g);break}case"codespan":{o+=r.codespan(g);break}case"br":{o+=r.br(g);break}case"del":{o+=r.del(g);break}case"text":{o+=r.text(g);break}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},Iu,Ga=(Iu=class{constructor(t){lt(this,"options");lt(this,"block");this.options=t||Pr}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Ls.lex:Ls.lexInline}provideParser(){return this.block?Ps.parse:Ps.parseInline}},lt(Iu,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),Iu),xS=class{constructor(...t){lt(this,"defaults",vd());lt(this,"options",this.setOptions);lt(this,"parse",this.parseMarkdown(!0));lt(this,"parseInline",this.parseMarkdown(!1));lt(this,"Parser",Ps);lt(this,"Renderer",ml);lt(this,"TextRenderer",Nd);lt(this,"Lexer",Ls);lt(this,"Tokenizer",hl);lt(this,"Hooks",Ga);this.use(...t)}walkTokens(t,s){var o,a;let r=[];for(const u of t)switch(r=r.concat(s.call(this,u)),u.type){case"table":{const f=u;for(const h of f.header)r=r.concat(this.walkTokens(h.tokens,s));for(const h of f.rows)for(const g of h)r=r.concat(this.walkTokens(g.tokens,s));break}case"list":{const f=u;r=r.concat(this.walkTokens(f.items,s));break}default:{const f=u;(a=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&a[f.type]?this.defaults.extensions.childTokens[f.type].forEach(h=>{const g=f[h].flat(1/0);r=r.concat(this.walkTokens(g,s))}):f.tokens&&(r=r.concat(this.walkTokens(f.tokens,s)))}}return r}use(...t){const s=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(a=>{if(!a.name)throw new Error("extension name required");if("renderer"in a){const u=s.renderers[a.name];u?s.renderers[a.name]=function(...f){let h=a.renderer.apply(this,f);return h===!1&&(h=u.apply(this,f)),h}:s.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 u=s[a.level];u?u.unshift(a.tokenizer):s[a.level]=[a.tokenizer],a.start&&(a.level==="block"?s.startBlock?s.startBlock.push(a.start):s.startBlock=[a.start]:a.level==="inline"&&(s.startInline?s.startInline.push(a.start):s.startInline=[a.start]))}"childTokens"in a&&a.childTokens&&(s.childTokens[a.name]=a.childTokens)}),o.extensions=s),r.renderer){const a=this.defaults.renderer||new ml(this.defaults);for(const u in r.renderer){if(!(u in a))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;const f=u,h=r.renderer[f],g=a[f];a[f]=(...m)=>{let v=h.apply(a,m);return v===!1&&(v=g.apply(a,m)),v||""}}o.renderer=a}if(r.tokenizer){const a=this.defaults.tokenizer||new hl(this.defaults);for(const u in r.tokenizer){if(!(u in a))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;const f=u,h=r.tokenizer[f],g=a[f];a[f]=(...m)=>{let v=h.apply(a,m);return v===!1&&(v=g.apply(a,m)),v}}o.tokenizer=a}if(r.hooks){const a=this.defaults.hooks||new Ga;for(const u in r.hooks){if(!(u in a))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;const f=u,h=r.hooks[f],g=a[f];Ga.passThroughHooks.has(u)?a[f]=m=>{if(this.defaults.async)return Promise.resolve(h.call(a,m)).then(k=>g.call(a,k));const v=h.call(a,m);return g.call(a,v)}:a[f]=(...m)=>{let v=h.apply(a,m);return v===!1&&(v=g.apply(a,m)),v}}o.hooks=a}if(r.walkTokens){const a=this.defaults.walkTokens,u=r.walkTokens;o.walkTokens=function(f){let h=[];return h.push(u.call(this,f)),a&&(h=h.concat(a.call(this,f))),h}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,s){return Ls.lex(t,s??this.defaults)}parser(t,s){return Ps.parse(t,s??this.defaults)}parseMarkdown(t){return(r,o)=>{const a={...o},u={...this.defaults,...a},f=this.onError(!!u.silent,!!u.async);if(this.defaults.async===!0&&a.async===!1)return f(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 f(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));u.hooks&&(u.hooks.options=u,u.hooks.block=t);const h=u.hooks?u.hooks.provideLexer():t?Ls.lex:Ls.lexInline,g=u.hooks?u.hooks.provideParser():t?Ps.parse:Ps.parseInline;if(u.async)return Promise.resolve(u.hooks?u.hooks.preprocess(r):r).then(m=>h(m,u)).then(m=>u.hooks?u.hooks.processAllTokens(m):m).then(m=>u.walkTokens?Promise.all(this.walkTokens(m,u.walkTokens)).then(()=>m):m).then(m=>g(m,u)).then(m=>u.hooks?u.hooks.postprocess(m):m).catch(f);try{u.hooks&&(r=u.hooks.preprocess(r));let m=h(r,u);u.hooks&&(m=u.hooks.processAllTokens(m)),u.walkTokens&&this.walkTokens(m,u.walkTokens);let v=g(m,u);return u.hooks&&(v=u.hooks.postprocess(v)),v}catch(m){return f(m)}}}onError(t,s){return r=>{if(r.message+=`
|
|
463
|
+
Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+Ss(r.message+"",!0)+"</pre>";return s?Promise.resolve(o):o}if(s)return Promise.reject(r);throw r}}},Mr=new xS;function qe(t,s){return Mr.parse(t,s)}qe.options=qe.setOptions=function(t){return Mr.setOptions(t),qe.defaults=Mr.defaults,Qg(qe.defaults),qe};qe.getDefaults=vd;qe.defaults=Pr;qe.use=function(...t){return Mr.use(...t),qe.defaults=Mr.defaults,Qg(qe.defaults),qe};qe.walkTokens=function(t,s){return Mr.walkTokens(t,s)};qe.parseInline=Mr.parseInline;qe.Parser=Ps;qe.parser=Ps.parse;qe.Renderer=ml;qe.TextRenderer=Nd;qe.Lexer=Ls;qe.lexer=Ls.lex;qe.Tokenizer=hl;qe.Hooks=Ga;qe.parse=qe;qe.options;qe.setOptions;qe.use;qe.walkTokens;qe.parseInline;Ps.parse;Ls.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 tm(t,s){(s==null||s>t.length)&&(s=t.length);for(var r=0,o=Array(s);r<s;r++)o[r]=t[r];return o}function wS(t){if(Array.isArray(t))return t}function kS(t,s){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var o,a,u,f,h=[],g=!0,m=!1;try{if(u=(r=r.call(t)).next,s!==0)for(;!(g=(o=u.call(r)).done)&&(h.push(o.value),h.length!==s);g=!0);}catch(v){m=!0,a=v}finally{try{if(!g&&r.return!=null&&(f=r.return(),Object(f)!==f))return}finally{if(m)throw a}}return h}}function SS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
464
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bS(t,s){return wS(t)||kS(t,s)||TS(t,s)||SS()}function TS(t,s){if(t){if(typeof t=="string")return tm(t,s);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?tm(t,s):void 0}}const lv=Object.entries,nm=Object.setPrototypeOf,NS=Object.isFrozen,CS=Object.getPrototypeOf,jS=Object.getOwnPropertyDescriptor;let sn=Object.freeze,rn=Object.seal,fi=Object.create,cv=typeof Reflect<"u"&&Reflect,Hu=cv.apply,Vu=cv.construct;sn||(sn=function(s){return s});rn||(rn=function(s){return s});Hu||(Hu=function(s,r){for(var o=arguments.length,a=new Array(o>2?o-2:0),u=2;u<o;u++)a[u-2]=arguments[u];return s.apply(r,a)});Vu||(Vu=function(s){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 s(...o)});const ci=zt(Array.prototype.forEach),_S=zt(Array.prototype.lastIndexOf),sm=zt(Array.prototype.pop),ui=zt(Array.prototype.push),ES=zt(Array.prototype.splice),lr=Array.isArray,uo=zt(String.prototype.toLowerCase),Nu=zt(String.prototype.toString),rm=zt(String.prototype.match),oo=zt(String.prototype.replace),im=zt(String.prototype.indexOf),RS=zt(String.prototype.trim),AS=zt(Number.prototype.toString),IS=zt(Boolean.prototype.toString),om=typeof BigInt>"u"?null:zt(BigInt.prototype.toString),am=typeof Symbol>"u"?null:zt(Symbol.prototype.toString),Zt=zt(Object.prototype.hasOwnProperty),ao=zt(Object.prototype.toString),Qt=zt(RegExp.prototype.test),Ar=DS(TypeError);function zt(t){return function(s){s instanceof RegExp&&(s.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 Hu(t,s,o)}}function DS(t){return function(){for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return Vu(t,r)}}function Ve(t,s){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:uo;if(nm&&nm(t,null),!lr(s))return t;let o=s.length;for(;o--;){let a=s[o];if(typeof a=="string"){const u=r(a);u!==a&&(NS(s)||(s[o]=u),a=u)}t[a]=!0}return t}function MS(t){for(let s=0;s<t.length;s++)Zt(t,s)||(t[s]=null);return t}function un(t){const s=fi(null);for(const o of lv(t)){var r=bS(o,2);const a=r[0],u=r[1];Zt(t,a)&&(lr(u)?s[a]=MS(u):u&&typeof u=="object"&&u.constructor===Object?s[a]=un(u):s[a]=u)}return s}function LS(t){switch(typeof t){case"string":return t;case"number":return AS(t);case"boolean":return IS(t);case"bigint":return om?om(t):"0";case"symbol":return am?am(t):"Symbol()";case"undefined":return ao(t);case"function":case"object":{if(t===null)return ao(t);const s=t,r=us(s,"toString");if(typeof r=="function"){const o=r(s);return typeof o=="string"?o:ao(o)}return ao(t)}default:return ao(t)}}function us(t,s){for(;t!==null;){const o=jS(t,s);if(o){if(o.get)return zt(o.get);if(typeof o.value=="function")return zt(o.value)}t=CS(t)}function r(){return null}return r}function PS(t){try{return Qt(t,""),!0}catch{return!1}}const lm=sn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Cu=sn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ju=sn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),OS=sn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),_u=sn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),$S=sn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),cm=sn(["#text"]),um=sn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Eu=sn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),dm=sn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Fa=sn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),zS=rn(/{{[\w\W]*|^[\w\W]*}}/g),FS=rn(/<%[\w\W]*|^[\w\W]*%>/g),US=rn(/\${[\w\W]*/g),BS=rn(/^data-[\-\w.\u00B7-\uFFFF]+$/),WS=rn(/^aria-[\-\w]+$/),fm=rn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),HS=rn(/^(?:\w+script|data):/i),VS=rn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qS=rn(/^html$/i),GS=rn(/^[a-z][.\w]*(-[.\w]+)+$/i),pm=rn(/<[/\w!]/g),hm=rn(/<[/\w]/g),KS=rn(/<\/no(script|embed|frames)/i),YS=rn(/\/>/i),Un={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},XS=function(){return typeof window>"u"?null:window},QS=function(s,r){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let o=null;const a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(o=r.getAttribute(a));const u="dompurify"+(o?"#"+o:"");try{return s.createPolicy(u,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},mm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},or=function(s,r,o,a){return Zt(s,r)&&lr(s[r])?Ve(a.base?un(a.base):{},s[r],a.transform):o};function uv(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XS();const s=ae=>uv(ae);if(s.version="3.4.13",s.removed=[],!t||!t.document||t.document.nodeType!==Un.document||!t.Element)return s.isSupported=!1,s;let r=t.document;const o=r,a=o.currentScript;t.DocumentFragment;const u=t.HTMLTemplateElement,f=t.Node,h=t.Element,g=t.NodeFilter,m=t.NamedNodeMap;m===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const v=t.DOMParser,k=t.trustedTypes,x=h.prototype,b=us(x,"cloneNode"),j=us(x,"remove"),C=us(x,"nextSibling"),T=us(x,"childNodes"),I=us(x,"parentNode"),A=us(x,"shadowRoot"),U=us(x,"attributes"),O=f&&f.prototype?us(f.prototype,"nodeType"):null,W=f&&f.prototype?us(f.prototype,"nodeName"):null,Z=f&&f.prototype?us(f.prototype,"ownerDocument"):null;if(typeof u=="function"){const ae=r.createElement("template");ae.content&&ae.content.ownerDocument&&(r=ae.content.ownerDocument)}let Y,Q="",ue,he=!1,H=0;const Te=function(){if(H>0)throw Ar('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(S){Te(),H++;try{return Y.createHTML(S)}finally{H--}},Le=function(S){Te(),H++;try{return Y.createScriptURL(S)}finally{H--}},se=function(){return he||(ue=QS(k,a),he=!0),ue},G=r,X=G.implementation,P=G.createNodeIterator,J=G.createDocumentFragment,q=G.getElementsByTagName,E=o.importNode;let L=mm();s.isSupported=typeof lv=="function"&&typeof I=="function"&&X&&X.createHTMLDocument!==void 0;const de=zS,K=FS,ce=US,fe=BS,Pe=WS,Ce=HS,Ee=VS,_e=GS;let it=fm,je=null;const kt=Ve({},[...lm,...Cu,...ju,..._u,...cm]);let ze=null;const It=Ve({},[...um,...Eu,...dm,...Fa]);let Fe=Object.seal(fi(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}})),Dt=null,Rn=null;const St=Object.seal(fi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Mt=!0,ht=!0,en=!1,V=!0,pe=!1,Ue=!0,tt=!1,mt=!1,gt=null,Rt=null,Ht=!1,ut=!1,An=!1,Hn=!1,Ts=!0,ms=!1;const In="user-content-";let Dn=!0,pn=!1,wn={},Ft=null;const Vt=Ve({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let st=null;const vt=Ve({},["audio","video","img","source","image","track"]);let yt=null;const qt=Ve({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),bt="http://www.w3.org/1998/Math/MathML",xt="http://www.w3.org/2000/svg",ot="http://www.w3.org/1999/xhtml";let Gt=ot,Je=!1,_=null;const oe=Ve({},[bt,xt,ot],Nu),ie=sn(["mi","mo","mn","ms","mtext"]);let ge=Ve({},ie);const $e=sn(["annotation-xml"]);let Be=Ve({},$e);const De=Ve({},["title","style","font","a","script"]);let at=null;const Mn=["application/xhtml+xml","text/html"],Ln="text/html";let He=null,kn=null;const zs=r.createElement("form"),ts=function(S){return S instanceof RegExp||S instanceof Function},ns=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(kn&&kn===S)return;(!S||typeof S!="object")&&(S={}),S=un(S),at=Mn.indexOf(S.PARSER_MEDIA_TYPE)===-1?Ln:S.PARSER_MEDIA_TYPE,He=at==="application/xhtml+xml"?Nu:uo,je=or(S,"ALLOWED_TAGS",kt,{transform:He}),ze=or(S,"ALLOWED_ATTR",It,{transform:He}),_=or(S,"ALLOWED_NAMESPACES",oe,{transform:Nu}),yt=or(S,"ADD_URI_SAFE_ATTR",qt,{transform:He,base:qt}),st=or(S,"ADD_DATA_URI_TAGS",vt,{transform:He,base:vt}),Ft=or(S,"FORBID_CONTENTS",Vt,{transform:He}),Dt=or(S,"FORBID_TAGS",un({}),{transform:He}),Rn=or(S,"FORBID_ATTR",un({}),{transform:He}),wn=Zt(S,"USE_PROFILES")?S.USE_PROFILES&&typeof S.USE_PROFILES=="object"?un(S.USE_PROFILES):S.USE_PROFILES:!1,Mt=S.ALLOW_ARIA_ATTR!==!1,ht=S.ALLOW_DATA_ATTR!==!1,en=S.ALLOW_UNKNOWN_PROTOCOLS||!1,V=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=S.SAFE_FOR_TEMPLATES||!1,Ue=S.SAFE_FOR_XML!==!1,tt=S.WHOLE_DOCUMENT||!1,ut=S.RETURN_DOM||!1,An=S.RETURN_DOM_FRAGMENT||!1,Hn=S.RETURN_TRUSTED_TYPE||!1,Ht=S.FORCE_BODY||!1,Ts=S.SANITIZE_DOM!==!1,ms=S.SANITIZE_NAMED_PROPS||!1,Dn=S.KEEP_CONTENT!==!1,pn=S.IN_PLACE||!1,it=PS(S.ALLOWED_URI_REGEXP)?S.ALLOWED_URI_REGEXP:fm,Gt=typeof S.NAMESPACE=="string"?S.NAMESPACE:ot,ge=Zt(S,"MATHML_TEXT_INTEGRATION_POINTS")&&S.MATHML_TEXT_INTEGRATION_POINTS&&typeof S.MATHML_TEXT_INTEGRATION_POINTS=="object"?un(S.MATHML_TEXT_INTEGRATION_POINTS):Ve({},ie),Be=Zt(S,"HTML_INTEGRATION_POINTS")&&S.HTML_INTEGRATION_POINTS&&typeof S.HTML_INTEGRATION_POINTS=="object"?un(S.HTML_INTEGRATION_POINTS):Ve({},$e);const $=Zt(S,"CUSTOM_ELEMENT_HANDLING")&&S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING=="object"?un(S.CUSTOM_ELEMENT_HANDLING):fi(null);if(Fe=fi(null),Zt($,"tagNameCheck")&&ts($.tagNameCheck)&&(Fe.tagNameCheck=$.tagNameCheck),Zt($,"attributeNameCheck")&&ts($.attributeNameCheck)&&(Fe.attributeNameCheck=$.attributeNameCheck),Zt($,"allowCustomizedBuiltInElements")&&typeof $.allowCustomizedBuiltInElements=="boolean"&&(Fe.allowCustomizedBuiltInElements=$.allowCustomizedBuiltInElements),rn(Fe),pe&&(ht=!1),An&&(ut=!0),wn&&(je=Ve({},cm),ze=fi(null),wn.html===!0&&(Ve(je,lm),Ve(ze,um)),wn.svg===!0&&(Ve(je,Cu),Ve(ze,Eu),Ve(ze,Fa)),wn.svgFilters===!0&&(Ve(je,ju),Ve(ze,Eu),Ve(ze,Fa)),wn.mathMl===!0&&(Ve(je,_u),Ve(ze,dm),Ve(ze,Fa))),St.tagCheck=null,St.attributeCheck=null,Zt(S,"ADD_TAGS")&&(typeof S.ADD_TAGS=="function"?St.tagCheck=S.ADD_TAGS:lr(S.ADD_TAGS)&&(je===kt&&(je=un(je)),Ve(je,S.ADD_TAGS,He))),Zt(S,"ADD_ATTR")&&(typeof S.ADD_ATTR=="function"?St.attributeCheck=S.ADD_ATTR:lr(S.ADD_ATTR)&&(ze===It&&(ze=un(ze)),Ve(ze,S.ADD_ATTR,He))),Zt(S,"ADD_URI_SAFE_ATTR")&&lr(S.ADD_URI_SAFE_ATTR)&&Ve(yt,S.ADD_URI_SAFE_ATTR,He),Zt(S,"FORBID_CONTENTS")&&lr(S.FORBID_CONTENTS)&&(Ft===Vt&&(Ft=un(Ft)),Ve(Ft,S.FORBID_CONTENTS,He)),Zt(S,"ADD_FORBID_CONTENTS")&&lr(S.ADD_FORBID_CONTENTS)&&(Ft===Vt&&(Ft=un(Ft)),Ve(Ft,S.ADD_FORBID_CONTENTS,He)),Dn&&(je["#text"]=!0),tt&&Ve(je,["html","head","body"]),je.table&&(Ve(je,["tbody"]),delete Dt.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const ee=Y;Y=S.TRUSTED_TYPES_POLICY;try{Q=Ne("")}catch(we){throw Y=ee,we}}else S.TRUSTED_TYPES_POLICY===null?(Y=void 0,Q=""):(Y===void 0&&(Y=se()),Y&&typeof Q=="string"&&(Q=Ne("")));sn&&sn(S),kn=S},Xe=Ve({},[...Cu,...ju,...OS]),Tt=Ve({},[..._u,...$S]),ss=function(S,$,ee){return $.namespaceURI===ot?S==="svg":$.namespaceURI===bt?S==="svg"&&(ee==="annotation-xml"||ge[ee]):!!Xe[S]},Al=function(S,$,ee){return $.namespaceURI===ot?S==="math":$.namespaceURI===xt?S==="math"&&Be[ee]:!!Tt[S]},Il=function(S,$,ee){return $.namespaceURI===xt&&!Be[ee]||$.namespaceURI===bt&&!ge[ee]?!1:!Tt[S]&&(De[S]||!Xe[S])},Nt=function(S){let $=I(S);(!$||!$.tagName)&&($={namespaceURI:Gt,tagName:"template"});const ee=uo(S.tagName),we=uo($.tagName);return _[S.namespaceURI]?S.namespaceURI===xt?ss(ee,$,we):S.namespaceURI===bt?Al(ee,$,we):S.namespaceURI===ot?Il(ee,$,we):!!(at==="application/xhtml+xml"&&_[S.namespaceURI]):!1},gs=function(S){ui(s.removed,{element:S});try{I(S).removeChild(S)}catch{if(j(S),!I(S))throw Ar("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Fs=function(S){fr(S);const $=T(S);if($){const we=[];ci($,be=>{ui(we,be)}),ci(we,be=>{try{j(be)}catch{}})}const ee=U(S);if(ee)for(let we=ee.length-1;we>=0;--we){const be=ee[we],Oe=be&&be.name;if(typeof Oe=="string")try{S.removeAttribute(Oe)}catch{}}},vs=function(S,$){try{ui(s.removed,{attribute:$.getAttributeNode(S),from:$})}catch{ui(s.removed,{attribute:null,from:$})}if($.removeAttribute(S),S==="is")if(ut||An)try{gs($)}catch{}else try{$.setAttribute(S,"")}catch{}},Or=function(S){const $=U(S);if($)for(let ee=$.length-1;ee>=0;--ee){const we=$[ee],be=we&&we.name;if(!(typeof be!="string"||ze[He(be)]))try{S.removeAttribute(be)}catch{}}},fr=function(S){const $=[S];for(;$.length>0;){const ee=$.pop();(O?O(ee):ee.nodeType)===Un.element&&Or(ee);const be=T(ee);if(be)for(let Oe=be.length-1;Oe>=0;--Oe)$.push(be[Oe])}},Ro=function(S){if(!Ue)return;const $=[S];for(;$.length>0;){const ee=$.pop(),we=O?O(ee):ee.nodeType;if(we===Un.processingInstruction||we===Un.comment&&Qt(hm,ee.data)){try{j(ee)}catch{}continue}if(we===Un.element){const Oe=ee,Ke=He(W?W(ee):ee.nodeName);try{Oe.hasAttribute&&Oe.hasAttribute("patchsrc")&&Oe.removeAttribute("patchsrc"),Oe.hasAttribute&&Oe.hasAttribute("for")&&Ke!=="label"&&Ke!=="output"&&Oe.removeAttribute("for")}catch{}}const be=T(ee);if(be)for(let Oe=be.length-1;Oe>=0;--Oe)$.push(be[Oe])}},pr=function(S){let $=null,ee=null;if(Ht)S="<remove></remove>"+S;else{const Oe=rm(S,/^[\r\n\t ]+/);ee=Oe&&Oe[0]}at==="application/xhtml+xml"&&Gt===ot&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");const we=Y?Ne(S):S;if(Gt===ot)try{$=new v().parseFromString(we,at)}catch{}if(!$||!$.documentElement){$=X.createDocument(Gt,"template",null);try{$.documentElement.innerHTML=Je?Q:we}catch{}}const be=$.body||$.documentElement;return S&&ee&&be.insertBefore(r.createTextNode(ee),be.childNodes[0]||null),Gt===ot?q.call($,tt?"html":"body")[0]:tt?$.documentElement:be},Pn=function(S){const $=Z?Z(S):S.ownerDocument;return P.call($||S,S,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},$r=function(S){return S=oo(S,de," "),S=oo(S,K," "),S=oo(S,ce," "),S},hn=function(S){var $;S.normalize();const ee=Z?Z(S):S.ownerDocument,we=P.call(ee||S,S,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let be=we.nextNode();for(;be;)be.data=$r(be.data),be=we.nextNode();const Oe=($=S.querySelectorAll)===null||$===void 0?void 0:$.call(S,"template");Oe&&ci(Oe,Ke=>{Us(Ke.content)&&hn(Ke.content)})},zr=function(S){const $=W?W(S):null;return typeof $!="string"||He($)!=="form"?!1:typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||S.attributes!==U(S)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function"||S.nodeType!==O(S)||S.childNodes!==T(S)},Us=function(S){if(!O||typeof S!="object"||S===null)return!1;try{return O(S)===Un.documentFragment}catch{return!1}},hr=function(S){if(!O||typeof S!="object"||S===null)return!1;try{return typeof O(S)=="number"}catch{return!1}};function mn(ae,S,$){ae.length!==0&&ci(ae,ee=>{ee.call(s,S,$,kn)})}const Fr=function(S,$){return!!(Ue&&S.hasChildNodes()&&!hr(S.firstElementChild)&&Qt(pm,S.textContent)&&Qt(pm,S.innerHTML)||Ue&&S.namespaceURI===ot&&$==="style"&&hr(S.firstElementChild)||S.nodeType===Un.processingInstruction||Ue&&S.nodeType===Un.comment&&Qt(hm,S.data))},mr=function(S,$,ee){if(!Dt[$]&&Ni($)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,$)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck($)))return!1;if(Dn&&!Ft[$]){const we=I(S),be=T(S);if(be&&we){const Oe=be.length;for(let Ke=Oe-1;Ke>=0;--Ke){const Qe=S===ee?b(be[Ke],!0):be[Ke];we.insertBefore(Qe,C(S))}}}return gs(S),!0},gr=function(S,$,ee,we){return S.length===0?$:$===ee||$===we?un($):$},Ao=function(S,$){if(mn(L.beforeSanitizeElements,S,null),S!==$&&I(S)===null)return pn&&fr(S),!0;if(zr(S))return gs(S),!0;const ee=He(W?W(S):S.nodeName);if(je=gr(L.uponSanitizeElement,je,kt,gt),mn(L.uponSanitizeElement,S,{tagName:ee,allowedTags:je}),S!==$&&I(S)===null)return pn&&fr(S),!0;if(Fr(S,ee))return gs(S),!0;if(Dt[ee]||!(St.tagCheck instanceof Function&&St.tagCheck(ee))&&!je[ee]){const be=mr(S,ee,$);return be===!1&&mn(L.afterSanitizeElements,S,null),be}if((O?O(S):S.nodeType)===Un.element&&!Nt(S)||(ee==="noscript"||ee==="noembed"||ee==="noframes")&&Qt(KS,S.innerHTML))return gs(S),!0;if(pe&&S.nodeType===Un.text){const be=$r(S.textContent);S.textContent!==be&&(ui(s.removed,{element:S.cloneNode()}),S.textContent=be)}return mn(L.afterSanitizeElements,S,null),!1},Io=function(S,$,ee){if(Rn[$]||Ue&&$==="patchsrc"||Ue&&$==="for"&&S!=="label"&&S!=="output"||Ts&&($==="id"||$==="name")&&(ee in r||ee in zs))return!1;const we=ze[$]||St.attributeCheck instanceof Function&&St.attributeCheck($,S);if(!(ht&&Qt(fe,$))){if(!(Mt&&Qt(Pe,$))){if(we){if(!yt[$]){if(!Qt(it,oo(ee,Ee,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&S!=="script"&&im(ee,"data:")===0&&st[S])){if(!(en&&!Qt(Ce,oo(ee,Ee,"")))){if(ee)return!1}}}}}else if(!(Ni(S)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,S)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(S))&&(Fe.attributeNameCheck instanceof RegExp&&Qt(Fe.attributeNameCheck,$)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck($,S))||$==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,ee)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(ee))))return!1}}return!0},Ti=Ve({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ni=function(S){return!Ti[uo(S)]&&Qt(_e,S)},Ci=function(S,$,ee,we){if(Y&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!ee)switch(k.getAttributeType(S,$)){case"TrustedHTML":return Ne(we);case"TrustedScriptURL":return Le(we)}return we},vr=function(S,$,ee,we){try{ee?S.setAttributeNS(ee,$,we):S.setAttribute($,we),zr(S)?gs(S):sm(s.removed)}catch{vs($,S)}},Do=function(S){mn(L.beforeSanitizeAttributes,S,null);const $=S.attributes;if(!$||zr(S))return;ze=gr(L.uponSanitizeAttribute,ze,It,Rt);const ee={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ze,forceKeepAttr:void 0};let we=$.length;const be=He(S.nodeName);for(;we--;){const Oe=$[we],Ke=Oe.name,Qe=Oe.namespaceURI,Ct=Oe.value,jt=He(Ke),Ns=Ct;let Lt=Ke==="value"?Ns:RS(Ns);if(ee.attrName=jt,ee.attrValue=Lt,ee.keepAttr=!0,ee.forceKeepAttr=void 0,mn(L.uponSanitizeAttribute,S,ee),Lt=ee.attrValue,ms&&(jt==="id"||jt==="name")&&im(Lt,In)!==0&&(vs(Ke,S),Lt=In+Lt),Ue&&Qt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Lt)){vs(Ke,S);continue}if(jt==="attributename"&&rm(Lt,"href")){vs(Ke,S);continue}if(!ee.forceKeepAttr){if(!ee.keepAttr){vs(Ke,S);continue}if(!V&&Qt(YS,Lt)){vs(Ke,S);continue}if(pe&&(Lt=$r(Lt)),!Io(be,jt,Lt)){vs(Ke,S);continue}Lt=Ci(be,jt,Qe,Lt),Lt!==Ns&&vr(S,Ke,Qe,Lt)}}mn(L.afterSanitizeAttributes,S,null)},Bs=function(S){let $=null;const ee=Pn(S);for(mn(L.beforeSanitizeShadowDOM,S,null);$=ee.nextNode();)if(mn(L.uponSanitizeShadowNode,$,null),Ao($,S),Do($),Us($.content)&&Bs($.content),(O?O($):$.nodeType)===Un.element){const be=A($);Us(be)&&(Ge(be),Bs(be))}mn(L.afterSanitizeShadowDOM,S,null)},Ge=function(S){const $=[{node:S,shadow:null}];for(;$.length>0;){const ee=$.pop();if(ee.shadow){Bs(ee.shadow);continue}const we=ee.node,Oe=(O?O(we):we.nodeType)===Un.element,Ke=T(we);if(Ke)for(let Qe=Ke.length-1;Qe>=0;--Qe)$.push({node:Ke[Qe],shadow:null});if(Oe){const Qe=W?W(we):null;if(typeof Qe=="string"&&He(Qe)==="template"){const Ct=we.content;Us(Ct)&&$.push({node:Ct,shadow:null})}}if(Oe){const Qe=A(we);Us(Qe)&&$.push({node:null,shadow:Qe},{node:Qe,shadow:null})}}};return s.sanitize=function(ae){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,ee=null,we=null,be=null;if(Je=!ae,Je&&(ae="<!-->"),typeof ae!="string"&&!hr(ae)&&(ae=LS(ae),typeof ae!="string"))throw Ar("dirty is not a string, aborting");if(!s.isSupported)return ae;mt?(je=gt,ze=Rt):ns(S),(L.uponSanitizeElement.length>0||L.uponSanitizeAttribute.length>0)&&(je=un(je)),L.uponSanitizeAttribute.length>0&&(ze=un(ze)),s.removed=[];const Oe=pn&&typeof ae!="string"&&hr(ae);if(Oe){Ro(ae);const Ct=W?W(ae):ae.nodeName;if(typeof Ct=="string"){const jt=He(Ct);if(!je[jt]||Dt[jt])throw Fs(ae),Ar("root node is forbidden and cannot be sanitized in-place")}if(zr(ae))throw Fs(ae),Ar("root node is clobbered and cannot be sanitized in-place");try{Ge(ae)}catch(jt){throw Fs(ae),jt}}else if(hr(ae))$=pr("<!---->"),ee=$.ownerDocument.importNode(ae,!0),ee.nodeType===Un.element&&ee.nodeName==="BODY"||ee.nodeName==="HTML"?$=ee:$.appendChild(ee),Ge(ee);else{if(!ut&&!pe&&!tt&&ae.indexOf("<")===-1)return Y&&Hn?Ne(ae):ae;if($=pr(ae),!$)return ut?null:Hn?Q:""}$&&Ht&&gs($.firstChild);const Ke=Oe?ae:$;try{const Ct=Pn(Ke);for(;we=Ct.nextNode();)Ao(we,Ke),Do(we),Us(we.content)&&Bs(we.content)}catch(Ct){throw Oe&&(Fs(ae),ci(s.removed,jt=>{jt.element&&fr(jt.element)})),Ct}if(Oe)return ci(s.removed,Ct=>{Ct.element&&fr(Ct.element)}),pe&&hn(ae),ae;if(ut){if(pe&&hn($),An)for(be=J.call($.ownerDocument);$.firstChild;)be.appendChild($.firstChild);else be=$;return(ze.shadowroot||ze.shadowrootmode)&&(be=E.call(o,be,!0)),be}let Qe=tt?$.outerHTML:$.innerHTML;return tt&&je["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&Qt(qS,$.ownerDocument.doctype.name)&&(Qe="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
|
|
465
|
+
`+Qe),pe&&(Qe=$r(Qe)),Y&&Hn?Ne(Qe):Qe},s.setConfig=function(){let ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ns(ae),mt=!0,gt=je,Rt=ze},s.clearConfig=function(){kn=null,mt=!1,gt=null,Rt=null,Y=ue,Q=""},s.isValidAttribute=function(ae,S,$){kn||ns({});const ee=He(ae),we=He(S);return Io(ee,we,$)},s.addHook=function(ae,S){typeof S=="function"&&Zt(L,ae)&&ui(L[ae],S)},s.removeHook=function(ae,S){if(Zt(L,ae)){if(S!==void 0){const $=_S(L[ae],S);return $===-1?void 0:ES(L[ae],$,1)[0]}return sm(L[ae])}},s.removeHooks=function(ae){Zt(L,ae)&&(L[ae]=[])},s.removeAllHooks=function(){L=mm()},s}var Cd=uv();const ZS=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),JS=100;function gm(t){return ZS.has(t.type)}function eb({items:t,runtimeType:s,turn:r,threads:o=[]}){const[a,u]=w.useState(!1),[f,h]=w.useState(!1);if(t.length===0)return null;const g=t.length,m=f?0:Math.max(0,g-JS),v=m>0?t.slice(m):t;return l.jsxs("div",{className:"tool-calls",children:[l.jsxs("div",{className:"tool-calls-header",onClick:()=>u(k=>!k),children:[l.jsx("span",{className:"tool-calls-icon",children:l.jsx(Mw,{size:12})}),l.jsxs("span",{className:"tool-calls-summary",children:[g," tool call",g>1?"s":""]}),l.jsx(ld,{size:14,className:"tool-calls-chevron",style:{transform:a?"rotate(90deg)":"none"}})]}),a&&l.jsxs("div",{className:"tool-calls-body",children:[m>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>h(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>l.jsx(Ms,{item:k,runtimeType:s,turn:r,threads:o},k.id))]})]})}qe.setOptions({breaks:!0,gfm:!0});function tb(t){const s=qe.parse(t);return Cd.sanitize(s)}function vm(t,s){var a;const r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let o=0;for(;r.nextNode();){const u=r.currentNode,f=((a=u.textContent)==null?void 0:a.length)??0;if(o+f>s)return{node:u,offset:s-o};o+=f}return null}function nb(t,s,r){const o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),a=[];for(;o.nextNode();){const u=o.currentNode;if(!u.textContent||u.textContent.trim()==="")continue;const f=document.createRange();f.selectNodeContents(u),!(f.compareBoundaryPoints(Range.START_TO_END,s)<=0)&&(f.compareBoundaryPoints(Range.END_TO_START,s)>=0||a.push(u))}for(const u of a){const f=u.length;let h=0,g=f;if(u===s.startContainer&&(h=Math.min(s.startOffset,f)),u===s.endContainer&&(g=Math.min(s.endOffset,f)),h>=g)continue;g<f&&u.splitText(g);const m=h>0?u.splitText(h):u,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function sb(t,s){t.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 s){if(r.start_offset===null||r.end_offset===null)continue;const o=vm(t,r.start_offset),a=vm(t,r.end_offset);if(!o||!a)continue;const u=document.createRange();u.setStart(o.node,o.offset),u.setEnd(a.node,a.offset),nb(t,u,()=>{const f=document.createElement("mark");return f.setAttribute("data-thread-id",r.id),r.status==="resolved"&&f.classList.add("thread-mark-resolved"),f})}}function rb(t){const s=window.getSelection();if(!s||s.rangeCount===0)return null;const r=s.getRangeAt(0);if(r.collapsed||!t.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(t,0),o.setEnd(r.startContainer,r.startOffset);const a=o.toString().length,u=r.toString();return{start:a,end:a+u.length,text:u}}function ib({itemId:t,turnId:s,sessionId:r,content:o,threads:a}){const u=w.useRef(null),f=w.useRef(null),h=w.useRef(null),g=w.useRef(""),m=w.useRef(0),[v,k]=w.useState(!1),[x,b]=w.useState({x:0,y:0}),[j,C]=w.useState(!1),[T,I]=w.useState({x:0,y:0}),[A,U]=w.useState(""),[O,W]=w.useState(null),[Z,Y]=w.useState(!1),Q=M(q=>q.createThread),ue=M(q=>q.switchRightTab),he=M(q=>xl(q.sessionDetails[r])),H=w.useCallback(async()=>{await ul(o||""),Y(!0),setTimeout(()=>Y(!1),1500)},[o]),Te=w.useCallback(()=>{var E;if(!O)return;const q=`
|
|
471
466
|
\`\`\`QUOTE
|
|
472
467
|
${O.text}
|
|
473
468
|
\`\`\`
|
|
474
469
|
|
|
475
|
-
`;M.setState({quotedText:q}),k(!1),W(null),(E=window.getSelection())==null||E.removeAllRanges()},[O]),Ne=w.useMemo(()=>
|
|
470
|
+
`;M.setState({quotedText:q}),k(!1),W(null),(E=window.getSelection())==null||E.removeAllRanges()},[O]),Ne=w.useMemo(()=>tb(o||"…"),[o]),Le=w.useMemo(()=>a.filter(q=>q.item_id===t),[a,t]);w.useEffect(()=>{u.current&&sb(u.current,Le)},[Ne,Le]),w.useEffect(()=>{g.current=A},[A]),w.useEffect(()=>{function q(E){f.current&&!f.current.contains(E.target)&&(k(!1),g.current.trim()||C(!1))}return document.addEventListener("mousedown",q),()=>document.removeEventListener("mousedown",q)},[]);const se=w.useCallback(()=>{k(!1),g.current.trim()||C(!1)},[]),G=w.useCallback(()=>{const q=u.current;if(!q)return;const E=rb(q);if(E&&E.text.trim().length>0){const L=window.getSelection();if(L&&L.rangeCount>0&&L.anchorNode&&L.focusNode){const K=L.getRangeAt(0).getBoundingClientRect(),ce=28,fe=6,Pe=170;let Ce=!1;try{const it=document.createRange();it.setStart(L.focusNode,L.focusOffset),it.setEnd(L.focusNode,L.focusOffset);const je=document.createRange();je.setStart(L.anchorNode,L.anchorOffset),je.setEnd(L.anchorNode,L.anchorOffset),Ce=je.compareBoundaryPoints(Range.START_TO_START,it)>0}catch{Ce=!1}let Ee=K.top-ce-fe;Ee<8&&(Ee=K.bottom+fe);let _e=Ce?K.left-Pe:K.right;_e=Math.max(8,Math.min(_e,window.innerWidth-Pe-8)),b({x:_e,y:Ee}),k(!0),W(E)}}else k(!1)},[]);w.useEffect(()=>{function q(E){const L=E.target;L&&(L.closest(".selection-actions")||L.closest(".thread-create-popover"))||G()}return document.addEventListener("mouseup",q),()=>document.removeEventListener("mouseup",q)},[G]);const X=w.useCallback(()=>{k(!1),C(!0),I({x:x.x,y:x.y})},[x]);w.useLayoutEffect(()=>{if(!j)return;const q=h.current;if(!q)return;const E=q.offsetWidth,L=q.offsetHeight,de=8;let K=x.x,ce=x.y;K-E<de&&(K=E+de),K>window.innerWidth-de&&(K=window.innerWidth-de),ce<de&&(ce=de),ce+L>window.innerHeight-de&&(ce=window.innerHeight-L-de),I({x:K,y:ce})},[j,x]);const P=w.useCallback(async()=>{var q;he||!O||!A.trim()||(await Q(r,{itemId:t,turnId:s,startOffset:O.start,endOffset:O.end,selectedText:O.text,message:A.trim()}),U(""),C(!1),W(null),(q=window.getSelection())==null||q.removeAllRanges(),ue("threads"))},[O,A,Q,r,t,s,ue,he]),J=w.useCallback(q=>{const E=q.target;if(E.tagName==="MARK"&&E.hasAttribute("data-thread-id")){q.preventDefault(),ue("threads");const L=E.getAttribute("data-thread-id");setTimeout(()=>{const de=document.getElementById(`thread-${L}`);de&&(de.scrollIntoView({behavior:"smooth",block:"center"}),de.classList.add("thread-card-highlighted"),setTimeout(()=>de.classList.remove("thread-card-highlighted"),1500))},100)}},[ue]);return l.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:f,children:[l.jsx("div",{ref:u,dangerouslySetInnerHTML:{__html:Ne},onMouseDown:se,onClick:J}),l.jsx("button",{className:`copy-text-btn${Z?" copied":""}`,onClick:H,title:Z?"Copied":"Copy message","aria-label":"Copy message text",children:Z?l.jsx(Os,{size:14}):l.jsx(nl,{size:14})}),v&&!j&&l.jsxs("div",{className:"selection-actions",style:{left:x.x,top:x.y},children:[!he&&l.jsxs("button",{className:"discuss-button",onClick:X,title:"Start a discussion about this text",children:[l.jsx(vw,{size:14}),l.jsx("span",{children:"Discuss"})]}),l.jsxs("button",{className:"discuss-button",onClick:Te,title:"Quote this text in your message",children:[l.jsx(xg,{size:14}),l.jsx("span",{children:"Quote"})]})]}),j&&l.jsxs("div",{ref:h,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:['"',O==null?void 0:O.text.slice(0,80),O&&O.text.length>80?"…":"",'"']}),l.jsx("button",{className:"thread-create-close",onClick:()=>{C(!1),W(null)},children:l.jsx(En,{size:14})})]}),l.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:A,onChange:q=>U(q.target.value),autoFocus:!0,rows:2,onKeyDown:q=>{if(q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&(q.preventDefault(),P()),q.key==="Escape")if(g.current.trim()){const E=Date.now();m.current&&E-m.current<400?(m.current=0,C(!1),W(null)):m.current=E}else C(!1),W(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:P,disabled:!A.trim()||he,title:he?"Wait for the running turn to finish first":void 0,children:[l.jsx(To,{size:13}),l.jsx("span",{children:"Send"})]})]})]})]})}const ym=w.memo(ib),gl=new Map,dv=new Set,qu=new Set,xm=new Map;function fv(){qu.forEach(t=>t())}function pv(t,s){return`${t}:${s}`}function ob(t,s,r,o,a){var g;const u=pv(s,r),f=gl.get(t)??new Map,h=new Map(f);((g=h.get(u))==null?void 0:g.answer)===a?h.delete(u):h.set(u,{itemIndex:s,groupIndex:r,question:o,answer:a}),gl.set(t,h),fv()}function ab(t){gl.delete(t),fv()}function lb(t){dv.add(t),ab(t)}function cb(t){const s=w.useCallback(r=>(qu.add(r),()=>{qu.delete(r)}),[]);return w.useSyncExternalStore(s,()=>gl.get(t)??xm,()=>xm)}function ub(t){return[...t].sort((s,r)=>s.itemIndex-r.itemIndex||s.groupIndex-r.groupIndex).map(s=>`> ${s.question}
|
|
476
471
|
${s.answer}`).join(`
|
|
477
472
|
|
|
478
|
-
`)}function
|
|
479
|
-
… (truncated, click to expand)`:I;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(kg,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Command"}),U&&l.jsx("span",{className:"turn-header-meta",children:U})]}),l.jsx("pre",{className:"cmd-block",children:l.jsx("code",{children:T})}),I&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"cmd-output",children:l.jsx("code",{children:W})}),O&&l.jsx("button",{className:"cmd-output-toggle",onClick:()=>f(Z=>!Z),children:u?"Show less":`Show full output (${(I.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const C=(h=t.data)==null?void 0:h.changes,T=Array.isArray(C)?C:[],I=`${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(cw,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"File Changes"}),l.jsx("span",{className:"turn-header-meta",children:I})]}),l.jsx("div",{className:"file-change-list",children:T.map((A,U)=>{const O=A.kind==="add"?"A":A.kind==="delete"?"D":"M",W=A.kind==="add"?"fc-add":A.kind==="delete"?"fc-del":"fc-mod";return l.jsxs("div",{className:"file-change",children:[l.jsx("span",{className:`fc-status ${W}`,children:O}),l.jsx("span",{className:"fc-name",children:A.path})]},U)})})]})}case"mcp_tool_call":{const C=t.data||{},T=C.tool||"mcp";if(T==="Agent"){const Q=C.arguments,ue=(Q==null?void 0:Q.description)||(Q==null?void 0:Q.prompt)||"Subagent",he=t.status==="failed",H=a?"running…":he?"failed":"done";return l.jsxs("div",{className:"agent-call-card",children:[l.jsx("span",{className:"agent-call-icon",children:l.jsx(ur,{size:14})}),l.jsx("span",{className:"agent-call-desc",children:ue}),l.jsx("span",{className:`agent-call-status ${a?"running":he?"failed":"done"}`,children:H})]})}const I=C.server||"",A=C.arguments,U=C.result,O=C.error,W=t.status==="failed"||!!O,Z=a?"running…":W?"failed":"done",Y=((g=U==null?void 0:U.content)==null?void 0:g.filter(Q=>Q.type==="text").map(Q=>Q.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(Cw,{size:14})}),l.jsxs("span",{className:"turn-header-title",children:["MCP: ",T]}),I&&l.jsx("span",{className:"turn-header-meta",children:I}),l.jsx("span",{className:"turn-header-meta",style:W?{color:"var(--red)"}:void 0,children:Z})]}),A&&Object.keys(A).length>0&&l.jsx("div",{className:"mcp-args",children:Object.entries(A).map(([Q,ue])=>l.jsxs("div",{className:"mcp-arg",children:[l.jsx("span",{className:"mcp-arg-key",children:Q}),Q==="code"?l.jsx("pre",{className:"cmd-block",children:l.jsx("code",{children:String(ue)})}):l.jsx("span",{className:"mcp-arg-value",children:typeof ue=="string"?ue:JSON.stringify(ue,null,2)})]},Q))}),Y.length>0&&Y.map((Q,ue)=>l.jsx("pre",{className:"cmd-output",children:l.jsx("code",{children:Q})},ue)),O&&l.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:l.jsx("code",{children:O})})]})}case"web_search":{const C=((m=t.data)==null?void 0:m.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(Ew,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),l.jsx("p",{className:"user-message",children:C})]})}case"todo_list":{const C=((v=t.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(mw,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),l.jsx("ul",{className:"todo-list",children:C.map((T,I)=>l.jsxs("li",{className:T.completed?"todo-done":"todo-pending",children:[T.completed?l.jsx(lr,{size:14}):l.jsx(Lr,{size:14})," ",T.text]},I))})]})}case"ask_user":return l.jsx(xm,{item:t,turn:r});case"final_result":{const C=t.data??{},T=C.text||"",I=C.html||null,A=Array.isArray(C.groups)?C.groups.filter(W=>!!W&&Array.isArray(W.selections)&&W.selections.length>0):[],{iconClass:U,iconText:O}=Mu(s??"codex");return l.jsxs(l.Fragment,{children:[(T||I)&&l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:`turn-header-icon ${U}`,children:O}),l.jsx("span",{className:"turn-header-title",children:"Agent"})]}),T&&l.jsx(vm,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:T,threads:o,runtimeType:s}),I&&l.jsx(Nb,{html:I})]}),A.length>0&&l.jsx(xm,{item:t,turn:r})]})}case"background_task":{const C=t.data||{},T=C.task_type||"unknown",I=C.subagent_type||null,A=C.description||"",U=C.status||"running",O=C.last_tool_name||null,W=C.token_count||null,Z=T==="local_agent",Y=T==="local_bash",Q=Z?ur:Y?wg:pg,ue=Z?`Subagent${I?`: ${I}`:""}`:Y?"Monitor":"Background Task",he=U==="running"?"running…":U==="completed"?"done":U==="failed"?"failed":U==="stopped"?"stopped":U,H=t.status==="failed"||U==="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(Q,{size:14})}),l.jsx("span",{className:"turn-header-title",children:ue}),l.jsx("span",{className:"turn-header-meta",style:H?{color:"var(--red)"}:void 0,children:he})]}),A&&l.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:A}),O&&a&&l.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",O,W!=null&&` · ${W.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 C=((k=t.data)==null?void 0:k.trigger)??"auto",T=((x=t.data)==null?void 0:x.pre_tokens)??0,I=((b=t.data)==null?void 0:b.post_tokens)??0,A=T>0?Math.round((1-I/T)*100):0,U=C==="manual"?"Context compacted (/compact)":"Context auto-compacted";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(xw,{size:14})}),l.jsx("span",{className:"turn-header-title",children:U})]}),l.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:[T.toLocaleString()," → ",I.toLocaleString()," tokens (",A,"% reduction)"]})]})}case"interruption":return l.jsx(mb,{item:t});case"error":{const C=((_=t.data)==null?void 0:_.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(kl,{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:C})})]})}default:return null}}const Ms=w.memo(Cb,(t,s)=>t.item===s.item&&t.runtimeType===s.runtimeType&&t.threads===s.threads&&t.turn.id===s.turn.id);function _b({turn:t,runtimeType:s,threads:r=[]}){Ot.trackRender("TurnContent");const[o,a]=w.useState(!1),[u,f]=w.useState(!1),[h,g]=w.useState(!1);w.useEffect(()=>{const H=t.items.some(Te=>Te.type==="background_task"&&Te.status==="in_progress");t.status==="running"||t.status==="pending"?a(!0):t.status==="completed"&&!H&&a(!1)},[t.status,t.items]);let m=-1;for(let H=t.items.length-1;H>=0;H--)if(t.items[H].type==="agent_message"){m=H;break}const v=m>=0,k=v?t.items.slice(0,m):t.items,x=t.items.some(H=>H.type==="final_result"||H.type==="ask_user"),b=!v&&t.status==="completed"&&t.agent_response&&!x?{id:`response-${t.id}`,turn_id:t.id,external_item_id:`response-${t.id}`,type:"agent_message",data:{text:t.agent_response},status:"completed",created_at:t.created_at,updated_at:t.updated_at}:null,C=k.filter(H=>{var Te;return!(H.type==="reasoning"&&(!((Te=H.data)!=null&&Te.text)||H.data.text===""))}).filter(H=>!(H.type==="background_task"||H.type==="ask_user"||H.type==="final_result")),T=u?0:Math.max(0,C.length-wb),I=T>0?C.slice(T):C,A=[];let U=null;for(const H of I)H.type==="agent_message"?(U&&A.push(U),U={agentMessage:H,toolItems:[],otherItems:[]}):H.type==="interruption"||H.type==="error"?(U&&A.push(U),A.push({agentMessage:null,toolItems:[],otherItems:[H]}),U=null):(U||(U={agentMessage:null,toolItems:[],otherItems:[]}),mm(H)?U.toolItems.push(H):U.otherItems.push(H));U&&A.push(U);const O=t.items.filter(H=>H.type==="background_task"),W=h?0:Math.max(0,O.length-xb),Z=W>0?O.slice(W):O,Y=C.filter(H=>mm(H)).length,Q=Y>0||C.length>0&&(t.status==="running"||t.status==="pending"),ue=t.status==="pending"&&t.resume_state==="waiting",he=t.resume_state==="gave_up"||t.resume_state==="skipped"||t.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:t.user_prompt}),Array.isArray(t.attachments)&&t.attachments.length>0&&l.jsx(kb,{attachments:t.attachments})]}),Q&&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(fw,{size:12})}),l.jsx("span",{className:"tool-calls-summary",children:Y>0?`${Y} tool call${Y>1?"s":""}`:ue?"interrupted":"thinking…"}),l.jsx(ld,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&l.jsxs("div",{className:"tool-calls-body",children:[T>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>f(!0),children:["Show ",T," earlier step",T>1?"s":""]})}),A.map((H,Te)=>l.jsxs("div",{className:"intermediate-segment",children:[H.agentMessage&&l.jsx(Ms,{item:H.agentMessage,runtimeType:s,turn:t,threads:r}),H.otherItems.map(Ne=>l.jsx(Ms,{item:Ne,runtimeType:s,turn:t,threads:r},Ne.id)),H.toolItems.length>0&&l.jsx(tb,{items:H.toolItems,runtimeType:s,turn:t,threads:r})]},Te))]})]}),W>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(!0),children:["Show ",W," earlier background task",W>1?"s":""]})}),Z.map(H=>l.jsx(Ms,{item:H,runtimeType:s,turn:t,threads:r},`task-${H.id}`)),v&&l.jsx(Ms,{item:t.items[m],runtimeType:s,turn:t,threads:r},t.items[m].id),b&&l.jsx(Ms,{item:b,runtimeType:s,turn:t,threads:r},b.id),v&&t.items.slice(m+1).filter(H=>H.type!=="ask_user"&&H.type!=="background_task"&&H.type!=="final_result").map(H=>l.jsx(Ms,{item:H,runtimeType:s,turn:t,threads:r},H.id)),t.items.filter(H=>H.type==="final_result").map(H=>l.jsx(Ms,{item:H,runtimeType:s,turn:t,threads:r},`final-${H.id}`)),t.items.filter(H=>H.type==="ask_user").map(H=>l.jsx(Ms,{item:H,runtimeType:s,turn:t,threads:r},`ask-${H.id}`)),t.items.length===0&&!t.error&&(t.status==="pending"||t.status==="running")&&l.jsx("div",{className:"render-content",children:l.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.status==="running"?"Agent is thinking…":"Waiting to start…"})}),t.error&&!he&&l.jsx("div",{className:"render-content",children:l.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:l.jsx("code",{children:t.error})})}),t.status==="running"&&l.jsx(yb,{turnId:t.id}),l.jsx(vb,{turn:t}),t.status==="aborted"&&l.jsxs("div",{className:"aborted-banner",children:[l.jsx("span",{className:"banner-icon",children:l.jsx(Lr,{size:12})}),l.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const jb=w.memo(_b),Eb=[],Ua=50;function Rb(){Ot.trackRender("RenderArea");const t=M(x=>x.activeSessionId),s=M(x=>x.activeSessionId?x.sessionDetails[x.activeSessionId]:null),r=M(x=>x.submittingPrompt),o=M(x=>x.loading),a=(s==null?void 0:s.turns)??[],u=(s==null?void 0:s.threads)??Eb,f=w.useRef(null),[h,g]=w.useState(Ua);w.useEffect(()=>{g(Ua)},[t]);const m=a.filter(x=>!x.thread_id),v=Math.max(0,m.length-h),k=m.slice(v);return w.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[t,a.length]),o&&!s?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"})]})}):s?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…"})})]})}),a.length===0&&!r&&l.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),v>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(x=>x+Ua),children:["Show ",Math.min(Ua,v)," earlier turns (",v," hidden)"]})}),k.map((x,b)=>l.jsx("div",{id:`turn-${v+b}`,className:"turn-block",children:l.jsx(jb,{turn:x,runtimeType:s.runtime_type,threads:u})},x.id))]}):l.jsx("div",{className:"render-scroll",children:l.jsx("div",{className:"empty-state",children:"No session selected"})})}const Ab=w.memo(Rb),Ib=[{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 Db(t){return t.map(s=>({id:s.name,label:`/${s.name}`,hint:s.description,capability:null,insertAsText:!0}))}function Mb(t,s,r=[]){const o=[...Ib,...Db(r)],a=new Set;return o.filter(u=>!(a.has(u.label)||(a.add(u.label),u.capability&&!s[u.capability])||t&&!u.label.toLowerCase().includes(t.toLowerCase())))}function Lb({commands:t,selectedIndex:s,onSelect:r,onHover:o}){return l.jsxs("div",{className:"slash-popup",children:[l.jsx("div",{className:"slash-popup-header",children:"Commands"}),t.length===0&&l.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),t.map((a,u)=>l.jsxs("div",{className:`slash-popup-item ${u===s?"selected":""}`,onMouseEnter:()=>o(u),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 ju({title:t,options:s,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:t})]}),s.map(u=>l.jsxs("div",{className:`slash-popup-item ${u.value===r?"selected":""}`,onClick:()=>o(u.value),children:[l.jsxs("div",{className:"slash-popup-item-main",children:[l.jsx("span",{className:"slash-popup-label",children:u.label}),u.description&&l.jsx("span",{className:"slash-popup-hint",children:u.description})]}),u.value===r&&l.jsx("span",{className:"slash-popup-check",children:"✓"})]},u.value))]})}function Pb(t){return fn("/skills")}function Ob({filter:t,onSelect:s,onClose:r}){const[o,a]=w.useState([]),[u,f]=w.useState(!0),[h,g]=w.useState(0),m=w.useRef(null);w.useEffect(()=>{Pb().then(a).catch(()=>a([])).finally(()=>f(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(t.toLowerCase())||k.description.toLowerCase().includes(t.toLowerCase()));return w.useEffect(()=>{g(0)},[t]),w.useEffect(()=>{function k(x){x.key==="ArrowDown"?(x.preventDefault(),g(b=>Math.min(b+1,v.length-1))):x.key==="ArrowUp"?(x.preventDefault(),g(b=>Math.max(b-1,0))):x.key==="Enter"?(x.preventDefault(),v[h]&&s(v[h])):x.key==="Escape"&&(x.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,h,s,r]),l.jsxs("div",{className:"slash-popup",ref:m,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"})]}),u&&l.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!u&&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===h?"selected":""}`,onMouseEnter:()=>g(x),onClick:()=>s(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 $b(){return fn("/providers")}function zb(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return fn(`/providers/${t}/commands${r}`)}const Fb={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function Ub(t){const[s,r]=w.useState([]),[o,a]=w.useState(!0);w.useEffect(()=>{$b().then(r).catch(()=>r([])).finally(()=>a(!1))},[]);const u=s.find(f=>f.id===t)??null;return{provider:u,capabilities:(u==null?void 0:u.capabilities)??Fb,loading:o}}const di=32,Eu=200;function bm(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function Tm(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}let Nm=0;function Bb(){return Nm+=1,`att-${Date.now()}-${Nm}`}function Wb(){Ot.trackRender("CommandInputBar");const[t,s]=w.useState(""),r=w.useRef(null),o=w.useRef(di),a=w.useRef(null),{submitPrompt:u,cancelTurn:f,updateRuntimeConfig:h,setShowModelSelector:g}=M(),m=M(V=>V.activeSessionId),v=M(V=>V.activeSessionId?V.sessionDetails[V.activeSessionId]:null),k=M(V=>V.quotedText),x=Jm(v),b=!!(v!=null&&v.turns.some(V=>V.status==="pending"&&V.resume_state==="waiting")),_=!m,{capabilities:C}=Ub(v==null?void 0:v.runtime_type),T=(v==null?void 0:v.runtime_type)??null,I=C.imageAttachments,[A,U]=w.useState([]),[O,W]=w.useState(!1),[Z,Y]=w.useState(null),[Q,ue]=w.useState([]);w.useEffect(()=>{if(!T){ue([]);return}let V=!1;return zb(T,(v==null?void 0:v.cwd)??void 0).then(pe=>{V||ue(pe)}).catch(()=>{V||ue([])}),()=>{V=!0}},[T,v==null?void 0:v.cwd]);const[he,H]=w.useState(!1),[Te,Ne]=w.useState(""),[Le,se]=w.useState(0),[G,X]=w.useState(void 0),[P,J]=w.useState(!1),[q,E]=w.useState(""),[L,de]=w.useState([]),K=he?Mb(Te,C,Q):[];w.useEffect(()=>{k!==null&&(s(V=>V+k),setTimeout(()=>{if(r.current){_e(),r.current.focus();const V=r.current.value.length;r.current.setSelectionRange(V,V)}},0),M.setState({quotedText:null}))},[k]),w.useEffect(()=>{if(!x)return;function V(pe){pe.key==="Escape"&&(pe.preventDefault(),f())}return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[x,f]),w.useEffect(()=>{H(!1),X(void 0),J(!1),de([]),U(V=>{for(const pe of V)pe.previewUrl&&URL.revokeObjectURL(pe.previewUrl);return[]})},[m]),w.useEffect(()=>{if(!Z)return;function V(pe){pe.key==="Escape"&&(pe.preventDefault(),Y(null))}return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[Z]);const ce=w.useCallback(V=>{if(!V)return;const pe=Array.from(V);for(const Ue of pe){const tt=new FileReader;tt.onload=()=>{const gt=tt.result.split(",")[1]??"",Rt=Ue.type.startsWith("image/")?URL.createObjectURL(Ue):void 0;U(Ht=>[...Ht,{id:Bb(),name:Ue.name,media_type:Ue.type||"application/octet-stream",data:gt,previewUrl:Rt,size:Ue.size}])},tt.readAsDataURL(Ue)}},[]),fe=w.useCallback(V=>{U(pe=>{const Ue=pe.find(tt=>tt.id===V);return Ue!=null&&Ue.previewUrl&&URL.revokeObjectURL(Ue.previewUrl),pe.filter(tt=>tt.id!==V)})},[]),Pe=w.useCallback(V=>{V.preventDefault(),V.stopPropagation(),!(!I||x)&&W(!0)},[I,x]),Ce=w.useCallback(V=>{V.preventDefault(),V.stopPropagation(),W(!1)},[]),Ee=w.useCallback(V=>{V.preventDefault(),V.stopPropagation(),W(!1),!(!I||x)&&ce(V.dataTransfer.files)},[I,x,ce]),je=w.useCallback(V=>{var tt;if(!I)return;const pe=(tt=V.clipboardData)==null?void 0:tt.items;if(!pe)return;const Ue=[];for(let mt=0;mt<pe.length;mt++){const gt=pe[mt];if(gt.type.startsWith("image/")){const Rt=gt.getAsFile();Rt&&Ue.push(Rt)}}Ue.length>0&&(V.preventDefault(),ce(Ue))},[I,ce]);function it(V){const pe=r.current;pe&&(pe.style.height=`${V}px`,o.current=V)}function _e(){const V=r.current;if(V){if(V.scrollHeight>V.clientHeight){const pe=Math.min(V.scrollHeight,Eu);pe!==o.current&&it(pe);return}o.current>di&&(V.style.height="auto",it(Math.min(V.scrollHeight,Eu)))}}function kt(){const V=t.trim();if(!V||x)return;let pe=V;L.length>0&&(pe=`${L.map(mt=>`$${mt.name}`).join(" ")}
|
|
473
|
+
`)}function wm({item:t,turn:s}){var b;const r=t.data??{},o=w.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(j=>!!j&&Array.isArray(j.selections)&&j.selections.length>0):[],[r.groups]),a=cb(s.id),u=M(j=>s.session_id?j.sessionDetails[s.session_id]:null),f=M(j=>j.activeSessionId),h=s.items.findIndex(j=>j.id===t.id),g=u?((b=u.turns[u.turns.length-1])==null?void 0:b.id)===s.id:!0,m=dv.has(s.id),v=m||eg(u)||!g||s.session_id!==f,k=(j,C,T)=>{v||ob(s.id,h,j,C,T)},x=()=>{const j=[...a.values()];if(j.length===0)return;const C=ub(j);lb(s.id),M.getState().submitPrompt(C)};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(sw,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Question"}),m&&l.jsx("span",{className:"turn-header-meta",children:"answered"})]}),o.length>0?l.jsxs("div",{className:"ask-user-groups",children:[o.map((j,C)=>l.jsxs("div",{className:"ask-user-group",children:[j.question&&l.jsx("div",{className:"ask-user-question",children:j.question}),l.jsx("div",{className:"ask-user-options",children:j.selections.map(T=>{var A;const I=((A=a.get(pv(h,C)))==null?void 0:A.answer)===T;return l.jsx("button",{type:"button",className:`ask-user-option ${I?"selected":""}`,disabled:v,onClick:()=>k(C,j.question,T),children:T},T)})})]},C)),v?m&&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(To,{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 db={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error"};function fo(t){return t&&db[t]||"interrupted"}function vl(t){if(!t)return"";const s=new Date(t);return Number.isNaN(s.getTime())?"":s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function fb(t){switch(t){case"network":return"Interrupted — network error. Will resume when the connection is back.";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 pb(t){return t.items.filter(s=>s.type==="interruption").map(s=>s.data)}function hb({item:t}){const s=t.data,r=vl(s.interrupted_at);let o="";switch(s.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=s.resumed_at?`resumed ${vl(s.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:s.detail??void 0,children:l.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",fo(s.reason),") · ",o]})})}function mb({turn:t,label:s}){const[r,o]=w.useState(!1),a=M(f=>f.addToast),u=()=>{o(!0),Nx(t.session_id,t.id).catch(f=>a("error",`Could not resume the turn — ${f.message}`)).finally(()=>o(!1))};return l.jsxs("button",{type:"button",className:"banner-action",onClick:u,disabled:r,children:[l.jsx(wg,{size:12}),s]})}function gb({turn:t}){const s=t.resume_state;if(!s||s==="cancelled")return null;const r=t.interrupt_reason,o=pb(t),a=o[o.length-1],u=vl(t.interrupted_at??(a==null?void 0:a.interrupted_at));if(s==="resumed"){const m=vl(a==null?void 0:a.resumed_at),v=t.status==="running"||t.status==="pending";return l.jsxs("div",{className:"interruption-banner resumed","data-state":"resumed",children:[l.jsx("span",{className:"banner-icon",children:l.jsx(wg,{size:12})}),l.jsxs("span",{className:"banner-text",children:["Interrupted",u?` ${u}`:""," (",fo(r),") · resumed",m?` ${m}`:"",v?" — continuing…":""]})]})}let f,h=null,g=null;switch(s){case"waiting":f=fb(r),g="Resume now";break;case"resuming":f=`Interrupted (${fo(r)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(o.length,1);f=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,h=t.error&&!t.error.startsWith("Automatic resume stopped")?t.error:null,g="Resume";break}case"skipped":f=`Interrupted${u?` ${u}`:""} (${fo(r)}) — too long ago to resume automatically.`,g="Resume";break;default:f=`Interrupted (${fo(r)}) — this turn cannot be resumed.`,h=t.error}return l.jsxs("div",{className:"interruption-banner","data-state":s,children:[l.jsx("span",{className:"banner-icon",children:r==="network"?l.jsx(bg,{size:12}):l.jsx(bl,{size:12})}),l.jsxs("span",{className:"banner-text",children:[f,h&&l.jsx("span",{className:"banner-detail",children:h})]}),g&&l.jsx(mb,{turn:t,label:g})]})}function vb({turnId:t}){const s=M(o=>o.retryStates[t]);if(!s)return null;const r=s.errorStatus?`API error ${s.errorStatus}`:"Connection problem";return l.jsxs("div",{className:"retry-banner",children:[l.jsx("span",{className:"banner-icon",children:l.jsx(bg,{size:12})}),l.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",s.attempt," of ",s.maxRetries,")…"]})]})}qe.setOptions({breaks:!0,gfm:!0});const yb=10,xb=100;function wb({attachments:t}){const[s,r]=w.useState(null);return w.useEffect(()=>{if(!s)return;function o(a){a.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[s]),!Array.isArray(t)||t.length===0?null:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"attachment-pills",children:t.map((o,a)=>{const u=o.media_type.startsWith("image/"),f=`data:${o.media_type};base64,${o.data}`;return l.jsxs("span",{className:"attachment-pill",title:o.name,onClick:u?()=>r(f):void 0,style:u?{cursor:"pointer"}:void 0,children:[u?l.jsx("img",{src:f,alt:o.name,className:"attachment-pill-thumb"}):l.jsx(mg,{size:12,className:"attachment-pill-icon"}),l.jsx("span",{className:"attachment-pill-name",children:o.name})]},a)})}),s&&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:s,alt:"preview"}),l.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:l.jsx(En,{size:20})})]})})]})}function kb(t){const s=qe.parse(t);return Cd.sanitize(s)}function km(t){var s;return(s=t.data)!=null&&s.text?t.data.text:""}function Sb(t){const s=t.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return s?s[1]:t}const Sm='<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 bb(t){return/<\/body>/i.test(t)?t.replace(/<\/body>/i,`${Sm}</body>`):t+Sm}function Tb({html:t}){const[s,r]=w.useState(480),o=w.useRef(null);return w.useEffect(()=>{function a(u){var f;u.source===((f=o.current)==null?void 0:f.contentWindow)&&typeof u.data=="number"&&u.data>0&&r(u.data)}return window.addEventListener("message",a),()=>window.removeEventListener("message",a)},[]),l.jsx("iframe",{ref:o,sandbox:"allow-scripts",srcDoc:bb(t),title:"HTML content",style:{width:"100%",height:`${s}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const bm=1e4;function Nb({item:t,runtimeType:s,turn:r,threads:o}){var h,g,m,v,k,x,b,j;const a=t.status==="in_progress",[u,f]=w.useState(!1);switch(t.type){case"agent_message":{const{iconClass:C,iconText:T}=Pu(s??"codex");return l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:`turn-header-icon ${C}`,children:T}),l.jsx("span",{className:"turn-header-title",children:"Agent"}),a&&l.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),l.jsx(ym,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:km(t)||"…",threads:o,runtimeType:s})]})}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(tw,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),l.jsx("div",{dangerouslySetInnerHTML:{__html:kb(km(t))}})]});case"command_execution":{const C=t.data||{},T=Sb(C.command||""),I=C.aggregated_output||"",A=C.exit_code,U=a?"running…":A!==null?`exit ${A}`:"",O=I.length>bm,W=O&&!u?I.slice(0,bm)+`
|
|
474
|
+
… (truncated, click to expand)`:I;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(Sg,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Command"}),U&&l.jsx("span",{className:"turn-header-meta",children:U})]}),l.jsx("pre",{className:"cmd-block",children:l.jsx("code",{children:T})}),I&&l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"cmd-output",children:l.jsx("code",{children:W})}),O&&l.jsx("button",{className:"cmd-output-toggle",onClick:()=>f(Z=>!Z),children:u?"Show less":`Show full output (${(I.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const C=(h=t.data)==null?void 0:h.changes,T=Array.isArray(C)?C:[],I=`${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(lw,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"File Changes"}),l.jsx("span",{className:"turn-header-meta",children:I})]}),l.jsx("div",{className:"file-change-list",children:T.map((A,U)=>{const O=A.kind==="add"?"A":A.kind==="delete"?"D":"M",W=A.kind==="add"?"fc-add":A.kind==="delete"?"fc-del":"fc-mod";return l.jsxs("div",{className:"file-change",children:[l.jsx("span",{className:`fc-status ${W}`,children:O}),l.jsx("span",{className:"fc-name",children:A.path})]},U)})})]})}case"mcp_tool_call":{const C=t.data||{},T=C.tool||"mcp";if(T==="Agent"){const Q=C.arguments,ue=(Q==null?void 0:Q.description)||(Q==null?void 0:Q.prompt)||"Subagent",he=t.status==="failed",H=a?"running…":he?"failed":"done";return l.jsxs("div",{className:"agent-call-card",children:[l.jsx("span",{className:"agent-call-icon",children:l.jsx(ur,{size:14})}),l.jsx("span",{className:"agent-call-desc",children:ue}),l.jsx("span",{className:`agent-call-status ${a?"running":he?"failed":"done"}`,children:H})]})}const I=C.server||"",A=C.arguments,U=C.result,O=C.error,W=t.status==="failed"||!!O,Z=a?"running…":W?"failed":"done",Y=((g=U==null?void 0:U.content)==null?void 0:g.filter(Q=>Q.type==="text").map(Q=>Q.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(Nw,{size:14})}),l.jsxs("span",{className:"turn-header-title",children:["MCP: ",T]}),I&&l.jsx("span",{className:"turn-header-meta",children:I}),l.jsx("span",{className:"turn-header-meta",style:W?{color:"var(--red)"}:void 0,children:Z})]}),A&&Object.keys(A).length>0&&l.jsx("div",{className:"mcp-args",children:Object.entries(A).map(([Q,ue])=>l.jsxs("div",{className:"mcp-arg",children:[l.jsx("span",{className:"mcp-arg-key",children:Q}),Q==="code"?l.jsx("pre",{className:"cmd-block",children:l.jsx("code",{children:String(ue)})}):l.jsx("span",{className:"mcp-arg-value",children:typeof ue=="string"?ue:JSON.stringify(ue,null,2)})]},Q))}),Y.length>0&&Y.map((Q,ue)=>l.jsx("pre",{className:"cmd-output",children:l.jsx("code",{children:Q})},ue)),O&&l.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:l.jsx("code",{children:O})})]})}case"web_search":{const C=((m=t.data)==null?void 0:m.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(_w,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),l.jsx("p",{className:"user-message",children:C})]})}case"todo_list":{const C=((v=t.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(hw,{size:14})}),l.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),l.jsx("ul",{className:"todo-list",children:C.map((T,I)=>l.jsxs("li",{className:T.completed?"todo-done":"todo-pending",children:[T.completed?l.jsx(Os,{size:14}):l.jsx(Lr,{size:14})," ",T.text]},I))})]})}case"ask_user":return l.jsx(wm,{item:t,turn:r});case"final_result":{const C=t.data??{},T=C.text||"",I=C.html||null,A=Array.isArray(C.groups)?C.groups.filter(W=>!!W&&Array.isArray(W.selections)&&W.selections.length>0):[],{iconClass:U,iconText:O}=Pu(s??"codex");return l.jsxs(l.Fragment,{children:[(T||I)&&l.jsxs("div",{className:"render-content",children:[l.jsxs("div",{className:"turn-header",children:[l.jsx("span",{className:`turn-header-icon ${U}`,children:O}),l.jsx("span",{className:"turn-header-title",children:"Agent"})]}),T&&l.jsx(ym,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:T,threads:o,runtimeType:s}),I&&l.jsx(Tb,{html:I})]}),A.length>0&&l.jsx(wm,{item:t,turn:r})]})}case"background_task":{const C=t.data||{},T=C.task_type||"unknown",I=C.subagent_type||null,A=C.description||"",U=C.status||"running",O=C.last_tool_name||null,W=C.token_count||null,Z=T==="local_agent",Y=T==="local_bash",Q=Z?ur:Y?kg:hg,ue=Z?`Subagent${I?`: ${I}`:""}`:Y?"Monitor":"Background Task",he=U==="running"?"running…":U==="completed"?"done":U==="failed"?"failed":U==="stopped"?"stopped":U,H=t.status==="failed"||U==="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(Q,{size:14})}),l.jsx("span",{className:"turn-header-title",children:ue}),l.jsx("span",{className:"turn-header-meta",style:H?{color:"var(--red)"}:void 0,children:he})]}),A&&l.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:A}),O&&a&&l.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",O,W!=null&&` · ${W.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 C=((k=t.data)==null?void 0:k.trigger)??"auto",T=((x=t.data)==null?void 0:x.pre_tokens)??0,I=((b=t.data)==null?void 0:b.post_tokens)??0,A=T>0?Math.round((1-I/T)*100):0,U=C==="manual"?"Context compacted (/compact)":"Context auto-compacted";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(yw,{size:14})}),l.jsx("span",{className:"turn-header-title",children:U})]}),l.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:[T.toLocaleString()," → ",I.toLocaleString()," tokens (",A,"% reduction)"]})]})}case"interruption":return l.jsx(hb,{item:t});case"error":{const C=((j=t.data)==null?void 0:j.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(bl,{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:C})})]})}default:return null}}const Ms=w.memo(Nb,(t,s)=>t.item===s.item&&t.runtimeType===s.runtimeType&&t.threads===s.threads&&t.turn.id===s.turn.id);function Cb({turn:t,runtimeType:s,threads:r=[]}){Ot.trackRender("TurnContent");const[o,a]=w.useState(!1),[u,f]=w.useState(!1),[h,g]=w.useState(!1);w.useEffect(()=>{const H=t.items.some(Te=>Te.type==="background_task"&&Te.status==="in_progress");t.status==="running"||t.status==="pending"?a(!0):t.status==="completed"&&!H&&a(!1)},[t.status,t.items]);let m=-1;for(let H=t.items.length-1;H>=0;H--)if(t.items[H].type==="agent_message"){m=H;break}const v=m>=0,k=v?t.items.slice(0,m):t.items,x=t.items.some(H=>H.type==="final_result"||H.type==="ask_user"),b=!v&&t.status==="completed"&&t.agent_response&&!x?{id:`response-${t.id}`,turn_id:t.id,external_item_id:`response-${t.id}`,type:"agent_message",data:{text:t.agent_response},status:"completed",created_at:t.created_at,updated_at:t.updated_at}:null,C=k.filter(H=>{var Te;return!(H.type==="reasoning"&&(!((Te=H.data)!=null&&Te.text)||H.data.text===""))}).filter(H=>!(H.type==="background_task"||H.type==="ask_user"||H.type==="final_result")),T=u?0:Math.max(0,C.length-xb),I=T>0?C.slice(T):C,A=[];let U=null;for(const H of I)H.type==="agent_message"?(U&&A.push(U),U={agentMessage:H,toolItems:[],otherItems:[]}):H.type==="interruption"||H.type==="error"?(U&&A.push(U),A.push({agentMessage:null,toolItems:[],otherItems:[H]}),U=null):(U||(U={agentMessage:null,toolItems:[],otherItems:[]}),gm(H)?U.toolItems.push(H):U.otherItems.push(H));U&&A.push(U);const O=t.items.filter(H=>H.type==="background_task"),W=h?0:Math.max(0,O.length-yb),Z=W>0?O.slice(W):O,Y=C.filter(H=>gm(H)).length,Q=Y>0||C.length>0&&(t.status==="running"||t.status==="pending"),ue=t.status==="pending"&&t.resume_state==="waiting",he=t.resume_state==="gave_up"||t.resume_state==="skipped"||t.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:t.user_prompt}),Array.isArray(t.attachments)&&t.attachments.length>0&&l.jsx(wb,{attachments:t.attachments})]}),Q&&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(dw,{size:12})}),l.jsx("span",{className:"tool-calls-summary",children:Y>0?`${Y} tool call${Y>1?"s":""}`:ue?"interrupted":"thinking…"}),l.jsx(ld,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&l.jsxs("div",{className:"tool-calls-body",children:[T>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>f(!0),children:["Show ",T," earlier step",T>1?"s":""]})}),A.map((H,Te)=>l.jsxs("div",{className:"intermediate-segment",children:[H.agentMessage&&l.jsx(Ms,{item:H.agentMessage,runtimeType:s,turn:t,threads:r}),H.otherItems.map(Ne=>l.jsx(Ms,{item:Ne,runtimeType:s,turn:t,threads:r},Ne.id)),H.toolItems.length>0&&l.jsx(eb,{items:H.toolItems,runtimeType:s,turn:t,threads:r})]},Te))]})]}),W>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(!0),children:["Show ",W," earlier background task",W>1?"s":""]})}),Z.map(H=>l.jsx(Ms,{item:H,runtimeType:s,turn:t,threads:r},`task-${H.id}`)),v&&l.jsx(Ms,{item:t.items[m],runtimeType:s,turn:t,threads:r},t.items[m].id),b&&l.jsx(Ms,{item:b,runtimeType:s,turn:t,threads:r},b.id),v&&t.items.slice(m+1).filter(H=>H.type!=="ask_user"&&H.type!=="background_task"&&H.type!=="final_result").map(H=>l.jsx(Ms,{item:H,runtimeType:s,turn:t,threads:r},H.id)),t.items.filter(H=>H.type==="final_result").map(H=>l.jsx(Ms,{item:H,runtimeType:s,turn:t,threads:r},`final-${H.id}`)),t.items.filter(H=>H.type==="ask_user").map(H=>l.jsx(Ms,{item:H,runtimeType:s,turn:t,threads:r},`ask-${H.id}`)),t.items.length===0&&!t.error&&(t.status==="pending"||t.status==="running")&&l.jsx("div",{className:"render-content",children:l.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.status==="running"?"Agent is thinking…":"Waiting to start…"})}),t.error&&!he&&l.jsx("div",{className:"render-content",children:l.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:l.jsx("code",{children:t.error})})}),t.status==="running"&&l.jsx(vb,{turnId:t.id}),l.jsx(gb,{turn:t}),t.status==="aborted"&&l.jsxs("div",{className:"aborted-banner",children:[l.jsx("span",{className:"banner-icon",children:l.jsx(Lr,{size:12})}),l.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const jb=w.memo(Cb),_b=[],Ua=50;function Eb(){Ot.trackRender("RenderArea");const t=M(x=>x.activeSessionId),s=M(x=>x.activeSessionId?x.sessionDetails[x.activeSessionId]:null),r=M(x=>x.submittingPrompt),o=M(x=>x.loading),a=(s==null?void 0:s.turns)??[],u=(s==null?void 0:s.threads)??_b,f=w.useRef(null),[h,g]=w.useState(Ua);w.useEffect(()=>{g(Ua)},[t]);const m=a.filter(x=>!x.thread_id),v=Math.max(0,m.length-h),k=m.slice(v);return w.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[t,a.length]),o&&!s?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"})]})}):s?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…"})})]})}),a.length===0&&!r&&l.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),v>0&&l.jsx("div",{className:"render-load-earlier",children:l.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(x=>x+Ua),children:["Show ",Math.min(Ua,v)," earlier turns (",v," hidden)"]})}),k.map((x,b)=>l.jsx("div",{id:`turn-${v+b}`,className:"turn-block",children:l.jsx(jb,{turn:x,runtimeType:s.runtime_type,threads:u})},x.id))]}):l.jsx("div",{className:"render-scroll",children:l.jsx("div",{className:"empty-state",children:"No session selected"})})}const Rb=w.memo(Eb),Ab=[{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 Ib(t){return t.map(s=>({id:s.name,label:`/${s.name}`,hint:s.description,capability:null,insertAsText:!0}))}function Db(t,s,r=[]){const o=[...Ab,...Ib(r)],a=new Set;return o.filter(u=>!(a.has(u.label)||(a.add(u.label),u.capability&&!s[u.capability])||t&&!u.label.toLowerCase().includes(t.toLowerCase())))}function Mb({commands:t,selectedIndex:s,onSelect:r,onHover:o}){return l.jsxs("div",{className:"slash-popup",children:[l.jsx("div",{className:"slash-popup-header",children:"Commands"}),t.length===0&&l.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),t.map((a,u)=>l.jsxs("div",{className:`slash-popup-item ${u===s?"selected":""}`,onMouseEnter:()=>o(u),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 Ru({title:t,options:s,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:t})]}),s.map(u=>l.jsxs("div",{className:`slash-popup-item ${u.value===r?"selected":""}`,onClick:()=>o(u.value),children:[l.jsxs("div",{className:"slash-popup-item-main",children:[l.jsx("span",{className:"slash-popup-label",children:u.label}),u.description&&l.jsx("span",{className:"slash-popup-hint",children:u.description})]}),u.value===r&&l.jsx("span",{className:"slash-popup-check",children:"✓"})]},u.value))]})}function Lb(t){return fn("/skills")}function Pb({filter:t,onSelect:s,onClose:r}){const[o,a]=w.useState([]),[u,f]=w.useState(!0),[h,g]=w.useState(0),m=w.useRef(null);w.useEffect(()=>{Lb().then(a).catch(()=>a([])).finally(()=>f(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(t.toLowerCase())||k.description.toLowerCase().includes(t.toLowerCase()));return w.useEffect(()=>{g(0)},[t]),w.useEffect(()=>{function k(x){x.key==="ArrowDown"?(x.preventDefault(),g(b=>Math.min(b+1,v.length-1))):x.key==="ArrowUp"?(x.preventDefault(),g(b=>Math.max(b-1,0))):x.key==="Enter"?(x.preventDefault(),v[h]&&s(v[h])):x.key==="Escape"&&(x.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,h,s,r]),l.jsxs("div",{className:"slash-popup",ref:m,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"})]}),u&&l.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!u&&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===h?"selected":""}`,onMouseEnter:()=>g(x),onClick:()=>s(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 Ob(){return fn("/providers")}function $b(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return fn(`/providers/${t}/commands${r}`)}const zb={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function Fb(t){const[s,r]=w.useState([]),[o,a]=w.useState(!0);w.useEffect(()=>{Ob().then(r).catch(()=>r([])).finally(()=>a(!1))},[]);const u=s.find(f=>f.id===t)??null;return{provider:u,capabilities:(u==null?void 0:u.capabilities)??zb,loading:o}}const di=32,Au=200;function Tm(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function Nm(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}let Cm=0;function Ub(){return Cm+=1,`att-${Date.now()}-${Cm}`}function Bb(){Ot.trackRender("CommandInputBar");const[t,s]=w.useState(""),r=w.useRef(null),o=w.useRef(di),a=w.useRef(null),{submitPrompt:u,cancelTurn:f,updateRuntimeConfig:h,setShowModelSelector:g}=M(),m=M(V=>V.activeSessionId),v=M(V=>V.activeSessionId?V.sessionDetails[V.activeSessionId]:null),k=M(V=>V.quotedText),x=eg(v),b=!!(v!=null&&v.turns.some(V=>V.status==="pending"&&V.resume_state==="waiting")),j=!m,{capabilities:C}=Fb(v==null?void 0:v.runtime_type),T=(v==null?void 0:v.runtime_type)??null,I=C.imageAttachments,[A,U]=w.useState([]),[O,W]=w.useState(!1),[Z,Y]=w.useState(null),[Q,ue]=w.useState([]);w.useEffect(()=>{if(!T){ue([]);return}let V=!1;return $b(T,(v==null?void 0:v.cwd)??void 0).then(pe=>{V||ue(pe)}).catch(()=>{V||ue([])}),()=>{V=!0}},[T,v==null?void 0:v.cwd]);const[he,H]=w.useState(!1),[Te,Ne]=w.useState(""),[Le,se]=w.useState(0),[G,X]=w.useState(void 0),[P,J]=w.useState(!1),[q,E]=w.useState(""),[L,de]=w.useState([]),K=he?Db(Te,C,Q):[];w.useEffect(()=>{k!==null&&(s(V=>V+k),setTimeout(()=>{if(r.current){je(),r.current.focus();const V=r.current.value.length;r.current.setSelectionRange(V,V)}},0),M.setState({quotedText:null}))},[k]),w.useEffect(()=>{if(!x)return;function V(pe){pe.key==="Escape"&&(pe.preventDefault(),f())}return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[x,f]),w.useEffect(()=>{H(!1),X(void 0),J(!1),de([]),U(V=>{for(const pe of V)pe.previewUrl&&URL.revokeObjectURL(pe.previewUrl);return[]})},[m]),w.useEffect(()=>{if(!Z)return;function V(pe){pe.key==="Escape"&&(pe.preventDefault(),Y(null))}return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[Z]);const ce=w.useCallback(V=>{if(!V)return;const pe=Array.from(V);for(const Ue of pe){const tt=new FileReader;tt.onload=()=>{const gt=tt.result.split(",")[1]??"",Rt=Ue.type.startsWith("image/")?URL.createObjectURL(Ue):void 0;U(Ht=>[...Ht,{id:Ub(),name:Ue.name,media_type:Ue.type||"application/octet-stream",data:gt,previewUrl:Rt,size:Ue.size}])},tt.readAsDataURL(Ue)}},[]),fe=w.useCallback(V=>{U(pe=>{const Ue=pe.find(tt=>tt.id===V);return Ue!=null&&Ue.previewUrl&&URL.revokeObjectURL(Ue.previewUrl),pe.filter(tt=>tt.id!==V)})},[]),Pe=w.useCallback(V=>{V.preventDefault(),V.stopPropagation(),!(!I||x)&&W(!0)},[I,x]),Ce=w.useCallback(V=>{V.preventDefault(),V.stopPropagation(),W(!1)},[]),Ee=w.useCallback(V=>{V.preventDefault(),V.stopPropagation(),W(!1),!(!I||x)&&ce(V.dataTransfer.files)},[I,x,ce]),_e=w.useCallback(V=>{var tt;if(!I)return;const pe=(tt=V.clipboardData)==null?void 0:tt.items;if(!pe)return;const Ue=[];for(let mt=0;mt<pe.length;mt++){const gt=pe[mt];if(gt.type.startsWith("image/")){const Rt=gt.getAsFile();Rt&&Ue.push(Rt)}}Ue.length>0&&(V.preventDefault(),ce(Ue))},[I,ce]);function it(V){const pe=r.current;pe&&(pe.style.height=`${V}px`,o.current=V)}function je(){const V=r.current;if(V){if(V.scrollHeight>V.clientHeight){const pe=Math.min(V.scrollHeight,Au);pe!==o.current&&it(pe);return}o.current>di&&(V.style.height="auto",it(Math.min(V.scrollHeight,Au)))}}function kt(){const V=t.trim();if(!V||x)return;let pe=V;L.length>0&&(pe=`${L.map(mt=>`$${mt.name}`).join(" ")}
|
|
480
475
|
|
|
481
|
-
${V}`);const Ue=A.map(({id:tt,previewUrl:mt,size:gt,...Rt})=>Rt);s(""),de([]),it(di),H(!1),X(void 0),J(!1);for(const tt of A)tt.previewUrl&&URL.revokeObjectURL(tt.previewUrl);U([]),u(pe,Ue.length>0?Ue:void 0)}function ze(V){if(V.insertAsText){const pe=`/${V.id} `;s(pe),H(!1),X(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Ue=pe.length;r.current.setSelectionRange(Ue,Ue),
|
|
482
|
-
… (truncated, click to expand)`:x,H=b?null:g==="completed"?l.jsx(
|
|
476
|
+
${V}`);const Ue=A.map(({id:tt,previewUrl:mt,size:gt,...Rt})=>Rt);s(""),de([]),it(di),H(!1),X(void 0),J(!1);for(const tt of A)tt.previewUrl&&URL.revokeObjectURL(tt.previewUrl);U([]),u(pe,Ue.length>0?Ue:void 0)}function ze(V){if(V.insertAsText){const pe=`/${V.id} `;s(pe),H(!1),X(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Ue=pe.length;r.current.setSelectionRange(Ue,Ue),je()}});return}V.subPopup?X(V.subPopup):V.id==="skills"?(J(!0),E(""),H(!1),s("")):V.id==="model"?(g(!0),H(!1),s("")):(H(!1),s(""))}function It(V){de(pe=>[...pe,V]),J(!1),s(""),it(di)}function Fe(V){const pe=Tm(v==null?void 0:v.runtime_config);G==="sandbox"?pe.sandboxMode=V:G==="websearch"?pe.webSearchMode=V:G==="network"&&(pe.networkAccessEnabled=V==="true"),h(pe),X(void 0),H(!1),s(""),it(di)}function Dt(V){if(Ot.markKeystroke(),he&&!G){if(V.key==="ArrowDown"){V.preventDefault(),se(pe=>Math.min(pe+1,K.length-1));return}if(V.key==="ArrowUp"){V.preventDefault(),se(pe=>Math.max(pe-1,0));return}if(V.key==="Enter"){V.preventDefault(),K[Le]&&ze(K[Le]);return}if(V.key==="Escape"){V.preventDefault(),H(!1),s("");return}}if(G&&V.key==="Escape"){V.preventDefault(),X(void 0);return}if(V.key==="Enter"&&(V.metaKey||V.ctrlKey)&&!x){V.preventDefault(),kt();return}V.key==="Escape"&&x&&(V.preventDefault(),f())}function Rn(V){Ot.markInputChange();const pe=V.target.value;s(pe),je(),pe.startsWith("/")&&!pe.includes(" ")&&!x?(H(!0),Ne(pe.slice(1)),se(0)):(H(!1),X(void 0)),pe.startsWith("$")&&!x?(J(!0),E(pe.slice(1))):pe.startsWith("$")||J(!1)}const St=Tm(v==null?void 0:v.runtime_config),Mt=[{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"}],ht=[{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"}],en=[{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${O?" drag-over":""}`,onDragOver:Pe,onDragLeave:Ce,onDrop:Ee,children:[he&&!G&&l.jsx(Mb,{commands:K,selectedIndex:Le,onSelect:ze,onHover:se}),he&&G==="sandbox"&&l.jsx(Ru,{title:"Sandbox Mode",options:Mt,currentValue:St.sandboxMode,onSelect:Fe,onClose:()=>X(void 0)}),he&&G==="websearch"&&l.jsx(Ru,{title:"Web Search",options:ht,currentValue:St.webSearchMode,onSelect:Fe,onClose:()=>X(void 0)}),he&&G==="network"&&l.jsx(Ru,{title:"Network Access",options:en,currentValue:St.networkAccessEnabled===!0?"true":"false",onSelect:Fe,onClose:()=>X(void 0)}),P&&l.jsx(Pb,{filter:q,onSelect:It,onClose:()=>{J(!1),s("")}}),L.length>0&&l.jsx("div",{className:"skill-badges",children:L.map(V=>l.jsxs("span",{className:"skill-badge",children:["$",V.name,l.jsx("button",{className:"skill-badge-remove",onClick:()=>de(pe=>pe.filter(Ue=>Ue.id!==V.id)),children:"×"})]},V.id))}),A.length>0&&l.jsx("div",{className:"attachment-preview-area",children:A.map(V=>l.jsxs("div",{className:"attachment-chip",title:V.name,children:[V.previewUrl?l.jsx("img",{src:V.previewUrl,alt:V.name,className:"attachment-thumb",onClick:()=>Y(V),style:{cursor:"pointer"}}):l.jsx(mg,{size:20,className:"attachment-file-icon"}),l.jsxs("div",{className:"attachment-info",children:[l.jsx("span",{className:"attachment-name",children:V.name}),l.jsx("span",{className:"attachment-size",children:Nm(V.size)})]}),l.jsx("button",{className:"attachment-remove",onClick:()=>fe(V.id),title:"Remove attachment",children:l.jsx(En,{size:14})})]},V.id))}),I&&!x&&!j&&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:V=>{ce(V.target.files),V.target.value=""}}),l.jsxs("div",{className:"cmd-input-row",children:[I&&!x&&!j&&l.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var V;return(V=a.current)==null?void 0:V.click()},title:"Attach files",disabled:x,children:l.jsx(bw,{size:16})}),l.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:j?"Select or create a session…":b?"Interrupted — waiting to resume…":x?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:t,disabled:x||j,rows:1,style:{minHeight:di,maxHeight:Au},onChange:Rn,onKeyDown:Dt,onPaste:_e}),x?l.jsx("button",{className:"cmd-stop-btn",onClick:()=>f(),title:"Stop (Esc)",children:l.jsx(Lr,{size:15})}):l.jsx("button",{className:"cmd-send-btn",onClick:kt,disabled:!t.trim()||j,title:"Send (⌘↵)",children:l.jsx(J0,{size:16})})]}),Z&&l.jsx("div",{className:"image-preview-modal",onClick:()=>Y(null),children:l.jsxs("div",{className:"image-preview-content",onClick:V=>V.stopPropagation(),children:[l.jsx("img",{src:Z.previewUrl,alt:Z.name}),l.jsxs("div",{className:"image-preview-info",children:[l.jsx("span",{children:Z.name}),l.jsx("span",{children:Nm(Z.size)})]}),l.jsx("button",{className:"image-preview-close",onClick:()=>Y(null),children:l.jsx(En,{size:20})})]})})]})}function Wb(){const t=M(T=>T.activeSessionId),s=M(T=>T.activeSessionId?T.sessionDetails[T.activeSessionId]:null),r=M(T=>T.activeTurnIndex),o=M(T=>T.setActiveTurnIndex),a=M(T=>T.rewindToTurn),u=M(T=>T.restoreSession),f=M(T=>T.branchFromTurn),h=(s==null?void 0:s.turns)??[],g=xl(s),m=!!(s!=null&&s.rewound_at_turn_id),v=(s==null?void 0:s.runtime_type)==="repoburg",k=v?"Rewind to this turn? Runtime history after this point is PERMANENTLY deleted and cannot be restored.":"Rewind to this turn? Hidden turns can be restored later.",[x,b]=w.useState(null),j=w.useRef(null);if(Sl(j,()=>b(null),!!x),id(()=>b(null),!!x),h.length===0)return l.jsx("div",{className:"empty-state",children:"No turns yet"});function C(T){o(T),requestAnimationFrame(()=>{var I;(I=document.getElementById(`turn-${T}`))==null||I.scrollIntoView({behavior:"smooth",block:"start"})})}return l.jsxs("div",{className:"right-section",children:[l.jsx("div",{className:"right-section-title",children:"Conversation"}),h.map((T,I)=>{const A=I===r,U=T.user_prompt.length>50?T.user_prompt.slice(0,50)+"…":T.user_prompt,O=T.status==="running"||T.status==="pending";return l.jsx("div",{children:l.jsxs("div",{className:`turn-item ${A?"active":""}`,onClick:()=>C(I),onContextMenu:W=>{W.preventDefault(),b({x:W.clientX,y:W.clientY,turnId:T.id,turnIndex:I,isLast:I===h.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(Dw,{size:12})}),l.jsx("span",{className:"turn-item-label",children:U}),O&&l.jsx("span",{className:"turn-item-status",children:T.status==="pending"&&T.resume_state==="waiting"?"interrupted":"running…"})]})},T.id)}),x&&l.jsxs("div",{ref:j,className:"ctx-menu",style:{position:"fixed",left:x.x,top:x.y,zIndex:500},children:[l.jsxs("div",{className:`ctx-menu-item ${x.isLast||g||x.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{x.isLast||g||x.isSlashCommand||(window.confirm(k)&&a(t,x.turnId),b(null))},children:[l.jsx(jw,{size:12})," Rewind to Here",x.isSlashCommand?" (slash command)":""]}),m&&!v&&l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{u(t),b(null)},children:[l.jsx(wo,{size:12})," Restore Rewind"]}),l.jsxs("div",{className:"ctx-menu-item",onClick:()=>{f(t,x.turnId),b(null)},children:[l.jsx(cw,{size:12})," Branch from Here"]})]})]})}const jm=2e4;function Hb(t){const s=[];return t.forEach((r,o)=>{var a;for(const u of r.items)if(u.type==="background_task"){if((((a=u.data)==null?void 0:a.task_type)||"unknown")==="local_agent")continue;s.push({item:u,turnIndex:o,turnPrompt:r.user_prompt})}}),s}function Vb({entry:t}){const{item:s,turnIndex:r,turnPrompt:o}=t,a=s.data||{},u=a.task_type||"unknown",f=a.subagent_type||null,h=a.description||"",g=a.status||"running",m=a.summary||null,v=a.last_tool_name||null,k=a.token_count||null,x=a.output||"",b=s.status==="in_progress",j=u==="local_agent",C=u==="local_bash",T=j?ur:C?kg:hg,I=j?`Subagent${f?`: ${f}`:""}`:C?"Monitor":"Background Task",A=g==="running"?"running…":g==="completed"?"done":g==="failed"?"failed":g==="stopped"?"stopped":g,U=s.status==="failed"||g==="failed",[O,W]=w.useState(b),[Z,Y]=w.useState(!1),Q=w.useRef(null);w.useEffect(()=>{b&&W(!0)},[b]),w.useEffect(()=>{O&&b&&Q.current&&(Q.current.scrollTop=Q.current.scrollHeight)},[O,b,x]);const ue=x.length>jm,he=ue&&!Z?x.slice(0,jm)+`
|
|
477
|
+
… (truncated, click to expand)`:x,H=b?null:g==="completed"?l.jsx(Os,{size:12}):U?l.jsx(bl,{size:12}):l.jsx(Lr,{size:12});return l.jsxs("div",{className:`task-card ${b?"task-running":""} ${U?"task-failed":""}`,children:[l.jsxs("div",{className:"task-card-header",onClick:()=>W(Te=>!Te),style:{cursor:"pointer"},children:[l.jsx("span",{className:"task-card-icon",children:l.jsx(T,{size:14})}),l.jsx("span",{className:"task-card-type",children:I}),l.jsxs("span",{className:`task-card-status ${U?"task-status-failed":b?"task-status-running":"task-status-done"}`,children:[H," ",A]}),l.jsx(ld,{size:14,className:"task-card-chevron",style:{transform:O?"rotate(90deg)":"none",marginLeft:"auto"}})]}),h&&l.jsx("div",{className:"task-card-desc",children:h}),b&&v&&l.jsxs("div",{className:"task-card-meta",children:["last tool: ",v,k!=null&&` · ${k.toLocaleString()} tokens`]}),O&&l.jsxs("div",{className:"task-card-body",children:[x?l.jsxs(l.Fragment,{children:[l.jsx("pre",{className:"cmd-output task-output",ref:Q,children:l.jsx("code",{children:he})}),ue&&l.jsx("button",{className:"cmd-output-toggle",onClick:()=>Y(Te=>!Te),children:Z?"Show less":`Show full output (${(x.length/1024).toFixed(0)}KB)`})]}):m?l.jsx("pre",{className:"cmd-output task-output",children:l.jsx("code",{children:m})}):b?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:o,children:["from turn ",r+1,": ",o.length>60?o.slice(0,60)+"…":o]})]})]})}const qb=w.memo(Vb);function Gb(){var g,m;const t=M(v=>v.activeSessionId?v.sessionDetails[v.activeSessionId]:null),s=M(v=>v.activeSessionId?v.backgroundTasks[v.activeSessionId]:void 0),r=(t==null?void 0:t.turns)??[],o=s??[],a=Hb(r),u=[...a].sort((v,k)=>{const x=v.item.status==="in_progress",b=k.item.status==="in_progress";return x&&!b?-1:!x&&b?1:k.turnIndex-v.turnIndex}),f=new Map;for(const v of o)v.task_type==="local_bash"&&f.set(v.task_id,v.task_type);for(const v of a)if(v.item.status==="in_progress"){const k=((g=v.item.data)==null?void 0:g.task_id)??v.item.external_item_id,x=((m=v.item.data)==null?void 0:m.task_type)??"unknown";f.set(k,x)}const h=[...f.values()].filter(v=>v==="local_bash").length;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,")",h>0&&l.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",h," running"]})]}),u.map(v=>l.jsx(qb,{entry:v},v.item.id))]})}const Kb=w.memo(Gb),Yb="Your job is to answer questions about this session:",_m="Understand the user's question below, read the session file given above, and answer.",Xb=new Set(["claude"]);function Qb(t){return Xb.has(t)}function jd(t){return t.kind==="sidecar"}function Zb(t){const s=(t??[]).filter(jd);return s.length?s[s.length-1]:null}function Jb(t){if(!t.startsWith(Yb))return t;const s=t.indexOf(_m);return s<0?t:t.slice(s+_m.length).replace(/^\n+/,"")}function eT({thread:t,onClose:s}){const{activeSessionId:r,resolveThread:o,shareThread:a}=M(),[u,f]=w.useState(""),[h,g]=w.useState(!1),[m,v]=w.useState(!1);async function k(){if(!r||h)return;g(!0),await a(r,t.id,u)?s():g(!1)}async function x(){!r||m||(v(!0),await o(r,t.id),s())}const b=h||m;return l.jsx("div",{className:"dialog-overlay",onClick:b?void 0:s,children:l.jsxs("div",{className:"dialog",onClick:j=>j.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:s,disabled:b,children:l.jsx(En,{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:u,onChange:j=>f(j.target.value),rows:3,disabled:b,autoFocus:!0})]})]}),l.jsxs("div",{className:"dialog-footer",children:[l.jsx("button",{className:"dialog-btn-cancel",onClick:s,disabled:b,children:"Cancel"}),l.jsxs("button",{className:"dialog-btn-cancel",onClick:x,disabled:b,title:"Resolve without sharing",children:[m?l.jsx(Jn,{size:13,className:"spin"}):l.jsx(tl,{size:13}),"Resolve only"]}),l.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:b,children:[h?l.jsx(Jn,{size:13,className:"spin"}):l.jsx(Ew,{size:13}),h?"Summarizing…":"Share & Resolve"]})]})]})})}const Em=[];qe.setOptions({breaks:!0,gfm:!0});function tT(t){const s=qe.parse(t);return Cd.sanitize(s)}function nT(t){var s,r,o;if(t.type==="agent_message"||t.type==="final_result"){const a=(s=t.data)==null?void 0:s.text;return typeof a=="string"&&a?a:null}if(t.type==="ask_user"){const a=Array.isArray((r=t.data)==null?void 0:r.groups)?t.data.groups:[],u=[(o=t.data)==null?void 0:o.question,...a.map(f=>f.question)].filter(f=>typeof f=="string"&&!!f);return u.length?u.join(`
|
|
483
478
|
|
|
484
|
-
`):null}return null}function
|
|
479
|
+
`):null}return null}function sT(t){const s=t.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return s?s[1]:t}function hv({turn:t,formatPrompt:s=sT}){const r=s(t.user_prompt),o=t.items.map(nT).filter(a=>a!==null);return o.length===0&&t.status==="completed"&&t.agent_response&&o.push(t.agent_response),l.jsxs("div",{className:"thread-card-turn",children:[l.jsx("div",{className:"thread-card-user-message",children:r}),o.map((a,u)=>l.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:tT(a)}},u)),o.length===0&&(t.status==="pending"||t.status==="running")&&l.jsx("div",{className:"thread-card-pending",children:t.status==="running"?"AI is responding…":"Waiting…"}),t.status==="failed"&&l.jsx("div",{className:"thread-card-pending",children:t.error||"Turn failed"})]})}function rT({thread:t,threadTurns:s,onStop:r,onResolve:o,onReopen:a,onDelete:u,onFollowup:f,onLocate:h}){var Ne,Le,se;const[g,m]=w.useState(""),[v,k]=w.useState(!0),x=w.useRef(null),b=w.useRef(null),[j,C]=w.useState(!1),[T,I]=w.useState({x:0,y:0}),[A,U]=w.useState(""),O=s.some(cr),W=28,Z=120,Y=w.useRef(W);w.useEffect(()=>{const G=b.current;G&&(G.scrollTop=G.scrollHeight)},[s.length,v]);function Q(G){const X=x.current;X&&(X.style.height=`${G}px`,Y.current=G)}function ue(){const G=x.current;if(G){if(G.scrollHeight>G.clientHeight){const X=Math.min(G.scrollHeight,Z);X!==Y.current&&Q(X);return}Y.current>W&&(G.style.height="auto",Q(Math.min(G.scrollHeight,Z)))}}const he=w.useCallback(()=>{C(!1)},[]),H=w.useCallback(()=>{const G=b.current;if(!G)return;const X=window.getSelection();if(!X||X.rangeCount===0||X.isCollapsed){C(!1);return}const P=X.getRangeAt(0);if(!G.contains(P.commonAncestorContainer)){C(!1);return}const J=P.commonAncestorContainer.nodeType===Node.TEXT_NODE?P.commonAncestorContainer.parentElement:P.commonAncestorContainer;if(!(J!=null&&J.closest(".thread-card-ai-response"))){C(!1);return}const q=X.toString();if(!q.trim()){C(!1);return}const E=P.getBoundingClientRect(),L=28,de=6,K=170;let ce=!1;if(X.anchorNode&&X.focusNode)try{const Ce=document.createRange();Ce.setStart(X.focusNode,X.focusOffset),Ce.setEnd(X.focusNode,X.focusOffset);const Ee=document.createRange();Ee.setStart(X.anchorNode,X.anchorOffset),Ee.setEnd(X.anchorNode,X.anchorOffset),ce=Ee.compareBoundaryPoints(Range.START_TO_START,Ce)>0}catch{ce=!1}let fe=E.top-L-de;fe<8&&(fe=E.bottom+de);let Pe=ce?E.left-K:E.right;Pe=Math.max(8,Math.min(Pe,window.innerWidth-K-8)),I({x:Pe,y:fe}),U(q),C(!0)},[]);w.useEffect(()=>{function G(X){const P=X.target;P&&P.closest(".selection-actions")||H()}return document.addEventListener("mouseup",G),()=>document.removeEventListener("mouseup",G)},[H]);const Te=w.useCallback(()=>{var X;const G=`
|
|
485
480
|
\`\`\`QUOTE
|
|
486
481
|
${A}
|
|
487
482
|
\`\`\`
|
|
488
483
|
|
|
489
|
-
`;m(P=>P+G),C(!1),U(""),(X=window.getSelection())==null||X.removeAllRanges(),setTimeout(()=>{if(x.current){ue(),x.current.focus();const P=x.current.value.length;x.current.setSelectionRange(P,P)}},0)},[A]);return l.jsxs("div",{className:`thread-card ${t.status==="resolved"?"thread-resolved":""}`,id:`thread-${t.id}`,children:[l.jsxs("div",{className:"thread-card-header",onClick:()=>k(G=>!G),children:[l.jsx("div",{className:"thread-card-quote",children:t.selected_text===null?((se=(Le=(Ne=t.turns)==null?void 0:Ne[0])==null?void 0:Le.user_prompt)==null?void 0:se.slice(0,100))||"Quick question":`“${t.selected_text.slice(0,100)}${t.selected_text.length>100?"…":""}”`}),l.jsxs("div",{className:"thread-card-header-right",children:[t.selected_text!==null&&l.jsx("button",{className:"thread-locate-btn",onClick:G=>{G.stopPropagation(),h()},title:"Scroll to text",children:l.jsx(ww,{size:12})}),l.jsx("span",{className:`thread-status-badge ${t.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:t.status==="open"?"Open":"Resolved"})]})]}),v&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"thread-card-conversation",ref:b,onMouseDown:he,children:[s.map(G=>l.jsx(pv,{turn:G},G.id)),s.length===0&&l.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),_&&l.jsx("div",{className:"selection-actions",style:{left:T.x,top:T.y},children:l.jsxs("button",{className:"discuss-button",onClick:Te,title:"Quote this text in your follow-up",children:[l.jsx(yg,{size:14}),l.jsx("span",{children:"Quote"})]})}),t.status==="open"&&l.jsxs("div",{className:"thread-card-followup",children:[l.jsx("textarea",{ref:x,className:"thread-card-followup-input",placeholder:O?"Agent is running…":"Type a follow-up…",value:g,onChange:G=>{Ot.markInputChange(),m(G.target.value),ue()},disabled:O,rows:1,style:{minHeight:W,maxHeight:Z},onKeyDown:G=>{Ot.markKeystroke(),G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&!O&&g.trim()&&(G.preventDefault(),f(g.trim()),m(""),Q(W))}}),l.jsx("button",{className:"thread-card-followup-send",disabled:O||!g.trim(),onClick:()=>{f(g.trim()),m("")},children:l.jsx(To,{size:13})}),O&&l.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:l.jsx(Lr,{size:13})})]}),l.jsxs("div",{className:"thread-card-actions",children:[t.status==="open"?l.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[l.jsx(tl,{size:13})," Resolve"]}):l.jsxs("button",{className:"thread-action-btn",onClick:a,title:"Reopen thread",children:[l.jsx(wo,{size:13})," Reopen"]}),l.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:u,title:"Delete thread",children:[l.jsx(fs,{size:13})," Delete"]})]})]})]})}function oT(){Ot.trackRender("ThreadsPanel");const t=M(I=>I.activeSessionId),s=M(I=>{var A;return I.activeSessionId?((A=I.sessionDetails[I.activeSessionId])==null?void 0:A.threads)??jm:jm}),r=w.useMemo(()=>s.filter(I=>!_d(I)),[s]),o=M(I=>I.followupThread),a=M(I=>I.cancelThreadTurn),u=M(I=>I.reopenThread),f=M(I=>I.deleteThread),h=M(I=>I.deepLinkThreadId),g=M(I=>I.setDeepLinkThreadId),[m,v]=w.useState("open"),[k,x]=w.useState(null);w.useEffect(()=>{if(!h)return;const I=h;g(null),v(U=>r.some(O=>O.id===I&&O.status==="open")?U:"all");const A=setTimeout(()=>{const U=document.getElementById(`thread-${I}`);U&&(U.scrollIntoView({behavior:"smooth",block:"center"}),U.classList.add("thread-card-highlighted"),setTimeout(()=>U.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(A)},[h,g,r]);const b=r.filter(I=>m==="open"?I.status==="open":m==="resolved"?I.status==="resolved":!0),_=r.filter(I=>I.status==="open").length,C=r.filter(I=>I.status==="resolved").length;function T(I){setTimeout(()=>{const A=document.querySelector(`mark[data-thread-id="${I}"]`);A&&(A.scrollIntoView({behavior:"smooth",block:"center"}),A.classList.add("thread-mark-flash"),setTimeout(()=>A.classList.remove("thread-mark-flash"),1500))},50)}return t?r.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx(vg,{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 ${m==="open"?"active":""}`,onClick:()=>v("open"),children:["Open (",_,")"]}),l.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",C,")"]}),l.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),b.length===0?l.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):b.map(I=>l.jsx(iT,{thread:I,threadTurns:I.turns??[],onStop:()=>a(t,I.id),onResolve:()=>x(I),onReopen:()=>u(t,I.id),onDelete:()=>f(t,I.id),onFollowup:A=>o(t,I.id,A),onLocate:()=>T(I.id)},I.id)),k&&l.jsx(tT,{thread:k,onClose:()=>x(null)})]}):l.jsx("div",{className:"empty-state",children:"No session selected"})}function aT(){const t=M(f=>f.apps),s=M(f=>f.activeAppTabId),r=M(f=>f.openAppTab),o=M(f=>f.startAppEdit),a=M(f=>f.toggleAppPin),u=M(f=>f.deleteApp);return t.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:t.map(f=>l.jsxs("div",{className:`apps-panel-row${s===f.id?" active":""}`,onClick:()=>r(f.id),title:f.description??void 0,children:[l.jsx(wi,{iconNode:f.iconNode,size:14,className:"sidebar-app-icon"}),l.jsxs("div",{className:"apps-panel-info",children:[l.jsx("span",{className:"apps-panel-title",children:f.title}),f.description&&l.jsx("span",{className:"apps-panel-desc",children:f.description})]}),l.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:h=>{h.stopPropagation(),o(f.id)},children:l.jsx(Va,{size:12})}),l.jsx("button",{className:`apps-panel-action${f.pinned?" pinned":""}`,title:f.pinned?"Unpin app":"Pin app (sorts first)",onClick:h=>{h.stopPropagation(),a(f.id)},children:l.jsx(nl,{size:12,fill:f.pinned?"currentColor":"none"})}),l.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:h=>{h.stopPropagation(),u(f.id)},children:l.jsx(fs,{size:12})})]},f.id))})}function lT(){Ot.trackRender("SidecarPanel");const t=M(T=>T.activeSessionId),s=M(T=>{var I;return T.activeSessionId?(I=T.sessionDetails[T.activeSessionId])==null?void 0:I.runtime_type:void 0}),r=M(T=>{var I;return T.activeSessionId?Jb((I=T.sessionDetails[T.activeSessionId])==null?void 0:I.threads):null}),o=M(T=>T.askSidecar),a=M(T=>T.cancelThreadTurn),u=M(T=>T.deleteThread),[f,h]=w.useState(""),[g,m]=w.useState(!1),v=w.useRef(null),k=(r==null?void 0:r.turns)??[],x=k[k.length-1],b=k.some(cr);if(w.useEffect(()=>{var T,I;(I=(T=v.current)==null?void 0:T.scrollIntoView)==null||I.call(T,{block:"end"})},[k.length,x==null?void 0:x.items.length,x==null?void 0:x.status]),!t||!s)return l.jsx("div",{className:"empty-state",children:"No session selected"});if(!Zb(s))return l.jsxs("div",{className:"empty-state",children:[l.jsx(ur,{size:24,style:{opacity:.3,marginBottom:8}}),l.jsxs("div",{children:["The sidecar is not available for ",s," sessions yet."]})]});const _=!b&&!g&&f.trim().length>0;async function C(){if(!t||!_)return;m(!0);const T=await o(t,f.trim());m(!1),T&&h("")}return l.jsxs("div",{className:"sidecar-panel",children:[l.jsxs("div",{className:"sidecar-conversation",children:[k.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx(ur,{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?"})]}):k.map(T=>l.jsx(pv,{turn:T,formatPrompt:eT},T.id)),l.jsx("div",{ref:v})]}),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:b?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:f,rows:2,disabled:b,onChange:T=>{Ot.markInputChange(),h(T.target.value)},onKeyDown:T=>{Ot.markKeystroke(),T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),C())}}),b&&r?l.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>a(t,r.id),children:l.jsx(Lr,{size:13})}):l.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!_,onClick:()=>void C(),children:l.jsx(To,{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:b,onClick:()=>u(t,r.id),children:[l.jsx(fs,{size:13})," Clear"]})})]})]})}function cT(){var g;Ot.trackRender("RightPanel");const t=M(m=>m.activeRightTab),s=M(m=>m.switchRightTab),r=M(m=>m.rightPanelCollapsed),o=M(m=>m.toggleRightPanel),a=M(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),u=M(m=>{var v;return m.activeSessionId?((v=m.backgroundTasks[m.activeSessionId])==null?void 0:v.length)??0:0}),f=((g=a==null?void 0:a.threads)==null?void 0:g.filter(m=>m.status==="open"&&!_d(m)).length)??0,h=[{id:"turns",label:"Turns",icon:hw},{id:"sidecar",label:"Sidecar",icon:ur},{id:"tasks",label:"Tasks",icon:pw,badge:u||void 0},{id:"threads",label:"Threads",icon:vg,badge:f||void 0},{id:"apps",label:"Apps",icon:gg}];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(Sw,{size:15})}),l.jsx("div",{className:"right-rail-divider"}),h.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return l.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${t===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>s(m.id),children:[l.jsx(v,{size:15}),m.badge?l.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):l.jsxs("div",{className:"ide-right",children:[l.jsxs("div",{className:"right-header",children:[l.jsx("div",{className:"right-tabs",children:h.map(m=>l.jsxs("div",{className:`right-tab ${t===m.id?"active":""}`,onClick:()=>s(m.id),children:[m.label,m.badge?l.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.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(kw,{size:14})})]}),l.jsxs("div",{className:"right-content",children:[t==="turns"&&l.jsx(Hb,{}),t==="sidecar"&&l.jsx(lT,{}),t==="tasks"&&l.jsx(Yb,{}),t==="threads"&&l.jsx(oT,{}),t==="apps"&&l.jsx(aT,{})]})]})}const Re={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"}},Gu=[{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:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max,Re.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max,Re.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.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:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high]}]}];function uT(t){return Gu.find(s=>s.id===t)}function jd(t){const s=uT(t);return(s==null?void 0:s.models)??[]}function hv(t,s){return jd(t).find(r=>r.slug===s)}function Ku(t,s){var r;return((r=hv(t,s))==null?void 0:r.reasoningLevels)??[]}function Yu(t,s){var r;return(r=hv(t,s))==null?void 0:r.defaultReasoning}function dT(){const{activeSessionId:t,sessions:s,updateModelConfig:r}=M(),o=M(se=>se.showModelSelector),a=M(se=>se.setShowModelSelector),u=s.find(se=>se.id===t),f=M(se=>se.models),h=M(se=>se.modelsLoading),g=M(se=>se.loadModels),[m,v]=w.useState(!1),k=w.useRef(null);if(wl(k,()=>v(!1),m),id(()=>v(!1),m),w.useEffect(()=>{o&&(v(!0),a(!1))},[o,a]),w.useEffect(()=>{u!=null&&u.runtime_type&&g(u.runtime_type,u.cwd??void 0)},[u==null?void 0:u.runtime_type,u==null?void 0:u.cwd,g]),!u)return null;const x=u.runtime_type,b=u.model??"",_=u.model_reasoning_effort??"",C=f.length>0?f:[],T=jd(x),A=[...C.length>0?C:T];if(b&&!A.some(se=>se.slug===b)){const se=T[0];A.unshift({slug:b,displayName:b,description:"Custom model",defaultReasoning:(se==null?void 0:se.defaultReasoning)??"medium",reasoningLevels:(se==null?void 0:se.reasoningLevels)??[]})}function U(se){return A.find(G=>G.slug===se)}function O(se){var G;return C.length>0?((G=U(se))==null?void 0:G.reasoningLevels)??[]:Ku(x,se)}function W(se){var G;return C.length>0?(G=U(se))==null?void 0:G.defaultReasoning:Yu(x,se)}const Z=Gu.find(se=>se.id===x),Y=U(b),Q=b?O(b):[],ue=(Z==null?void 0:Z.label)??x,he=(Y==null?void 0:Y.displayName)??(b||"Default"),H=Q.find(se=>se.effort===_),Te=(H==null?void 0:H.label)??(_||"Default");function Ne(se){var J;const G=O(se),P=G.some(q=>q.effort===_)?_:W(se)??((J=G[0])==null?void 0:J.effort)??"";r(se,P),v(!1)}function Le(se){r(b,se),v(!1)}return l.jsxs("div",{className:"model-selector",ref:k,children:[l.jsxs("button",{className:"model-selector-btn",onClick:()=>v(!m),title:"Change model and thinking level",children:[l.jsx("span",{className:"model-selector-provider",children:ue}),l.jsx("span",{className:"model-selector-sep",children:"›"}),l.jsx("span",{className:"model-selector-model",children:he}),Te!=="Default"&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"model-selector-sep",children:"›"}),l.jsx("span",{className:"model-selector-reasoning",children:Te})]}),l.jsx(vi,{size:12,className:"model-selector-chevron"})]}),m&&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"}),Gu.map(se=>l.jsxs("div",{className:`model-selector-item ${se.id===x?"selected":""} ${se.available?"":"disabled"}`,onClick:()=>{if(se.available){if(se.id===x){v(!1);return}r("","",se.id)}},children:[l.jsx("span",{children:se.label}),!se.available&&l.jsxs("span",{className:"model-selector-coming-soon",children:[l.jsx(vw,{size:10})," Soon"]}),se.id===x&&l.jsx(lr,{size:12})]},se.id))]}),l.jsxs("div",{className:"model-selector-column",children:[l.jsx("div",{className:"model-selector-col-header",children:"Model"}),h&&l.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!h&&A.length===0&&l.jsx("div",{className:"model-selector-empty",children:"No models available"}),A.map(se=>l.jsxs("div",{className:`model-selector-item ${se.slug===b?"selected":""}`,onClick:()=>Ne(se.slug),children:[l.jsxs("div",{className:"model-selector-item-main",children:[l.jsx("span",{className:"model-selector-item-name",children:se.displayName}),l.jsx("span",{className:"model-selector-item-desc",children:se.description})]}),se.slug===b&&l.jsx(lr,{size:12})]},se.slug))]}),l.jsxs("div",{className:"model-selector-column",children:[l.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),Q.length===0&&l.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),Q.map(se=>l.jsxs("div",{className:`model-selector-item ${se.effort===_?"selected":""}`,onClick:()=>Le(se.effort),children:[l.jsx("span",{children:se.label}),se.effort===_&&l.jsx(lr,{size:12})]},se.effort))]})]})]})}function lo(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Em(){const t=M(s=>s.setShowRemoteModal);return l.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>t(!0),children:[l.jsx(Pw,{size:14})," Repoburg"]})}function Rm(){const t=M(r=>r.usageViewOpen),s=M(r=>r.toggleUsageView);return l.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Usage Center",onClick:s,children:[l.jsx(mg,{size:14})," Usage"]})}function Am(){const t=M(r=>r.vscodeViewOpen),s=M(r=>r.toggleVscodeView);return l.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open VS Code",onClick:s,children:[l.jsx(iw,{size:14})," Code"]})}function fT(){var x,b;Ot.trackRender("StatusBar");const t=M(_=>_.activeSessionId),s=M(_=>t?_.sessions.find(C=>C.id===t)??null:null),r=M(_=>t?_.sessionDetails[t]??null:null),o=M(_=>t?_.backgroundTasks[t]:void 0),a=M(_=>_.wsConnected),u=M(_=>_.switchRightTab),f=(r==null?void 0:r.contextUsage)??null;if(!s)return l.jsxs("div",{className:"ide-statusbar",children:[l.jsx(Em,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Am,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Rm,{}),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(jh,{size:14})," K"]})]});const h=o??[],g=xl(s,h.length),m=new Set,v=new Map;for(const _ of h)m.add(_.task_id),v.set(_.task_id,_.task_type);for(const _ of(r==null?void 0:r.turns)??[])for(const C of _.items)if(C.type==="background_task"&&C.status==="in_progress"){const T=((x=C.data)==null?void 0:x.task_id)??C.external_item_id,I=((b=C.data)==null?void 0:b.task_type)??"unknown";m.add(T),v.set(T,I)}const k=[...v.values()].filter(_=>_==="local_bash").length;return l.jsxs("div",{className:"ide-statusbar",children:[l.jsx(Em,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Am,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Rm,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(dT,{}),k>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:`${k} Monitor task${k>1?"s":""} running — click to view`,onClick:()=>u("tasks"),children:[l.jsx(kg,{size:14})," ",k]})]}),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:g.dot==="background"?{color:"var(--purple)"}:s.status==="failed"?{color:"var(--red)"}:void 0,title:g.dot==="background"?g.dotTitle:void 0,children:g.label}),f&&l.jsx(pT,{usage:f}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsxs("div",{className:"sb-item",children:[l.jsx(jh,{size:14})," K"]})]})}function pT({usage:t}){const s=t.percentage>=85?"var(--red)":t.percentage>=60?"var(--amber)":"var(--green)",r=`${lo(t.totalTokens)} / ${lo(t.contextWindow)} tokens`+(t.autoCompactThreshold?` · auto-compacts at ${lo(t.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:s},children:[Math.round(t.percentage),"% / ",lo(t.totalTokens)," / ",lo(t.contextWindow)]})})]})}function Im(t){return fn(`/vscode-web/status?folder=${encodeURIComponent(t??"")}`)}function hT(t){return pt("/vscode-web/start",{folder:t})}function mT(t){return pt("/vscode-web/heartbeat",{id:t})}const gT=1e3,vT=5*6e4;function Dm({children:t}){const s=M(r=>r.toggleVscodeView);return l.jsxs("div",{className:"vscode-view vscode-view--loading",children:[t,l.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:s,children:l.jsx(En,{size:16})})]})}function yT(){const t=M(_=>_.vscodeState),s=M(_=>_.vscodeId),r=M(_=>_.vscodeToken),o=M(_=>_.setVscodeView),a=M(_=>{var T;const C=_.activeSessionId?_.sessions.find(I=>I.id===_.activeSessionId):null;return C!=null&&C.cwd?C.cwd:((T=_.workspaces.find(I=>I.deleted===0))==null?void 0:T.path)??null}),[u,f]=w.useState(!1),[h,g]=w.useState(0),m=w.useRef(null),v=dn(),k=v===""||v===window.location.origin,x=`${v}/vscode/${s??""}/?tkn=${r??""}${a?`&folder=${encodeURIComponent(a)}`:""}`;w.useEffect(()=>{let _=!1;function C(){m.current&&(clearInterval(m.current),m.current=null)}async function T(){try{let A=await Im(a);if((A.state==="stopped"||A.state==="error")&&(A=await hT(a)),_||(o(A.state,A.id,A.token),A.state==="running"||A.state==="error"))return;m.current=setInterval(async()=>{const U=await Im(a);_||(o(U.state,U.id,U.token),(U.state==="running"||U.state==="error"||U.state==="stopped")&&C())},gT)}catch{_||o("error",null,null)}}T();const I=setInterval(()=>{const A=M.getState().vscodeId;A&&mT(A).catch(()=>{})},vT);return()=>{_=!0,C(),clearInterval(I)}},[h,a,o]);function b(){f(!1),o("starting",null,null),g(_=>_+1)}return t!=="running"||!r||!s?l.jsx(Dm,{children:t==="error"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"VS Code could not start."}),l.jsxs("button",{className:"dialog-btn-cancel",onClick:b,children:[l.jsx(wo,{size:14})," Retry"]})]}):l.jsxs("span",{className:"vscode-view-hint",children:[l.jsx(Jn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?l.jsxs("div",{className:"vscode-view",children:[!u&&l.jsxs("div",{className:"vscode-view-overlay",children:[l.jsx(Jn,{size:16,className:"spin"})," Loading VS Code…"]}),l.jsx("iframe",{src:x,title:"VS Code",className:"vscode-view-frame",onLoad:()=>f(!0)},s)]}):l.jsxs(Dm,{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(lw,{size:14})," Open VS Code in a new tab"]})]})}function Mm(t,s){const r=new URLSearchParams;t&&r.set("since",t),s&&r.set("until",s);const o=r.toString();return fn(`/usage/summary${o?`?${o}`:""}`)}const mv="agentpane:usage-budget";function ds(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Ir(t){return`$${t>=100?t.toFixed(0):t>=1?t.toFixed(2):t.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}`}function xT(t,s=new Date){if(t==="all")return{since:null,until:null};const r=new Date(s);return t==="today"?r.setHours(0,0,0,0):r.setDate(r.getDate()-(t==="7d"?7:30)),{since:r.toISOString(),until:null}}function wT(t=new Date){return new Date(t.getFullYear(),t.getMonth(),1).toISOString()}function kT(){try{const t=Number(localStorage.getItem(mv));return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function ST(t){try{localStorage.setItem(mv,String(t))}catch{}}const bT={claude:"Claude",codex:"Codex",repoburg:"Repoburg"};function Ba({label:t,value:s,sub:r,tone:o}){return l.jsxs("div",{className:"usage-kpi",children:[l.jsx("div",{className:"usage-kpi-label",children:t}),l.jsx("div",{className:"usage-kpi-value",style:o?{color:o}:void 0,children:s}),r&&l.jsx("div",{className:"usage-kpi-sub",children:r})]})}function TT({day:t,max:s}){const r=o=>s>0?o/s*100:0;return l.jsxs("div",{className:"usage-day",title:`${t.date} · ${ds(t.input_tokens)} input · ${ds(t.cached_input_tokens)} cached · ${ds(t.output_tokens)} output · ${Ir(t.cost_usd)}`,children:[l.jsxs("div",{className:"usage-day-bar",children:[l.jsx("div",{className:"usage-seg usage-seg-output",style:{height:`${r(t.output_tokens)}%`}}),l.jsx("div",{className:"usage-seg usage-seg-cached",style:{height:`${r(t.cached_input_tokens+t.cache_write_input_tokens)}%`}}),l.jsx("div",{className:"usage-seg usage-seg-input",style:{height:`${r(t.input_tokens)}%`}})]}),l.jsx("div",{className:"usage-day-label",children:t.date.slice(5)})]})}function NT(){const t=M(A=>A.toggleUsageView),[s,r]=w.useState("30d"),[o,a]=w.useState(null),[u,f]=w.useState(null),[h,g]=w.useState(kT),[m,v]=w.useState(null),[k,x]=w.useState(!1),b=w.useCallback(async()=>{x(!0),v(null);try{const{since:A,until:U}=xT(s),[O,W]=await Promise.all([Mm(A,U),Mm(wT(),null)]);a(O),f(W.totals.cost_usd)}catch(A){v(A.message)}finally{x(!1)}},[s]);w.useEffect(()=>{b()},[b]);const _=o==null?void 0:o.totals,C=h>0&&u!==null?h-u:null,T=w.useMemo(()=>Math.max(0,...((o==null?void 0:o.daily)??[]).map(A=>A.input_tokens+A.cached_input_tokens+A.output_tokens)),[o]),I=A=>{const U=Number(A.replace(",",".")),O=Number.isFinite(U)&&U>0?U:0;g(O),ST(O)};return l.jsxs("div",{className:"usage-view",children:[l.jsxs("div",{className:"usage-header",children:[l.jsxs("div",{className:"usage-title",children:[l.jsx(mg,{size:18})," Usage Center"]}),l.jsxs("div",{className:"usage-controls",children:[["today","7d","30d","all"].map(A=>l.jsx("button",{className:`usage-range-btn${s===A?" usage-range-btn-active":""}`,onClick:()=>r(A),children:A==="today"?"Today":A==="7d"?"7 days":A==="30d"?"30 days":"All"},A)),l.jsx("button",{className:"usage-range-btn",onClick:()=>void b(),title:"Refresh",children:l.jsx(_w,{size:13,className:k?"spin":void 0})}),l.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:t,children:l.jsx(En,{size:16})})]})]}),m&&l.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",m]}),!o&&!m&&l.jsx("div",{className:"usage-empty",children:"Loading…"}),o&&_&&l.jsxs("div",{className:"usage-body",children:[l.jsxs("div",{className:"usage-kpis",children:[l.jsx(Ba,{label:"Spend",value:Ir(_.cost_usd),sub:_.unpriced_models.length>0?"excluding unpriced models":void 0}),l.jsx(Ba,{label:"Remaining (monthly)",value:C===null?"—":C>=0?Ir(C):Ir(0),sub:h>0&&u!==null?`this month ${Ir(u)} / budget ${Ir(h)}`:"no budget set",tone:C!==null&&C<0?"var(--red)":void 0}),l.jsx(Ba,{label:"Tokens",value:ds(_.input_tokens+_.cached_input_tokens+_.cache_write_input_tokens+_.output_tokens),sub:`input ${ds(_.input_tokens)} · cached ${ds(_.cached_input_tokens)} · write ${ds(_.cache_write_input_tokens)} · output ${ds(_.output_tokens)}`}),l.jsx(Ba,{label:"Calls",value:String(_.calls),sub:_.errors>0?`${_.errors} failed`:void 0,tone:_.errors>0?"var(--amber)":void 0})]}),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:h>0?h:"",placeholder:"e.g. 50",onBlur:A=>I(A.target.value)}),h>0&&u!==null&&l.jsx("div",{className:"usage-budget-bar",children:l.jsx("div",{className:"usage-budget-fill",style:{width:`${Math.min(100,u/h*100)}%`,background:u>=h?"var(--red)":void 0}})})]}),_.unpriced_models.length>0&&l.jsxs("div",{className:"usage-note",children:["Unpriced models: ",_.unpriced_models.join(", ")]}),l.jsxs("div",{className:"usage-chart",children:[l.jsx("div",{className:"usage-section-title",children:"Daily usage"}),o.daily.length===0?l.jsx("div",{className:"usage-empty",children:"No usage in this range."}):l.jsx("div",{className:"usage-days",children:o.daily.map(A=>l.jsx(TT,{day:A,max:T},A.date))}),l.jsxs("div",{className:"usage-legend",children:[l.jsxs("span",{children:[l.jsx("span",{className:"usage-dot usage-seg-input"})," input"]}),l.jsxs("span",{children:[l.jsx("span",{className:"usage-dot usage-seg-cached"})," cached"]}),l.jsxs("span",{children:[l.jsx("span",{className:"usage-dot usage-seg-output"})," output"]})]})]}),l.jsxs("div",{className:"usage-table-wrap",children:[l.jsx("div",{className:"usage-section-title",children:"By model"}),l.jsxs("table",{className:"usage-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Runtime"}),l.jsx("th",{children:"Provider"}),l.jsx("th",{children:"Model"}),l.jsx("th",{children:"Effort"}),l.jsx("th",{children:"Calls"}),l.jsx("th",{children:"Input"}),l.jsx("th",{children:"Cached"}),l.jsx("th",{children:"Output"}),l.jsx("th",{children:"Cost"})]})}),l.jsxs("tbody",{children:[o.by_model.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:9,className:"usage-empty",children:"No usage records yet."})}),o.by_model.map(A=>l.jsxs("tr",{children:[l.jsx("td",{children:bT[A.runtime_type]??A.runtime_type}),l.jsx("td",{children:A.provider??"—"}),l.jsx("td",{title:A.model,children:A.model}),l.jsx("td",{children:A.reasoning_effort??"default"}),l.jsxs("td",{children:[A.calls,A.errors>0&&l.jsxs("span",{className:"usage-err",children:[" (",A.errors," failed)"]})]}),l.jsx("td",{children:ds(A.input_tokens)}),l.jsx("td",{children:ds(A.cached_input_tokens+A.cache_write_input_tokens)}),l.jsx("td",{children:ds(A.output_tokens)}),l.jsx("td",{children:A.cost_usd===null?l.jsx("span",{className:"usage-unpriced",children:"unknown"}):Ir(A.cost_usd)})]},`${A.runtime_type}|${A.provider??""}|${A.model}|${A.reasoning_effort??""}`))]})]})]})]})]})}const Lm=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,CT=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,_T={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function gv(){return dn()||window.location.origin}function vv(t,s){let r=s;if(r&&typeof r=="object"){const f=r;r=typeof f.id=="string"?f.id:f.url}if(typeof r!="string")return null;const o=r.trim();if(Lm.test(o))return o;const a=CT.exec(o);if(!a)return null;let u;try{u=decodeURIComponent(a[1])}catch{return null}return u===t&&Lm.test(a[2])?a[2]:null}function Pm(t){return/^https?:\/\//i.test(t.url)?t:{...t,url:`${gv()}${t.url}`}}function jT(t){return _T[t.slice(t.lastIndexOf(".")+1)]??"application/octet-stream"}function yv(t){return new Promise((s,r)=>{const o=new FileReader;o.onload=()=>{const a=String(o.result??"");s(a.slice(a.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(t)})}function ET(t,s){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(t);return r?{type:s||r[1]||void 0,data:t.slice(r[0].length)}:{type:s,data:t}}async function xv(t){if(t instanceof Blob){const s=t.name;return{name:typeof s=="string"&&s?s:void 0,type:t.type||void 0,data:await yv(t)}}if(t&&typeof t=="object"&&typeof t.data=="string"){const s=t;return{name:typeof s.name=="string"&&s.name?s.name:void 0,type:typeof s.type=="string"&&s.type?s.type:void 0,data:s.data}}return null}async function RT(t){const s=await xv(t);if(!s)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return s}async function AT(t,s,r){if(s==null)return[];if(!Array.isArray(s))throw new Error("submitTurn: attachments must be an array");const o=[];for(let a=0;a<s.length;a++){const u=s[a],f=await xv(u);if(f){const{type:m,data:v}=ET(f.data,f.type);if(!m)throw new Error(`submitTurn: attachment ${a+1} has no type`);o.push({name:f.name??`attachment-${a+1}`,media_type:m,data:v});continue}const h=vv(t,u);if(!h)throw new Error(`submitTurn: attachment ${a+1} is not a file of this app`);const g=await r(h);o.push({name:h,media_type:jT(h),data:await yv(g)})}return o}const IT=`function (config) {
|
|
484
|
+
`;m(P=>P+G),C(!1),U(""),(X=window.getSelection())==null||X.removeAllRanges(),setTimeout(()=>{if(x.current){ue(),x.current.focus();const P=x.current.value.length;x.current.setSelectionRange(P,P)}},0)},[A]);return l.jsxs("div",{className:`thread-card ${t.status==="resolved"?"thread-resolved":""}`,id:`thread-${t.id}`,children:[l.jsxs("div",{className:"thread-card-header",onClick:()=>k(G=>!G),children:[l.jsx("div",{className:"thread-card-quote",children:t.selected_text===null?((se=(Le=(Ne=t.turns)==null?void 0:Ne[0])==null?void 0:Le.user_prompt)==null?void 0:se.slice(0,100))||"Quick question":`“${t.selected_text.slice(0,100)}${t.selected_text.length>100?"…":""}”`}),l.jsxs("div",{className:"thread-card-header-right",children:[t.selected_text!==null&&l.jsx("button",{className:"thread-locate-btn",onClick:G=>{G.stopPropagation(),h()},title:"Scroll to text",children:l.jsx(xw,{size:12})}),l.jsx("span",{className:`thread-status-badge ${t.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:t.status==="open"?"Open":"Resolved"})]})]}),v&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"thread-card-conversation",ref:b,onMouseDown:he,children:[s.map(G=>l.jsx(hv,{turn:G},G.id)),s.length===0&&l.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),j&&l.jsx("div",{className:"selection-actions",style:{left:T.x,top:T.y},children:l.jsxs("button",{className:"discuss-button",onClick:Te,title:"Quote this text in your follow-up",children:[l.jsx(xg,{size:14}),l.jsx("span",{children:"Quote"})]})}),t.status==="open"&&l.jsxs("div",{className:"thread-card-followup",children:[l.jsx("textarea",{ref:x,className:"thread-card-followup-input",placeholder:O?"Agent is running…":"Type a follow-up…",value:g,onChange:G=>{Ot.markInputChange(),m(G.target.value),ue()},disabled:O,rows:1,style:{minHeight:W,maxHeight:Z},onKeyDown:G=>{Ot.markKeystroke(),G.key==="Enter"&&(G.metaKey||G.ctrlKey)&&!O&&g.trim()&&(G.preventDefault(),f(g.trim()),m(""),Q(W))}}),l.jsx("button",{className:"thread-card-followup-send",disabled:O||!g.trim(),onClick:()=>{f(g.trim()),m("")},children:l.jsx(To,{size:13})}),O&&l.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:l.jsx(Lr,{size:13})})]}),l.jsxs("div",{className:"thread-card-actions",children:[t.status==="open"?l.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[l.jsx(tl,{size:13})," Resolve"]}):l.jsxs("button",{className:"thread-action-btn",onClick:a,title:"Reopen thread",children:[l.jsx(wo,{size:13})," Reopen"]}),l.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:u,title:"Delete thread",children:[l.jsx(fs,{size:13})," Delete"]})]})]})]})}function iT(){Ot.trackRender("ThreadsPanel");const t=M(I=>I.activeSessionId),s=M(I=>{var A;return I.activeSessionId?((A=I.sessionDetails[I.activeSessionId])==null?void 0:A.threads)??Em:Em}),r=w.useMemo(()=>s.filter(I=>!jd(I)),[s]),o=M(I=>I.followupThread),a=M(I=>I.cancelThreadTurn),u=M(I=>I.reopenThread),f=M(I=>I.deleteThread),h=M(I=>I.deepLinkThreadId),g=M(I=>I.setDeepLinkThreadId),[m,v]=w.useState("open"),[k,x]=w.useState(null);w.useEffect(()=>{if(!h)return;const I=h;g(null),v(U=>r.some(O=>O.id===I&&O.status==="open")?U:"all");const A=setTimeout(()=>{const U=document.getElementById(`thread-${I}`);U&&(U.scrollIntoView({behavior:"smooth",block:"center"}),U.classList.add("thread-card-highlighted"),setTimeout(()=>U.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(A)},[h,g,r]);const b=r.filter(I=>m==="open"?I.status==="open":m==="resolved"?I.status==="resolved":!0),j=r.filter(I=>I.status==="open").length,C=r.filter(I=>I.status==="resolved").length;function T(I){setTimeout(()=>{const A=document.querySelector(`mark[data-thread-id="${I}"]`);A&&(A.scrollIntoView({behavior:"smooth",block:"center"}),A.classList.add("thread-mark-flash"),setTimeout(()=>A.classList.remove("thread-mark-flash"),1500))},50)}return t?r.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx(yg,{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 ${m==="open"?"active":""}`,onClick:()=>v("open"),children:["Open (",j,")"]}),l.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",C,")"]}),l.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),b.length===0?l.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):b.map(I=>l.jsx(rT,{thread:I,threadTurns:I.turns??[],onStop:()=>a(t,I.id),onResolve:()=>x(I),onReopen:()=>u(t,I.id),onDelete:()=>f(t,I.id),onFollowup:A=>o(t,I.id,A),onLocate:()=>T(I.id)},I.id)),k&&l.jsx(eT,{thread:k,onClose:()=>x(null)})]}):l.jsx("div",{className:"empty-state",children:"No session selected"})}function oT(){const t=M(f=>f.apps),s=M(f=>f.activeAppTabId),r=M(f=>f.openAppTab),o=M(f=>f.startAppEdit),a=M(f=>f.toggleAppPin),u=M(f=>f.deleteApp);return t.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:t.map(f=>l.jsxs("div",{className:`apps-panel-row${s===f.id?" active":""}`,onClick:()=>r(f.id),title:f.description??void 0,children:[l.jsx(wi,{iconNode:f.iconNode,size:14,className:"sidebar-app-icon"}),l.jsxs("div",{className:"apps-panel-info",children:[l.jsx("span",{className:"apps-panel-title",children:f.title}),f.description&&l.jsx("span",{className:"apps-panel-desc",children:f.description})]}),l.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:h=>{h.stopPropagation(),o(f.id)},children:l.jsx(Va,{size:12})}),l.jsx("button",{className:`apps-panel-action${f.pinned?" pinned":""}`,title:f.pinned?"Unpin app":"Pin app (sorts first)",onClick:h=>{h.stopPropagation(),a(f.id)},children:l.jsx(sl,{size:12,fill:f.pinned?"currentColor":"none"})}),l.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:h=>{h.stopPropagation(),u(f.id)},children:l.jsx(fs,{size:12})})]},f.id))})}function aT(){Ot.trackRender("SidecarPanel");const t=M(T=>T.activeSessionId),s=M(T=>{var I;return T.activeSessionId?(I=T.sessionDetails[T.activeSessionId])==null?void 0:I.runtime_type:void 0}),r=M(T=>{var I;return T.activeSessionId?Zb((I=T.sessionDetails[T.activeSessionId])==null?void 0:I.threads):null}),o=M(T=>T.askSidecar),a=M(T=>T.cancelThreadTurn),u=M(T=>T.deleteThread),[f,h]=w.useState(""),[g,m]=w.useState(!1),v=w.useRef(null),k=(r==null?void 0:r.turns)??[],x=k[k.length-1],b=k.some(cr);if(w.useEffect(()=>{var T,I;(I=(T=v.current)==null?void 0:T.scrollIntoView)==null||I.call(T,{block:"end"})},[k.length,x==null?void 0:x.items.length,x==null?void 0:x.status]),!t||!s)return l.jsx("div",{className:"empty-state",children:"No session selected"});if(!Qb(s))return l.jsxs("div",{className:"empty-state",children:[l.jsx(ur,{size:24,style:{opacity:.3,marginBottom:8}}),l.jsxs("div",{children:["The sidecar is not available for ",s," sessions yet."]})]});const j=!b&&!g&&f.trim().length>0;async function C(){if(!t||!j)return;m(!0);const T=await o(t,f.trim());m(!1),T&&h("")}return l.jsxs("div",{className:"sidecar-panel",children:[l.jsxs("div",{className:"sidecar-conversation",children:[k.length===0?l.jsxs("div",{className:"empty-state",children:[l.jsx(ur,{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?"})]}):k.map(T=>l.jsx(hv,{turn:T,formatPrompt:Jb},T.id)),l.jsx("div",{ref:v})]}),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:b?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:f,rows:2,disabled:b,onChange:T=>{Ot.markInputChange(),h(T.target.value)},onKeyDown:T=>{Ot.markKeystroke(),T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),C())}}),b&&r?l.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>a(t,r.id),children:l.jsx(Lr,{size:13})}):l.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!j,onClick:()=>void C(),children:l.jsx(To,{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:b,onClick:()=>u(t,r.id),children:[l.jsx(fs,{size:13})," Clear"]})})]})]})}function lT(){var g;Ot.trackRender("RightPanel");const t=M(m=>m.activeRightTab),s=M(m=>m.switchRightTab),r=M(m=>m.rightPanelCollapsed),o=M(m=>m.toggleRightPanel),a=M(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),u=M(m=>{var v;return m.activeSessionId?((v=m.backgroundTasks[m.activeSessionId])==null?void 0:v.length)??0:0}),f=((g=a==null?void 0:a.threads)==null?void 0:g.filter(m=>m.status==="open"&&!jd(m)).length)??0,h=[{id:"turns",label:"Turns",icon:pw},{id:"sidecar",label:"Sidecar",icon:ur},{id:"tasks",label:"Tasks",icon:fw,badge:u||void 0},{id:"threads",label:"Threads",icon:yg,badge:f||void 0},{id:"apps",label:"Apps",icon:vg}];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(kw,{size:15})}),l.jsx("div",{className:"right-rail-divider"}),h.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return l.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${t===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>s(m.id),children:[l.jsx(v,{size:15}),m.badge?l.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):l.jsxs("div",{className:"ide-right",children:[l.jsxs("div",{className:"right-header",children:[l.jsx("div",{className:"right-tabs",children:h.map(m=>l.jsxs("div",{className:`right-tab ${t===m.id?"active":""}`,onClick:()=>s(m.id),children:[m.label,m.badge?l.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.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(ww,{size:14})})]}),l.jsxs("div",{className:"right-content",children:[t==="turns"&&l.jsx(Wb,{}),t==="sidecar"&&l.jsx(aT,{}),t==="tasks"&&l.jsx(Kb,{}),t==="threads"&&l.jsx(iT,{}),t==="apps"&&l.jsx(oT,{})]})]})}const Re={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"}},Gu=[{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:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max,Re.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max,Re.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.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:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high,Re.xhigh,Re.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[Re.low,Re.medium,Re.high]}]}];function cT(t){return Gu.find(s=>s.id===t)}function _d(t){const s=cT(t);return(s==null?void 0:s.models)??[]}function mv(t,s){return _d(t).find(r=>r.slug===s)}function Ku(t,s){var r;return((r=mv(t,s))==null?void 0:r.reasoningLevels)??[]}function Yu(t,s){var r;return(r=mv(t,s))==null?void 0:r.defaultReasoning}function uT(){const{activeSessionId:t,sessions:s,updateModelConfig:r}=M(),o=M(se=>se.showModelSelector),a=M(se=>se.setShowModelSelector),u=s.find(se=>se.id===t),f=M(se=>se.models),h=M(se=>se.modelsLoading),g=M(se=>se.loadModels),[m,v]=w.useState(!1),k=w.useRef(null);if(Sl(k,()=>v(!1),m),id(()=>v(!1),m),w.useEffect(()=>{o&&(v(!0),a(!1))},[o,a]),w.useEffect(()=>{u!=null&&u.runtime_type&&g(u.runtime_type,u.cwd??void 0)},[u==null?void 0:u.runtime_type,u==null?void 0:u.cwd,g]),!u)return null;const x=u.runtime_type,b=u.model??"",j=u.model_reasoning_effort??"",C=f.length>0?f:[],T=_d(x),A=[...C.length>0?C:T];if(b&&!A.some(se=>se.slug===b)){const se=T[0];A.unshift({slug:b,displayName:b,description:"Custom model",defaultReasoning:(se==null?void 0:se.defaultReasoning)??"medium",reasoningLevels:(se==null?void 0:se.reasoningLevels)??[]})}function U(se){return A.find(G=>G.slug===se)}function O(se){var G;return C.length>0?((G=U(se))==null?void 0:G.reasoningLevels)??[]:Ku(x,se)}function W(se){var G;return C.length>0?(G=U(se))==null?void 0:G.defaultReasoning:Yu(x,se)}const Z=Gu.find(se=>se.id===x),Y=U(b),Q=b?O(b):[],ue=(Z==null?void 0:Z.label)??x,he=(Y==null?void 0:Y.displayName)??(b||"Default"),H=Q.find(se=>se.effort===j),Te=(H==null?void 0:H.label)??(j||"Default");function Ne(se){var J;const G=O(se),P=G.some(q=>q.effort===j)?j:W(se)??((J=G[0])==null?void 0:J.effort)??"";r(se,P),v(!1)}function Le(se){r(b,se),v(!1)}return l.jsxs("div",{className:"model-selector",ref:k,children:[l.jsxs("button",{className:"model-selector-btn",onClick:()=>v(!m),title:"Change model and thinking level",children:[l.jsx("span",{className:"model-selector-provider",children:ue}),l.jsx("span",{className:"model-selector-sep",children:"›"}),l.jsx("span",{className:"model-selector-model",children:he}),Te!=="Default"&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"model-selector-sep",children:"›"}),l.jsx("span",{className:"model-selector-reasoning",children:Te})]}),l.jsx(vi,{size:12,className:"model-selector-chevron"})]}),m&&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"}),Gu.map(se=>l.jsxs("div",{className:`model-selector-item ${se.id===x?"selected":""} ${se.available?"":"disabled"}`,onClick:()=>{if(se.available){if(se.id===x){v(!1);return}r("","",se.id)}},children:[l.jsx("span",{children:se.label}),!se.available&&l.jsxs("span",{className:"model-selector-coming-soon",children:[l.jsx(gw,{size:10})," Soon"]}),se.id===x&&l.jsx(Os,{size:12})]},se.id))]}),l.jsxs("div",{className:"model-selector-column",children:[l.jsx("div",{className:"model-selector-col-header",children:"Model"}),h&&l.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!h&&A.length===0&&l.jsx("div",{className:"model-selector-empty",children:"No models available"}),A.map(se=>l.jsxs("div",{className:`model-selector-item ${se.slug===b?"selected":""}`,onClick:()=>Ne(se.slug),children:[l.jsxs("div",{className:"model-selector-item-main",children:[l.jsx("span",{className:"model-selector-item-name",children:se.displayName}),l.jsx("span",{className:"model-selector-item-desc",children:se.description})]}),se.slug===b&&l.jsx(Os,{size:12})]},se.slug))]}),l.jsxs("div",{className:"model-selector-column",children:[l.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),Q.length===0&&l.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),Q.map(se=>l.jsxs("div",{className:`model-selector-item ${se.effort===j?"selected":""}`,onClick:()=>Le(se.effort),children:[l.jsx("span",{children:se.label}),se.effort===j&&l.jsx(Os,{size:12})]},se.effort))]})]})]})}function lo(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Rm(){const t=M(s=>s.setShowRemoteModal);return l.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>t(!0),children:[l.jsx(Lw,{size:14})," Repoburg"]})}function Am(){const t=M(r=>r.usageViewOpen),s=M(r=>r.toggleUsageView);return l.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Usage Center",onClick:s,children:[l.jsx(gg,{size:14})," Usage"]})}function Im(){const t=M(r=>r.vscodeViewOpen),s=M(r=>r.toggleVscodeView);return l.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open VS Code",onClick:s,children:[l.jsx(iw,{size:14})," Code"]})}function dT(){var x,b;Ot.trackRender("StatusBar");const t=M(j=>j.activeSessionId),s=M(j=>t?j.sessions.find(C=>C.id===t)??null:null),r=M(j=>t?j.sessionDetails[t]??null:null),o=M(j=>t?j.backgroundTasks[t]:void 0),a=M(j=>j.wsConnected),u=M(j=>j.switchRightTab),f=(r==null?void 0:r.contextUsage)??null;if(!s)return l.jsxs("div",{className:"ide-statusbar",children:[l.jsx(Rm,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Im,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Am,{}),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(Eh,{size:14})," K"]})]});const h=o??[],g=kl(s,h.length),m=new Set,v=new Map;for(const j of h)m.add(j.task_id),v.set(j.task_id,j.task_type);for(const j of(r==null?void 0:r.turns)??[])for(const C of j.items)if(C.type==="background_task"&&C.status==="in_progress"){const T=((x=C.data)==null?void 0:x.task_id)??C.external_item_id,I=((b=C.data)==null?void 0:b.task_type)??"unknown";m.add(T),v.set(T,I)}const k=[...v.values()].filter(j=>j==="local_bash").length;return l.jsxs("div",{className:"ide-statusbar",children:[l.jsx(Rm,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Im,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(Am,{}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsx(uT,{}),k>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:`${k} Monitor task${k>1?"s":""} running — click to view`,onClick:()=>u("tasks"),children:[l.jsx(Sg,{size:14})," ",k]})]}),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:g.dot==="background"?{color:"var(--purple)"}:s.status==="failed"?{color:"var(--red)"}:void 0,title:g.dot==="background"?g.dotTitle:void 0,children:g.label}),f&&l.jsx(fT,{usage:f}),l.jsx("div",{className:"sb-divider",children:"|"}),l.jsxs("div",{className:"sb-item",children:[l.jsx(Eh,{size:14})," K"]})]})}function fT({usage:t}){const s=t.percentage>=85?"var(--red)":t.percentage>=60?"var(--amber)":"var(--green)",r=`${lo(t.totalTokens)} / ${lo(t.contextWindow)} tokens`+(t.autoCompactThreshold?` · auto-compacts at ${lo(t.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:s},children:[Math.round(t.percentage),"% / ",lo(t.totalTokens)," / ",lo(t.contextWindow)]})})]})}function Dm(t){return fn(`/vscode-web/status?folder=${encodeURIComponent(t??"")}`)}function pT(t){return pt("/vscode-web/start",{folder:t})}function hT(t){return pt("/vscode-web/heartbeat",{id:t})}const mT=1e3,gT=5*6e4;function Mm({children:t}){const s=M(r=>r.toggleVscodeView);return l.jsxs("div",{className:"vscode-view vscode-view--loading",children:[t,l.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:s,children:l.jsx(En,{size:16})})]})}function vT(){const t=M(j=>j.vscodeState),s=M(j=>j.vscodeId),r=M(j=>j.vscodeToken),o=M(j=>j.setVscodeView),a=M(j=>{var T;const C=j.activeSessionId?j.sessions.find(I=>I.id===j.activeSessionId):null;return C!=null&&C.cwd?C.cwd:((T=j.workspaces.find(I=>I.deleted===0))==null?void 0:T.path)??null}),[u,f]=w.useState(!1),[h,g]=w.useState(0),m=w.useRef(null),v=dn(),k=v===""||v===window.location.origin,x=`${v}/vscode/${s??""}/?tkn=${r??""}${a?`&folder=${encodeURIComponent(a)}`:""}`;w.useEffect(()=>{let j=!1;function C(){m.current&&(clearInterval(m.current),m.current=null)}async function T(){try{let A=await Dm(a);if((A.state==="stopped"||A.state==="error")&&(A=await pT(a)),j||(o(A.state,A.id,A.token),A.state==="running"||A.state==="error"))return;m.current=setInterval(async()=>{const U=await Dm(a);j||(o(U.state,U.id,U.token),(U.state==="running"||U.state==="error"||U.state==="stopped")&&C())},mT)}catch{j||o("error",null,null)}}T();const I=setInterval(()=>{const A=M.getState().vscodeId;A&&hT(A).catch(()=>{})},gT);return()=>{j=!0,C(),clearInterval(I)}},[h,a,o]);function b(){f(!1),o("starting",null,null),g(j=>j+1)}return t!=="running"||!r||!s?l.jsx(Mm,{children:t==="error"?l.jsxs(l.Fragment,{children:[l.jsx("span",{children:"VS Code could not start."}),l.jsxs("button",{className:"dialog-btn-cancel",onClick:b,children:[l.jsx(wo,{size:14})," Retry"]})]}):l.jsxs("span",{className:"vscode-view-hint",children:[l.jsx(Jn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?l.jsxs("div",{className:"vscode-view",children:[!u&&l.jsxs("div",{className:"vscode-view-overlay",children:[l.jsx(Jn,{size:16,className:"spin"})," Loading VS Code…"]}),l.jsx("iframe",{src:x,title:"VS Code",className:"vscode-view-frame",onLoad:()=>f(!0)},s)]}):l.jsxs(Mm,{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(aw,{size:14})," Open VS Code in a new tab"]})]})}function Lm(t,s){const r=new URLSearchParams;t&&r.set("since",t),s&&r.set("until",s);const o=r.toString();return fn(`/usage/summary${o?`?${o}`:""}`)}const gv="agentpane:usage-budget";function ds(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Ir(t){return`$${t>=100?t.toFixed(0):t>=1?t.toFixed(2):t.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}`}function yT(t,s=new Date){if(t==="all")return{since:null,until:null};const r=new Date(s);return t==="today"?r.setHours(0,0,0,0):r.setDate(r.getDate()-(t==="7d"?7:30)),{since:r.toISOString(),until:null}}function xT(t=new Date){return new Date(t.getFullYear(),t.getMonth(),1).toISOString()}function wT(){try{const t=Number(localStorage.getItem(gv));return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function kT(t){try{localStorage.setItem(gv,String(t))}catch{}}const ST={claude:"Claude",codex:"Codex",repoburg:"Repoburg"};function Ba({label:t,value:s,sub:r,tone:o}){return l.jsxs("div",{className:"usage-kpi",children:[l.jsx("div",{className:"usage-kpi-label",children:t}),l.jsx("div",{className:"usage-kpi-value",style:o?{color:o}:void 0,children:s}),r&&l.jsx("div",{className:"usage-kpi-sub",children:r})]})}function bT({day:t,max:s}){const r=o=>s>0?o/s*100:0;return l.jsxs("div",{className:"usage-day",title:`${t.date} · ${ds(t.input_tokens)} input · ${ds(t.cached_input_tokens)} cached · ${ds(t.output_tokens)} output · ${Ir(t.cost_usd)}`,children:[l.jsxs("div",{className:"usage-day-bar",children:[l.jsx("div",{className:"usage-seg usage-seg-output",style:{height:`${r(t.output_tokens)}%`}}),l.jsx("div",{className:"usage-seg usage-seg-cached",style:{height:`${r(t.cached_input_tokens+t.cache_write_input_tokens)}%`}}),l.jsx("div",{className:"usage-seg usage-seg-input",style:{height:`${r(t.input_tokens)}%`}})]}),l.jsx("div",{className:"usage-day-label",children:t.date.slice(5)})]})}function TT(){const t=M(A=>A.toggleUsageView),[s,r]=w.useState("30d"),[o,a]=w.useState(null),[u,f]=w.useState(null),[h,g]=w.useState(wT),[m,v]=w.useState(null),[k,x]=w.useState(!1),b=w.useCallback(async()=>{x(!0),v(null);try{const{since:A,until:U}=yT(s),[O,W]=await Promise.all([Lm(A,U),Lm(xT(),null)]);a(O),f(W.totals.cost_usd)}catch(A){v(A.message)}finally{x(!1)}},[s]);w.useEffect(()=>{b()},[b]);const j=o==null?void 0:o.totals,C=h>0&&u!==null?h-u:null,T=w.useMemo(()=>Math.max(0,...((o==null?void 0:o.daily)??[]).map(A=>A.input_tokens+A.cached_input_tokens+A.output_tokens)),[o]),I=A=>{const U=Number(A.replace(",",".")),O=Number.isFinite(U)&&U>0?U:0;g(O),kT(O)};return l.jsxs("div",{className:"usage-view",children:[l.jsxs("div",{className:"usage-header",children:[l.jsxs("div",{className:"usage-title",children:[l.jsx(gg,{size:18})," Usage Center"]}),l.jsxs("div",{className:"usage-controls",children:[["today","7d","30d","all"].map(A=>l.jsx("button",{className:`usage-range-btn${s===A?" usage-range-btn-active":""}`,onClick:()=>r(A),children:A==="today"?"Today":A==="7d"?"7 days":A==="30d"?"30 days":"All"},A)),l.jsx("button",{className:"usage-range-btn",onClick:()=>void b(),title:"Refresh",children:l.jsx(Cw,{size:13,className:k?"spin":void 0})}),l.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:t,children:l.jsx(En,{size:16})})]})]}),m&&l.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",m]}),!o&&!m&&l.jsx("div",{className:"usage-empty",children:"Loading…"}),o&&j&&l.jsxs("div",{className:"usage-body",children:[l.jsxs("div",{className:"usage-kpis",children:[l.jsx(Ba,{label:"Spend",value:Ir(j.cost_usd),sub:j.unpriced_models.length>0?"excluding unpriced models":void 0}),l.jsx(Ba,{label:"Remaining (monthly)",value:C===null?"—":C>=0?Ir(C):Ir(0),sub:h>0&&u!==null?`this month ${Ir(u)} / budget ${Ir(h)}`:"no budget set",tone:C!==null&&C<0?"var(--red)":void 0}),l.jsx(Ba,{label:"Tokens",value:ds(j.input_tokens+j.cached_input_tokens+j.cache_write_input_tokens+j.output_tokens),sub:`input ${ds(j.input_tokens)} · cached ${ds(j.cached_input_tokens)} · write ${ds(j.cache_write_input_tokens)} · output ${ds(j.output_tokens)}`}),l.jsx(Ba,{label:"Calls",value:String(j.calls),sub:j.errors>0?`${j.errors} failed`:void 0,tone:j.errors>0?"var(--amber)":void 0})]}),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:h>0?h:"",placeholder:"e.g. 50",onBlur:A=>I(A.target.value)}),h>0&&u!==null&&l.jsx("div",{className:"usage-budget-bar",children:l.jsx("div",{className:"usage-budget-fill",style:{width:`${Math.min(100,u/h*100)}%`,background:u>=h?"var(--red)":void 0}})})]}),j.unpriced_models.length>0&&l.jsxs("div",{className:"usage-note",children:["Unpriced models: ",j.unpriced_models.join(", ")]}),l.jsxs("div",{className:"usage-chart",children:[l.jsx("div",{className:"usage-section-title",children:"Daily usage"}),o.daily.length===0?l.jsx("div",{className:"usage-empty",children:"No usage in this range."}):l.jsx("div",{className:"usage-days",children:o.daily.map(A=>l.jsx(bT,{day:A,max:T},A.date))}),l.jsxs("div",{className:"usage-legend",children:[l.jsxs("span",{children:[l.jsx("span",{className:"usage-dot usage-seg-input"})," input"]}),l.jsxs("span",{children:[l.jsx("span",{className:"usage-dot usage-seg-cached"})," cached"]}),l.jsxs("span",{children:[l.jsx("span",{className:"usage-dot usage-seg-output"})," output"]})]})]}),l.jsxs("div",{className:"usage-table-wrap",children:[l.jsx("div",{className:"usage-section-title",children:"By model"}),l.jsxs("table",{className:"usage-table",children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Runtime"}),l.jsx("th",{children:"Provider"}),l.jsx("th",{children:"Model"}),l.jsx("th",{children:"Effort"}),l.jsx("th",{children:"Calls"}),l.jsx("th",{children:"Input"}),l.jsx("th",{children:"Cached"}),l.jsx("th",{children:"Output"}),l.jsx("th",{children:"Cost"})]})}),l.jsxs("tbody",{children:[o.by_model.length===0&&l.jsx("tr",{children:l.jsx("td",{colSpan:9,className:"usage-empty",children:"No usage records yet."})}),o.by_model.map(A=>l.jsxs("tr",{children:[l.jsx("td",{children:ST[A.runtime_type]??A.runtime_type}),l.jsx("td",{children:A.provider??"—"}),l.jsx("td",{title:A.model,children:A.model}),l.jsx("td",{children:A.reasoning_effort??"default"}),l.jsxs("td",{children:[A.calls,A.errors>0&&l.jsxs("span",{className:"usage-err",children:[" (",A.errors," failed)"]})]}),l.jsx("td",{children:ds(A.input_tokens)}),l.jsx("td",{children:ds(A.cached_input_tokens+A.cache_write_input_tokens)}),l.jsx("td",{children:ds(A.output_tokens)}),l.jsx("td",{children:A.cost_usd===null?l.jsx("span",{className:"usage-unpriced",children:"unknown"}):Ir(A.cost_usd)})]},`${A.runtime_type}|${A.provider??""}|${A.model}|${A.reasoning_effort??""}`))]})]})]})]})]})}const Pm=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,NT=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,CT={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function vv(){return dn()||window.location.origin}function yv(t,s){let r=s;if(r&&typeof r=="object"){const f=r;r=typeof f.id=="string"?f.id:f.url}if(typeof r!="string")return null;const o=r.trim();if(Pm.test(o))return o;const a=NT.exec(o);if(!a)return null;let u;try{u=decodeURIComponent(a[1])}catch{return null}return u===t&&Pm.test(a[2])?a[2]:null}function Om(t){return/^https?:\/\//i.test(t.url)?t:{...t,url:`${vv()}${t.url}`}}function jT(t){return CT[t.slice(t.lastIndexOf(".")+1)]??"application/octet-stream"}function xv(t){return new Promise((s,r)=>{const o=new FileReader;o.onload=()=>{const a=String(o.result??"");s(a.slice(a.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(t)})}function _T(t,s){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(t);return r?{type:s||r[1]||void 0,data:t.slice(r[0].length)}:{type:s,data:t}}async function wv(t){if(t instanceof Blob){const s=t.name;return{name:typeof s=="string"&&s?s:void 0,type:t.type||void 0,data:await xv(t)}}if(t&&typeof t=="object"&&typeof t.data=="string"){const s=t;return{name:typeof s.name=="string"&&s.name?s.name:void 0,type:typeof s.type=="string"&&s.type?s.type:void 0,data:s.data}}return null}async function ET(t){const s=await wv(t);if(!s)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return s}async function RT(t,s,r){if(s==null)return[];if(!Array.isArray(s))throw new Error("submitTurn: attachments must be an array");const o=[];for(let a=0;a<s.length;a++){const u=s[a],f=await wv(u);if(f){const{type:m,data:v}=_T(f.data,f.type);if(!m)throw new Error(`submitTurn: attachment ${a+1} has no type`);o.push({name:f.name??`attachment-${a+1}`,media_type:m,data:v});continue}const h=yv(t,u);if(!h)throw new Error(`submitTurn: attachment ${a+1} is not a file of this app`);const g=await r(h);o.push({name:h,media_type:jT(h),data:await xv(g)})}return o}const AT=`function (config) {
|
|
490
485
|
var nextId = 1;
|
|
491
486
|
var pending = new Map();
|
|
492
487
|
var listeners = [];
|
|
@@ -609,9 +604,9 @@ ${A}
|
|
|
609
604
|
stack: (r && r.stack) || '', line: 0, col: 0
|
|
610
605
|
}, '*');
|
|
611
606
|
});
|
|
612
|
-
}`;function DT(t){return`(${IT})(${JSON.stringify(t)});`}function Om(t){return t.replace(/<\/script/gi,"<\\/script")}function MT(t,s){const r=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let a=-1,u;for(;(u=o.exec(t))!==null;)a=u.index;return a}function $m(t,s,r){const o=MT(t,s);return o===-1?t+r:t.slice(0,o)+r+t.slice(o)}function LT(t,s,r){let o=t;const a=`<script>${Om(s)}<\/script>`;if(/<\/head>/i.test(o)?o=$m(o,"</head>",a):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${a}</head>`):o=`${a}${o}`,r){const u=`<script>${Om(r)}<\/script>`;o=$m(o,"</body>",u)}return o}function PT({appId:t,workspace:s=""}){const r=w.useRef(null),o=w.useRef({pinned:!1,data:null}),[a,u]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState([]);w.useEffect(()=>{let b=!0;Yx(t,C=>{var T,I;return(I=(T=r.current)==null?void 0:T.contentWindow)==null?void 0:I.postMessage(C,"*")});const _=async C=>{var O,W,Z,Y,Q,ue,he,H,Te,Ne,Le,se;if(C.source!==((O=r.current)==null?void 0:O.contentWindow))return;const T=C.data;if(!T||T.source!=="agentpane-app")return;if(T.report==="error"){const G={message:String(T.message??"Unknown error"),stack:String(T.stack??"")};m(X=>{const P=X[X.length-1];return P&&P.message===G.message?X:[...X,G].slice(-20)});return}if(typeof T.method!="string")return;let I=!0,A,U;try{switch(T.method){case"getApp":A={id:t};break;case"getState":A=o.current;break;case"setState":{const G=((W=T.params)==null?void 0:W.data)??null,X=await ig(t,{data:G},s);o.current=X,A=X;break}case"createSession":{const G=T.params??{},X=await Zu({title:typeof G.title=="string"?G.title:void 0,runtime_type:typeof G.runtime_type=="string"?G.runtime_type:void 0,model:typeof G.model=="string"?G.model:void 0,model_reasoning_effort:typeof G.model_reasoning_effort=="string"?G.model_reasoning_effort:void 0,cwd:typeof G.cwd=="string"?G.cwd:void 0,origin_app_id:t});du(X.id,t),M.getState().addSession(X),A=X;break}case"submitTurn":{const G=String(((Z=T.params)==null?void 0:Z.sessionId)??""),X=String(((Y=T.params)==null?void 0:Y.prompt)??""),P=await AT(t,(Q=T.params)==null?void 0:Q.attachments,q=>L0(t,q)),J=await Xm(G,X,P.length?P:void 0,{originAppId:t});du(G,t),A=J;break}case"resolveToolCall":{const G=String(((ue=T.params)==null?void 0:ue.callId)??""),X=(he=T.params)==null?void 0:he.result;await A0(G,X),A={ok:!0};break}case"openSession":{if(M.getState().activeAppTabId!==t)throw new Error("openSession: the app is not on screen — call it from a click in the app");const G=typeof((H=T.params)==null?void 0:H.sessionId)=="string"?T.params.sessionId.trim():"";if(!G)throw new Error("openSession: sessionId is required");try{await M.getState().revealSession(G)}catch(X){throw new Error(`openSession: ${X instanceof Error?X.message:String(X)}`)}A={ok:!0};break}case"uploadFile":{const G=await RT((Te=T.params)==null?void 0:Te.file);try{A=Pm(await D0(t,G))}catch(X){throw new Error(`uploadFile: ${X instanceof Error?X.message:String(X)}`)}break}case"getFile":{const G=vv(t,(Ne=T.params)==null?void 0:Ne.ref),X=G?await M0(t,G):null;A=X?Pm(X):null;break}default:throw new Error(`Unknown bridge method: ${T.method}`)}}catch(G){I=!1,U=G instanceof Error?G.message:String(G)}(se=(Le=r.current)==null?void 0:Le.contentWindow)==null||se.postMessage({source:"agentpane-host",id:T.id,ok:I,result:A,error:U},"*")};return window.addEventListener("message",_),t0(t,()=>{Th(t,s).then(C=>{b&&(o.current=C)}).catch(()=>{})}),Jx(t,()=>{bh(t).then(C=>{b&&(u(C),m([]))}).catch(()=>{})}),(async()=>{try{const[C,T,I]=await Promise.all([bh(t),Th(t,s),C0(t).catch(()=>[])]);if(!b)return;o.current=T,I.forEach(A=>du(A.id,t)),u(C)}catch(C){b&&h(C instanceof Error?C.message:String(C))}})(),()=>{b=!1,Xx(t),e0(t),n0(t),window.removeEventListener("message",_)}},[t,s]);const v=w.useMemo(()=>a?LT(a.html,DT({appId:t,apiOrigin:gv()}),a.js):"",[a,t]);if(f)return l.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",f]});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(b=>b.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((b,_)=>l.jsxs("div",{className:"miniapp-diag",children:[b.file,":",b.line,":",b.column," — ",b.message]},_))]}),l.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",title:`Mini app: ${t}`,srcDoc:v}),g.length>0&&l.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:g.map((b,_)=>l.jsxs("div",{className:"miniapp-rt-error",children:[l.jsx("div",{className:"miniapp-rt-error-message",children:b.message}),b.stack&&l.jsx("pre",{className:"miniapp-rt-error-stack",children:b.stack})]},_))})]})}function OT({appId:t,active:s}){const r=M(x=>x.apps),o=M(x=>x.workspaces),a=M(x=>x.appWorkspaces),u=M(x=>x.setAppWorkspace),f=M(x=>x.setActiveAppTab),h=M(x=>x.startAppEdit),g=r.find(x=>x.id===t),m=a[t]??"",v=o.filter(x=>x.deleted!==1),k=m!==""&&!v.some(x=>x.path===m)?m:null;return l.jsxs("div",{className:`miniapp-view ${s?"":"miniapp-view-hidden"}`,children:[l.jsxs("div",{className:"miniapp-header",children:[l.jsx(wi,{iconNode:g==null?void 0:g.iconNode,size:14,className:"miniapp-header-icon"}),l.jsx("span",{className:"miniapp-header-title",children:(g==null?void 0:g.title)??t}),l.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:x=>u(t,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 h(t),children:[l.jsx(Nw,{size:13}),"Edit"]}),l.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>f(null),children:l.jsx(En,{size:14})})]}),l.jsx("div",{className:"miniapp-body",children:l.jsx(PT,{appId:t,workspace:m},`${t}:${m}`)})]})}function $T({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:a}){const[u,f]=w.useState(!1),h=w.useRef(0),g=w.useRef(0),m=w.useCallback(x=>{const b=x.clientX-h.current,_=t==="left"?g.current+b:g.current-b,C=Math.min(r,Math.max(s,_));a(C)},[t,s,r,a]),v=w.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),f(!1)},[m]);return{onPointerDown:w.useCallback(x=>{var b,_;x.preventDefault(),x.stopPropagation();try{(_=(b=x.currentTarget)==null?void 0:b.setPointerCapture)==null||_.call(b,x.pointerId)}catch{}h.current=x.clientX,g.current=o(),f(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:u}}function zm({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:a}){const{onPointerDown:u,dragging:f}=$T({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:a});return l.jsx("div",{className:`resize-handle ${t}${f?" dragging":""}`,onPointerDown:u,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${t} panel`,"data-resizing":f?"":void 0})}function zT(){Ot.trackRender("IdeWorkspace");const t=M(v=>v.sidebarWidth),s=M(v=>v.rightPanelWidth),r=M(v=>v.setSidebarWidth),o=M(v=>v.setRightPanelWidth),a=M(v=>v.rightPanelCollapsed),u=M(v=>v.vscodeViewOpen),f=M(v=>v.usageViewOpen),h=M(v=>v.activeAppTabId),g=M(v=>v.openAppTabs);w.useEffect(()=>{const v=()=>{const k=Xa(),{rightPanelWidth:x,setRightPanelWidth:b}=M.getState();x>k&&b(k)};return window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[]);const m=a?`${t}px 6px 1fr ${x0}px`:`${t}px 6px 1fr 6px ${s}px`;return l.jsxs("div",{className:"ide-root",children:[l.jsxs("div",{className:`ide-layout ${u||f?"ide-hidden":""}`,style:{gridTemplateColumns:m},children:[l.jsx(Ok,{}),l.jsx(zm,{side:"left",minWidth:Au,maxWidth:Iu,getWidth:()=>M.getState().sidebarWidth,setWidth:r}),l.jsxs("div",{className:"ide-center",children:[l.jsx($k,{}),l.jsxs("div",{className:"ide-render",children:[g.map(v=>l.jsx(OT,{appId:v,active:h===v},v)),h==null&&l.jsx(Ab,{})]}),l.jsx(Wb,{})]}),!a&&l.jsx(zm,{side:"right",minWidth:Ya,maxWidth:Xa(),getWidth:()=>M.getState().rightPanelWidth,setWidth:o}),l.jsx(cT,{})]}),u&&l.jsx(yT,{}),f&&l.jsx(NT,{}),l.jsx(fT,{})]})}function FT(){const{showNewSessionDialog:t,setShowNewSessionDialog:s,createSession:r,lastModelConfig:o}=M(),a=(o==null?void 0:o.provider)??"codex",u=(o==null?void 0:o.model)??"",f=(o==null?void 0:o.reasoning)??"",[h,g]=w.useState(""),[m,v]=w.useState(u),[k,x]=w.useState(f),[b,_]=w.useState("");if(!t)return null;const C=jd(a),T=m?Ku(a,m):[];function I(){r({title:h.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:b.trim()||void 0,runtime_type:a}),g(""),_("")}function A(O){O.key==="Escape"&&s(!1)}function U(O){var Y;v(O);const W=Ku(a,O);W.some(Q=>Q.effort===k)||x(Yu(a,O)??((Y=W[0])==null?void 0:Y.effort)??"")}return l.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:l.jsxs("div",{className:"dialog",onClick:O=>O.stopPropagation(),onKeyDown:A,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",children:"New Session"}),l.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:l.jsx(En,{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:h,onChange:O=>g(O.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:m,onChange:O=>U(O.target.value),children:[l.jsx("option",{value:"",children:"Default (Codex picks)"}),C.map(O=>l.jsxs("option",{value:O.slug,children:[O.displayName," — ",O.description]},O.slug))]})]}),T.length>0&&l.jsxs("label",{className:"dialog-label",children:["Thinking Level",l.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:O=>x(O.target.value),children:[l.jsxs("option",{value:"",children:["Default (",Yu(a,m),")"]}),T.map(O=>l.jsx("option",{value:O.effort,children:O.label},O.effort))]})]}),l.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",l.jsx("input",{className:"dialog-input",type:"text",value:b,onChange:O=>_(O.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:()=>s(!1),children:"Cancel"}),l.jsx("button",{className:"dialog-btn-create",onClick:I,children:"Create"})]})]})})}const UT=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,BT=512*1024;function WT(t){const s=t.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(s)?s:""}function HT(){const{appCatalogOpen:t,closeAppCatalog:s,apps:r,installExampleApp:o,createSkeletonApp:a,importAppFolder:u}=M(),[f,h]=w.useState("examples"),[g,m]=w.useState(null),[v,k]=w.useState(null),[x,b]=w.useState(!1),[_,C]=w.useState(""),[T,I]=w.useState(""),[A,U]=w.useState(""),[O,W]=w.useState(""),[Z,Y]=w.useState(null),[Q,ue]=w.useState(""),he=w.useRef(null);if(w.useEffect(()=>{t&&(m(null),_0().then(m).catch(()=>m([])))},[t]),w.useEffect(()=>{he.current&&(he.current.webkitdirectory=!0)},[f]),!t)return null;const H=new Set(r.map(P=>P.id));async function Te(P){k(P);try{await o(P)&&s()}finally{k(null)}}async function Ne(){if(x)return;const P=_.trim(),J=T.trim();if(!(!P||!J)){b(!0);try{await a({id:P,title:J,description:A.trim()||void 0,icon:O.trim()||void 0})&&(C(""),I(""),U(""),W(""),s())}finally{b(!1)}}}async function Le(P){const J=Array.from(P.target.files??[]),q={};let E="";for(const L of J){const K=(L.webkitRelativePath??"").split("/");!E&&K.length>1&&(E=K[0]);const ce=K[K.length-1];if(!(!ce||!UT.test(ce))&&!(L.size>BT))try{q[ce]=await L.text()}catch{}}Y(Object.keys(q).length>0?q:null),ue(WT(E))}async function se(){if(!(x||!Z||!Q.trim())){b(!0);try{await u(Q.trim(),Z)&&(Y(null),ue(""),s())}finally{b(!1)}}}function G(P){P.key==="Escape"&&s()}const X=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return l.jsx("div",{className:"dialog-overlay",onClick:s,children:l.jsxs("div",{className:"dialog app-catalog",onClick:P=>P.stopPropagation(),onKeyDown:G,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:s,children:"✕"})]}),l.jsx("div",{className:"catalog-tabs",children:X.map(P=>l.jsx("button",{className:`catalog-tab${f===P.key?" active":""}`,onClick:()=>h(P.key),children:P.label},P.key))}),l.jsxs("div",{className:"dialog-body catalog-body",children:[f==="examples"&&l.jsx("div",{className:"catalog-examples",children:g===null?l.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):g.length===0?l.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):g.map(P=>{const J=H.has(P.id);return l.jsxs("div",{className:"example-row",children:[l.jsx(wi,{iconNode:P.iconNode,size:14,className:"sidebar-app-icon"}),l.jsxs("div",{className:"example-info",children:[l.jsx("span",{className:"example-title",children:P.title}),P.description&&l.jsx("span",{className:"example-desc",children:P.description})]}),l.jsx("button",{className:"example-install",disabled:J||v===P.id,onClick:()=>Te(P.id),title:J?"Already installed":"Install this example",children:J?"Installed":v===P.id?"Installing…":"Install"})]},P.id)})}),f==="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:_,onChange:P=>C(P.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:P=>I(P.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:A,onChange:P=>U(P.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:O,onChange:P=>W(P.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),l.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!_.trim()||!T.trim(),onClick:Ne,children:[l.jsx(Dr,{size:13})," Create App"]})]}),f==="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:he,type:"file",multiple:!0,onChange:Le}),Z&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"dialog-label",children:["App id",l.jsx("input",{className:"dialog-input",type:"text",value:Q,onChange:P=>ue(P.target.value)})]}),l.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(Z).length," file(s):"," ",Object.keys(Z).slice(0,6).join(", "),Object.keys(Z).length>6?", …":""]})]}),l.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!Z||!Q.trim(),onClick:se,children:[l.jsx(Dw,{size:13})," Import App"]})]})]}),l.jsx("div",{className:"dialog-footer",children:l.jsx("button",{className:"dialog-btn-cancel",onClick:s,children:"Close"})})]})})}function VT(){const t=M(k=>k.showCommandPalette),s=M(k=>k.setShowCommandPalette),r=M(),[o,a]=w.useState(""),[u,f]=w.useState(0),h=w.useRef(null),g=w.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:Dr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:fs,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:To,action:()=>{const b=document.querySelector(".cmd-input");b==null||b.focus()},available:!!r.activeSessionId&&!x},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:Lr,action:()=>r.cancelTurn(),available:x},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:gw,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:ur,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:bw,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:En,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=w.useMemo(()=>{const k=o.toLowerCase().trim(),x=g.filter(b=>b.available);return k?x.filter(b=>b.label.toLowerCase().includes(k)||b.hint.toLowerCase().includes(k)):x},[g,o]);w.useEffect(()=>{t&&(a(""),f(0),setTimeout(()=>{var k;return(k=h.current)==null?void 0:k.focus()},50))},[t]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),f(x=>Math.min(x+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),f(x=>Math.max(x-1,0));else if(k.key==="Enter"){k.preventDefault();const x=m[u];x&&(x.action(),s(!1))}else k.key==="Escape"&&s(!1)}return t?l.jsx("div",{className:"palette-overlay",onClick:()=>s(!1),children:l.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[l.jsxs("div",{className:"palette-search",children:[l.jsx("input",{ref:h,type:"text",placeholder:"Type a command…",value:o,onChange:k=>{a(k.target.value),f(0)},onKeyDown:v}),l.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?l.jsx("div",{className:"palette-empty",children:"No matching commands"}):l.jsx("div",{className:"palette-list",children:m.map((k,x)=>{const b=k.icon;return l.jsxs("div",{className:`palette-item ${x===u?"selected":""}`,onClick:()=>{k.action(),s(!1)},onMouseEnter:()=>f(x),children:[l.jsx("span",{className:"palette-item-icon",children:l.jsx(b,{size:16})}),l.jsx("span",{className:"palette-item-label",children:k.label}),l.jsx("span",{className:"palette-item-hint",children:k.hint}),x===u&&l.jsx(ow,{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 Fm=/^[a-z][a-z0-9-]{1,30}$/,qT=2e3;function GT(){const{showRemoteModal:t,setShowRemoteModal:s,selectSession:r}=M(),[o,a]=w.useState(null),[u,f]=w.useState(null),[h,g]=w.useState(!1),[m,v]=w.useState(!1),[k,x]=w.useState(!1),[b,_]=w.useState(!1),[C,T]=w.useState("main"),[I,A]=w.useState(""),[U,O]=w.useState(!1),[W,Z]=w.useState(null),Y=w.useRef(null);wl(Y,()=>_(!1),b);const Q=m||k,ue=w.useCallback(async()=>{g(!0),f(null);try{const P=await fetch(`${dn()}/remote/status`,{headers:{Accept:"application/json"}});if(!P.ok)throw new Error(`status ${P.status}`);a(await P.json())}catch{a(null),f("Machine management is only available from this machine's local pane.")}finally{g(!1)}},[]);w.useEffect(()=>{t&&(T("main"),Z(null),ue())},[t,ue]);const he=W!==null&&W.state==="running";if(w.useEffect(()=>{if(!he)return;const P=setInterval(async()=>{try{const J=await fetch(`${dn()}/remote/enable`,{headers:{Accept:"application/json"}});J.ok&&Z(await J.json())}catch{}},qT);return()=>clearInterval(P)},[he]),!t)return null;const H=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function Te(P){P.key==="Escape"&&s(!1)}async function Ne(P){if(Fm.test(P)){O(!0);try{const J=await fetch(`${dn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:P})});if(!J.ok)throw new Error(`enable ${J.status}`);Z(await J.json()),T("setup")}catch{f("Could not start the setup — check the daemon logs.")}finally{O(!1)}}}function Le(){W!=null&&W.troubleshootingSessionId&&(r(W.troubleshootingSessionId),s(!1))}async function se(){v(!0);try{await fetch(`${dn()}/remote/disable`,{method:"POST"}),await ue()}catch{f("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function G(){if(_(!1),!!window.confirm(`Remove the tunnel completely?
|
|
607
|
+
}`;function IT(t){return`(${AT})(${JSON.stringify(t)});`}function $m(t){return t.replace(/<\/script/gi,"<\\/script")}function DT(t,s){const r=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let a=-1,u;for(;(u=o.exec(t))!==null;)a=u.index;return a}function zm(t,s,r){const o=DT(t,s);return o===-1?t+r:t.slice(0,o)+r+t.slice(o)}function MT(t,s,r){let o=t;const a=`<script>${$m(s)}<\/script>`;if(/<\/head>/i.test(o)?o=zm(o,"</head>",a):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${a}</head>`):o=`${a}${o}`,r){const u=`<script>${$m(r)}<\/script>`;o=zm(o,"</body>",u)}return o}function LT({appId:t,workspace:s=""}){const r=w.useRef(null),o=w.useRef({pinned:!1,data:null}),[a,u]=w.useState(null),[f,h]=w.useState(null),[g,m]=w.useState([]);w.useEffect(()=>{let b=!0;Xx(t,C=>{var T,I;return(I=(T=r.current)==null?void 0:T.contentWindow)==null?void 0:I.postMessage(C,"*")});const j=async C=>{var O,W,Z,Y,Q,ue,he,H,Te,Ne,Le,se;if(C.source!==((O=r.current)==null?void 0:O.contentWindow))return;const T=C.data;if(!T||T.source!=="agentpane-app")return;if(T.report==="error"){const G={message:String(T.message??"Unknown error"),stack:String(T.stack??"")};m(X=>{const P=X[X.length-1];return P&&P.message===G.message?X:[...X,G].slice(-20)});return}if(typeof T.method!="string")return;let I=!0,A,U;try{switch(T.method){case"getApp":A={id:t};break;case"getState":A=o.current;break;case"setState":{const G=((W=T.params)==null?void 0:W.data)??null,X=await og(t,{data:G},s);o.current=X,A=X;break}case"createSession":{const G=T.params??{},X=await Zu({title:typeof G.title=="string"?G.title:void 0,runtime_type:typeof G.runtime_type=="string"?G.runtime_type:void 0,model:typeof G.model=="string"?G.model:void 0,model_reasoning_effort:typeof G.model_reasoning_effort=="string"?G.model_reasoning_effort:void 0,cwd:typeof G.cwd=="string"?G.cwd:void 0,origin_app_id:t});pu(X.id,t),M.getState().addSession(X),A=X;break}case"submitTurn":{const G=String(((Z=T.params)==null?void 0:Z.sessionId)??""),X=String(((Y=T.params)==null?void 0:Y.prompt)??""),P=await RT(t,(Q=T.params)==null?void 0:Q.attachments,q=>L0(t,q)),J=await Qm(G,X,P.length?P:void 0,{originAppId:t});pu(G,t),A=J;break}case"resolveToolCall":{const G=String(((ue=T.params)==null?void 0:ue.callId)??""),X=(he=T.params)==null?void 0:he.result;await A0(G,X),A={ok:!0};break}case"openSession":{if(M.getState().activeAppTabId!==t)throw new Error("openSession: the app is not on screen — call it from a click in the app");const G=typeof((H=T.params)==null?void 0:H.sessionId)=="string"?T.params.sessionId.trim():"";if(!G)throw new Error("openSession: sessionId is required");try{await M.getState().revealSession(G)}catch(X){throw new Error(`openSession: ${X instanceof Error?X.message:String(X)}`)}A={ok:!0};break}case"uploadFile":{const G=await ET((Te=T.params)==null?void 0:Te.file);try{A=Om(await D0(t,G))}catch(X){throw new Error(`uploadFile: ${X instanceof Error?X.message:String(X)}`)}break}case"getFile":{const G=yv(t,(Ne=T.params)==null?void 0:Ne.ref),X=G?await M0(t,G):null;A=X?Om(X):null;break}default:throw new Error(`Unknown bridge method: ${T.method}`)}}catch(G){I=!1,U=G instanceof Error?G.message:String(G)}(se=(Le=r.current)==null?void 0:Le.contentWindow)==null||se.postMessage({source:"agentpane-host",id:T.id,ok:I,result:A,error:U},"*")};return window.addEventListener("message",j),n0(t,()=>{Nh(t,s).then(C=>{b&&(o.current=C)}).catch(()=>{})}),e0(t,()=>{Th(t).then(C=>{b&&(u(C),m([]))}).catch(()=>{})}),(async()=>{try{const[C,T,I]=await Promise.all([Th(t),Nh(t,s),C0(t).catch(()=>[])]);if(!b)return;o.current=T,I.forEach(A=>pu(A.id,t)),u(C)}catch(C){b&&h(C instanceof Error?C.message:String(C))}})(),()=>{b=!1,Qx(t),t0(t),s0(t),window.removeEventListener("message",j)}},[t,s]);const v=w.useMemo(()=>a?MT(a.html,IT({appId:t,apiOrigin:vv()}),a.js):"",[a,t]);if(f)return l.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",f]});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(b=>b.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((b,j)=>l.jsxs("div",{className:"miniapp-diag",children:[b.file,":",b.line,":",b.column," — ",b.message]},j))]}),l.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",title:`Mini app: ${t}`,srcDoc:v}),g.length>0&&l.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:g.map((b,j)=>l.jsxs("div",{className:"miniapp-rt-error",children:[l.jsx("div",{className:"miniapp-rt-error-message",children:b.message}),b.stack&&l.jsx("pre",{className:"miniapp-rt-error-stack",children:b.stack})]},j))})]})}function PT({appId:t,active:s}){const r=M(x=>x.apps),o=M(x=>x.workspaces),a=M(x=>x.appWorkspaces),u=M(x=>x.setAppWorkspace),f=M(x=>x.setActiveAppTab),h=M(x=>x.startAppEdit),g=r.find(x=>x.id===t),m=a[t]??"",v=o.filter(x=>x.deleted!==1),k=m!==""&&!v.some(x=>x.path===m)?m:null;return l.jsxs("div",{className:`miniapp-view ${s?"":"miniapp-view-hidden"}`,children:[l.jsxs("div",{className:"miniapp-header",children:[l.jsx(wi,{iconNode:g==null?void 0:g.iconNode,size:14,className:"miniapp-header-icon"}),l.jsx("span",{className:"miniapp-header-title",children:(g==null?void 0:g.title)??t}),l.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:x=>u(t,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 h(t),children:[l.jsx(Tw,{size:13}),"Edit"]}),l.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>f(null),children:l.jsx(En,{size:14})})]}),l.jsx("div",{className:"miniapp-body",children:l.jsx(LT,{appId:t,workspace:m},`${t}:${m}`)})]})}function OT({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:a}){const[u,f]=w.useState(!1),h=w.useRef(0),g=w.useRef(0),m=w.useCallback(x=>{const b=x.clientX-h.current,j=t==="left"?g.current+b:g.current-b,C=Math.min(r,Math.max(s,j));a(C)},[t,s,r,a]),v=w.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),f(!1)},[m]);return{onPointerDown:w.useCallback(x=>{var b,j;x.preventDefault(),x.stopPropagation();try{(j=(b=x.currentTarget)==null?void 0:b.setPointerCapture)==null||j.call(b,x.pointerId)}catch{}h.current=x.clientX,g.current=o(),f(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:u}}function Fm({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:a}){const{onPointerDown:u,dragging:f}=OT({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:a});return l.jsx("div",{className:`resize-handle ${t}${f?" dragging":""}`,onPointerDown:u,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${t} panel`,"data-resizing":f?"":void 0})}function $T(){Ot.trackRender("IdeWorkspace");const t=M(v=>v.sidebarWidth),s=M(v=>v.rightPanelWidth),r=M(v=>v.setSidebarWidth),o=M(v=>v.setRightPanelWidth),a=M(v=>v.rightPanelCollapsed),u=M(v=>v.vscodeViewOpen),f=M(v=>v.usageViewOpen),h=M(v=>v.activeAppTabId),g=M(v=>v.openAppTabs);w.useEffect(()=>{const v=()=>{const k=Xa(),{rightPanelWidth:x,setRightPanelWidth:b}=M.getState();x>k&&b(k)};return window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[]);const m=a?`${t}px 6px 1fr ${x0}px`:`${t}px 6px 1fr 6px ${s}px`;return l.jsxs("div",{className:"ide-root",children:[l.jsxs("div",{className:`ide-layout ${u||f?"ide-hidden":""}`,style:{gridTemplateColumns:m},children:[l.jsx(Pk,{}),l.jsx(Fm,{side:"left",minWidth:Du,maxWidth:Mu,getWidth:()=>M.getState().sidebarWidth,setWidth:r}),l.jsxs("div",{className:"ide-center",children:[l.jsx(Ok,{}),l.jsxs("div",{className:"ide-render",children:[g.map(v=>l.jsx(PT,{appId:v,active:h===v},v)),h==null&&l.jsx(Rb,{})]}),l.jsx(Bb,{})]}),!a&&l.jsx(Fm,{side:"right",minWidth:Ya,maxWidth:Xa(),getWidth:()=>M.getState().rightPanelWidth,setWidth:o}),l.jsx(lT,{})]}),u&&l.jsx(vT,{}),f&&l.jsx(TT,{}),l.jsx(dT,{})]})}function zT(){const{showNewSessionDialog:t,setShowNewSessionDialog:s,createSession:r,lastModelConfig:o}=M(),a=(o==null?void 0:o.provider)??"codex",u=(o==null?void 0:o.model)??"",f=(o==null?void 0:o.reasoning)??"",[h,g]=w.useState(""),[m,v]=w.useState(u),[k,x]=w.useState(f),[b,j]=w.useState("");if(!t)return null;const C=_d(a),T=m?Ku(a,m):[];function I(){r({title:h.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:b.trim()||void 0,runtime_type:a}),g(""),j("")}function A(O){O.key==="Escape"&&s(!1)}function U(O){var Y;v(O);const W=Ku(a,O);W.some(Q=>Q.effort===k)||x(Yu(a,O)??((Y=W[0])==null?void 0:Y.effort)??"")}return l.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:l.jsxs("div",{className:"dialog",onClick:O=>O.stopPropagation(),onKeyDown:A,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",children:"New Session"}),l.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:l.jsx(En,{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:h,onChange:O=>g(O.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:m,onChange:O=>U(O.target.value),children:[l.jsx("option",{value:"",children:"Default (Codex picks)"}),C.map(O=>l.jsxs("option",{value:O.slug,children:[O.displayName," — ",O.description]},O.slug))]})]}),T.length>0&&l.jsxs("label",{className:"dialog-label",children:["Thinking Level",l.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:O=>x(O.target.value),children:[l.jsxs("option",{value:"",children:["Default (",Yu(a,m),")"]}),T.map(O=>l.jsx("option",{value:O.effort,children:O.label},O.effort))]})]}),l.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",l.jsx("input",{className:"dialog-input",type:"text",value:b,onChange:O=>j(O.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:()=>s(!1),children:"Cancel"}),l.jsx("button",{className:"dialog-btn-create",onClick:I,children:"Create"})]})]})})}const FT=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,UT=512*1024;function BT(t){const s=t.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(s)?s:""}function WT(){const{appCatalogOpen:t,closeAppCatalog:s,apps:r,installExampleApp:o,createSkeletonApp:a,importAppFolder:u}=M(),[f,h]=w.useState("examples"),[g,m]=w.useState(null),[v,k]=w.useState(null),[x,b]=w.useState(!1),[j,C]=w.useState(""),[T,I]=w.useState(""),[A,U]=w.useState(""),[O,W]=w.useState(""),[Z,Y]=w.useState(null),[Q,ue]=w.useState(""),he=w.useRef(null);if(w.useEffect(()=>{t&&(m(null),j0().then(m).catch(()=>m([])))},[t]),w.useEffect(()=>{he.current&&(he.current.webkitdirectory=!0)},[f]),!t)return null;const H=new Set(r.map(P=>P.id));async function Te(P){k(P);try{await o(P)&&s()}finally{k(null)}}async function Ne(){if(x)return;const P=j.trim(),J=T.trim();if(!(!P||!J)){b(!0);try{await a({id:P,title:J,description:A.trim()||void 0,icon:O.trim()||void 0})&&(C(""),I(""),U(""),W(""),s())}finally{b(!1)}}}async function Le(P){const J=Array.from(P.target.files??[]),q={};let E="";for(const L of J){const K=(L.webkitRelativePath??"").split("/");!E&&K.length>1&&(E=K[0]);const ce=K[K.length-1];if(!(!ce||!FT.test(ce))&&!(L.size>UT))try{q[ce]=await L.text()}catch{}}Y(Object.keys(q).length>0?q:null),ue(BT(E))}async function se(){if(!(x||!Z||!Q.trim())){b(!0);try{await u(Q.trim(),Z)&&(Y(null),ue(""),s())}finally{b(!1)}}}function G(P){P.key==="Escape"&&s()}const X=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return l.jsx("div",{className:"dialog-overlay",onClick:s,children:l.jsxs("div",{className:"dialog app-catalog",onClick:P=>P.stopPropagation(),onKeyDown:G,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:s,children:"✕"})]}),l.jsx("div",{className:"catalog-tabs",children:X.map(P=>l.jsx("button",{className:`catalog-tab${f===P.key?" active":""}`,onClick:()=>h(P.key),children:P.label},P.key))}),l.jsxs("div",{className:"dialog-body catalog-body",children:[f==="examples"&&l.jsx("div",{className:"catalog-examples",children:g===null?l.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):g.length===0?l.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):g.map(P=>{const J=H.has(P.id);return l.jsxs("div",{className:"example-row",children:[l.jsx(wi,{iconNode:P.iconNode,size:14,className:"sidebar-app-icon"}),l.jsxs("div",{className:"example-info",children:[l.jsx("span",{className:"example-title",children:P.title}),P.description&&l.jsx("span",{className:"example-desc",children:P.description})]}),l.jsx("button",{className:"example-install",disabled:J||v===P.id,onClick:()=>Te(P.id),title:J?"Already installed":"Install this example",children:J?"Installed":v===P.id?"Installing…":"Install"})]},P.id)})}),f==="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:j,onChange:P=>C(P.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:P=>I(P.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:A,onChange:P=>U(P.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:O,onChange:P=>W(P.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),l.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!j.trim()||!T.trim(),onClick:Ne,children:[l.jsx(Dr,{size:13})," Create App"]})]}),f==="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:he,type:"file",multiple:!0,onChange:Le}),Z&&l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"dialog-label",children:["App id",l.jsx("input",{className:"dialog-input",type:"text",value:Q,onChange:P=>ue(P.target.value)})]}),l.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(Z).length," file(s):"," ",Object.keys(Z).slice(0,6).join(", "),Object.keys(Z).length>6?", …":""]})]}),l.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:x||!Z||!Q.trim(),onClick:se,children:[l.jsx(Iw,{size:13})," Import App"]})]})]}),l.jsx("div",{className:"dialog-footer",children:l.jsx("button",{className:"dialog-btn-cancel",onClick:s,children:"Close"})})]})})}function HT(){const t=M(k=>k.showCommandPalette),s=M(k=>k.setShowCommandPalette),r=M(),[o,a]=w.useState(""),[u,f]=w.useState(0),h=w.useRef(null),g=w.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,x=xl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:Dr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:fs,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:To,action:()=>{const b=document.querySelector(".cmd-input");b==null||b.focus()},available:!!r.activeSessionId&&!x},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:Lr,action:()=>r.cancelTurn(),available:x},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:mw,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:ur,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:Sw,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:En,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=w.useMemo(()=>{const k=o.toLowerCase().trim(),x=g.filter(b=>b.available);return k?x.filter(b=>b.label.toLowerCase().includes(k)||b.hint.toLowerCase().includes(k)):x},[g,o]);w.useEffect(()=>{t&&(a(""),f(0),setTimeout(()=>{var k;return(k=h.current)==null?void 0:k.focus()},50))},[t]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),f(x=>Math.min(x+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),f(x=>Math.max(x-1,0));else if(k.key==="Enter"){k.preventDefault();const x=m[u];x&&(x.action(),s(!1))}else k.key==="Escape"&&s(!1)}return t?l.jsx("div",{className:"palette-overlay",onClick:()=>s(!1),children:l.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[l.jsxs("div",{className:"palette-search",children:[l.jsx("input",{ref:h,type:"text",placeholder:"Type a command…",value:o,onChange:k=>{a(k.target.value),f(0)},onKeyDown:v}),l.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?l.jsx("div",{className:"palette-empty",children:"No matching commands"}):l.jsx("div",{className:"palette-list",children:m.map((k,x)=>{const b=k.icon;return l.jsxs("div",{className:`palette-item ${x===u?"selected":""}`,onClick:()=>{k.action(),s(!1)},onMouseEnter:()=>f(x),children:[l.jsx("span",{className:"palette-item-icon",children:l.jsx(b,{size:16})}),l.jsx("span",{className:"palette-item-label",children:k.label}),l.jsx("span",{className:"palette-item-hint",children:k.hint}),x===u&&l.jsx(ow,{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 Um=/^[a-z][a-z0-9-]{1,30}$/,VT=2e3;function qT(){const{showRemoteModal:t,setShowRemoteModal:s,selectSession:r}=M(),[o,a]=w.useState(null),[u,f]=w.useState(null),[h,g]=w.useState(!1),[m,v]=w.useState(!1),[k,x]=w.useState(!1),[b,j]=w.useState(!1),[C,T]=w.useState("main"),[I,A]=w.useState(""),[U,O]=w.useState(!1),[W,Z]=w.useState(null),Y=w.useRef(null);Sl(Y,()=>j(!1),b);const Q=m||k,ue=w.useCallback(async()=>{g(!0),f(null);try{const P=await fetch(`${dn()}/remote/status`,{headers:{Accept:"application/json"}});if(!P.ok)throw new Error(`status ${P.status}`);a(await P.json())}catch{a(null),f("Machine management is only available from this machine's local pane.")}finally{g(!1)}},[]);w.useEffect(()=>{t&&(T("main"),Z(null),ue())},[t,ue]);const he=W!==null&&W.state==="running";if(w.useEffect(()=>{if(!he)return;const P=setInterval(async()=>{try{const J=await fetch(`${dn()}/remote/enable`,{headers:{Accept:"application/json"}});J.ok&&Z(await J.json())}catch{}},VT);return()=>clearInterval(P)},[he]),!t)return null;const H=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function Te(P){P.key==="Escape"&&s(!1)}async function Ne(P){if(Um.test(P)){O(!0);try{const J=await fetch(`${dn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:P})});if(!J.ok)throw new Error(`enable ${J.status}`);Z(await J.json()),T("setup")}catch{f("Could not start the setup — check the daemon logs.")}finally{O(!1)}}}function Le(){W!=null&&W.troubleshootingSessionId&&(r(W.troubleshootingSessionId),s(!1))}async function se(){v(!0);try{await fetch(`${dn()}/remote/disable`,{method:"POST"}),await ue()}catch{f("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function G(){if(j(!1),!!window.confirm(`Remove the tunnel completely?
|
|
613
608
|
|
|
614
609
|
This deletes the Cloudflare tunnel, its DNS record and Access app, and this machine's remote state. The mahlas is released.
|
|
615
610
|
|
|
616
|
-
This cannot be undone.`)){x(!0);try{const J=await fetch(`${dn()}/remote/uninstall`,{method:"DELETE"});if(!J.ok)throw new Error(`uninstall ${J.status}`);await ue()}catch{f("Could not remove the tunnel — check the daemon logs.")}finally{x(!1)}}}function X(){if(!W)return l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",l.jsx("input",{className:"dialog-input",value:I,onChange:E=>A(E.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:!
|
|
617
|
-
`)}),W.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:Le,children:"Open troubleshooting session"})})]}),W.state==="failed"&&l.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",W.error]}),l.jsx("div",{className:"dialog-footer",children:l.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void ue(),children:"Refresh status"})})]})}return l.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:l.jsxs("div",{className:"dialog",onClick:P=>P.stopPropagation(),onKeyDown:Te,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",children:"Remote Access"}),l.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:l.jsx(En,{size:16})})]}),l.jsxs("div",{className:"dialog-body",children:[h&&l.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx(Jn,{size:14,className:"spin"})," Loading machine status…"]}),u&&l.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:u}),C==="setup"?X():l.jsxs(l.Fragment,{children:[H&&(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 se(),disabled:Q,children:[m?l.jsx(Jn,{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:()=>_(P=>!P),disabled:Q,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":b,children:k?l.jsx(Jn,{size:14,className:"spin"}):l.jsx(vi,{size:14})}),b&&l.jsx("div",{ref:Y,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 G(),children:[l.jsx(fs,{size:12})," Remove tunnel"]})})]})]}),!H&&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:U,children:[U?l.jsx(Jn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):l.jsx(Eh,{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(Eh,{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 KT={success:nw,error:kl,info:dw,warn:Aw},YT=4e3;function XT({toast:t}){const s=M(f=>f.removeToast),r=KT[t.type],o=w.useRef(null);w.useEffect(()=>{function f(){o.current=setTimeout(()=>s(t.id),YT)}return f(),()=>{o.current&&clearTimeout(o.current)}},[t.id,s]);function a(){o.current&&(clearTimeout(o.current),o.current=null)}function u(){o.current=setTimeout(()=>s(t.id),2e3)}return l.jsxs("div",{className:`toast toast-${t.type}`,onMouseEnter:a,onMouseLeave:u,children:[l.jsx(r,{size:16}),l.jsx("span",{className:"toast-message",children:t.message}),t.undoAction&&l.jsxs("button",{className:"toast-undo",onClick:()=>{var f;(f=t.undoAction)==null||f.call(t),s(t.id)},children:[l.jsx(Iw,{size:12})," ",t.undoLabel||"Undo"]}),l.jsx("button",{className:"toast-close",onClick:()=>s(t.id),children:l.jsx(En,{size:14})})]})}function QT(){const t=M(s=>s.toasts);return t.length===0?null:l.jsx("div",{className:"toast-container",children:t.map(s=>l.jsx(XT,{toast:s},s.id))})}function ZT(){const[t]=w.useState(p0),[s,r]=w.useState(!1);return l.jsxs("main",{className:"daemon-download",children:[l.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),t&&l.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),l.jsxs("a",{className:t?"daemon-download-link":"daemon-download-btn",href:c0,onClick:()=>r(!0),children:[l.jsx(aw,{size:t?13:16}),"Download for Mac"]}),(t||s)&&l.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[l.jsx(Jn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]}),s&&l.jsx("p",{className:"daemon-download-hint",children:"First launch: if macOS blocks Repoburg, open System Settings → Privacy & Security and click Open Anyway."})]})}let Zn=null,xi=null,vo=1e3;const JT=1e4;function eN(){const t=dn();return t?`${t.replace(/^http/,"ws")}/ws`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function Xu(){Zn&&(Zn.readyState===WebSocket.OPEN||Zn.readyState===WebSocket.CONNECTING)||(Zn=new WebSocket(eN()),Zn.onopen=()=>{const t=vo>1e3;if(vo=1e3,M.getState().setWsConnected(!0),M.getState().addLogEntry("INFO","WebSocket connected"),t){const s=M.getState();s.activeSessionId&&(s.refreshActiveSession(),s.addToast("info","WebSocket reconnected — session state reconciled"))}},Zn.onclose=()=>{M.getState().setWsConnected(!1),M.getState().addLogEntry("WARN","WebSocket disconnected"),M.getState().addToast("warn","WebSocket disconnected — reconnecting…"),nN()},Zn.onerror=()=>{},Zn.onmessage=t=>{try{const s=JSON.parse(t.data);Ot.trackWsEvent(typeof s.event=="string"?s.event:"unknown",typeof t.data=="string"?t.data.length:0);const r=sN[s.event];r&&r(s.data)}catch{}})}function tN(){xi&&(clearTimeout(xi),xi=null),Zn&&(Zn.onclose=null,Zn.close(),Zn=null),M.getState().setWsConnected(!1)}function nN(){xi||(xi=window.setTimeout(()=>{xi=null,Xu()},vo),vo=Math.min(vo*2,JT))}const sN={"turn:created":t=>{const s=t;M.getState().onTurnCreated(s.sessionId,s.turn)},"turn:started":t=>{const s=t;Ot.note(`turn:started — ${s.turnId.slice(0,8)}`),M.getState().onTurnStarted(s.sessionId,s.turnId)},"item:started":t=>{const s=t;M.getState().onItemStarted(s.sessionId,s.turnId,s.item)},"item:updated":t=>{const s=t;M.getState().onItemUpdated(s.sessionId,s.turnId,s.item)},"item:completed":t=>{const s=t;M.getState().onItemCompleted(s.sessionId,s.turnId,s.item)},"item:delta":t=>{const s=t;M.getState().onItemDelta(s.sessionId,s.turnId,s.itemId,s.delta)},"turn:completed":t=>{const s=t;Ot.note(`turn:completed — ${s.turnId.slice(0,8)}`),M.getState().onTurnCompleted(s.sessionId,s.turnId,s.usage,s.hasUnreviewed,s.response??void 0)},"turn:tokenUsage":t=>{const s=t;M.getState().onTokenUsageUpdated(s.sessionId,s.turnId,s.usage)},"turn:contextUsage":t=>{const s=t,r={totalTokens:s.totalTokens,contextWindow:s.contextWindow,percentage:s.percentage,...s.autoCompactThreshold?{autoCompactThreshold:s.autoCompactThreshold}:{}};M.getState().onContextUsageUpdated(s.sessionId,r)},"turn:failed":t=>{const s=t;M.getState().onTurnFailed(s.sessionId,s.turnId,s.error,s.resumeState)},"turn:interrupted":t=>{const s=t;Ot.note(`turn:interrupted — ${s.turnId.slice(0,8)} (${s.reason})`),M.getState().onTurnInterrupted(s.sessionId,s.turnId,{reason:s.reason,interruptedAt:s.interruptedAt,attempts:s.attempts,detail:s.detail??null})},"turn:resuming":t=>{const s=t;M.getState().onTurnResuming(s.sessionId,s.turnId,s.attempt)},"turn:resumed":t=>{const s=t;M.getState().onTurnResumed(s.sessionId,s.turnId)},"turn:retrying":t=>{const s=t;M.getState().onTurnRetrying(s.sessionId,s.turnId,{attempt:s.attempt,maxRetries:s.maxRetries,retryDelayMs:s.retryDelayMs,errorStatus:s.errorStatus??null,error:s.error??null})},"turn:cancelled":t=>{const s=t;M.getState().onTurnCancelled(s.sessionId,s.turnId)},"session:title":t=>{const s=t;M.getState().onSessionTitle(s.sessionId,s.title)},"session:touched":t=>{const s=t;M.getState().onSessionTouched(s.sessionId)},"session:updated":t=>{const s=t;M.getState().onSessionUpdated(s.session)},background_tasks:t=>{const s=t;Ot.note(`background_tasks — ${s.tasks.length} live (${s.tasks.map(r=>r.task_type).join(", ")||"none"})`),M.getState().onBackgroundTasksChanged(s.sessionId,s.tasks)},"background_tasks:snapshot":t=>{const s=t;M.getState().onBackgroundTasksSnapshot(s.sessions??{})},"thread:created":t=>{const s=t;M.getState().onThreadCreated(s.sessionId,s.thread,s.turn)},"thread:followup":t=>{const s=t;M.getState().onThreadFollowup(s.sessionId,s.threadId,s.turn)},"thread:resolved":t=>{const s=t;M.getState().onThreadResolved(s.sessionId,s.threadId,s.status)},"thread:deleted":t=>{const s=t;M.getState().onThreadDeleted(s.sessionId,s.threadId)},"app:tool_call":t=>{const s=t;Qx(s.appId,s.callId,s.tool,s.args??{})},"app:source:updated":t=>{r0(t.appId)},"app:state_changed":t=>{s0(t.appId)}};function rN(){const t=M(s=>s.init);return w.useEffect(()=>{yx();function s(){t(),Xu()}const{daemonStatus:r,setDaemonStatus:o}=M.getState();let a=null;r==="ready"?s():a=m0({onMissing:()=>o("missing"),onReady:()=>{o("ready"),s()}});function u(){if(document.visibilityState!=="visible")return;const f=M.getState(),h=f.activeSessionId;if(!h)return;const g=f.sessionDetails[h];f.wsConnected||Xu(),g&&g.is_running===1&&(f.refreshActiveSession(),f.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",u),()=>{a==null||a(),tN(),document.removeEventListener("visibilitychange",u)}},[t]),null}function iN(){const t=M(u=>u.loading),s=M(u=>u.error),r=M(u=>u.sessions),o=M(u=>u.daemonStatus),a=M(u=>u.setShowCommandPalette);return w.useEffect(()=>Ot.start(),[]),w.useEffect(()=>{function u(f){(f.metaKey||f.ctrlKey)&&f.key==="k"&&(f.preventDefault(),a(!0))}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[a]),l.jsxs(l.Fragment,{children:[l.jsx(rN,{}),o==="missing"?l.jsx(ZT,{}):o==="checking"||t&&r.length===0?l.jsx("div",{className:"empty-state",children:"Loading sessions…"}):s&&r.length===0?l.jsxs("div",{className:"empty-state",children:["Error: ",s]}):l.jsxs(l.Fragment,{children:[l.jsx(zT,{}),l.jsx(FT,{}),l.jsx(HT,{}),l.jsx(GT,{}),l.jsx(VT,{}),l.jsx(QT,{})]})]})}lx.createRoot(document.getElementById("root")).render(l.jsx(rt.StrictMode,{children:l.jsx(iN,{})}));
|
|
611
|
+
This cannot be undone.`)){x(!0);try{const J=await fetch(`${dn()}/remote/uninstall`,{method:"DELETE"});if(!J.ok)throw new Error(`uninstall ${J.status}`);await ue()}catch{f("Could not remove the tunnel — check the daemon logs.")}finally{x(!1)}}}function X(){if(!W)return l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",l.jsx("input",{className:"dialog-input",value:I,onChange:E=>A(E.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:!Um.test(I)||U,onClick:()=>void Ne(I),children:[U?l.jsx(Jn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const P=["detect","provision","install","verify","ready"],J=P.indexOf(W.step),q=W.state==="ready";return l.jsxs(l.Fragment,{children:[W.state==="running"&&l.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx(Jn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),W.state==="ready"&&l.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[l.jsx(Os,{size:14})," Setup complete — you can close this window."]}),W.state==="ready"&&W.hostname&&l.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",l.jsx("a",{href:`https://${W.hostname}`,target:"_blank",rel:"noreferrer",children:W.hostname})]}),l.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:P.map((E,L)=>{const de=q||J>-1&&L<J,K=!q&&L===J&&W.state==="running";return l.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:de||K?1:.4,color:de?"var(--green)":void 0},children:[de?l.jsx(Os,{size:13}):K?l.jsx(Jn,{size:13,className:"spin"}):l.jsx(rw,{size:9,style:{marginLeft:2,marginRight:2}}),E]},E)})}),W.logs.length>0&&l.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:W.logs.slice(-3).map(E=>E.message).join(`
|
|
612
|
+
`)}),W.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:Le,children:"Open troubleshooting session"})})]}),W.state==="failed"&&l.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",W.error]}),l.jsx("div",{className:"dialog-footer",children:l.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void ue(),children:"Refresh status"})})]})}return l.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:l.jsxs("div",{className:"dialog",onClick:P=>P.stopPropagation(),onKeyDown:Te,children:[l.jsxs("div",{className:"dialog-header",children:[l.jsx("span",{className:"dialog-title",children:"Remote Access"}),l.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:l.jsx(En,{size:16})})]}),l.jsxs("div",{className:"dialog-body",children:[h&&l.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[l.jsx(Jn,{size:14,className:"spin"})," Loading machine status…"]}),u&&l.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:u}),C==="setup"?X():l.jsxs(l.Fragment,{children:[H&&(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 se(),disabled:Q,children:[m?l.jsx(Jn,{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:()=>j(P=>!P),disabled:Q,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":b,children:k?l.jsx(Jn,{size:14,className:"spin"}):l.jsx(vi,{size:14})}),b&&l.jsx("div",{ref:Y,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 G(),children:[l.jsx(fs,{size:12})," Remove tunnel"]})})]})]}),!H&&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:U,children:[U?l.jsx(Jn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):l.jsx(Rh,{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(Rh,{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 GT={success:nw,error:bl,info:uw,warn:Rw},KT=4e3;function YT({toast:t}){const s=M(f=>f.removeToast),r=GT[t.type],o=w.useRef(null);w.useEffect(()=>{function f(){o.current=setTimeout(()=>s(t.id),KT)}return f(),()=>{o.current&&clearTimeout(o.current)}},[t.id,s]);function a(){o.current&&(clearTimeout(o.current),o.current=null)}function u(){o.current=setTimeout(()=>s(t.id),2e3)}return l.jsxs("div",{className:`toast toast-${t.type}`,onMouseEnter:a,onMouseLeave:u,children:[l.jsx(r,{size:16}),l.jsx("span",{className:"toast-message",children:t.message}),t.undoAction&&l.jsxs("button",{className:"toast-undo",onClick:()=>{var f;(f=t.undoAction)==null||f.call(t),s(t.id)},children:[l.jsx(Aw,{size:12})," ",t.undoLabel||"Undo"]}),l.jsx("button",{className:"toast-close",onClick:()=>s(t.id),children:l.jsx(En,{size:14})})]})}function XT(){const t=M(s=>s.toasts);return t.length===0?null:l.jsx("div",{className:"toast-container",children:t.map(s=>l.jsx(YT,{toast:s},s.id))})}function QT(){const[t]=w.useState(p0),[s,r]=w.useState(!1),[o,a]=w.useState(!1),u=w.useRef(void 0);w.useEffect(()=>()=>clearTimeout(u.current),[]);async function f(){await ul(vh)&&(r(!0),a(!0),clearTimeout(u.current),u.current=setTimeout(()=>r(!1),1500))}return l.jsxs("main",{className:"daemon-download",children:[l.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),t&&l.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),l.jsxs("div",{className:"daemon-download-install",children:[t&&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:vh}),l.jsx("button",{type:"button",className:`daemon-download-copy${s?" copied":""}`,onClick:()=>void f(),"aria-label":"Copy the install command",title:s?"Copied":"Copy",children:s?l.jsx(Os,{size:15}):l.jsx(nl,{size:15})})]}),!t&&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."}),(t||o)&&l.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[l.jsx(Jn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Zn=null,xi=null,vo=1e3;const ZT=1e4;function JT(){const t=dn();return t?`${t.replace(/^http/,"ws")}/ws`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function Xu(){Zn&&(Zn.readyState===WebSocket.OPEN||Zn.readyState===WebSocket.CONNECTING)||(Zn=new WebSocket(JT()),Zn.onopen=()=>{const t=vo>1e3;if(vo=1e3,M.getState().setWsConnected(!0),M.getState().addLogEntry("INFO","WebSocket connected"),t){const s=M.getState();s.activeSessionId&&(s.refreshActiveSession(),s.addToast("info","WebSocket reconnected — session state reconciled"))}},Zn.onclose=()=>{M.getState().setWsConnected(!1),M.getState().addLogEntry("WARN","WebSocket disconnected"),M.getState().addToast("warn","WebSocket disconnected — reconnecting…"),tN()},Zn.onerror=()=>{},Zn.onmessage=t=>{try{const s=JSON.parse(t.data);Ot.trackWsEvent(typeof s.event=="string"?s.event:"unknown",typeof t.data=="string"?t.data.length:0);const r=nN[s.event];r&&r(s.data)}catch{}})}function eN(){xi&&(clearTimeout(xi),xi=null),Zn&&(Zn.onclose=null,Zn.close(),Zn=null),M.getState().setWsConnected(!1)}function tN(){xi||(xi=window.setTimeout(()=>{xi=null,Xu()},vo),vo=Math.min(vo*2,ZT))}const nN={"turn:created":t=>{const s=t;M.getState().onTurnCreated(s.sessionId,s.turn)},"turn:started":t=>{const s=t;Ot.note(`turn:started — ${s.turnId.slice(0,8)}`),M.getState().onTurnStarted(s.sessionId,s.turnId)},"item:started":t=>{const s=t;M.getState().onItemStarted(s.sessionId,s.turnId,s.item)},"item:updated":t=>{const s=t;M.getState().onItemUpdated(s.sessionId,s.turnId,s.item)},"item:completed":t=>{const s=t;M.getState().onItemCompleted(s.sessionId,s.turnId,s.item)},"item:delta":t=>{const s=t;M.getState().onItemDelta(s.sessionId,s.turnId,s.itemId,s.delta)},"turn:completed":t=>{const s=t;Ot.note(`turn:completed — ${s.turnId.slice(0,8)}`),M.getState().onTurnCompleted(s.sessionId,s.turnId,s.usage,s.hasUnreviewed,s.response??void 0)},"turn:tokenUsage":t=>{const s=t;M.getState().onTokenUsageUpdated(s.sessionId,s.turnId,s.usage)},"turn:contextUsage":t=>{const s=t,r={totalTokens:s.totalTokens,contextWindow:s.contextWindow,percentage:s.percentage,...s.autoCompactThreshold?{autoCompactThreshold:s.autoCompactThreshold}:{}};M.getState().onContextUsageUpdated(s.sessionId,r)},"turn:failed":t=>{const s=t;M.getState().onTurnFailed(s.sessionId,s.turnId,s.error,s.resumeState)},"turn:interrupted":t=>{const s=t;Ot.note(`turn:interrupted — ${s.turnId.slice(0,8)} (${s.reason})`),M.getState().onTurnInterrupted(s.sessionId,s.turnId,{reason:s.reason,interruptedAt:s.interruptedAt,attempts:s.attempts,detail:s.detail??null})},"turn:resuming":t=>{const s=t;M.getState().onTurnResuming(s.sessionId,s.turnId,s.attempt)},"turn:resumed":t=>{const s=t;M.getState().onTurnResumed(s.sessionId,s.turnId)},"turn:retrying":t=>{const s=t;M.getState().onTurnRetrying(s.sessionId,s.turnId,{attempt:s.attempt,maxRetries:s.maxRetries,retryDelayMs:s.retryDelayMs,errorStatus:s.errorStatus??null,error:s.error??null})},"turn:cancelled":t=>{const s=t;M.getState().onTurnCancelled(s.sessionId,s.turnId)},"session:title":t=>{const s=t;M.getState().onSessionTitle(s.sessionId,s.title)},"session:touched":t=>{const s=t;M.getState().onSessionTouched(s.sessionId)},"session:updated":t=>{const s=t;M.getState().onSessionUpdated(s.session)},background_tasks:t=>{const s=t;Ot.note(`background_tasks — ${s.tasks.length} live (${s.tasks.map(r=>r.task_type).join(", ")||"none"})`),M.getState().onBackgroundTasksChanged(s.sessionId,s.tasks)},"background_tasks:snapshot":t=>{const s=t;M.getState().onBackgroundTasksSnapshot(s.sessions??{})},"thread:created":t=>{const s=t;M.getState().onThreadCreated(s.sessionId,s.thread,s.turn)},"thread:followup":t=>{const s=t;M.getState().onThreadFollowup(s.sessionId,s.threadId,s.turn)},"thread:resolved":t=>{const s=t;M.getState().onThreadResolved(s.sessionId,s.threadId,s.status)},"thread:deleted":t=>{const s=t;M.getState().onThreadDeleted(s.sessionId,s.threadId)},"app:tool_call":t=>{const s=t;Zx(s.appId,s.callId,s.tool,s.args??{})},"app:source:updated":t=>{i0(t.appId)},"app:state_changed":t=>{r0(t.appId)}};function sN(){const t=M(s=>s.init);return w.useEffect(()=>{xx();function s(){t(),Xu()}const{daemonStatus:r,setDaemonStatus:o}=M.getState();let a=null;r==="ready"?s():a=m0({onMissing:()=>o("missing"),onReady:()=>{o("ready"),s()}});function u(){if(document.visibilityState!=="visible")return;const f=M.getState(),h=f.activeSessionId;if(!h)return;const g=f.sessionDetails[h];f.wsConnected||Xu(),g&&g.is_running===1&&(f.refreshActiveSession(),f.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",u),()=>{a==null||a(),eN(),document.removeEventListener("visibilitychange",u)}},[t]),null}function rN(){const t=M(u=>u.loading),s=M(u=>u.error),r=M(u=>u.sessions),o=M(u=>u.daemonStatus),a=M(u=>u.setShowCommandPalette);return w.useEffect(()=>Ot.start(),[]),w.useEffect(()=>{function u(f){(f.metaKey||f.ctrlKey)&&f.key==="k"&&(f.preventDefault(),a(!0))}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[a]),l.jsxs(l.Fragment,{children:[l.jsx(sN,{}),o==="missing"?l.jsx(QT,{}):o==="checking"||t&&r.length===0?l.jsx("div",{className:"empty-state",children:"Loading sessions…"}):s&&r.length===0?l.jsxs("div",{className:"empty-state",children:["Error: ",s]}):l.jsxs(l.Fragment,{children:[l.jsx($T,{}),l.jsx(zT,{}),l.jsx(WT,{}),l.jsx(qT,{}),l.jsx(HT,{}),l.jsx(XT,{})]})]})}cx.createRoot(document.getElementById("root")).render(l.jsx(rt.StrictMode,{children:l.jsx(rN,{})}));
|