@mono-agent/web 0.20.9 → 0.20.11
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/dist/contracts.d.ts +7 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/service.d.ts +17 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +130 -4
- package/dist/service.js.map +1 -1
- package/dist/store.d.ts +27 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +43 -2
- package/dist/store.js.map +1 -1
- package/package.json +4 -4
- package/webapp/dist/assets/{assistant-ui-CxqQJmH9.js → assistant-ui-BzN2E6n6.js} +1 -1
- package/webapp/dist/assets/index-BT463dRM.css +1 -0
- package/webapp/dist/assets/index-Co-qDQPq.js +155 -0
- package/webapp/dist/assets/{markdown-8pwMczg6.js → markdown-Vq23xgh7.js} +1 -1
- package/webapp/dist/index.html +4 -4
- package/webapp/dist/sw.js +1 -1
- package/webapp/dist/assets/index-BWVWkCJ2.js +0 -152
- package/webapp/dist/assets/index-SugvifaX.css +0 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import{b as $p,c as iR,r as v,j as f,d as tu,e as kn,f as qt,R as lR,h as Lp,k as wo,l as gr,m as cR,n as $s,o as Af,p as uR,q as dR,s as fR,t as pR,v as hR,w as qp,x as mR,y as gR,z as vR,A as ji,B as yR,C as bR,D as Oy,E as Ny,F as SR,G as xR,H as wR,I as Hp,J as da,P as Ls,K as ER,L as TR,M as _R,N as RR,O as Ii,Q as My,S as cn,T as Is,U as CR,V as zn,W as AR,X as kf,Y as B0,Z as kR,_ as jR,$ as OR,a0 as NR,a1 as Z0,a2 as MR,a3 as aa,a4 as jf,a5 as bi,a6 as zR,a7 as IR}from"./assistant-ui-BzN2E6n6.js";import{M as DR,r as UR}from"./markdown-Vq23xgh7.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function s(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(i){if(i.ep)return;i.ep=!0;const c=s(i);fetch(i.href,c)}})();var Of={exports:{}},Si={},Nf={exports:{}},Mf={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* scheduler.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var zy;function PR(){return zy||(zy=1,(function(e){function n(z,G){var Q=z.length;z.push(G);e:for(;0<Q;){var q=Q-1>>>1,re=z[q];if(0<i(re,G))z[q]=G,z[Q]=re,Q=q;else break e}}function s(z){return z.length===0?null:z[0]}function r(z){if(z.length===0)return null;var G=z[0],Q=z.pop();if(Q!==G){z[0]=Q;e:for(var q=0,re=z.length,Se=re>>>1;q<Se;){var D=2*(q+1)-1,ne=z[D],de=D+1,ae=z[de];if(0>i(ne,Q))de<re&&0>i(ae,ne)?(z[q]=ae,z[de]=Q,q=de):(z[q]=ne,z[D]=Q,q=D);else if(de<re&&0>i(ae,Q))z[q]=ae,z[de]=Q,q=de;else break e}}return G}function i(z,G){var Q=z.sortIndex-G.sortIndex;return Q!==0?Q:z.id-G.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var g=[],m=[],y=1,b=null,x=3,w=!1,E=!1,C=!1,A=!1,j=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function R(z){for(var G=s(m);G!==null;){if(G.callback===null)r(m);else if(G.startTime<=z)r(m),G.sortIndex=G.expirationTime,n(g,G);else break;G=s(m)}}function M(z){if(C=!1,R(z),!E)if(s(g)!==null)E=!0,U||(U=!0,P());else{var G=s(m);G!==null&&ee(M,G.startTime-z)}}var U=!1,k=-1,Y=5,H=-1;function $(){return A?!0:!(e.unstable_now()-H<Y)}function B(){if(A=!1,U){var z=e.unstable_now();H=z;var G=!0;try{e:{E=!1,C&&(C=!1,_(k),k=-1),w=!0;var Q=x;try{t:{for(R(z),b=s(g);b!==null&&!(b.expirationTime>z&&$());){var q=b.callback;if(typeof q=="function"){b.callback=null,x=b.priorityLevel;var re=q(b.expirationTime<=z);if(z=e.unstable_now(),typeof re=="function"){b.callback=re,R(z),G=!0;break t}b===s(g)&&r(g),R(z)}else r(g);b=s(g)}if(b!==null)G=!0;else{var Se=s(m);Se!==null&&ee(M,Se.startTime-z),G=!1}}break e}finally{b=null,x=Q,w=!1}G=void 0}}finally{G?P():U=!1}}}var P;if(typeof O=="function")P=function(){O(B)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,le=oe.port2;oe.port1.onmessage=B,P=function(){le.postMessage(null)}}else P=function(){j(B,0)};function ee(z,G){k=j(function(){z(e.unstable_now())},G)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(z){switch(x){case 1:case 2:case 3:var G=3;break;default:G=x}var Q=x;x=G;try{return z()}finally{x=Q}},e.unstable_requestPaint=function(){A=!0},e.unstable_runWithPriority=function(z,G){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var Q=x;x=z;try{return G()}finally{x=Q}},e.unstable_scheduleCallback=function(z,G,Q){var q=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?q+Q:q):Q=q,z){case 1:var re=-1;break;case 2:re=250;break;case 5:re=1073741823;break;case 4:re=1e4;break;default:re=5e3}return re=Q+re,z={id:y++,callback:G,priorityLevel:z,startTime:Q,expirationTime:re,sortIndex:-1},Q>q?(z.sortIndex=Q,n(m,z),s(g)===null&&z===s(m)&&(C?(_(k),k=-1):C=!0,ee(M,Q-q))):(z.sortIndex=re,n(g,z),E||w||(E=!0,U||(U=!0,P()))),z},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(z){var G=x;return function(){var Q=x;x=G;try{return z.apply(this,arguments)}finally{x=Q}}}})(Mf)),Mf}var Iy;function $R(){return Iy||(Iy=1,Nf.exports=PR()),Nf.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-dom-client.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Dy;function LR(){if(Dy)return Si;Dy=1;var e=$R(),n=$p(),s=iR();function r(t){var o="https://react.dev/errors/"+t;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)o+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var o=t,a=t;if(t.alternate)for(;o.return;)o=o.return;else{t=o;do o=t,(o.flags&4098)!==0&&(a=o.return),t=o.return;while(t)}return o.tag===3?a:null}function d(t){if(t.tag===13){var o=t.memoizedState;if(o===null&&(t=t.alternate,t!==null&&(o=t.memoizedState)),o!==null)return o.dehydrated}return null}function p(t){if(c(t)!==t)throw Error(r(188))}function g(t){var o=t.alternate;if(!o){if(o=c(t),o===null)throw Error(r(188));return o!==t?null:t}for(var a=t,l=o;;){var u=a.return;if(u===null)break;var h=u.alternate;if(h===null){if(l=u.return,l!==null){a=l;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===a)return p(u),t;if(h===l)return p(u),o;h=h.sibling}throw Error(r(188))}if(a.return!==l.return)a=u,l=h;else{for(var S=!1,T=u.child;T;){if(T===a){S=!0,a=u,l=h;break}if(T===l){S=!0,l=u,a=h;break}T=T.sibling}if(!S){for(T=h.child;T;){if(T===a){S=!0,a=h,l=u;break}if(T===l){S=!0,l=h,a=u;break}T=T.sibling}if(!S)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?t:o}function m(t){var o=t.tag;if(o===5||o===26||o===27||o===6)return t;for(t=t.child;t!==null;){if(o=m(t),o!==null)return o;t=t.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),j=Symbol.for("react.provider"),_=Symbol.for("react.consumer"),O=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),U=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function P(t){return t===null||typeof t!="object"?null:(t=B&&t[B]||t["@@iterator"],typeof t=="function"?t:null)}var oe=Symbol.for("react.client.reference");function le(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===oe?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case E:return"Fragment";case A:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case U:return"SuspenseList";case H:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case O:return(t.displayName||"Context")+".Provider";case _:return(t._context.displayName||"Context")+".Consumer";case R:var o=t.render;return t=t.displayName,t||(t=o.displayName||o.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case k:return o=t.displayName||null,o!==null?o:le(t.type)||"Memo";case Y:o=t._payload,t=t._init;try{return le(t(o))}catch{}}return null}var ee=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},q=[],re=-1;function Se(t){return{current:t}}function D(t){0>re||(t.current=q[re],q[re]=null,re--)}function ne(t,o){re++,q[re]=t.current,t.current=o}var de=Se(null),ae=Se(null),me=Se(null),Ce=Se(null);function be(t,o){switch(ne(me,o),ne(ae,t),ne(de,null),o.nodeType){case 9:case 11:t=(t=o.documentElement)&&(t=t.namespaceURI)?ry(t):0;break;default:if(t=o.tagName,o=o.namespaceURI)o=ry(o),t=ay(o,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}D(de),ne(de,t)}function xe(){D(de),D(ae),D(me)}function qe(t){t.memoizedState!==null&&ne(Ce,t);var o=de.current,a=ay(o,t.type);o!==a&&(ne(ae,t),ne(de,a))}function it(t){ae.current===t&&(D(de),D(ae)),Ce.current===t&&(D(Ce),hi._currentValue=Q)}var Me=Object.prototype.hasOwnProperty,Te=e.unstable_scheduleCallback,$e=e.unstable_cancelCallback,_e=e.unstable_shouldYield,Be=e.unstable_requestPaint,ge=e.unstable_now,Oe=e.unstable_getCurrentPriorityLevel,Re=e.unstable_ImmediatePriority,Ge=e.unstable_UserBlockingPriority,tt=e.unstable_NormalPriority,ye=e.unstable_LowPriority,Je=e.unstable_IdlePriority,we=e.log,Ee=e.unstable_setDisableYieldValue,rt=null,Ne=null;function Fe(t){if(typeof we=="function"&&Ee(t),Ne&&typeof Ne.setStrictMode=="function")try{Ne.setStrictMode(rt,t)}catch{}}var nt=Math.clz32?Math.clz32:fn,ht=Math.log,zt=Math.LN2;function fn(t){return t>>>=0,t===0?32:31-(ht(t)/zt|0)|0}var kt=256,Tn=4194304;function on(t){var o=t&42;if(o!==0)return o;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function no(t,o,a){var l=t.pendingLanes;if(l===0)return 0;var u=0,h=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var T=l&134217727;return T!==0?(l=T&~h,l!==0?u=on(l):(S&=T,S!==0?u=on(S):a||(a=T&~t,a!==0&&(u=on(a))))):(T=l&~h,T!==0?u=on(T):S!==0?u=on(S):a||(a=l&~t,a!==0&&(u=on(a)))),u===0?0:o!==0&&o!==u&&(o&h)===0&&(h=u&-u,a=o&-o,h>=a||h===32&&(a&4194048)!==0)?o:u}function Zn(t,o){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&o)===0}function Io(t,o){switch(t){case 1:case 2:case 4:case 8:case 64:return o+250;case 16:case 32: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 o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function at(){var t=kt;return kt<<=1,(kt&4194048)===0&&(kt=256),t}function Kt(){var t=Tn;return Tn<<=1,(Tn&62914560)===0&&(Tn=4194304),t}function yn(t){for(var o=[],a=0;31>a;a++)o.push(t);return o}function Ft(t,o){t.pendingLanes|=o,o!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function _n(t,o,a,l,u,h){var S=t.pendingLanes;t.pendingLanes=a,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=a,t.entangledLanes&=a,t.errorRecoveryDisabledLanes&=a,t.shellSuspendCounter=0;var T=t.entanglements,N=t.expirationTimes,F=t.hiddenUpdates;for(a=S&~a;0<a;){var ue=31-nt(a),pe=1<<ue;T[ue]=0,N[ue]=-1;var X=F[ue];if(X!==null)for(F[ue]=null,ue=0;ue<X.length;ue++){var W=X[ue];W!==null&&(W.lane&=-536870913)}a&=~pe}l!==0&&sn(t,l,0),h!==0&&u===0&&t.tag!==0&&(t.suspendedLanes|=h&~(S&~o))}function sn(t,o,a){t.pendingLanes|=o,t.suspendedLanes&=~o;var l=31-nt(o);t.entangledLanes|=o,t.entanglements[l]=t.entanglements[l]|1073741824|a&4194090}function rn(t,o){var a=t.entangledLanes|=o;for(t=t.entanglements;a;){var l=31-nt(a),u=1<<l;u&o|t[l]&o&&(t[l]|=o),a&=~u}}function Vn(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function vo(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Do(){var t=G.p;return t!==0?t:(t=window.event,t===void 0?32:_y(t.type))}function is(t,o){var a=G.p;try{return G.p=t,o()}finally{G.p=a}}var Rn=Math.random().toString(36).slice(2),We="__reactFiber$"+Rn,Ut="__reactProps$"+Rn,pn="__reactContainer$"+Rn,To="__reactEvents$"+Rn,Zs="__reactListeners$"+Rn,_o="__reactHandles$"+Rn,Uo="__reactResources$"+Rn,Ro="__reactMarker$"+Rn;function ls(t){delete t[We],delete t[Ut],delete t[To],delete t[Zs],delete t[_o]}function Po(t){var o=t[We];if(o)return o;for(var a=t.parentNode;a;){if(o=a[pn]||a[We]){if(a=o.alternate,o.child!==null||a!==null&&a.child!==null)for(t=uy(t);t!==null;){if(a=t[We])return a;t=uy(t)}return o}t=a,a=t.parentNode}return null}function $o(t){if(t=t[We]||t[pn]){var o=t.tag;if(o===5||o===6||o===13||o===26||o===27||o===3)return t}return null}function cs(t){var o=t.tag;if(o===5||o===26||o===27||o===6)return t.stateNode;throw Error(r(33))}function Lo(t){var o=t[Uo];return o||(o=t[Uo]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function Xt(t){t[Ro]=!0}var Ra=new Set,ul={};function J(t,o){se(t,o),se(t+"Capture",o)}function se(t,o){for(ul[t]=o,t=0;t<o.length;t++)Ra.add(o[t])}var ve=RegExp("^[: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]*$"),ie={},he={};function Le(t){return Me.call(he,t)?!0:Me.call(ie,t)?!1:ve.test(t)?he[t]=!0:(ie[t]=!0,!1)}function St(t,o,a){if(Le(o))if(a===null)t.removeAttribute(o);else{switch(typeof a){case"undefined":case"function":case"symbol":t.removeAttribute(o);return;case"boolean":var l=o.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){t.removeAttribute(o);return}}t.setAttribute(o,""+a)}}function It(t,o,a){if(a===null)t.removeAttribute(o);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(o);return}t.setAttribute(o,""+a)}}function In(t,o,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttributeNS(o,a,""+l)}}var Vs,Jh;function _r(t){if(Vs===void 0)try{throw Error()}catch(a){var o=a.stack.trim().match(/\n( *(at )?)/);Vs=o&&o[1]||"",Jh=-1<a.stack.indexOf(`
|
|
18
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
19
|
+
`+Vs+t+Jh}var wu=!1;function Eu(t,o){if(!t||wu)return"";wu=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(o){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(W){var X=W}Reflect.construct(t,[],pe)}else{try{pe.call()}catch(W){X=W}t.call(pe.prototype)}}else{try{throw Error()}catch(W){X=W}(pe=t())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(W){if(W&&X&&typeof W.stack=="string")return[W.stack,X.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=l.DetermineComponentFrameRoot(),S=h[0],T=h[1];if(S&&T){var N=S.split(`
|
|
20
|
+
`),F=T.split(`
|
|
21
|
+
`);for(u=l=0;l<N.length&&!N[l].includes("DetermineComponentFrameRoot");)l++;for(;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;if(l===N.length||u===F.length)for(l=N.length-1,u=F.length-1;1<=l&&0<=u&&N[l]!==F[u];)u--;for(;1<=l&&0<=u;l--,u--)if(N[l]!==F[u]){if(l!==1||u!==1)do if(l--,u--,0>u||N[l]!==F[u]){var ue=`
|
|
22
|
+
`+N[l].replace(" at new "," at ");return t.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",t.displayName)),ue}while(1<=l&&0<=u);break}}}finally{wu=!1,Error.prepareStackTrace=a}return(a=t?t.displayName||t.name:"")?_r(a):""}function tT(t){switch(t.tag){case 26:case 27:case 5:return _r(t.type);case 16:return _r("Lazy");case 13:return _r("Suspense");case 19:return _r("SuspenseList");case 0:case 15:return Eu(t.type,!1);case 11:return Eu(t.type.render,!1);case 1:return Eu(t.type,!0);case 31:return _r("Activity");default:return""}}function Wh(t){try{var o="";do o+=tT(t),t=t.return;while(t);return o}catch(a){return`
|
|
23
|
+
Error generating stack: `+a.message+`
|
|
24
|
+
`+a.stack}}function oo(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function em(t){var o=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function nT(t){var o=em(t)?"checked":"value",a=Object.getOwnPropertyDescriptor(t.constructor.prototype,o),l=""+t[o];if(!t.hasOwnProperty(o)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var u=a.get,h=a.set;return Object.defineProperty(t,o,{configurable:!0,get:function(){return u.call(this)},set:function(S){l=""+S,h.call(this,S)}}),Object.defineProperty(t,o,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(S){l=""+S},stopTracking:function(){t._valueTracker=null,delete t[o]}}}}function dl(t){t._valueTracker||(t._valueTracker=nT(t))}function tm(t){if(!t)return!1;var o=t._valueTracker;if(!o)return!0;var a=o.getValue(),l="";return t&&(l=em(t)?t.checked?"true":"false":t.value),t=l,t!==a?(o.setValue(t),!0):!1}function fl(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var oT=/[\n"\\]/g;function so(t){return t.replace(oT,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function Tu(t,o,a,l,u,h,S,T){t.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.type=S:t.removeAttribute("type"),o!=null?S==="number"?(o===0&&t.value===""||t.value!=o)&&(t.value=""+oo(o)):t.value!==""+oo(o)&&(t.value=""+oo(o)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),o!=null?_u(t,S,oo(o)):a!=null?_u(t,S,oo(a)):l!=null&&t.removeAttribute("value"),u==null&&h!=null&&(t.defaultChecked=!!h),u!=null&&(t.checked=u&&typeof u!="function"&&typeof u!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?t.name=""+oo(T):t.removeAttribute("name")}function nm(t,o,a,l,u,h,S,T){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(t.type=h),o!=null||a!=null){if(!(h!=="submit"&&h!=="reset"||o!=null))return;a=a!=null?""+oo(a):"",o=o!=null?""+oo(o):a,T||o===t.value||(t.value=o),t.defaultValue=o}l=l??u,l=typeof l!="function"&&typeof l!="symbol"&&!!l,t.checked=T?t.checked:!!l,t.defaultChecked=!!l,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S)}function _u(t,o,a){o==="number"&&fl(t.ownerDocument)===t||t.defaultValue===""+a||(t.defaultValue=""+a)}function Rr(t,o,a,l){if(t=t.options,o){o={};for(var u=0;u<a.length;u++)o["$"+a[u]]=!0;for(a=0;a<t.length;a++)u=o.hasOwnProperty("$"+t[a].value),t[a].selected!==u&&(t[a].selected=u),u&&l&&(t[a].defaultSelected=!0)}else{for(a=""+oo(a),o=null,u=0;u<t.length;u++){if(t[u].value===a){t[u].selected=!0,l&&(t[u].defaultSelected=!0);return}o!==null||t[u].disabled||(o=t[u])}o!==null&&(o.selected=!0)}}function om(t,o,a){if(o!=null&&(o=""+oo(o),o!==t.value&&(t.value=o),a==null)){t.defaultValue!==o&&(t.defaultValue=o);return}t.defaultValue=a!=null?""+oo(a):""}function sm(t,o,a,l){if(o==null){if(l!=null){if(a!=null)throw Error(r(92));if(ee(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),o=a}a=oo(o),t.defaultValue=a,l=t.textContent,l===a&&l!==""&&l!==null&&(t.value=l)}function Cr(t,o){if(o){var a=t.firstChild;if(a&&a===t.lastChild&&a.nodeType===3){a.nodeValue=o;return}}t.textContent=o}var sT=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function rm(t,o,a){var l=o.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?t.setProperty(o,""):o==="float"?t.cssFloat="":t[o]="":l?t.setProperty(o,a):typeof a!="number"||a===0||sT.has(o)?o==="float"?t.cssFloat=a:t[o]=(""+a).trim():t[o]=a+"px"}function am(t,o,a){if(o!=null&&typeof o!="object")throw Error(r(62));if(t=t.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||o!=null&&o.hasOwnProperty(l)||(l.indexOf("--")===0?t.setProperty(l,""):l==="float"?t.cssFloat="":t[l]="");for(var u in o)l=o[u],o.hasOwnProperty(u)&&a[u]!==l&&rm(t,u,l)}else for(var h in o)o.hasOwnProperty(h)&&rm(t,h,o[h])}function Ru(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rT=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),aT=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function pl(t){return aT.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}var Cu=null;function Au(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Ar=null,kr=null;function im(t){var o=$o(t);if(o&&(t=o.stateNode)){var a=t[Ut]||null;e:switch(t=o.stateNode,o.type){case"input":if(Tu(t,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),o=a.name,a.type==="radio"&&o!=null){for(a=t;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+so(""+o)+'"][type="radio"]'),o=0;o<a.length;o++){var l=a[o];if(l!==t&&l.form===t.form){var u=l[Ut]||null;if(!u)throw Error(r(90));Tu(l,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(o=0;o<a.length;o++)l=a[o],l.form===t.form&&tm(l)}break e;case"textarea":om(t,a.value,a.defaultValue);break e;case"select":o=a.value,o!=null&&Rr(t,!!a.multiple,o,!1)}}}var ku=!1;function lm(t,o,a){if(ku)return t(o,a);ku=!0;try{var l=t(o);return l}finally{if(ku=!1,(Ar!==null||kr!==null)&&(Jl(),Ar&&(o=Ar,t=kr,kr=Ar=null,im(o),t)))for(o=0;o<t.length;o++)im(t[o])}}function Ca(t,o){var a=t.stateNode;if(a===null)return null;var l=a[Ut]||null;if(l===null)return null;a=l[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(t=t.type,l=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!l;break e;default:t=!1}if(t)return null;if(a&&typeof a!="function")throw Error(r(231,o,typeof a));return a}var qo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ju=!1;if(qo)try{var Aa={};Object.defineProperty(Aa,"passive",{get:function(){ju=!0}}),window.addEventListener("test",Aa,Aa),window.removeEventListener("test",Aa,Aa)}catch{ju=!1}var us=null,Ou=null,hl=null;function cm(){if(hl)return hl;var t,o=Ou,a=o.length,l,u="value"in us?us.value:us.textContent,h=u.length;for(t=0;t<a&&o[t]===u[t];t++);var S=a-t;for(l=1;l<=S&&o[a-l]===u[h-l];l++);return hl=u.slice(t,1<l?1-l:void 0)}function ml(t){var o=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&o===13&&(t=13)):t=o,t===10&&(t=13),32<=t||t===13?t:0}function gl(){return!0}function um(){return!1}function Dn(t){function o(a,l,u,h,S){this._reactName=a,this._targetInst=u,this.type=l,this.nativeEvent=h,this.target=S,this.currentTarget=null;for(var T in t)t.hasOwnProperty(T)&&(a=t[T],this[T]=a?a(h):h[T]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?gl:um,this.isPropagationStopped=um,this}return y(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=gl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=gl)},persist:function(){},isPersistent:gl}),o}var Ys={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vl=Dn(Ys),ka=y({},Ys,{view:0,detail:0}),iT=Dn(ka),Nu,Mu,ja,yl=y({},ka,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Iu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ja&&(ja&&t.type==="mousemove"?(Nu=t.screenX-ja.screenX,Mu=t.screenY-ja.screenY):Mu=Nu=0,ja=t),Nu)},movementY:function(t){return"movementY"in t?t.movementY:Mu}}),dm=Dn(yl),lT=y({},yl,{dataTransfer:0}),cT=Dn(lT),uT=y({},ka,{relatedTarget:0}),zu=Dn(uT),dT=y({},Ys,{animationName:0,elapsedTime:0,pseudoElement:0}),fT=Dn(dT),pT=y({},Ys,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),hT=Dn(pT),mT=y({},Ys,{data:0}),fm=Dn(mT),gT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vT={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"},yT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bT(t){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(t):(t=yT[t])?!!o[t]:!1}function Iu(){return bT}var ST=y({},ka,{key:function(t){if(t.key){var o=gT[t.key]||t.key;if(o!=="Unidentified")return o}return t.type==="keypress"?(t=ml(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?vT[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Iu,charCode:function(t){return t.type==="keypress"?ml(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?ml(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),xT=Dn(ST),wT=y({},yl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pm=Dn(wT),ET=y({},ka,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Iu}),TT=Dn(ET),_T=y({},Ys,{propertyName:0,elapsedTime:0,pseudoElement:0}),RT=Dn(_T),CT=y({},yl,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),AT=Dn(CT),kT=y({},Ys,{newState:0,oldState:0}),jT=Dn(kT),OT=[9,13,27,32],Du=qo&&"CompositionEvent"in window,Oa=null;qo&&"documentMode"in document&&(Oa=document.documentMode);var NT=qo&&"TextEvent"in window&&!Oa,hm=qo&&(!Du||Oa&&8<Oa&&11>=Oa),mm=" ",gm=!1;function vm(t,o){switch(t){case"keyup":return OT.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ym(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var jr=!1;function MT(t,o){switch(t){case"compositionend":return ym(o);case"keypress":return o.which!==32?null:(gm=!0,mm);case"textInput":return t=o.data,t===mm&&gm?null:t;default:return null}}function zT(t,o){if(jr)return t==="compositionend"||!Du&&vm(t,o)?(t=cm(),hl=Ou=us=null,jr=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return hm&&o.locale!=="ko"?null:o.data;default:return null}}var IT={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 bm(t){var o=t&&t.nodeName&&t.nodeName.toLowerCase();return o==="input"?!!IT[t.type]:o==="textarea"}function Sm(t,o,a,l){Ar?kr?kr.push(l):kr=[l]:Ar=l,o=sc(o,"onChange"),0<o.length&&(a=new vl("onChange","change",null,a,l),t.push({event:a,listeners:o}))}var Na=null,Ma=null;function DT(t){ey(t,0)}function bl(t){var o=cs(t);if(tm(o))return t}function xm(t,o){if(t==="change")return o}var wm=!1;if(qo){var Uu;if(qo){var Pu="oninput"in document;if(!Pu){var Em=document.createElement("div");Em.setAttribute("oninput","return;"),Pu=typeof Em.oninput=="function"}Uu=Pu}else Uu=!1;wm=Uu&&(!document.documentMode||9<document.documentMode)}function Tm(){Na&&(Na.detachEvent("onpropertychange",_m),Ma=Na=null)}function _m(t){if(t.propertyName==="value"&&bl(Ma)){var o=[];Sm(o,Ma,t,Au(t)),lm(DT,o)}}function UT(t,o,a){t==="focusin"?(Tm(),Na=o,Ma=a,Na.attachEvent("onpropertychange",_m)):t==="focusout"&&Tm()}function PT(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return bl(Ma)}function $T(t,o){if(t==="click")return bl(o)}function LT(t,o){if(t==="input"||t==="change")return bl(o)}function qT(t,o){return t===o&&(t!==0||1/t===1/o)||t!==t&&o!==o}var Yn=typeof Object.is=="function"?Object.is:qT;function za(t,o){if(Yn(t,o))return!0;if(typeof t!="object"||t===null||typeof o!="object"||o===null)return!1;var a=Object.keys(t),l=Object.keys(o);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var u=a[l];if(!Me.call(o,u)||!Yn(t[u],o[u]))return!1}return!0}function Rm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Cm(t,o){var a=Rm(t);t=0;for(var l;a;){if(a.nodeType===3){if(l=t+a.textContent.length,t<=o&&l>=o)return{node:a,offset:o-t};t=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Rm(a)}}function Am(t,o){return t&&o?t===o?!0:t&&t.nodeType===3?!1:o&&o.nodeType===3?Am(t,o.parentNode):"contains"in t?t.contains(o):t.compareDocumentPosition?!!(t.compareDocumentPosition(o)&16):!1:!1}function km(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var o=fl(t.document);o instanceof t.HTMLIFrameElement;){try{var a=typeof o.contentWindow.location.href=="string"}catch{a=!1}if(a)t=o.contentWindow;else break;o=fl(t.document)}return o}function $u(t){var o=t&&t.nodeName&&t.nodeName.toLowerCase();return o&&(o==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||o==="textarea"||t.contentEditable==="true")}var HT=qo&&"documentMode"in document&&11>=document.documentMode,Or=null,Lu=null,Ia=null,qu=!1;function jm(t,o,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;qu||Or==null||Or!==fl(l)||(l=Or,"selectionStart"in l&&$u(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Ia&&za(Ia,l)||(Ia=l,l=sc(Lu,"onSelect"),0<l.length&&(o=new vl("onSelect","select",null,o,a),t.push({event:o,listeners:l}),o.target=Or)))}function Gs(t,o){var a={};return a[t.toLowerCase()]=o.toLowerCase(),a["Webkit"+t]="webkit"+o,a["Moz"+t]="moz"+o,a}var Nr={animationend:Gs("Animation","AnimationEnd"),animationiteration:Gs("Animation","AnimationIteration"),animationstart:Gs("Animation","AnimationStart"),transitionrun:Gs("Transition","TransitionRun"),transitionstart:Gs("Transition","TransitionStart"),transitioncancel:Gs("Transition","TransitionCancel"),transitionend:Gs("Transition","TransitionEnd")},Hu={},Om={};qo&&(Om=document.createElement("div").style,"AnimationEvent"in window||(delete Nr.animationend.animation,delete Nr.animationiteration.animation,delete Nr.animationstart.animation),"TransitionEvent"in window||delete Nr.transitionend.transition);function Ks(t){if(Hu[t])return Hu[t];if(!Nr[t])return t;var o=Nr[t],a;for(a in o)if(o.hasOwnProperty(a)&&a in Om)return Hu[t]=o[a];return t}var Nm=Ks("animationend"),Mm=Ks("animationiteration"),zm=Ks("animationstart"),BT=Ks("transitionrun"),ZT=Ks("transitionstart"),VT=Ks("transitioncancel"),Im=Ks("transitionend"),Dm=new Map,Bu="abort auxClick beforeToggle 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(" ");Bu.push("scrollEnd");function yo(t,o){Dm.set(t,o),J(o,[t])}var Um=new WeakMap;function ro(t,o){if(typeof t=="object"&&t!==null){var a=Um.get(t);return a!==void 0?a:(o={value:t,source:o,stack:Wh(o)},Um.set(t,o),o)}return{value:t,source:o,stack:Wh(o)}}var ao=[],Mr=0,Zu=0;function Sl(){for(var t=Mr,o=Zu=Mr=0;o<t;){var a=ao[o];ao[o++]=null;var l=ao[o];ao[o++]=null;var u=ao[o];ao[o++]=null;var h=ao[o];if(ao[o++]=null,l!==null&&u!==null){var S=l.pending;S===null?u.next=u:(u.next=S.next,S.next=u),l.pending=u}h!==0&&Pm(a,u,h)}}function xl(t,o,a,l){ao[Mr++]=t,ao[Mr++]=o,ao[Mr++]=a,ao[Mr++]=l,Zu|=l,t.lanes|=l,t=t.alternate,t!==null&&(t.lanes|=l)}function Vu(t,o,a,l){return xl(t,o,a,l),wl(t)}function zr(t,o){return xl(t,null,null,o),wl(t)}function Pm(t,o,a){t.lanes|=a;var l=t.alternate;l!==null&&(l.lanes|=a);for(var u=!1,h=t.return;h!==null;)h.childLanes|=a,l=h.alternate,l!==null&&(l.childLanes|=a),h.tag===22&&(t=h.stateNode,t===null||t._visibility&1||(u=!0)),t=h,h=h.return;return t.tag===3?(h=t.stateNode,u&&o!==null&&(u=31-nt(a),t=h.hiddenUpdates,l=t[u],l===null?t[u]=[o]:l.push(o),o.lane=a|536870912),h):null}function wl(t){if(50<ai)throw ai=0,Qd=null,Error(r(185));for(var o=t.return;o!==null;)t=o,o=t.return;return t.tag===3?t.stateNode:null}var Ir={};function YT(t,o,a,l){this.tag=t,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(t,o,a,l){return new YT(t,o,a,l)}function Yu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Ho(t,o){var a=t.alternate;return a===null?(a=Gn(t.tag,o,t.key,t.mode),a.elementType=t.elementType,a.type=t.type,a.stateNode=t.stateNode,a.alternate=t,t.alternate=a):(a.pendingProps=o,a.type=t.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=t.flags&65011712,a.childLanes=t.childLanes,a.lanes=t.lanes,a.child=t.child,a.memoizedProps=t.memoizedProps,a.memoizedState=t.memoizedState,a.updateQueue=t.updateQueue,o=t.dependencies,a.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},a.sibling=t.sibling,a.index=t.index,a.ref=t.ref,a.refCleanup=t.refCleanup,a}function $m(t,o){t.flags&=65011714;var a=t.alternate;return a===null?(t.childLanes=0,t.lanes=o,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=a.childLanes,t.lanes=a.lanes,t.child=a.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=a.memoizedProps,t.memoizedState=a.memoizedState,t.updateQueue=a.updateQueue,t.type=a.type,o=a.dependencies,t.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),t}function El(t,o,a,l,u,h){var S=0;if(l=t,typeof t=="function")Yu(t)&&(S=1);else if(typeof t=="string")S=K_(t,a,de.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case H:return t=Gn(31,a,o,u),t.elementType=H,t.lanes=h,t;case E:return Fs(a.children,u,h,o);case C:S=8,u|=24;break;case A:return t=Gn(12,a,o,u|2),t.elementType=A,t.lanes=h,t;case M:return t=Gn(13,a,o,u),t.elementType=M,t.lanes=h,t;case U:return t=Gn(19,a,o,u),t.elementType=U,t.lanes=h,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case j:case O:S=10;break e;case _:S=9;break e;case R:S=11;break e;case k:S=14;break e;case Y:S=16,l=null;break e}S=29,a=Error(r(130,t===null?"null":typeof t,"")),l=null}return o=Gn(S,a,o,u),o.elementType=t,o.type=l,o.lanes=h,o}function Fs(t,o,a,l){return t=Gn(7,t,l,o),t.lanes=a,t}function Gu(t,o,a){return t=Gn(6,t,null,o),t.lanes=a,t}function Ku(t,o,a){return o=Gn(4,t.children!==null?t.children:[],t.key,o),o.lanes=a,o.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},o}var Dr=[],Ur=0,Tl=null,_l=0,io=[],lo=0,Xs=null,Bo=1,Zo="";function Qs(t,o){Dr[Ur++]=_l,Dr[Ur++]=Tl,Tl=t,_l=o}function Lm(t,o,a){io[lo++]=Bo,io[lo++]=Zo,io[lo++]=Xs,Xs=t;var l=Bo;t=Zo;var u=32-nt(l)-1;l&=~(1<<u),a+=1;var h=32-nt(o)+u;if(30<h){var S=u-u%5;h=(l&(1<<S)-1).toString(32),l>>=S,u-=S,Bo=1<<32-nt(o)+u|a<<u|l,Zo=h+t}else Bo=1<<h|a<<u|l,Zo=t}function Fu(t){t.return!==null&&(Qs(t,1),Lm(t,1,0))}function Xu(t){for(;t===Tl;)Tl=Dr[--Ur],Dr[Ur]=null,_l=Dr[--Ur],Dr[Ur]=null;for(;t===Xs;)Xs=io[--lo],io[lo]=null,Zo=io[--lo],io[lo]=null,Bo=io[--lo],io[lo]=null}var jn=null,Vt=null,mt=!1,Js=null,Co=!1,Qu=Error(r(519));function Ws(t){var o=Error(r(418,""));throw Pa(ro(o,t)),Qu}function qm(t){var o=t.stateNode,a=t.type,l=t.memoizedProps;switch(o[We]=t,o[Ut]=l,a){case"dialog":st("cancel",o),st("close",o);break;case"iframe":case"object":case"embed":st("load",o);break;case"video":case"audio":for(a=0;a<li.length;a++)st(li[a],o);break;case"source":st("error",o);break;case"img":case"image":case"link":st("error",o),st("load",o);break;case"details":st("toggle",o);break;case"input":st("invalid",o),nm(o,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),dl(o);break;case"select":st("invalid",o);break;case"textarea":st("invalid",o),sm(o,l.value,l.defaultValue,l.children),dl(o)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||o.textContent===""+a||l.suppressHydrationWarning===!0||sy(o.textContent,a)?(l.popover!=null&&(st("beforetoggle",o),st("toggle",o)),l.onScroll!=null&&st("scroll",o),l.onScrollEnd!=null&&st("scrollend",o),l.onClick!=null&&(o.onclick=rc),o=!0):o=!1,o||Ws(t)}function Hm(t){for(jn=t.return;jn;)switch(jn.tag){case 5:case 13:Co=!1;return;case 27:case 3:Co=!0;return;default:jn=jn.return}}function Da(t){if(t!==jn)return!1;if(!mt)return Hm(t),mt=!0,!1;var o=t.tag,a;if((a=o!==3&&o!==27)&&((a=o===5)&&(a=t.type,a=!(a!=="form"&&a!=="button")||hf(t.type,t.memoizedProps)),a=!a),a&&Vt&&Ws(t),Hm(t),o===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));e:{for(t=t.nextSibling,o=0;t;){if(t.nodeType===8)if(a=t.data,a==="/$"){if(o===0){Vt=So(t.nextSibling);break e}o--}else a!=="$"&&a!=="$!"&&a!=="$?"||o++;t=t.nextSibling}Vt=null}}else o===27?(o=Vt,Rs(t.type)?(t=yf,yf=null,Vt=t):Vt=o):Vt=jn?So(t.stateNode.nextSibling):null;return!0}function Ua(){Vt=jn=null,mt=!1}function Bm(){var t=Js;return t!==null&&($n===null?$n=t:$n.push.apply($n,t),Js=null),t}function Pa(t){Js===null?Js=[t]:Js.push(t)}var Ju=Se(null),er=null,Vo=null;function ds(t,o,a){ne(Ju,o._currentValue),o._currentValue=a}function Yo(t){t._currentValue=Ju.current,D(Ju)}function Wu(t,o,a){for(;t!==null;){var l=t.alternate;if((t.childLanes&o)!==o?(t.childLanes|=o,l!==null&&(l.childLanes|=o)):l!==null&&(l.childLanes&o)!==o&&(l.childLanes|=o),t===a)break;t=t.return}}function ed(t,o,a,l){var u=t.child;for(u!==null&&(u.return=t);u!==null;){var h=u.dependencies;if(h!==null){var S=u.child;h=h.firstContext;e:for(;h!==null;){var T=h;h=u;for(var N=0;N<o.length;N++)if(T.context===o[N]){h.lanes|=a,T=h.alternate,T!==null&&(T.lanes|=a),Wu(h.return,a,t),l||(S=null);break e}h=T.next}}else if(u.tag===18){if(S=u.return,S===null)throw Error(r(341));S.lanes|=a,h=S.alternate,h!==null&&(h.lanes|=a),Wu(S,a,t),S=null}else S=u.child;if(S!==null)S.return=u;else for(S=u;S!==null;){if(S===t){S=null;break}if(u=S.sibling,u!==null){u.return=S.return,S=u;break}S=S.return}u=S}}function $a(t,o,a,l){t=null;for(var u=o,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var S=u.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var T=u.type;Yn(u.pendingProps.value,S.value)||(t!==null?t.push(T):t=[T])}}else if(u===Ce.current){if(S=u.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(t!==null?t.push(hi):t=[hi])}u=u.return}t!==null&&ed(o,t,a,l),o.flags|=262144}function Rl(t){for(t=t.firstContext;t!==null;){if(!Yn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function tr(t){er=t,Vo=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Cn(t){return Zm(er,t)}function Cl(t,o){return er===null&&tr(t),Zm(t,o)}function Zm(t,o){var a=o._currentValue;if(o={context:o,memoizedValue:a,next:null},Vo===null){if(t===null)throw Error(r(308));Vo=o,t.dependencies={lanes:0,firstContext:o},t.flags|=524288}else Vo=Vo.next=o;return a}var GT=typeof AbortController<"u"?AbortController:function(){var t=[],o=this.signal={aborted:!1,addEventListener:function(a,l){t.push(l)}};this.abort=function(){o.aborted=!0,t.forEach(function(a){return a()})}},KT=e.unstable_scheduleCallback,FT=e.unstable_NormalPriority,an={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function td(){return{controller:new GT,data:new Map,refCount:0}}function La(t){t.refCount--,t.refCount===0&&KT(FT,function(){t.controller.abort()})}var qa=null,nd=0,Pr=0,$r=null;function XT(t,o){if(qa===null){var a=qa=[];nd=0,Pr=sf(),$r={status:"pending",value:void 0,then:function(l){a.push(l)}}}return nd++,o.then(Vm,Vm),o}function Vm(){if(--nd===0&&qa!==null){$r!==null&&($r.status="fulfilled");var t=qa;qa=null,Pr=0,$r=null;for(var o=0;o<t.length;o++)(0,t[o])()}}function QT(t,o){var a=[],l={status:"pending",value:null,reason:null,then:function(u){a.push(u)}};return t.then(function(){l.status="fulfilled",l.value=o;for(var u=0;u<a.length;u++)(0,a[u])(o)},function(u){for(l.status="rejected",l.reason=u,u=0;u<a.length;u++)(0,a[u])(void 0)}),l}var Ym=z.S;z.S=function(t,o){typeof o=="object"&&o!==null&&typeof o.then=="function"&&XT(t,o),Ym!==null&&Ym(t,o)};var nr=Se(null);function od(){var t=nr.current;return t!==null?t:jt.pooledCache}function Al(t,o){o===null?ne(nr,nr.current):ne(nr,o.pool)}function Gm(){var t=od();return t===null?null:{parent:an._currentValue,pool:t}}var Ha=Error(r(460)),Km=Error(r(474)),kl=Error(r(542)),sd={then:function(){}};function Fm(t){return t=t.status,t==="fulfilled"||t==="rejected"}function jl(){}function Xm(t,o,a){switch(a=t[a],a===void 0?t.push(o):a!==o&&(o.then(jl,jl),o=a),o.status){case"fulfilled":return o.value;case"rejected":throw t=o.reason,Jm(t),t;default:if(typeof o.status=="string")o.then(jl,jl);else{if(t=jt,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=o,t.status="pending",t.then(function(l){if(o.status==="pending"){var u=o;u.status="fulfilled",u.value=l}},function(l){if(o.status==="pending"){var u=o;u.status="rejected",u.reason=l}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw t=o.reason,Jm(t),t}throw Ba=o,Ha}}var Ba=null;function Qm(){if(Ba===null)throw Error(r(459));var t=Ba;return Ba=null,t}function Jm(t){if(t===Ha||t===kl)throw Error(r(483))}var fs=!1;function rd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ad(t,o){t=t.updateQueue,o.updateQueue===t&&(o.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function ps(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function hs(t,o,a){var l=t.updateQueue;if(l===null)return null;if(l=l.shared,(gt&2)!==0){var u=l.pending;return u===null?o.next=o:(o.next=u.next,u.next=o),l.pending=o,o=wl(t),Pm(t,null,a),o}return xl(t,l,o,a),wl(t)}function Za(t,o,a){if(o=o.updateQueue,o!==null&&(o=o.shared,(a&4194048)!==0)){var l=o.lanes;l&=t.pendingLanes,a|=l,o.lanes=a,rn(t,a)}}function id(t,o){var a=t.updateQueue,l=t.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var u=null,h=null;if(a=a.firstBaseUpdate,a!==null){do{var S={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};h===null?u=h=S:h=h.next=S,a=a.next}while(a!==null);h===null?u=h=o:h=h.next=o}else u=h=o;a={baseState:l.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:l.shared,callbacks:l.callbacks},t.updateQueue=a;return}t=a.lastBaseUpdate,t===null?a.firstBaseUpdate=o:t.next=o,a.lastBaseUpdate=o}var ld=!1;function Va(){if(ld){var t=$r;if(t!==null)throw t}}function Ya(t,o,a,l){ld=!1;var u=t.updateQueue;fs=!1;var h=u.firstBaseUpdate,S=u.lastBaseUpdate,T=u.shared.pending;if(T!==null){u.shared.pending=null;var N=T,F=N.next;N.next=null,S===null?h=F:S.next=F,S=N;var ue=t.alternate;ue!==null&&(ue=ue.updateQueue,T=ue.lastBaseUpdate,T!==S&&(T===null?ue.firstBaseUpdate=F:T.next=F,ue.lastBaseUpdate=N))}if(h!==null){var pe=u.baseState;S=0,ue=F=N=null,T=h;do{var X=T.lane&-536870913,W=X!==T.lane;if(W?(ut&X)===X:(l&X)===X){X!==0&&X===Pr&&(ld=!0),ue!==null&&(ue=ue.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var He=t,Ue=T;X=o;var Et=a;switch(Ue.tag){case 1:if(He=Ue.payload,typeof He=="function"){pe=He.call(Et,pe,X);break e}pe=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=Ue.payload,X=typeof He=="function"?He.call(Et,pe,X):He,X==null)break e;pe=y({},pe,X);break e;case 2:fs=!0}}X=T.callback,X!==null&&(t.flags|=64,W&&(t.flags|=8192),W=u.callbacks,W===null?u.callbacks=[X]:W.push(X))}else W={lane:X,tag:T.tag,payload:T.payload,callback:T.callback,next:null},ue===null?(F=ue=W,N=pe):ue=ue.next=W,S|=X;if(T=T.next,T===null){if(T=u.shared.pending,T===null)break;W=T,T=W.next,W.next=null,u.lastBaseUpdate=W,u.shared.pending=null}}while(!0);ue===null&&(N=pe),u.baseState=N,u.firstBaseUpdate=F,u.lastBaseUpdate=ue,h===null&&(u.shared.lanes=0),ws|=S,t.lanes=S,t.memoizedState=pe}}function Wm(t,o){if(typeof t!="function")throw Error(r(191,t));t.call(o)}function eg(t,o){var a=t.callbacks;if(a!==null)for(t.callbacks=null,t=0;t<a.length;t++)Wm(a[t],o)}var Lr=Se(null),Ol=Se(0);function tg(t,o){t=Wo,ne(Ol,t),ne(Lr,o),Wo=t|o.baseLanes}function cd(){ne(Ol,Wo),ne(Lr,Lr.current)}function ud(){Wo=Ol.current,D(Lr),D(Ol)}var ms=0,Xe=null,xt=null,Wt=null,Nl=!1,qr=!1,or=!1,Ml=0,Ga=0,Hr=null,JT=0;function Qt(){throw Error(r(321))}function dd(t,o){if(o===null)return!1;for(var a=0;a<o.length&&a<t.length;a++)if(!Yn(t[a],o[a]))return!1;return!0}function fd(t,o,a,l,u,h){return ms=h,Xe=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,z.H=t===null||t.memoizedState===null?Pg:$g,or=!1,h=a(l,u),or=!1,qr&&(h=og(o,a,l,u)),ng(t),h}function ng(t){z.H=$l;var o=xt!==null&&xt.next!==null;if(ms=0,Wt=xt=Xe=null,Nl=!1,Ga=0,Hr=null,o)throw Error(r(300));t===null||hn||(t=t.dependencies,t!==null&&Rl(t)&&(hn=!0))}function og(t,o,a,l){Xe=t;var u=0;do{if(qr&&(Hr=null),Ga=0,qr=!1,25<=u)throw Error(r(301));if(u+=1,Wt=xt=null,t.updateQueue!=null){var h=t.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}z.H=r_,h=o(a,l)}while(qr);return h}function WT(){var t=z.H,o=t.useState()[0];return o=typeof o.then=="function"?Ka(o):o,t=t.useState()[0],(xt!==null?xt.memoizedState:null)!==t&&(Xe.flags|=1024),o}function pd(){var t=Ml!==0;return Ml=0,t}function hd(t,o,a){o.updateQueue=t.updateQueue,o.flags&=-2053,t.lanes&=~a}function md(t){if(Nl){for(t=t.memoizedState;t!==null;){var o=t.queue;o!==null&&(o.pending=null),t=t.next}Nl=!1}ms=0,Wt=xt=Xe=null,qr=!1,Ga=Ml=0,Hr=null}function Un(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wt===null?Xe.memoizedState=Wt=t:Wt=Wt.next=t,Wt}function en(){if(xt===null){var t=Xe.alternate;t=t!==null?t.memoizedState:null}else t=xt.next;var o=Wt===null?Xe.memoizedState:Wt.next;if(o!==null)Wt=o,xt=t;else{if(t===null)throw Xe.alternate===null?Error(r(467)):Error(r(310));xt=t,t={memoizedState:xt.memoizedState,baseState:xt.baseState,baseQueue:xt.baseQueue,queue:xt.queue,next:null},Wt===null?Xe.memoizedState=Wt=t:Wt=Wt.next=t}return Wt}function gd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ka(t){var o=Ga;return Ga+=1,Hr===null&&(Hr=[]),t=Xm(Hr,t,o),o=Xe,(Wt===null?o.memoizedState:Wt.next)===null&&(o=o.alternate,z.H=o===null||o.memoizedState===null?Pg:$g),t}function zl(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ka(t);if(t.$$typeof===O)return Cn(t)}throw Error(r(438,String(t)))}function vd(t){var o=null,a=Xe.updateQueue;if(a!==null&&(o=a.memoCache),o==null){var l=Xe.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(o={data:l.data.map(function(u){return u.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),a===null&&(a=gd(),Xe.updateQueue=a),a.memoCache=o,a=o.data[o.index],a===void 0)for(a=o.data[o.index]=Array(t),l=0;l<t;l++)a[l]=$;return o.index++,a}function Go(t,o){return typeof o=="function"?o(t):o}function Il(t){var o=en();return yd(o,xt,t)}function yd(t,o,a){var l=t.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var u=t.baseQueue,h=l.pending;if(h!==null){if(u!==null){var S=u.next;u.next=h.next,h.next=S}o.baseQueue=u=h,l.pending=null}if(h=t.baseState,u===null)t.memoizedState=h;else{o=u.next;var T=S=null,N=null,F=o,ue=!1;do{var pe=F.lane&-536870913;if(pe!==F.lane?(ut&pe)===pe:(ms&pe)===pe){var X=F.revertLane;if(X===0)N!==null&&(N=N.next={lane:0,revertLane:0,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),pe===Pr&&(ue=!0);else if((ms&X)===X){F=F.next,X===Pr&&(ue=!0);continue}else pe={lane:0,revertLane:F.revertLane,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},N===null?(T=N=pe,S=h):N=N.next=pe,Xe.lanes|=X,ws|=X;pe=F.action,or&&a(h,pe),h=F.hasEagerState?F.eagerState:a(h,pe)}else X={lane:pe,revertLane:F.revertLane,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},N===null?(T=N=X,S=h):N=N.next=X,Xe.lanes|=pe,ws|=pe;F=F.next}while(F!==null&&F!==o);if(N===null?S=h:N.next=T,!Yn(h,t.memoizedState)&&(hn=!0,ue&&(a=$r,a!==null)))throw a;t.memoizedState=h,t.baseState=S,t.baseQueue=N,l.lastRenderedState=h}return u===null&&(l.lanes=0),[t.memoizedState,l.dispatch]}function bd(t){var o=en(),a=o.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=t;var l=a.dispatch,u=a.pending,h=o.memoizedState;if(u!==null){a.pending=null;var S=u=u.next;do h=t(h,S.action),S=S.next;while(S!==u);Yn(h,o.memoizedState)||(hn=!0),o.memoizedState=h,o.baseQueue===null&&(o.baseState=h),a.lastRenderedState=h}return[h,l]}function sg(t,o,a){var l=Xe,u=en(),h=mt;if(h){if(a===void 0)throw Error(r(407));a=a()}else a=o();var S=!Yn((xt||u).memoizedState,a);S&&(u.memoizedState=a,hn=!0),u=u.queue;var T=ig.bind(null,l,u,t);if(Fa(2048,8,T,[t]),u.getSnapshot!==o||S||Wt!==null&&Wt.memoizedState.tag&1){if(l.flags|=2048,Br(9,Dl(),ag.bind(null,l,u,a,o),null),jt===null)throw Error(r(349));h||(ms&124)!==0||rg(l,o,a)}return a}function rg(t,o,a){t.flags|=16384,t={getSnapshot:o,value:a},o=Xe.updateQueue,o===null?(o=gd(),Xe.updateQueue=o,o.stores=[t]):(a=o.stores,a===null?o.stores=[t]:a.push(t))}function ag(t,o,a,l){o.value=a,o.getSnapshot=l,lg(o)&&cg(t)}function ig(t,o,a){return a(function(){lg(o)&&cg(t)})}function lg(t){var o=t.getSnapshot;t=t.value;try{var a=o();return!Yn(t,a)}catch{return!0}}function cg(t){var o=zr(t,2);o!==null&&Jn(o,t,2)}function Sd(t){var o=Un();if(typeof t=="function"){var a=t;if(t=a(),or){Fe(!0);try{a()}finally{Fe(!1)}}}return o.memoizedState=o.baseState=t,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:t},o}function ug(t,o,a,l){return t.baseState=a,yd(t,xt,typeof l=="function"?l:Go)}function e_(t,o,a,l,u){if(Pl(t))throw Error(r(485));if(t=o.action,t!==null){var h={payload:u,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){h.listeners.push(S)}};z.T!==null?a(!0):h.isTransition=!1,l(h),a=o.pending,a===null?(h.next=o.pending=h,dg(o,h)):(h.next=a.next,o.pending=a.next=h)}}function dg(t,o){var a=o.action,l=o.payload,u=t.state;if(o.isTransition){var h=z.T,S={};z.T=S;try{var T=a(u,l),N=z.S;N!==null&&N(S,T),fg(t,o,T)}catch(F){xd(t,o,F)}finally{z.T=h}}else try{h=a(u,l),fg(t,o,h)}catch(F){xd(t,o,F)}}function fg(t,o,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){pg(t,o,l)},function(l){return xd(t,o,l)}):pg(t,o,a)}function pg(t,o,a){o.status="fulfilled",o.value=a,hg(o),t.state=a,o=t.pending,o!==null&&(a=o.next,a===o?t.pending=null:(a=a.next,o.next=a,dg(t,a)))}function xd(t,o,a){var l=t.pending;if(t.pending=null,l!==null){l=l.next;do o.status="rejected",o.reason=a,hg(o),o=o.next;while(o!==l)}t.action=null}function hg(t){t=t.listeners;for(var o=0;o<t.length;o++)(0,t[o])()}function mg(t,o){return o}function gg(t,o){if(mt){var a=jt.formState;if(a!==null){e:{var l=Xe;if(mt){if(Vt){t:{for(var u=Vt,h=Co;u.nodeType!==8;){if(!h){u=null;break t}if(u=So(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){Vt=So(u.nextSibling),l=u.data==="F!";break e}}Ws(l)}l=!1}l&&(o=a[0])}}return a=Un(),a.memoizedState=a.baseState=o,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mg,lastRenderedState:o},a.queue=l,a=Ig.bind(null,Xe,l),l.dispatch=a,l=Sd(!1),h=Rd.bind(null,Xe,!1,l.queue),l=Un(),u={state:o,dispatch:null,action:t,pending:null},l.queue=u,a=e_.bind(null,Xe,u,h,a),u.dispatch=a,l.memoizedState=t,[o,a,!1]}function vg(t){var o=en();return yg(o,xt,t)}function yg(t,o,a){if(o=yd(t,o,mg)[0],t=Il(Go)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var l=Ka(o)}catch(S){throw S===Ha?kl:S}else l=o;o=en();var u=o.queue,h=u.dispatch;return a!==o.memoizedState&&(Xe.flags|=2048,Br(9,Dl(),t_.bind(null,u,a),null)),[l,h,t]}function t_(t,o){t.action=o}function bg(t){var o=en(),a=xt;if(a!==null)return yg(o,a,t);en(),o=o.memoizedState,a=en();var l=a.queue.dispatch;return a.memoizedState=t,[o,l,!1]}function Br(t,o,a,l){return t={tag:t,create:a,deps:l,inst:o,next:null},o=Xe.updateQueue,o===null&&(o=gd(),Xe.updateQueue=o),a=o.lastEffect,a===null?o.lastEffect=t.next=t:(l=a.next,a.next=t,t.next=l,o.lastEffect=t),t}function Dl(){return{destroy:void 0,resource:void 0}}function Sg(){return en().memoizedState}function Ul(t,o,a,l){var u=Un();l=l===void 0?null:l,Xe.flags|=t,u.memoizedState=Br(1|o,Dl(),a,l)}function Fa(t,o,a,l){var u=en();l=l===void 0?null:l;var h=u.memoizedState.inst;xt!==null&&l!==null&&dd(l,xt.memoizedState.deps)?u.memoizedState=Br(o,h,a,l):(Xe.flags|=t,u.memoizedState=Br(1|o,h,a,l))}function xg(t,o){Ul(8390656,8,t,o)}function wg(t,o){Fa(2048,8,t,o)}function Eg(t,o){return Fa(4,2,t,o)}function Tg(t,o){return Fa(4,4,t,o)}function _g(t,o){if(typeof o=="function"){t=t();var a=o(t);return function(){typeof a=="function"?a():o(null)}}if(o!=null)return t=t(),o.current=t,function(){o.current=null}}function Rg(t,o,a){a=a!=null?a.concat([t]):null,Fa(4,4,_g.bind(null,o,t),a)}function wd(){}function Cg(t,o){var a=en();o=o===void 0?null:o;var l=a.memoizedState;return o!==null&&dd(o,l[1])?l[0]:(a.memoizedState=[t,o],t)}function Ag(t,o){var a=en();o=o===void 0?null:o;var l=a.memoizedState;if(o!==null&&dd(o,l[1]))return l[0];if(l=t(),or){Fe(!0);try{t()}finally{Fe(!1)}}return a.memoizedState=[l,o],l}function Ed(t,o,a){return a===void 0||(ms&1073741824)!==0?t.memoizedState=o:(t.memoizedState=a,t=Ov(),Xe.lanes|=t,ws|=t,a)}function kg(t,o,a,l){return Yn(a,o)?a:Lr.current!==null?(t=Ed(t,a,l),Yn(t,o)||(hn=!0),t):(ms&42)===0?(hn=!0,t.memoizedState=a):(t=Ov(),Xe.lanes|=t,ws|=t,o)}function jg(t,o,a,l,u){var h=G.p;G.p=h!==0&&8>h?h:8;var S=z.T,T={};z.T=T,Rd(t,!1,o,a);try{var N=u(),F=z.S;if(F!==null&&F(T,N),N!==null&&typeof N=="object"&&typeof N.then=="function"){var ue=QT(N,l);Xa(t,o,ue,Qn(t))}else Xa(t,o,l,Qn(t))}catch(pe){Xa(t,o,{then:function(){},status:"rejected",reason:pe},Qn())}finally{G.p=h,z.T=S}}function n_(){}function Td(t,o,a,l){if(t.tag!==5)throw Error(r(476));var u=Og(t).queue;jg(t,u,o,Q,a===null?n_:function(){return Ng(t),a(l)})}function Og(t){var o=t.memoizedState;if(o!==null)return o;o={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:Q},next:null};var a={};return o.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Go,lastRenderedState:a},next:null},t.memoizedState=o,t=t.alternate,t!==null&&(t.memoizedState=o),o}function Ng(t){var o=Og(t).next.queue;Xa(t,o,{},Qn())}function _d(){return Cn(hi)}function Mg(){return en().memoizedState}function zg(){return en().memoizedState}function o_(t){for(var o=t.return;o!==null;){switch(o.tag){case 24:case 3:var a=Qn();t=ps(a);var l=hs(o,t,a);l!==null&&(Jn(l,o,a),Za(l,o,a)),o={cache:td()},t.payload=o;return}o=o.return}}function s_(t,o,a){var l=Qn();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},Pl(t)?Dg(o,a):(a=Vu(t,o,a,l),a!==null&&(Jn(a,t,l),Ug(a,o,l)))}function Ig(t,o,a){var l=Qn();Xa(t,o,a,l)}function Xa(t,o,a,l){var u={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(Pl(t))Dg(o,u);else{var h=t.alternate;if(t.lanes===0&&(h===null||h.lanes===0)&&(h=o.lastRenderedReducer,h!==null))try{var S=o.lastRenderedState,T=h(S,a);if(u.hasEagerState=!0,u.eagerState=T,Yn(T,S))return xl(t,o,u,0),jt===null&&Sl(),!1}catch{}finally{}if(a=Vu(t,o,u,l),a!==null)return Jn(a,t,l),Ug(a,o,l),!0}return!1}function Rd(t,o,a,l){if(l={lane:2,revertLane:sf(),action:l,hasEagerState:!1,eagerState:null,next:null},Pl(t)){if(o)throw Error(r(479))}else o=Vu(t,a,l,2),o!==null&&Jn(o,t,2)}function Pl(t){var o=t.alternate;return t===Xe||o!==null&&o===Xe}function Dg(t,o){qr=Nl=!0;var a=t.pending;a===null?o.next=o:(o.next=a.next,a.next=o),t.pending=o}function Ug(t,o,a){if((a&4194048)!==0){var l=o.lanes;l&=t.pendingLanes,a|=l,o.lanes=a,rn(t,a)}}var $l={readContext:Cn,use:zl,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt},Pg={readContext:Cn,use:zl,useCallback:function(t,o){return Un().memoizedState=[t,o===void 0?null:o],t},useContext:Cn,useEffect:xg,useImperativeHandle:function(t,o,a){a=a!=null?a.concat([t]):null,Ul(4194308,4,_g.bind(null,o,t),a)},useLayoutEffect:function(t,o){return Ul(4194308,4,t,o)},useInsertionEffect:function(t,o){Ul(4,2,t,o)},useMemo:function(t,o){var a=Un();o=o===void 0?null:o;var l=t();if(or){Fe(!0);try{t()}finally{Fe(!1)}}return a.memoizedState=[l,o],l},useReducer:function(t,o,a){var l=Un();if(a!==void 0){var u=a(o);if(or){Fe(!0);try{a(o)}finally{Fe(!1)}}}else u=o;return l.memoizedState=l.baseState=u,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:u},l.queue=t,t=t.dispatch=s_.bind(null,Xe,t),[l.memoizedState,t]},useRef:function(t){var o=Un();return t={current:t},o.memoizedState=t},useState:function(t){t=Sd(t);var o=t.queue,a=Ig.bind(null,Xe,o);return o.dispatch=a,[t.memoizedState,a]},useDebugValue:wd,useDeferredValue:function(t,o){var a=Un();return Ed(a,t,o)},useTransition:function(){var t=Sd(!1);return t=jg.bind(null,Xe,t.queue,!0,!1),Un().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,o,a){var l=Xe,u=Un();if(mt){if(a===void 0)throw Error(r(407));a=a()}else{if(a=o(),jt===null)throw Error(r(349));(ut&124)!==0||rg(l,o,a)}u.memoizedState=a;var h={value:a,getSnapshot:o};return u.queue=h,xg(ig.bind(null,l,h,t),[t]),l.flags|=2048,Br(9,Dl(),ag.bind(null,l,h,a,o),null),a},useId:function(){var t=Un(),o=jt.identifierPrefix;if(mt){var a=Zo,l=Bo;a=(l&~(1<<32-nt(l)-1)).toString(32)+a,o="«"+o+"R"+a,a=Ml++,0<a&&(o+="H"+a.toString(32)),o+="»"}else a=JT++,o="«"+o+"r"+a.toString(32)+"»";return t.memoizedState=o},useHostTransitionStatus:_d,useFormState:gg,useActionState:gg,useOptimistic:function(t){var o=Un();o.memoizedState=o.baseState=t;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=a,o=Rd.bind(null,Xe,!0,a),a.dispatch=o,[t,o]},useMemoCache:vd,useCacheRefresh:function(){return Un().memoizedState=o_.bind(null,Xe)}},$g={readContext:Cn,use:zl,useCallback:Cg,useContext:Cn,useEffect:wg,useImperativeHandle:Rg,useInsertionEffect:Eg,useLayoutEffect:Tg,useMemo:Ag,useReducer:Il,useRef:Sg,useState:function(){return Il(Go)},useDebugValue:wd,useDeferredValue:function(t,o){var a=en();return kg(a,xt.memoizedState,t,o)},useTransition:function(){var t=Il(Go)[0],o=en().memoizedState;return[typeof t=="boolean"?t:Ka(t),o]},useSyncExternalStore:sg,useId:Mg,useHostTransitionStatus:_d,useFormState:vg,useActionState:vg,useOptimistic:function(t,o){var a=en();return ug(a,xt,t,o)},useMemoCache:vd,useCacheRefresh:zg},r_={readContext:Cn,use:zl,useCallback:Cg,useContext:Cn,useEffect:wg,useImperativeHandle:Rg,useInsertionEffect:Eg,useLayoutEffect:Tg,useMemo:Ag,useReducer:bd,useRef:Sg,useState:function(){return bd(Go)},useDebugValue:wd,useDeferredValue:function(t,o){var a=en();return xt===null?Ed(a,t,o):kg(a,xt.memoizedState,t,o)},useTransition:function(){var t=bd(Go)[0],o=en().memoizedState;return[typeof t=="boolean"?t:Ka(t),o]},useSyncExternalStore:sg,useId:Mg,useHostTransitionStatus:_d,useFormState:bg,useActionState:bg,useOptimistic:function(t,o){var a=en();return xt!==null?ug(a,xt,t,o):(a.baseState=t,[t,a.queue.dispatch])},useMemoCache:vd,useCacheRefresh:zg},Zr=null,Qa=0;function Ll(t){var o=Qa;return Qa+=1,Zr===null&&(Zr=[]),Xm(Zr,t,o)}function Ja(t,o){o=o.props.ref,t.ref=o!==void 0?o:null}function ql(t,o){throw o.$$typeof===b?Error(r(525)):(t=Object.prototype.toString.call(o),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":t)))}function Lg(t){var o=t._init;return o(t._payload)}function qg(t){function o(L,I){if(t){var Z=L.deletions;Z===null?(L.deletions=[I],L.flags|=16):Z.push(I)}}function a(L,I){if(!t)return null;for(;I!==null;)o(L,I),I=I.sibling;return null}function l(L){for(var I=new Map;L!==null;)L.key!==null?I.set(L.key,L):I.set(L.index,L),L=L.sibling;return I}function u(L,I){return L=Ho(L,I),L.index=0,L.sibling=null,L}function h(L,I,Z){return L.index=Z,t?(Z=L.alternate,Z!==null?(Z=Z.index,Z<I?(L.flags|=67108866,I):Z):(L.flags|=67108866,I)):(L.flags|=1048576,I)}function S(L){return t&&L.alternate===null&&(L.flags|=67108866),L}function T(L,I,Z,fe){return I===null||I.tag!==6?(I=Gu(Z,L.mode,fe),I.return=L,I):(I=u(I,Z),I.return=L,I)}function N(L,I,Z,fe){var ke=Z.type;return ke===E?ue(L,I,Z.props.children,fe,Z.key):I!==null&&(I.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===Y&&Lg(ke)===I.type)?(I=u(I,Z.props),Ja(I,Z),I.return=L,I):(I=El(Z.type,Z.key,Z.props,null,L.mode,fe),Ja(I,Z),I.return=L,I)}function F(L,I,Z,fe){return I===null||I.tag!==4||I.stateNode.containerInfo!==Z.containerInfo||I.stateNode.implementation!==Z.implementation?(I=Ku(Z,L.mode,fe),I.return=L,I):(I=u(I,Z.children||[]),I.return=L,I)}function ue(L,I,Z,fe,ke){return I===null||I.tag!==7?(I=Fs(Z,L.mode,fe,ke),I.return=L,I):(I=u(I,Z),I.return=L,I)}function pe(L,I,Z){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return I=Gu(""+I,L.mode,Z),I.return=L,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case x:return Z=El(I.type,I.key,I.props,null,L.mode,Z),Ja(Z,I),Z.return=L,Z;case w:return I=Ku(I,L.mode,Z),I.return=L,I;case Y:var fe=I._init;return I=fe(I._payload),pe(L,I,Z)}if(ee(I)||P(I))return I=Fs(I,L.mode,Z,null),I.return=L,I;if(typeof I.then=="function")return pe(L,Ll(I),Z);if(I.$$typeof===O)return pe(L,Cl(L,I),Z);ql(L,I)}return null}function X(L,I,Z,fe){var ke=I!==null?I.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return ke!==null?null:T(L,I,""+Z,fe);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:return Z.key===ke?N(L,I,Z,fe):null;case w:return Z.key===ke?F(L,I,Z,fe):null;case Y:return ke=Z._init,Z=ke(Z._payload),X(L,I,Z,fe)}if(ee(Z)||P(Z))return ke!==null?null:ue(L,I,Z,fe,null);if(typeof Z.then=="function")return X(L,I,Ll(Z),fe);if(Z.$$typeof===O)return X(L,I,Cl(L,Z),fe);ql(L,Z)}return null}function W(L,I,Z,fe,ke){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return L=L.get(Z)||null,T(I,L,""+fe,ke);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case x:return L=L.get(fe.key===null?Z:fe.key)||null,N(I,L,fe,ke);case w:return L=L.get(fe.key===null?Z:fe.key)||null,F(I,L,fe,ke);case Y:var et=fe._init;return fe=et(fe._payload),W(L,I,Z,fe,ke)}if(ee(fe)||P(fe))return L=L.get(Z)||null,ue(I,L,fe,ke,null);if(typeof fe.then=="function")return W(L,I,Z,Ll(fe),ke);if(fe.$$typeof===O)return W(L,I,Z,Cl(I,fe),ke);ql(I,fe)}return null}function He(L,I,Z,fe){for(var ke=null,et=null,ze=I,Pe=I=0,gn=null;ze!==null&&Pe<Z.length;Pe++){ze.index>Pe?(gn=ze,ze=null):gn=ze.sibling;var pt=X(L,ze,Z[Pe],fe);if(pt===null){ze===null&&(ze=gn);break}t&&ze&&pt.alternate===null&&o(L,ze),I=h(pt,I,Pe),et===null?ke=pt:et.sibling=pt,et=pt,ze=gn}if(Pe===Z.length)return a(L,ze),mt&&Qs(L,Pe),ke;if(ze===null){for(;Pe<Z.length;Pe++)ze=pe(L,Z[Pe],fe),ze!==null&&(I=h(ze,I,Pe),et===null?ke=ze:et.sibling=ze,et=ze);return mt&&Qs(L,Pe),ke}for(ze=l(ze);Pe<Z.length;Pe++)gn=W(ze,L,Pe,Z[Pe],fe),gn!==null&&(t&&gn.alternate!==null&&ze.delete(gn.key===null?Pe:gn.key),I=h(gn,I,Pe),et===null?ke=gn:et.sibling=gn,et=gn);return t&&ze.forEach(function(Os){return o(L,Os)}),mt&&Qs(L,Pe),ke}function Ue(L,I,Z,fe){if(Z==null)throw Error(r(151));for(var ke=null,et=null,ze=I,Pe=I=0,gn=null,pt=Z.next();ze!==null&&!pt.done;Pe++,pt=Z.next()){ze.index>Pe?(gn=ze,ze=null):gn=ze.sibling;var Os=X(L,ze,pt.value,fe);if(Os===null){ze===null&&(ze=gn);break}t&&ze&&Os.alternate===null&&o(L,ze),I=h(Os,I,Pe),et===null?ke=Os:et.sibling=Os,et=Os,ze=gn}if(pt.done)return a(L,ze),mt&&Qs(L,Pe),ke;if(ze===null){for(;!pt.done;Pe++,pt=Z.next())pt=pe(L,pt.value,fe),pt!==null&&(I=h(pt,I,Pe),et===null?ke=pt:et.sibling=pt,et=pt);return mt&&Qs(L,Pe),ke}for(ze=l(ze);!pt.done;Pe++,pt=Z.next())pt=W(ze,L,Pe,pt.value,fe),pt!==null&&(t&&pt.alternate!==null&&ze.delete(pt.key===null?Pe:pt.key),I=h(pt,I,Pe),et===null?ke=pt:et.sibling=pt,et=pt);return t&&ze.forEach(function(aR){return o(L,aR)}),mt&&Qs(L,Pe),ke}function Et(L,I,Z,fe){if(typeof Z=="object"&&Z!==null&&Z.type===E&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case x:e:{for(var ke=Z.key;I!==null;){if(I.key===ke){if(ke=Z.type,ke===E){if(I.tag===7){a(L,I.sibling),fe=u(I,Z.props.children),fe.return=L,L=fe;break e}}else if(I.elementType===ke||typeof ke=="object"&&ke!==null&&ke.$$typeof===Y&&Lg(ke)===I.type){a(L,I.sibling),fe=u(I,Z.props),Ja(fe,Z),fe.return=L,L=fe;break e}a(L,I);break}else o(L,I);I=I.sibling}Z.type===E?(fe=Fs(Z.props.children,L.mode,fe,Z.key),fe.return=L,L=fe):(fe=El(Z.type,Z.key,Z.props,null,L.mode,fe),Ja(fe,Z),fe.return=L,L=fe)}return S(L);case w:e:{for(ke=Z.key;I!==null;){if(I.key===ke)if(I.tag===4&&I.stateNode.containerInfo===Z.containerInfo&&I.stateNode.implementation===Z.implementation){a(L,I.sibling),fe=u(I,Z.children||[]),fe.return=L,L=fe;break e}else{a(L,I);break}else o(L,I);I=I.sibling}fe=Ku(Z,L.mode,fe),fe.return=L,L=fe}return S(L);case Y:return ke=Z._init,Z=ke(Z._payload),Et(L,I,Z,fe)}if(ee(Z))return He(L,I,Z,fe);if(P(Z)){if(ke=P(Z),typeof ke!="function")throw Error(r(150));return Z=ke.call(Z),Ue(L,I,Z,fe)}if(typeof Z.then=="function")return Et(L,I,Ll(Z),fe);if(Z.$$typeof===O)return Et(L,I,Cl(L,Z),fe);ql(L,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,I!==null&&I.tag===6?(a(L,I.sibling),fe=u(I,Z),fe.return=L,L=fe):(a(L,I),fe=Gu(Z,L.mode,fe),fe.return=L,L=fe),S(L)):a(L,I)}return function(L,I,Z,fe){try{Qa=0;var ke=Et(L,I,Z,fe);return Zr=null,ke}catch(ze){if(ze===Ha||ze===kl)throw ze;var et=Gn(29,ze,null,L.mode);return et.lanes=fe,et.return=L,et}finally{}}}var Vr=qg(!0),Hg=qg(!1),co=Se(null),Ao=null;function gs(t){var o=t.alternate;ne(ln,ln.current&1),ne(co,t),Ao===null&&(o===null||Lr.current!==null||o.memoizedState!==null)&&(Ao=t)}function Bg(t){if(t.tag===22){if(ne(ln,ln.current),ne(co,t),Ao===null){var o=t.alternate;o!==null&&o.memoizedState!==null&&(Ao=t)}}else vs()}function vs(){ne(ln,ln.current),ne(co,co.current)}function Ko(t){D(co),Ao===t&&(Ao=null),D(ln)}var ln=Se(0);function Hl(t){for(var o=t;o!==null;){if(o.tag===13){var a=o.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||vf(a)))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break;for(;o.sibling===null;){if(o.return===null||o.return===t)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}function Cd(t,o,a,l){o=t.memoizedState,a=a(l,o),a=a==null?o:y({},o,a),t.memoizedState=a,t.lanes===0&&(t.updateQueue.baseState=a)}var Ad={enqueueSetState:function(t,o,a){t=t._reactInternals;var l=Qn(),u=ps(l);u.payload=o,a!=null&&(u.callback=a),o=hs(t,u,l),o!==null&&(Jn(o,t,l),Za(o,t,l))},enqueueReplaceState:function(t,o,a){t=t._reactInternals;var l=Qn(),u=ps(l);u.tag=1,u.payload=o,a!=null&&(u.callback=a),o=hs(t,u,l),o!==null&&(Jn(o,t,l),Za(o,t,l))},enqueueForceUpdate:function(t,o){t=t._reactInternals;var a=Qn(),l=ps(a);l.tag=2,o!=null&&(l.callback=o),o=hs(t,l,a),o!==null&&(Jn(o,t,a),Za(o,t,a))}};function Zg(t,o,a,l,u,h,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(l,h,S):o.prototype&&o.prototype.isPureReactComponent?!za(a,l)||!za(u,h):!0}function Vg(t,o,a,l){t=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(a,l),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(a,l),o.state!==t&&Ad.enqueueReplaceState(o,o.state,null)}function sr(t,o){var a=o;if("ref"in o){a={};for(var l in o)l!=="ref"&&(a[l]=o[l])}if(t=t.defaultProps){a===o&&(a=y({},a));for(var u in t)a[u]===void 0&&(a[u]=t[u])}return a}var Bl=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function Yg(t){Bl(t)}function Gg(t){console.error(t)}function Kg(t){Bl(t)}function Zl(t,o){try{var a=t.onUncaughtError;a(o.value,{componentStack:o.stack})}catch(l){setTimeout(function(){throw l})}}function Fg(t,o,a){try{var l=t.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function kd(t,o,a){return a=ps(a),a.tag=3,a.payload={element:null},a.callback=function(){Zl(t,o)},a}function Xg(t){return t=ps(t),t.tag=3,t}function Qg(t,o,a,l){var u=a.type.getDerivedStateFromError;if(typeof u=="function"){var h=l.value;t.payload=function(){return u(h)},t.callback=function(){Fg(o,a,l)}}var S=a.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){Fg(o,a,l),typeof u!="function"&&(Es===null?Es=new Set([this]):Es.add(this));var T=l.stack;this.componentDidCatch(l.value,{componentStack:T!==null?T:""})})}function a_(t,o,a,l,u){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(o=a.alternate,o!==null&&$a(o,a,u,!0),a=co.current,a!==null){switch(a.tag){case 13:return Ao===null?Wd():a.alternate===null&&Yt===0&&(Yt=3),a.flags&=-257,a.flags|=65536,a.lanes=u,l===sd?a.flags|=16384:(o=a.updateQueue,o===null?a.updateQueue=new Set([l]):o.add(l),tf(t,l,u)),!1;case 22:return a.flags|=65536,l===sd?a.flags|=16384:(o=a.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=o):(a=o.retryQueue,a===null?o.retryQueue=new Set([l]):a.add(l)),tf(t,l,u)),!1}throw Error(r(435,a.tag))}return tf(t,l,u),Wd(),!1}if(mt)return o=co.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=u,l!==Qu&&(t=Error(r(422),{cause:l}),Pa(ro(t,a)))):(l!==Qu&&(o=Error(r(423),{cause:l}),Pa(ro(o,a))),t=t.current.alternate,t.flags|=65536,u&=-u,t.lanes|=u,l=ro(l,a),u=kd(t.stateNode,l,u),id(t,u),Yt!==4&&(Yt=2)),!1;var h=Error(r(520),{cause:l});if(h=ro(h,a),ri===null?ri=[h]:ri.push(h),Yt!==4&&(Yt=2),o===null)return!0;l=ro(l,a),a=o;do{switch(a.tag){case 3:return a.flags|=65536,t=u&-u,a.lanes|=t,t=kd(a.stateNode,l,t),id(a,t),!1;case 1:if(o=a.type,h=a.stateNode,(a.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Es===null||!Es.has(h))))return a.flags|=65536,u&=-u,a.lanes|=u,u=Xg(u),Qg(u,t,a,l),id(a,u),!1}a=a.return}while(a!==null);return!1}var Jg=Error(r(461)),hn=!1;function bn(t,o,a,l){o.child=t===null?Hg(o,null,a,l):Vr(o,t.child,a,l)}function Wg(t,o,a,l,u){a=a.render;var h=o.ref;if("ref"in l){var S={};for(var T in l)T!=="ref"&&(S[T]=l[T])}else S=l;return tr(o),l=fd(t,o,a,S,h,u),T=pd(),t!==null&&!hn?(hd(t,o,u),Fo(t,o,u)):(mt&&T&&Fu(o),o.flags|=1,bn(t,o,l,u),o.child)}function ev(t,o,a,l,u){if(t===null){var h=a.type;return typeof h=="function"&&!Yu(h)&&h.defaultProps===void 0&&a.compare===null?(o.tag=15,o.type=h,tv(t,o,h,l,u)):(t=El(a.type,null,l,o,o.mode,u),t.ref=o.ref,t.return=o,o.child=t)}if(h=t.child,!Ud(t,u)){var S=h.memoizedProps;if(a=a.compare,a=a!==null?a:za,a(S,l)&&t.ref===o.ref)return Fo(t,o,u)}return o.flags|=1,t=Ho(h,l),t.ref=o.ref,t.return=o,o.child=t}function tv(t,o,a,l,u){if(t!==null){var h=t.memoizedProps;if(za(h,l)&&t.ref===o.ref)if(hn=!1,o.pendingProps=l=h,Ud(t,u))(t.flags&131072)!==0&&(hn=!0);else return o.lanes=t.lanes,Fo(t,o,u)}return jd(t,o,a,l,u)}function nv(t,o,a){var l=o.pendingProps,u=l.children,h=t!==null?t.memoizedState:null;if(l.mode==="hidden"){if((o.flags&128)!==0){if(l=h!==null?h.baseLanes|a:a,t!==null){for(u=o.child=t.child,h=0;u!==null;)h=h|u.lanes|u.childLanes,u=u.sibling;o.childLanes=h&~l}else o.childLanes=0,o.child=null;return ov(t,o,l,a)}if((a&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},t!==null&&Al(o,h!==null?h.cachePool:null),h!==null?tg(o,h):cd(),Bg(o);else return o.lanes=o.childLanes=536870912,ov(t,o,h!==null?h.baseLanes|a:a,a)}else h!==null?(Al(o,h.cachePool),tg(o,h),vs(),o.memoizedState=null):(t!==null&&Al(o,null),cd(),vs());return bn(t,o,u,a),o.child}function ov(t,o,a,l){var u=od();return u=u===null?null:{parent:an._currentValue,pool:u},o.memoizedState={baseLanes:a,cachePool:u},t!==null&&Al(o,null),cd(),Bg(o),t!==null&&$a(t,o,l,!0),null}function Vl(t,o){var a=o.ref;if(a===null)t!==null&&t.ref!==null&&(o.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(t===null||t.ref!==a)&&(o.flags|=4194816)}}function jd(t,o,a,l,u){return tr(o),a=fd(t,o,a,l,void 0,u),l=pd(),t!==null&&!hn?(hd(t,o,u),Fo(t,o,u)):(mt&&l&&Fu(o),o.flags|=1,bn(t,o,a,u),o.child)}function sv(t,o,a,l,u,h){return tr(o),o.updateQueue=null,a=og(o,l,a,u),ng(t),l=pd(),t!==null&&!hn?(hd(t,o,h),Fo(t,o,h)):(mt&&l&&Fu(o),o.flags|=1,bn(t,o,a,h),o.child)}function rv(t,o,a,l,u){if(tr(o),o.stateNode===null){var h=Ir,S=a.contextType;typeof S=="object"&&S!==null&&(h=Cn(S)),h=new a(l,h),o.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Ad,o.stateNode=h,h._reactInternals=o,h=o.stateNode,h.props=l,h.state=o.memoizedState,h.refs={},rd(o),S=a.contextType,h.context=typeof S=="object"&&S!==null?Cn(S):Ir,h.state=o.memoizedState,S=a.getDerivedStateFromProps,typeof S=="function"&&(Cd(o,a,S,l),h.state=o.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(S=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),S!==h.state&&Ad.enqueueReplaceState(h,h.state,null),Ya(o,l,h,u),Va(),h.state=o.memoizedState),typeof h.componentDidMount=="function"&&(o.flags|=4194308),l=!0}else if(t===null){h=o.stateNode;var T=o.memoizedProps,N=sr(a,T);h.props=N;var F=h.context,ue=a.contextType;S=Ir,typeof ue=="object"&&ue!==null&&(S=Cn(ue));var pe=a.getDerivedStateFromProps;ue=typeof pe=="function"||typeof h.getSnapshotBeforeUpdate=="function",T=o.pendingProps!==T,ue||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(T||F!==S)&&Vg(o,h,l,S),fs=!1;var X=o.memoizedState;h.state=X,Ya(o,l,h,u),Va(),F=o.memoizedState,T||X!==F||fs?(typeof pe=="function"&&(Cd(o,a,pe,l),F=o.memoizedState),(N=fs||Zg(o,a,N,l,X,F,S))?(ue||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(o.flags|=4194308)):(typeof h.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=l,o.memoizedState=F),h.props=l,h.state=F,h.context=S,l=N):(typeof h.componentDidMount=="function"&&(o.flags|=4194308),l=!1)}else{h=o.stateNode,ad(t,o),S=o.memoizedProps,ue=sr(a,S),h.props=ue,pe=o.pendingProps,X=h.context,F=a.contextType,N=Ir,typeof F=="object"&&F!==null&&(N=Cn(F)),T=a.getDerivedStateFromProps,(F=typeof T=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(S!==pe||X!==N)&&Vg(o,h,l,N),fs=!1,X=o.memoizedState,h.state=X,Ya(o,l,h,u),Va();var W=o.memoizedState;S!==pe||X!==W||fs||t!==null&&t.dependencies!==null&&Rl(t.dependencies)?(typeof T=="function"&&(Cd(o,a,T,l),W=o.memoizedState),(ue=fs||Zg(o,a,ue,l,X,W,N)||t!==null&&t.dependencies!==null&&Rl(t.dependencies))?(F||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(l,W,N),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(l,W,N)),typeof h.componentDidUpdate=="function"&&(o.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof h.componentDidUpdate!="function"||S===t.memoizedProps&&X===t.memoizedState||(o.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&X===t.memoizedState||(o.flags|=1024),o.memoizedProps=l,o.memoizedState=W),h.props=l,h.state=W,h.context=N,l=ue):(typeof h.componentDidUpdate!="function"||S===t.memoizedProps&&X===t.memoizedState||(o.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&X===t.memoizedState||(o.flags|=1024),l=!1)}return h=l,Vl(t,o),l=(o.flags&128)!==0,h||l?(h=o.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:h.render(),o.flags|=1,t!==null&&l?(o.child=Vr(o,t.child,null,u),o.child=Vr(o,null,a,u)):bn(t,o,a,u),o.memoizedState=h.state,t=o.child):t=Fo(t,o,u),t}function av(t,o,a,l){return Ua(),o.flags|=256,bn(t,o,a,l),o.child}var Od={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Nd(t){return{baseLanes:t,cachePool:Gm()}}function Md(t,o,a){return t=t!==null?t.childLanes&~a:0,o&&(t|=uo),t}function iv(t,o,a){var l=o.pendingProps,u=!1,h=(o.flags&128)!==0,S;if((S=h)||(S=t!==null&&t.memoizedState===null?!1:(ln.current&2)!==0),S&&(u=!0,o.flags&=-129),S=(o.flags&32)!==0,o.flags&=-33,t===null){if(mt){if(u?gs(o):vs(),mt){var T=Vt,N;if(N=T){e:{for(N=T,T=Co;N.nodeType!==8;){if(!T){T=null;break e}if(N=So(N.nextSibling),N===null){T=null;break e}}T=N}T!==null?(o.memoizedState={dehydrated:T,treeContext:Xs!==null?{id:Bo,overflow:Zo}:null,retryLane:536870912,hydrationErrors:null},N=Gn(18,null,null,0),N.stateNode=T,N.return=o,o.child=N,jn=o,Vt=null,N=!0):N=!1}N||Ws(o)}if(T=o.memoizedState,T!==null&&(T=T.dehydrated,T!==null))return vf(T)?o.lanes=32:o.lanes=536870912,null;Ko(o)}return T=l.children,l=l.fallback,u?(vs(),u=o.mode,T=Yl({mode:"hidden",children:T},u),l=Fs(l,u,a,null),T.return=o,l.return=o,T.sibling=l,o.child=T,u=o.child,u.memoizedState=Nd(a),u.childLanes=Md(t,S,a),o.memoizedState=Od,l):(gs(o),zd(o,T))}if(N=t.memoizedState,N!==null&&(T=N.dehydrated,T!==null)){if(h)o.flags&256?(gs(o),o.flags&=-257,o=Id(t,o,a)):o.memoizedState!==null?(vs(),o.child=t.child,o.flags|=128,o=null):(vs(),u=l.fallback,T=o.mode,l=Yl({mode:"visible",children:l.children},T),u=Fs(u,T,a,null),u.flags|=2,l.return=o,u.return=o,l.sibling=u,o.child=l,Vr(o,t.child,null,a),l=o.child,l.memoizedState=Nd(a),l.childLanes=Md(t,S,a),o.memoizedState=Od,o=u);else if(gs(o),vf(T)){if(S=T.nextSibling&&T.nextSibling.dataset,S)var F=S.dgst;S=F,l=Error(r(419)),l.stack="",l.digest=S,Pa({value:l,source:null,stack:null}),o=Id(t,o,a)}else if(hn||$a(t,o,a,!1),S=(a&t.childLanes)!==0,hn||S){if(S=jt,S!==null&&(l=a&-a,l=(l&42)!==0?1:Vn(l),l=(l&(S.suspendedLanes|a))!==0?0:l,l!==0&&l!==N.retryLane))throw N.retryLane=l,zr(t,l),Jn(S,t,l),Jg;T.data==="$?"||Wd(),o=Id(t,o,a)}else T.data==="$?"?(o.flags|=192,o.child=t.child,o=null):(t=N.treeContext,Vt=So(T.nextSibling),jn=o,mt=!0,Js=null,Co=!1,t!==null&&(io[lo++]=Bo,io[lo++]=Zo,io[lo++]=Xs,Bo=t.id,Zo=t.overflow,Xs=o),o=zd(o,l.children),o.flags|=4096);return o}return u?(vs(),u=l.fallback,T=o.mode,N=t.child,F=N.sibling,l=Ho(N,{mode:"hidden",children:l.children}),l.subtreeFlags=N.subtreeFlags&65011712,F!==null?u=Ho(F,u):(u=Fs(u,T,a,null),u.flags|=2),u.return=o,l.return=o,l.sibling=u,o.child=l,l=u,u=o.child,T=t.child.memoizedState,T===null?T=Nd(a):(N=T.cachePool,N!==null?(F=an._currentValue,N=N.parent!==F?{parent:F,pool:F}:N):N=Gm(),T={baseLanes:T.baseLanes|a,cachePool:N}),u.memoizedState=T,u.childLanes=Md(t,S,a),o.memoizedState=Od,l):(gs(o),a=t.child,t=a.sibling,a=Ho(a,{mode:"visible",children:l.children}),a.return=o,a.sibling=null,t!==null&&(S=o.deletions,S===null?(o.deletions=[t],o.flags|=16):S.push(t)),o.child=a,o.memoizedState=null,a)}function zd(t,o){return o=Yl({mode:"visible",children:o},t.mode),o.return=t,t.child=o}function Yl(t,o){return t=Gn(22,t,null,o),t.lanes=0,t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},t}function Id(t,o,a){return Vr(o,t.child,null,a),t=zd(o,o.pendingProps.children),t.flags|=2,o.memoizedState=null,t}function lv(t,o,a){t.lanes|=o;var l=t.alternate;l!==null&&(l.lanes|=o),Wu(t.return,o,a)}function Dd(t,o,a,l,u){var h=t.memoizedState;h===null?t.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:u}:(h.isBackwards=o,h.rendering=null,h.renderingStartTime=0,h.last=l,h.tail=a,h.tailMode=u)}function cv(t,o,a){var l=o.pendingProps,u=l.revealOrder,h=l.tail;if(bn(t,o,l.children,a),l=ln.current,(l&2)!==0)l=l&1|2,o.flags|=128;else{if(t!==null&&(t.flags&128)!==0)e:for(t=o.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&lv(t,a,o);else if(t.tag===19)lv(t,a,o);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===o)break e;for(;t.sibling===null;){if(t.return===null||t.return===o)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}l&=1}switch(ne(ln,l),u){case"forwards":for(a=o.child,u=null;a!==null;)t=a.alternate,t!==null&&Hl(t)===null&&(u=a),a=a.sibling;a=u,a===null?(u=o.child,o.child=null):(u=a.sibling,a.sibling=null),Dd(o,!1,u,a,h);break;case"backwards":for(a=null,u=o.child,o.child=null;u!==null;){if(t=u.alternate,t!==null&&Hl(t)===null){o.child=u;break}t=u.sibling,u.sibling=a,a=u,u=t}Dd(o,!0,a,null,h);break;case"together":Dd(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function Fo(t,o,a){if(t!==null&&(o.dependencies=t.dependencies),ws|=o.lanes,(a&o.childLanes)===0)if(t!==null){if($a(t,o,a,!1),(a&o.childLanes)===0)return null}else return null;if(t!==null&&o.child!==t.child)throw Error(r(153));if(o.child!==null){for(t=o.child,a=Ho(t,t.pendingProps),o.child=a,a.return=o;t.sibling!==null;)t=t.sibling,a=a.sibling=Ho(t,t.pendingProps),a.return=o;a.sibling=null}return o.child}function Ud(t,o){return(t.lanes&o)!==0?!0:(t=t.dependencies,!!(t!==null&&Rl(t)))}function i_(t,o,a){switch(o.tag){case 3:be(o,o.stateNode.containerInfo),ds(o,an,t.memoizedState.cache),Ua();break;case 27:case 5:qe(o);break;case 4:be(o,o.stateNode.containerInfo);break;case 10:ds(o,o.type,o.memoizedProps.value);break;case 13:var l=o.memoizedState;if(l!==null)return l.dehydrated!==null?(gs(o),o.flags|=128,null):(a&o.child.childLanes)!==0?iv(t,o,a):(gs(o),t=Fo(t,o,a),t!==null?t.sibling:null);gs(o);break;case 19:var u=(t.flags&128)!==0;if(l=(a&o.childLanes)!==0,l||($a(t,o,a,!1),l=(a&o.childLanes)!==0),u){if(l)return cv(t,o,a);o.flags|=128}if(u=o.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ne(ln,ln.current),l)break;return null;case 22:case 23:return o.lanes=0,nv(t,o,a);case 24:ds(o,an,t.memoizedState.cache)}return Fo(t,o,a)}function uv(t,o,a){if(t!==null)if(t.memoizedProps!==o.pendingProps)hn=!0;else{if(!Ud(t,a)&&(o.flags&128)===0)return hn=!1,i_(t,o,a);hn=(t.flags&131072)!==0}else hn=!1,mt&&(o.flags&1048576)!==0&&Lm(o,_l,o.index);switch(o.lanes=0,o.tag){case 16:e:{t=o.pendingProps;var l=o.elementType,u=l._init;if(l=u(l._payload),o.type=l,typeof l=="function")Yu(l)?(t=sr(l,t),o.tag=1,o=rv(null,o,l,t,a)):(o.tag=0,o=jd(null,o,l,t,a));else{if(l!=null){if(u=l.$$typeof,u===R){o.tag=11,o=Wg(null,o,l,t,a);break e}else if(u===k){o.tag=14,o=ev(null,o,l,t,a);break e}}throw o=le(l)||l,Error(r(306,o,""))}}return o;case 0:return jd(t,o,o.type,o.pendingProps,a);case 1:return l=o.type,u=sr(l,o.pendingProps),rv(t,o,l,u,a);case 3:e:{if(be(o,o.stateNode.containerInfo),t===null)throw Error(r(387));l=o.pendingProps;var h=o.memoizedState;u=h.element,ad(t,o),Ya(o,l,null,a);var S=o.memoizedState;if(l=S.cache,ds(o,an,l),l!==h.cache&&ed(o,[an],a,!0),Va(),l=S.element,h.isDehydrated)if(h={element:l,isDehydrated:!1,cache:S.cache},o.updateQueue.baseState=h,o.memoizedState=h,o.flags&256){o=av(t,o,l,a);break e}else if(l!==u){u=ro(Error(r(424)),o),Pa(u),o=av(t,o,l,a);break e}else{switch(t=o.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Vt=So(t.firstChild),jn=o,mt=!0,Js=null,Co=!0,a=Hg(o,null,l,a),o.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ua(),l===u){o=Fo(t,o,a);break e}bn(t,o,l,a)}o=o.child}return o;case 26:return Vl(t,o),t===null?(a=hy(o.type,null,o.pendingProps,null))?o.memoizedState=a:mt||(a=o.type,t=o.pendingProps,l=ac(me.current).createElement(a),l[We]=o,l[Ut]=t,xn(l,a,t),Xt(l),o.stateNode=l):o.memoizedState=hy(o.type,t.memoizedProps,o.pendingProps,t.memoizedState),null;case 27:return qe(o),t===null&&mt&&(l=o.stateNode=dy(o.type,o.pendingProps,me.current),jn=o,Co=!0,u=Vt,Rs(o.type)?(yf=u,Vt=So(l.firstChild)):Vt=u),bn(t,o,o.pendingProps.children,a),Vl(t,o),t===null&&(o.flags|=4194304),o.child;case 5:return t===null&&mt&&((u=l=Vt)&&(l=I_(l,o.type,o.pendingProps,Co),l!==null?(o.stateNode=l,jn=o,Vt=So(l.firstChild),Co=!1,u=!0):u=!1),u||Ws(o)),qe(o),u=o.type,h=o.pendingProps,S=t!==null?t.memoizedProps:null,l=h.children,hf(u,h)?l=null:S!==null&&hf(u,S)&&(o.flags|=32),o.memoizedState!==null&&(u=fd(t,o,WT,null,null,a),hi._currentValue=u),Vl(t,o),bn(t,o,l,a),o.child;case 6:return t===null&&mt&&((t=a=Vt)&&(a=D_(a,o.pendingProps,Co),a!==null?(o.stateNode=a,jn=o,Vt=null,t=!0):t=!1),t||Ws(o)),null;case 13:return iv(t,o,a);case 4:return be(o,o.stateNode.containerInfo),l=o.pendingProps,t===null?o.child=Vr(o,null,l,a):bn(t,o,l,a),o.child;case 11:return Wg(t,o,o.type,o.pendingProps,a);case 7:return bn(t,o,o.pendingProps,a),o.child;case 8:return bn(t,o,o.pendingProps.children,a),o.child;case 12:return bn(t,o,o.pendingProps.children,a),o.child;case 10:return l=o.pendingProps,ds(o,o.type,l.value),bn(t,o,l.children,a),o.child;case 9:return u=o.type._context,l=o.pendingProps.children,tr(o),u=Cn(u),l=l(u),o.flags|=1,bn(t,o,l,a),o.child;case 14:return ev(t,o,o.type,o.pendingProps,a);case 15:return tv(t,o,o.type,o.pendingProps,a);case 19:return cv(t,o,a);case 31:return l=o.pendingProps,a=o.mode,l={mode:l.mode,children:l.children},t===null?(a=Yl(l,a),a.ref=o.ref,o.child=a,a.return=o,o=a):(a=Ho(t.child,l),a.ref=o.ref,o.child=a,a.return=o,o=a),o;case 22:return nv(t,o,a);case 24:return tr(o),l=Cn(an),t===null?(u=od(),u===null&&(u=jt,h=td(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=a),u=h),o.memoizedState={parent:l,cache:u},rd(o),ds(o,an,u)):((t.lanes&a)!==0&&(ad(t,o),Ya(o,null,null,a),Va()),u=t.memoizedState,h=o.memoizedState,u.parent!==l?(u={parent:l,cache:l},o.memoizedState=u,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=u),ds(o,an,l)):(l=h.cache,ds(o,an,l),l!==u.cache&&ed(o,[an],a,!0))),bn(t,o,o.pendingProps.children,a),o.child;case 29:throw o.pendingProps}throw Error(r(156,o.tag))}function Xo(t){t.flags|=4}function dv(t,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!by(o)){if(o=co.current,o!==null&&((ut&4194048)===ut?Ao!==null:(ut&62914560)!==ut&&(ut&536870912)===0||o!==Ao))throw Ba=sd,Km;t.flags|=8192}}function Gl(t,o){o!==null&&(t.flags|=4),t.flags&16384&&(o=t.tag!==22?Kt():536870912,t.lanes|=o,Fr|=o)}function Wa(t,o){if(!mt)switch(t.tailMode){case"hidden":o=t.tail;for(var a=null;o!==null;)o.alternate!==null&&(a=o),o=o.sibling;a===null?t.tail=null:a.sibling=null;break;case"collapsed":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?o||t.tail===null?t.tail=null:t.tail.sibling=null:l.sibling=null}}function Lt(t){var o=t.alternate!==null&&t.alternate.child===t.child,a=0,l=0;if(o)for(var u=t.child;u!==null;)a|=u.lanes|u.childLanes,l|=u.subtreeFlags&65011712,l|=u.flags&65011712,u.return=t,u=u.sibling;else for(u=t.child;u!==null;)a|=u.lanes|u.childLanes,l|=u.subtreeFlags,l|=u.flags,u.return=t,u=u.sibling;return t.subtreeFlags|=l,t.childLanes=a,o}function l_(t,o,a){var l=o.pendingProps;switch(Xu(o),o.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lt(o),null;case 1:return Lt(o),null;case 3:return a=o.stateNode,l=null,t!==null&&(l=t.memoizedState.cache),o.memoizedState.cache!==l&&(o.flags|=2048),Yo(an),xe(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(t===null||t.child===null)&&(Da(o)?Xo(o):t===null||t.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Bm())),Lt(o),null;case 26:return a=o.memoizedState,t===null?(Xo(o),a!==null?(Lt(o),dv(o,a)):(Lt(o),o.flags&=-16777217)):a?a!==t.memoizedState?(Xo(o),Lt(o),dv(o,a)):(Lt(o),o.flags&=-16777217):(t.memoizedProps!==l&&Xo(o),Lt(o),o.flags&=-16777217),null;case 27:it(o),a=me.current;var u=o.type;if(t!==null&&o.stateNode!=null)t.memoizedProps!==l&&Xo(o);else{if(!l){if(o.stateNode===null)throw Error(r(166));return Lt(o),null}t=de.current,Da(o)?qm(o):(t=dy(u,l,a),o.stateNode=t,Xo(o))}return Lt(o),null;case 5:if(it(o),a=o.type,t!==null&&o.stateNode!=null)t.memoizedProps!==l&&Xo(o);else{if(!l){if(o.stateNode===null)throw Error(r(166));return Lt(o),null}if(t=de.current,Da(o))qm(o);else{switch(u=ac(me.current),t){case 1:t=u.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:t=u.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":t=u.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":t=u.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":t=u.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild);break;case"select":t=typeof l.is=="string"?u.createElement("select",{is:l.is}):u.createElement("select"),l.multiple?t.multiple=!0:l.size&&(t.size=l.size);break;default:t=typeof l.is=="string"?u.createElement(a,{is:l.is}):u.createElement(a)}}t[We]=o,t[Ut]=l;e:for(u=o.child;u!==null;){if(u.tag===5||u.tag===6)t.appendChild(u.stateNode);else if(u.tag!==4&&u.tag!==27&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break e;for(;u.sibling===null;){if(u.return===null||u.return===o)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}o.stateNode=t;e:switch(xn(t,a,l),a){case"button":case"input":case"select":case"textarea":t=!!l.autoFocus;break e;case"img":t=!0;break e;default:t=!1}t&&Xo(o)}}return Lt(o),o.flags&=-16777217,null;case 6:if(t&&o.stateNode!=null)t.memoizedProps!==l&&Xo(o);else{if(typeof l!="string"&&o.stateNode===null)throw Error(r(166));if(t=me.current,Da(o)){if(t=o.stateNode,a=o.memoizedProps,l=null,u=jn,u!==null)switch(u.tag){case 27:case 5:l=u.memoizedProps}t[We]=o,t=!!(t.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||sy(t.nodeValue,a)),t||Ws(o)}else t=ac(t).createTextNode(l),t[We]=o,o.stateNode=t}return Lt(o),null;case 13:if(l=o.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(u=Da(o),l!==null&&l.dehydrated!==null){if(t===null){if(!u)throw Error(r(318));if(u=o.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(317));u[We]=o}else Ua(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Lt(o),u=!1}else u=Bm(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=u),u=!0;if(!u)return o.flags&256?(Ko(o),o):(Ko(o),null)}if(Ko(o),(o.flags&128)!==0)return o.lanes=a,o;if(a=l!==null,t=t!==null&&t.memoizedState!==null,a){l=o.child,u=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(u=l.alternate.memoizedState.cachePool.pool);var h=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==u&&(l.flags|=2048)}return a!==t&&a&&(o.child.flags|=8192),Gl(o,o.updateQueue),Lt(o),null;case 4:return xe(),t===null&&cf(o.stateNode.containerInfo),Lt(o),null;case 10:return Yo(o.type),Lt(o),null;case 19:if(D(ln),u=o.memoizedState,u===null)return Lt(o),null;if(l=(o.flags&128)!==0,h=u.rendering,h===null)if(l)Wa(u,!1);else{if(Yt!==0||t!==null&&(t.flags&128)!==0)for(t=o.child;t!==null;){if(h=Hl(t),h!==null){for(o.flags|=128,Wa(u,!1),t=h.updateQueue,o.updateQueue=t,Gl(o,t),o.subtreeFlags=0,t=a,a=o.child;a!==null;)$m(a,t),a=a.sibling;return ne(ln,ln.current&1|2),o.child}t=t.sibling}u.tail!==null&&ge()>Xl&&(o.flags|=128,l=!0,Wa(u,!1),o.lanes=4194304)}else{if(!l)if(t=Hl(h),t!==null){if(o.flags|=128,l=!0,t=t.updateQueue,o.updateQueue=t,Gl(o,t),Wa(u,!0),u.tail===null&&u.tailMode==="hidden"&&!h.alternate&&!mt)return Lt(o),null}else 2*ge()-u.renderingStartTime>Xl&&a!==536870912&&(o.flags|=128,l=!0,Wa(u,!1),o.lanes=4194304);u.isBackwards?(h.sibling=o.child,o.child=h):(t=u.last,t!==null?t.sibling=h:o.child=h,u.last=h)}return u.tail!==null?(o=u.tail,u.rendering=o,u.tail=o.sibling,u.renderingStartTime=ge(),o.sibling=null,t=ln.current,ne(ln,l?t&1|2:t&1),o):(Lt(o),null);case 22:case 23:return Ko(o),ud(),l=o.memoizedState!==null,t!==null?t.memoizedState!==null!==l&&(o.flags|=8192):l&&(o.flags|=8192),l?(a&536870912)!==0&&(o.flags&128)===0&&(Lt(o),o.subtreeFlags&6&&(o.flags|=8192)):Lt(o),a=o.updateQueue,a!==null&&Gl(o,a.retryQueue),a=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),l=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(l=o.memoizedState.cachePool.pool),l!==a&&(o.flags|=2048),t!==null&&D(nr),null;case 24:return a=null,t!==null&&(a=t.memoizedState.cache),o.memoizedState.cache!==a&&(o.flags|=2048),Yo(an),Lt(o),null;case 25:return null;case 30:return null}throw Error(r(156,o.tag))}function c_(t,o){switch(Xu(o),o.tag){case 1:return t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 3:return Yo(an),xe(),t=o.flags,(t&65536)!==0&&(t&128)===0?(o.flags=t&-65537|128,o):null;case 26:case 27:case 5:return it(o),null;case 13:if(Ko(o),t=o.memoizedState,t!==null&&t.dehydrated!==null){if(o.alternate===null)throw Error(r(340));Ua()}return t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 19:return D(ln),null;case 4:return xe(),null;case 10:return Yo(o.type),null;case 22:case 23:return Ko(o),ud(),t!==null&&D(nr),t=o.flags,t&65536?(o.flags=t&-65537|128,o):null;case 24:return Yo(an),null;case 25:return null;default:return null}}function fv(t,o){switch(Xu(o),o.tag){case 3:Yo(an),xe();break;case 26:case 27:case 5:it(o);break;case 4:xe();break;case 13:Ko(o);break;case 19:D(ln);break;case 10:Yo(o.type);break;case 22:case 23:Ko(o),ud(),t!==null&&D(nr);break;case 24:Yo(an)}}function ei(t,o){try{var a=o.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var u=l.next;a=u;do{if((a.tag&t)===t){l=void 0;var h=a.create,S=a.inst;l=h(),S.destroy=l}a=a.next}while(a!==u)}}catch(T){_t(o,o.return,T)}}function ys(t,o,a){try{var l=o.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var h=u.next;l=h;do{if((l.tag&t)===t){var S=l.inst,T=S.destroy;if(T!==void 0){S.destroy=void 0,u=o;var N=a,F=T;try{F()}catch(ue){_t(u,N,ue)}}}l=l.next}while(l!==h)}}catch(ue){_t(o,o.return,ue)}}function pv(t){var o=t.updateQueue;if(o!==null){var a=t.stateNode;try{eg(o,a)}catch(l){_t(t,t.return,l)}}}function hv(t,o,a){a.props=sr(t.type,t.memoizedProps),a.state=t.memoizedState;try{a.componentWillUnmount()}catch(l){_t(t,o,l)}}function ti(t,o){try{var a=t.ref;if(a!==null){switch(t.tag){case 26:case 27:case 5:var l=t.stateNode;break;case 30:l=t.stateNode;break;default:l=t.stateNode}typeof a=="function"?t.refCleanup=a(l):a.current=l}}catch(u){_t(t,o,u)}}function ko(t,o){var a=t.ref,l=t.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(u){_t(t,o,u)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(u){_t(t,o,u)}else a.current=null}function mv(t){var o=t.type,a=t.memoizedProps,l=t.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(u){_t(t,t.return,u)}}function Pd(t,o,a){try{var l=t.stateNode;j_(l,t.type,a,o),l[Ut]=o}catch(u){_t(t,t.return,u)}}function gv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Rs(t.type)||t.tag===4}function $d(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||gv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&Rs(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ld(t,o,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,o?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(t,o):(o=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,o.appendChild(t),a=a._reactRootContainer,a!=null||o.onclick!==null||(o.onclick=rc));else if(l!==4&&(l===27&&Rs(t.type)&&(a=t.stateNode,o=null),t=t.child,t!==null))for(Ld(t,o,a),t=t.sibling;t!==null;)Ld(t,o,a),t=t.sibling}function Kl(t,o,a){var l=t.tag;if(l===5||l===6)t=t.stateNode,o?a.insertBefore(t,o):a.appendChild(t);else if(l!==4&&(l===27&&Rs(t.type)&&(a=t.stateNode),t=t.child,t!==null))for(Kl(t,o,a),t=t.sibling;t!==null;)Kl(t,o,a),t=t.sibling}function vv(t){var o=t.stateNode,a=t.memoizedProps;try{for(var l=t.type,u=o.attributes;u.length;)o.removeAttributeNode(u[0]);xn(o,l,a),o[We]=t,o[Ut]=a}catch(h){_t(t,t.return,h)}}var Qo=!1,Jt=!1,qd=!1,yv=typeof WeakSet=="function"?WeakSet:Set,mn=null;function u_(t,o){if(t=t.containerInfo,ff=fc,t=km(t),$u(t)){if("selectionStart"in t)var a={start:t.selectionStart,end:t.selectionEnd};else e:{a=(a=t.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var u=l.anchorOffset,h=l.focusNode;l=l.focusOffset;try{a.nodeType,h.nodeType}catch{a=null;break e}var S=0,T=-1,N=-1,F=0,ue=0,pe=t,X=null;t:for(;;){for(var W;pe!==a||u!==0&&pe.nodeType!==3||(T=S+u),pe!==h||l!==0&&pe.nodeType!==3||(N=S+l),pe.nodeType===3&&(S+=pe.nodeValue.length),(W=pe.firstChild)!==null;)X=pe,pe=W;for(;;){if(pe===t)break t;if(X===a&&++F===u&&(T=S),X===h&&++ue===l&&(N=S),(W=pe.nextSibling)!==null)break;pe=X,X=pe.parentNode}pe=W}a=T===-1||N===-1?null:{start:T,end:N}}else a=null}a=a||{start:0,end:0}}else a=null;for(pf={focusedElem:t,selectionRange:a},fc=!1,mn=o;mn!==null;)if(o=mn,t=o.child,(o.subtreeFlags&1024)!==0&&t!==null)t.return=o,mn=t;else for(;mn!==null;){switch(o=mn,h=o.alternate,t=o.flags,o.tag){case 0:break;case 11:case 15:break;case 1:if((t&1024)!==0&&h!==null){t=void 0,a=o,u=h.memoizedProps,h=h.memoizedState,l=a.stateNode;try{var He=sr(a.type,u,a.elementType===a.type);t=l.getSnapshotBeforeUpdate(He,h),l.__reactInternalSnapshotBeforeUpdate=t}catch(Ue){_t(a,a.return,Ue)}}break;case 3:if((t&1024)!==0){if(t=o.stateNode.containerInfo,a=t.nodeType,a===9)gf(t);else if(a===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":gf(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(r(163))}if(t=o.sibling,t!==null){t.return=o.return,mn=t;break}mn=o.return}}function bv(t,o,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:bs(t,a),l&4&&ei(5,a);break;case 1:if(bs(t,a),l&4)if(t=a.stateNode,o===null)try{t.componentDidMount()}catch(S){_t(a,a.return,S)}else{var u=sr(a.type,o.memoizedProps);o=o.memoizedState;try{t.componentDidUpdate(u,o,t.__reactInternalSnapshotBeforeUpdate)}catch(S){_t(a,a.return,S)}}l&64&&pv(a),l&512&&ti(a,a.return);break;case 3:if(bs(t,a),l&64&&(t=a.updateQueue,t!==null)){if(o=null,a.child!==null)switch(a.child.tag){case 27:case 5:o=a.child.stateNode;break;case 1:o=a.child.stateNode}try{eg(t,o)}catch(S){_t(a,a.return,S)}}break;case 27:o===null&&l&4&&vv(a);case 26:case 5:bs(t,a),o===null&&l&4&&mv(a),l&512&&ti(a,a.return);break;case 12:bs(t,a);break;case 13:bs(t,a),l&4&&wv(t,a),l&64&&(t=a.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(a=b_.bind(null,a),U_(t,a))));break;case 22:if(l=a.memoizedState!==null||Qo,!l){o=o!==null&&o.memoizedState!==null||Jt,u=Qo;var h=Jt;Qo=l,(Jt=o)&&!h?Ss(t,a,(a.subtreeFlags&8772)!==0):bs(t,a),Qo=u,Jt=h}break;case 30:break;default:bs(t,a)}}function Sv(t){var o=t.alternate;o!==null&&(t.alternate=null,Sv(o)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(o=t.stateNode,o!==null&&ls(o)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Pt=null,Pn=!1;function Jo(t,o,a){for(a=a.child;a!==null;)xv(t,o,a),a=a.sibling}function xv(t,o,a){if(Ne&&typeof Ne.onCommitFiberUnmount=="function")try{Ne.onCommitFiberUnmount(rt,a)}catch{}switch(a.tag){case 26:Jt||ko(a,o),Jo(t,o,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Jt||ko(a,o);var l=Pt,u=Pn;Rs(a.type)&&(Pt=a.stateNode,Pn=!1),Jo(t,o,a),ui(a.stateNode),Pt=l,Pn=u;break;case 5:Jt||ko(a,o);case 6:if(l=Pt,u=Pn,Pt=null,Jo(t,o,a),Pt=l,Pn=u,Pt!==null)if(Pn)try{(Pt.nodeType===9?Pt.body:Pt.nodeName==="HTML"?Pt.ownerDocument.body:Pt).removeChild(a.stateNode)}catch(h){_t(a,o,h)}else try{Pt.removeChild(a.stateNode)}catch(h){_t(a,o,h)}break;case 18:Pt!==null&&(Pn?(t=Pt,cy(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,a.stateNode),yi(t)):cy(Pt,a.stateNode));break;case 4:l=Pt,u=Pn,Pt=a.stateNode.containerInfo,Pn=!0,Jo(t,o,a),Pt=l,Pn=u;break;case 0:case 11:case 14:case 15:Jt||ys(2,a,o),Jt||ys(4,a,o),Jo(t,o,a);break;case 1:Jt||(ko(a,o),l=a.stateNode,typeof l.componentWillUnmount=="function"&&hv(a,o,l)),Jo(t,o,a);break;case 21:Jo(t,o,a);break;case 22:Jt=(l=Jt)||a.memoizedState!==null,Jo(t,o,a),Jt=l;break;default:Jo(t,o,a)}}function wv(t,o){if(o.memoizedState===null&&(t=o.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{yi(t)}catch(a){_t(o,o.return,a)}}function d_(t){switch(t.tag){case 13:case 19:var o=t.stateNode;return o===null&&(o=t.stateNode=new yv),o;case 22:return t=t.stateNode,o=t._retryCache,o===null&&(o=t._retryCache=new yv),o;default:throw Error(r(435,t.tag))}}function Hd(t,o){var a=d_(t);o.forEach(function(l){var u=S_.bind(null,t,l);a.has(l)||(a.add(l),l.then(u,u))})}function Kn(t,o){var a=o.deletions;if(a!==null)for(var l=0;l<a.length;l++){var u=a[l],h=t,S=o,T=S;e:for(;T!==null;){switch(T.tag){case 27:if(Rs(T.type)){Pt=T.stateNode,Pn=!1;break e}break;case 5:Pt=T.stateNode,Pn=!1;break e;case 3:case 4:Pt=T.stateNode.containerInfo,Pn=!0;break e}T=T.return}if(Pt===null)throw Error(r(160));xv(h,S,u),Pt=null,Pn=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(o.subtreeFlags&13878)for(o=o.child;o!==null;)Ev(o,t),o=o.sibling}var bo=null;function Ev(t,o){var a=t.alternate,l=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Kn(o,t),Fn(t),l&4&&(ys(3,t,t.return),ei(3,t),ys(5,t,t.return));break;case 1:Kn(o,t),Fn(t),l&512&&(Jt||a===null||ko(a,a.return)),l&64&&Qo&&(t=t.updateQueue,t!==null&&(l=t.callbacks,l!==null&&(a=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var u=bo;if(Kn(o,t),Fn(t),l&512&&(Jt||a===null||ko(a,a.return)),l&4){var h=a!==null?a.memoizedState:null;if(l=t.memoizedState,a===null)if(l===null)if(t.stateNode===null){e:{l=t.type,a=t.memoizedProps,u=u.ownerDocument||u;t:switch(l){case"title":h=u.getElementsByTagName("title")[0],(!h||h[Ro]||h[We]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(l),u.head.insertBefore(h,u.querySelector("head > title"))),xn(h,l,a),h[We]=t,Xt(h),l=h;break e;case"link":var S=vy("link","href",u).get(l+(a.href||""));if(S){for(var T=0;T<S.length;T++)if(h=S[T],h.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&h.getAttribute("rel")===(a.rel==null?null:a.rel)&&h.getAttribute("title")===(a.title==null?null:a.title)&&h.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){S.splice(T,1);break t}}h=u.createElement(l),xn(h,l,a),u.head.appendChild(h);break;case"meta":if(S=vy("meta","content",u).get(l+(a.content||""))){for(T=0;T<S.length;T++)if(h=S[T],h.getAttribute("content")===(a.content==null?null:""+a.content)&&h.getAttribute("name")===(a.name==null?null:a.name)&&h.getAttribute("property")===(a.property==null?null:a.property)&&h.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&h.getAttribute("charset")===(a.charSet==null?null:a.charSet)){S.splice(T,1);break t}}h=u.createElement(l),xn(h,l,a),u.head.appendChild(h);break;default:throw Error(r(468,l))}h[We]=t,Xt(h),l=h}t.stateNode=l}else yy(u,t.type,t.stateNode);else t.stateNode=gy(u,l,t.memoizedProps);else h!==l?(h===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):h.count--,l===null?yy(u,t.type,t.stateNode):gy(u,l,t.memoizedProps)):l===null&&t.stateNode!==null&&Pd(t,t.memoizedProps,a.memoizedProps)}break;case 27:Kn(o,t),Fn(t),l&512&&(Jt||a===null||ko(a,a.return)),a!==null&&l&4&&Pd(t,t.memoizedProps,a.memoizedProps);break;case 5:if(Kn(o,t),Fn(t),l&512&&(Jt||a===null||ko(a,a.return)),t.flags&32){u=t.stateNode;try{Cr(u,"")}catch(W){_t(t,t.return,W)}}l&4&&t.stateNode!=null&&(u=t.memoizedProps,Pd(t,u,a!==null?a.memoizedProps:u)),l&1024&&(qd=!0);break;case 6:if(Kn(o,t),Fn(t),l&4){if(t.stateNode===null)throw Error(r(162));l=t.memoizedProps,a=t.stateNode;try{a.nodeValue=l}catch(W){_t(t,t.return,W)}}break;case 3:if(cc=null,u=bo,bo=ic(o.containerInfo),Kn(o,t),bo=u,Fn(t),l&4&&a!==null&&a.memoizedState.isDehydrated)try{yi(o.containerInfo)}catch(W){_t(t,t.return,W)}qd&&(qd=!1,Tv(t));break;case 4:l=bo,bo=ic(t.stateNode.containerInfo),Kn(o,t),Fn(t),bo=l;break;case 12:Kn(o,t),Fn(t);break;case 13:Kn(o,t),Fn(t),t.child.flags&8192&&t.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Kd=ge()),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Hd(t,l)));break;case 22:u=t.memoizedState!==null;var N=a!==null&&a.memoizedState!==null,F=Qo,ue=Jt;if(Qo=F||u,Jt=ue||N,Kn(o,t),Jt=ue,Qo=F,Fn(t),l&8192)e:for(o=t.stateNode,o._visibility=u?o._visibility&-2:o._visibility|1,u&&(a===null||N||Qo||Jt||rr(t)),a=null,o=t;;){if(o.tag===5||o.tag===26){if(a===null){N=a=o;try{if(h=N.stateNode,u)S=h.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{T=N.stateNode;var pe=N.memoizedProps.style,X=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;T.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(W){_t(N,N.return,W)}}}else if(o.tag===6){if(a===null){N=o;try{N.stateNode.nodeValue=u?"":N.memoizedProps}catch(W){_t(N,N.return,W)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===t)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;a===o&&(a=null),o=o.return}a===o&&(a=null),o.sibling.return=o.return,o=o.sibling}l&4&&(l=t.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,Hd(t,a))));break;case 19:Kn(o,t),Fn(t),l&4&&(l=t.updateQueue,l!==null&&(t.updateQueue=null,Hd(t,l)));break;case 30:break;case 21:break;default:Kn(o,t),Fn(t)}}function Fn(t){var o=t.flags;if(o&2){try{for(var a,l=t.return;l!==null;){if(gv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var u=a.stateNode,h=$d(t);Kl(t,h,u);break;case 5:var S=a.stateNode;a.flags&32&&(Cr(S,""),a.flags&=-33);var T=$d(t);Kl(t,T,S);break;case 3:case 4:var N=a.stateNode.containerInfo,F=$d(t);Ld(t,F,N);break;default:throw Error(r(161))}}catch(ue){_t(t,t.return,ue)}t.flags&=-3}o&4096&&(t.flags&=-4097)}function Tv(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var o=t;Tv(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),t=t.sibling}}function bs(t,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)bv(t,o.alternate,o),o=o.sibling}function rr(t){for(t=t.child;t!==null;){var o=t;switch(o.tag){case 0:case 11:case 14:case 15:ys(4,o,o.return),rr(o);break;case 1:ko(o,o.return);var a=o.stateNode;typeof a.componentWillUnmount=="function"&&hv(o,o.return,a),rr(o);break;case 27:ui(o.stateNode);case 26:case 5:ko(o,o.return),rr(o);break;case 22:o.memoizedState===null&&rr(o);break;case 30:rr(o);break;default:rr(o)}t=t.sibling}}function Ss(t,o,a){for(a=a&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var l=o.alternate,u=t,h=o,S=h.flags;switch(h.tag){case 0:case 11:case 15:Ss(u,h,a),ei(4,h);break;case 1:if(Ss(u,h,a),l=h,u=l.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(F){_t(l,l.return,F)}if(l=h,u=l.updateQueue,u!==null){var T=l.stateNode;try{var N=u.shared.hiddenCallbacks;if(N!==null)for(u.shared.hiddenCallbacks=null,u=0;u<N.length;u++)Wm(N[u],T)}catch(F){_t(l,l.return,F)}}a&&S&64&&pv(h),ti(h,h.return);break;case 27:vv(h);case 26:case 5:Ss(u,h,a),a&&l===null&&S&4&&mv(h),ti(h,h.return);break;case 12:Ss(u,h,a);break;case 13:Ss(u,h,a),a&&S&4&&wv(u,h);break;case 22:h.memoizedState===null&&Ss(u,h,a),ti(h,h.return);break;case 30:break;default:Ss(u,h,a)}o=o.sibling}}function Bd(t,o){var a=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(a=t.memoizedState.cachePool.pool),t=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(t=o.memoizedState.cachePool.pool),t!==a&&(t!=null&&t.refCount++,a!=null&&La(a))}function Zd(t,o){t=null,o.alternate!==null&&(t=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==t&&(o.refCount++,t!=null&&La(t))}function jo(t,o,a,l){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)_v(t,o,a,l),o=o.sibling}function _v(t,o,a,l){var u=o.flags;switch(o.tag){case 0:case 11:case 15:jo(t,o,a,l),u&2048&&ei(9,o);break;case 1:jo(t,o,a,l);break;case 3:jo(t,o,a,l),u&2048&&(t=null,o.alternate!==null&&(t=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==t&&(o.refCount++,t!=null&&La(t)));break;case 12:if(u&2048){jo(t,o,a,l),t=o.stateNode;try{var h=o.memoizedProps,S=h.id,T=h.onPostCommit;typeof T=="function"&&T(S,o.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(N){_t(o,o.return,N)}}else jo(t,o,a,l);break;case 13:jo(t,o,a,l);break;case 23:break;case 22:h=o.stateNode,S=o.alternate,o.memoizedState!==null?h._visibility&2?jo(t,o,a,l):ni(t,o):h._visibility&2?jo(t,o,a,l):(h._visibility|=2,Yr(t,o,a,l,(o.subtreeFlags&10256)!==0)),u&2048&&Bd(S,o);break;case 24:jo(t,o,a,l),u&2048&&Zd(o.alternate,o);break;default:jo(t,o,a,l)}}function Yr(t,o,a,l,u){for(u=u&&(o.subtreeFlags&10256)!==0,o=o.child;o!==null;){var h=t,S=o,T=a,N=l,F=S.flags;switch(S.tag){case 0:case 11:case 15:Yr(h,S,T,N,u),ei(8,S);break;case 23:break;case 22:var ue=S.stateNode;S.memoizedState!==null?ue._visibility&2?Yr(h,S,T,N,u):ni(h,S):(ue._visibility|=2,Yr(h,S,T,N,u)),u&&F&2048&&Bd(S.alternate,S);break;case 24:Yr(h,S,T,N,u),u&&F&2048&&Zd(S.alternate,S);break;default:Yr(h,S,T,N,u)}o=o.sibling}}function ni(t,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var a=t,l=o,u=l.flags;switch(l.tag){case 22:ni(a,l),u&2048&&Bd(l.alternate,l);break;case 24:ni(a,l),u&2048&&Zd(l.alternate,l);break;default:ni(a,l)}o=o.sibling}}var oi=8192;function Gr(t){if(t.subtreeFlags&oi)for(t=t.child;t!==null;)Rv(t),t=t.sibling}function Rv(t){switch(t.tag){case 26:Gr(t),t.flags&oi&&t.memoizedState!==null&&X_(bo,t.memoizedState,t.memoizedProps);break;case 5:Gr(t);break;case 3:case 4:var o=bo;bo=ic(t.stateNode.containerInfo),Gr(t),bo=o;break;case 22:t.memoizedState===null&&(o=t.alternate,o!==null&&o.memoizedState!==null?(o=oi,oi=16777216,Gr(t),oi=o):Gr(t));break;default:Gr(t)}}function Cv(t){var o=t.alternate;if(o!==null&&(t=o.child,t!==null)){o.child=null;do o=t.sibling,t.sibling=null,t=o;while(t!==null)}}function si(t){var o=t.deletions;if((t.flags&16)!==0){if(o!==null)for(var a=0;a<o.length;a++){var l=o[a];mn=l,kv(l,t)}Cv(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Av(t),t=t.sibling}function Av(t){switch(t.tag){case 0:case 11:case 15:si(t),t.flags&2048&&ys(9,t,t.return);break;case 3:si(t);break;case 12:si(t);break;case 22:var o=t.stateNode;t.memoizedState!==null&&o._visibility&2&&(t.return===null||t.return.tag!==13)?(o._visibility&=-3,Fl(t)):si(t);break;default:si(t)}}function Fl(t){var o=t.deletions;if((t.flags&16)!==0){if(o!==null)for(var a=0;a<o.length;a++){var l=o[a];mn=l,kv(l,t)}Cv(t)}for(t=t.child;t!==null;){switch(o=t,o.tag){case 0:case 11:case 15:ys(8,o,o.return),Fl(o);break;case 22:a=o.stateNode,a._visibility&2&&(a._visibility&=-3,Fl(o));break;default:Fl(o)}t=t.sibling}}function kv(t,o){for(;mn!==null;){var a=mn;switch(a.tag){case 0:case 11:case 15:ys(8,a,o);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:La(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,mn=l;else e:for(a=t;mn!==null;){l=mn;var u=l.sibling,h=l.return;if(Sv(l),l===a){mn=null;break e}if(u!==null){u.return=h,mn=u;break e}mn=h}}}var f_={getCacheForType:function(t){var o=Cn(an),a=o.data.get(t);return a===void 0&&(a=t(),o.data.set(t,a)),a}},p_=typeof WeakMap=="function"?WeakMap:Map,gt=0,jt=null,ot=null,ut=0,vt=0,Xn=null,xs=!1,Kr=!1,Vd=!1,Wo=0,Yt=0,ws=0,ar=0,Yd=0,uo=0,Fr=0,ri=null,$n=null,Gd=!1,Kd=0,Xl=1/0,Ql=null,Es=null,Sn=0,Ts=null,Xr=null,Qr=0,Fd=0,Xd=null,jv=null,ai=0,Qd=null;function Qn(){if((gt&2)!==0&&ut!==0)return ut&-ut;if(z.T!==null){var t=Pr;return t!==0?t:sf()}return Do()}function Ov(){uo===0&&(uo=(ut&536870912)===0||mt?at():536870912);var t=co.current;return t!==null&&(t.flags|=32),uo}function Jn(t,o,a){(t===jt&&(vt===2||vt===9)||t.cancelPendingCommit!==null)&&(Jr(t,0),_s(t,ut,uo,!1)),Ft(t,a),((gt&2)===0||t!==jt)&&(t===jt&&((gt&2)===0&&(ar|=a),Yt===4&&_s(t,ut,uo,!1)),Oo(t))}function Nv(t,o,a){if((gt&6)!==0)throw Error(r(327));var l=!a&&(o&124)===0&&(o&t.expiredLanes)===0||Zn(t,o),u=l?g_(t,o):ef(t,o,!0),h=l;do{if(u===0){Kr&&!l&&_s(t,o,0,!1);break}else{if(a=t.current.alternate,h&&!h_(a)){u=ef(t,o,!1),h=!1;continue}if(u===2){if(h=o,t.errorRecoveryDisabledLanes&h)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){o=S;e:{var T=t;u=ri;var N=T.current.memoizedState.isDehydrated;if(N&&(Jr(T,S).flags|=256),S=ef(T,S,!1),S!==2){if(Vd&&!N){T.errorRecoveryDisabledLanes|=h,ar|=h,u=4;break e}h=$n,$n=u,h!==null&&($n===null?$n=h:$n.push.apply($n,h))}u=S}if(h=!1,u!==2)continue}}if(u===1){Jr(t,0),_s(t,o,0,!0);break}e:{switch(l=t,h=u,h){case 0:case 1:throw Error(r(345));case 4:if((o&4194048)!==o)break;case 6:_s(l,o,uo,!xs);break e;case 2:$n=null;break;case 3:case 5:break;default:throw Error(r(329))}if((o&62914560)===o&&(u=Kd+300-ge(),10<u)){if(_s(l,o,uo,!xs),no(l,0,!0)!==0)break e;l.timeoutHandle=iy(Mv.bind(null,l,a,$n,Ql,Gd,o,uo,ar,Fr,xs,h,2,-0,0),u);break e}Mv(l,a,$n,Ql,Gd,o,uo,ar,Fr,xs,h,0,-0,0)}}break}while(!0);Oo(t)}function Mv(t,o,a,l,u,h,S,T,N,F,ue,pe,X,W){if(t.timeoutHandle=-1,pe=o.subtreeFlags,(pe&8192||(pe&16785408)===16785408)&&(pi={stylesheets:null,count:0,unsuspend:F_},Rv(o),pe=Q_(),pe!==null)){t.cancelPendingCommit=pe(Lv.bind(null,t,o,h,a,l,u,S,T,N,ue,1,X,W)),_s(t,h,S,!F);return}Lv(t,o,h,a,l,u,S,T,N)}function h_(t){for(var o=t;;){var a=o.tag;if((a===0||a===11||a===15)&&o.flags&16384&&(a=o.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var u=a[l],h=u.getSnapshot;u=u.value;try{if(!Yn(h(),u))return!1}catch{return!1}}if(a=o.child,o.subtreeFlags&16384&&a!==null)a.return=o,o=a;else{if(o===t)break;for(;o.sibling===null;){if(o.return===null||o.return===t)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function _s(t,o,a,l){o&=~Yd,o&=~ar,t.suspendedLanes|=o,t.pingedLanes&=~o,l&&(t.warmLanes|=o),l=t.expirationTimes;for(var u=o;0<u;){var h=31-nt(u),S=1<<h;l[h]=-1,u&=~S}a!==0&&sn(t,a,o)}function Jl(){return(gt&6)===0?(ii(0),!1):!0}function Jd(){if(ot!==null){if(vt===0)var t=ot.return;else t=ot,Vo=er=null,md(t),Zr=null,Qa=0,t=ot;for(;t!==null;)fv(t.alternate,t),t=t.return;ot=null}}function Jr(t,o){var a=t.timeoutHandle;a!==-1&&(t.timeoutHandle=-1,N_(a)),a=t.cancelPendingCommit,a!==null&&(t.cancelPendingCommit=null,a()),Jd(),jt=t,ot=a=Ho(t.current,null),ut=o,vt=0,Xn=null,xs=!1,Kr=Zn(t,o),Vd=!1,Fr=uo=Yd=ar=ws=Yt=0,$n=ri=null,Gd=!1,(o&8)!==0&&(o|=o&32);var l=t.entangledLanes;if(l!==0)for(t=t.entanglements,l&=o;0<l;){var u=31-nt(l),h=1<<u;o|=t[u],l&=~h}return Wo=o,Sl(),a}function zv(t,o){Xe=null,z.H=$l,o===Ha||o===kl?(o=Qm(),vt=3):o===Km?(o=Qm(),vt=4):vt=o===Jg?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Xn=o,ot===null&&(Yt=1,Zl(t,ro(o,t.current)))}function Iv(){var t=z.H;return z.H=$l,t===null?$l:t}function Dv(){var t=z.A;return z.A=f_,t}function Wd(){Yt=4,xs||(ut&4194048)!==ut&&co.current!==null||(Kr=!0),(ws&134217727)===0&&(ar&134217727)===0||jt===null||_s(jt,ut,uo,!1)}function ef(t,o,a){var l=gt;gt|=2;var u=Iv(),h=Dv();(jt!==t||ut!==o)&&(Ql=null,Jr(t,o)),o=!1;var S=Yt;e:do try{if(vt!==0&&ot!==null){var T=ot,N=Xn;switch(vt){case 8:Jd(),S=6;break e;case 3:case 2:case 9:case 6:co.current===null&&(o=!0);var F=vt;if(vt=0,Xn=null,Wr(t,T,N,F),a&&Kr){S=0;break e}break;default:F=vt,vt=0,Xn=null,Wr(t,T,N,F)}}m_(),S=Yt;break}catch(ue){zv(t,ue)}while(!0);return o&&t.shellSuspendCounter++,Vo=er=null,gt=l,z.H=u,z.A=h,ot===null&&(jt=null,ut=0,Sl()),S}function m_(){for(;ot!==null;)Uv(ot)}function g_(t,o){var a=gt;gt|=2;var l=Iv(),u=Dv();jt!==t||ut!==o?(Ql=null,Xl=ge()+500,Jr(t,o)):Kr=Zn(t,o);e:do try{if(vt!==0&&ot!==null){o=ot;var h=Xn;t:switch(vt){case 1:vt=0,Xn=null,Wr(t,o,h,1);break;case 2:case 9:if(Fm(h)){vt=0,Xn=null,Pv(o);break}o=function(){vt!==2&&vt!==9||jt!==t||(vt=7),Oo(t)},h.then(o,o);break e;case 3:vt=7;break e;case 4:vt=5;break e;case 7:Fm(h)?(vt=0,Xn=null,Pv(o)):(vt=0,Xn=null,Wr(t,o,h,7));break;case 5:var S=null;switch(ot.tag){case 26:S=ot.memoizedState;case 5:case 27:var T=ot;if(!S||by(S)){vt=0,Xn=null;var N=T.sibling;if(N!==null)ot=N;else{var F=T.return;F!==null?(ot=F,Wl(F)):ot=null}break t}}vt=0,Xn=null,Wr(t,o,h,5);break;case 6:vt=0,Xn=null,Wr(t,o,h,6);break;case 8:Jd(),Yt=6;break e;default:throw Error(r(462))}}v_();break}catch(ue){zv(t,ue)}while(!0);return Vo=er=null,z.H=l,z.A=u,gt=a,ot!==null?0:(jt=null,ut=0,Sl(),Yt)}function v_(){for(;ot!==null&&!_e();)Uv(ot)}function Uv(t){var o=uv(t.alternate,t,Wo);t.memoizedProps=t.pendingProps,o===null?Wl(t):ot=o}function Pv(t){var o=t,a=o.alternate;switch(o.tag){case 15:case 0:o=sv(a,o,o.pendingProps,o.type,void 0,ut);break;case 11:o=sv(a,o,o.pendingProps,o.type.render,o.ref,ut);break;case 5:md(o);default:fv(a,o),o=ot=$m(o,Wo),o=uv(a,o,Wo)}t.memoizedProps=t.pendingProps,o===null?Wl(t):ot=o}function Wr(t,o,a,l){Vo=er=null,md(o),Zr=null,Qa=0;var u=o.return;try{if(a_(t,u,o,a,ut)){Yt=1,Zl(t,ro(a,t.current)),ot=null;return}}catch(h){if(u!==null)throw ot=u,h;Yt=1,Zl(t,ro(a,t.current)),ot=null;return}o.flags&32768?(mt||l===1?t=!0:Kr||(ut&536870912)!==0?t=!1:(xs=t=!0,(l===2||l===9||l===3||l===6)&&(l=co.current,l!==null&&l.tag===13&&(l.flags|=16384))),$v(o,t)):Wl(o)}function Wl(t){var o=t;do{if((o.flags&32768)!==0){$v(o,xs);return}t=o.return;var a=l_(o.alternate,o,Wo);if(a!==null){ot=a;return}if(o=o.sibling,o!==null){ot=o;return}ot=o=t}while(o!==null);Yt===0&&(Yt=5)}function $v(t,o){do{var a=c_(t.alternate,t);if(a!==null){a.flags&=32767,ot=a;return}if(a=t.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!o&&(t=t.sibling,t!==null)){ot=t;return}ot=t=a}while(t!==null);Yt=6,ot=null}function Lv(t,o,a,l,u,h,S,T,N){t.cancelPendingCommit=null;do ec();while(Sn!==0);if((gt&6)!==0)throw Error(r(327));if(o!==null){if(o===t.current)throw Error(r(177));if(h=o.lanes|o.childLanes,h|=Zu,_n(t,a,h,S,T,N),t===jt&&(ot=jt=null,ut=0),Xr=o,Ts=t,Qr=a,Fd=h,Xd=u,jv=l,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,x_(tt,function(){return Vv(),null})):(t.callbackNode=null,t.callbackPriority=0),l=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||l){l=z.T,z.T=null,u=G.p,G.p=2,S=gt,gt|=4;try{u_(t,o,a)}finally{gt=S,G.p=u,z.T=l}}Sn=1,qv(),Hv(),Bv()}}function qv(){if(Sn===1){Sn=0;var t=Ts,o=Xr,a=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||a){a=z.T,z.T=null;var l=G.p;G.p=2;var u=gt;gt|=4;try{Ev(o,t);var h=pf,S=km(t.containerInfo),T=h.focusedElem,N=h.selectionRange;if(S!==T&&T&&T.ownerDocument&&Am(T.ownerDocument.documentElement,T)){if(N!==null&&$u(T)){var F=N.start,ue=N.end;if(ue===void 0&&(ue=F),"selectionStart"in T)T.selectionStart=F,T.selectionEnd=Math.min(ue,T.value.length);else{var pe=T.ownerDocument||document,X=pe&&pe.defaultView||window;if(X.getSelection){var W=X.getSelection(),He=T.textContent.length,Ue=Math.min(N.start,He),Et=N.end===void 0?Ue:Math.min(N.end,He);!W.extend&&Ue>Et&&(S=Et,Et=Ue,Ue=S);var L=Cm(T,Ue),I=Cm(T,Et);if(L&&I&&(W.rangeCount!==1||W.anchorNode!==L.node||W.anchorOffset!==L.offset||W.focusNode!==I.node||W.focusOffset!==I.offset)){var Z=pe.createRange();Z.setStart(L.node,L.offset),W.removeAllRanges(),Ue>Et?(W.addRange(Z),W.extend(I.node,I.offset)):(Z.setEnd(I.node,I.offset),W.addRange(Z))}}}}for(pe=[],W=T;W=W.parentNode;)W.nodeType===1&&pe.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<pe.length;T++){var fe=pe[T];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}fc=!!ff,pf=ff=null}finally{gt=u,G.p=l,z.T=a}}t.current=o,Sn=2}}function Hv(){if(Sn===2){Sn=0;var t=Ts,o=Xr,a=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||a){a=z.T,z.T=null;var l=G.p;G.p=2;var u=gt;gt|=4;try{bv(t,o.alternate,o)}finally{gt=u,G.p=l,z.T=a}}Sn=3}}function Bv(){if(Sn===4||Sn===3){Sn=0,Be();var t=Ts,o=Xr,a=Qr,l=jv;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?Sn=5:(Sn=0,Xr=Ts=null,Zv(t,t.pendingLanes));var u=t.pendingLanes;if(u===0&&(Es=null),vo(a),o=o.stateNode,Ne&&typeof Ne.onCommitFiberRoot=="function")try{Ne.onCommitFiberRoot(rt,o,void 0,(o.current.flags&128)===128)}catch{}if(l!==null){o=z.T,u=G.p,G.p=2,z.T=null;try{for(var h=t.onRecoverableError,S=0;S<l.length;S++){var T=l[S];h(T.value,{componentStack:T.stack})}}finally{z.T=o,G.p=u}}(Qr&3)!==0&&ec(),Oo(t),u=t.pendingLanes,(a&4194090)!==0&&(u&42)!==0?t===Qd?ai++:(ai=0,Qd=t):ai=0,ii(0)}}function Zv(t,o){(t.pooledCacheLanes&=o)===0&&(o=t.pooledCache,o!=null&&(t.pooledCache=null,La(o)))}function ec(t){return qv(),Hv(),Bv(),Vv()}function Vv(){if(Sn!==5)return!1;var t=Ts,o=Fd;Fd=0;var a=vo(Qr),l=z.T,u=G.p;try{G.p=32>a?32:a,z.T=null,a=Xd,Xd=null;var h=Ts,S=Qr;if(Sn=0,Xr=Ts=null,Qr=0,(gt&6)!==0)throw Error(r(331));var T=gt;if(gt|=4,Av(h.current),_v(h,h.current,S,a),gt=T,ii(0,!1),Ne&&typeof Ne.onPostCommitFiberRoot=="function")try{Ne.onPostCommitFiberRoot(rt,h)}catch{}return!0}finally{G.p=u,z.T=l,Zv(t,o)}}function Yv(t,o,a){o=ro(a,o),o=kd(t.stateNode,o,2),t=hs(t,o,2),t!==null&&(Ft(t,2),Oo(t))}function _t(t,o,a){if(t.tag===3)Yv(t,t,a);else for(;o!==null;){if(o.tag===3){Yv(o,t,a);break}else if(o.tag===1){var l=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Es===null||!Es.has(l))){t=ro(a,t),a=Xg(2),l=hs(o,a,2),l!==null&&(Qg(a,l,o,t),Ft(l,2),Oo(l));break}}o=o.return}}function tf(t,o,a){var l=t.pingCache;if(l===null){l=t.pingCache=new p_;var u=new Set;l.set(o,u)}else u=l.get(o),u===void 0&&(u=new Set,l.set(o,u));u.has(a)||(Vd=!0,u.add(a),t=y_.bind(null,t,o,a),o.then(t,t))}function y_(t,o,a){var l=t.pingCache;l!==null&&l.delete(o),t.pingedLanes|=t.suspendedLanes&a,t.warmLanes&=~a,jt===t&&(ut&a)===a&&(Yt===4||Yt===3&&(ut&62914560)===ut&&300>ge()-Kd?(gt&2)===0&&Jr(t,0):Yd|=a,Fr===ut&&(Fr=0)),Oo(t)}function Gv(t,o){o===0&&(o=Kt()),t=zr(t,o),t!==null&&(Ft(t,o),Oo(t))}function b_(t){var o=t.memoizedState,a=0;o!==null&&(a=o.retryLane),Gv(t,a)}function S_(t,o){var a=0;switch(t.tag){case 13:var l=t.stateNode,u=t.memoizedState;u!==null&&(a=u.retryLane);break;case 19:l=t.stateNode;break;case 22:l=t.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(o),Gv(t,a)}function x_(t,o){return Te(t,o)}var tc=null,ea=null,nf=!1,nc=!1,of=!1,ir=0;function Oo(t){t!==ea&&t.next===null&&(ea===null?tc=ea=t:ea=ea.next=t),nc=!0,nf||(nf=!0,E_())}function ii(t,o){if(!of&&nc){of=!0;do for(var a=!1,l=tc;l!==null;){if(t!==0){var u=l.pendingLanes;if(u===0)var h=0;else{var S=l.suspendedLanes,T=l.pingedLanes;h=(1<<31-nt(42|t)+1)-1,h&=u&~(S&~T),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(a=!0,Qv(l,h))}else h=ut,h=no(l,l===jt?h:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(h&3)===0||Zn(l,h)||(a=!0,Qv(l,h));l=l.next}while(a);of=!1}}function w_(){Kv()}function Kv(){nc=nf=!1;var t=0;ir!==0&&(O_()&&(t=ir),ir=0);for(var o=ge(),a=null,l=tc;l!==null;){var u=l.next,h=Fv(l,o);h===0?(l.next=null,a===null?tc=u:a.next=u,u===null&&(ea=a)):(a=l,(t!==0||(h&3)!==0)&&(nc=!0)),l=u}ii(t)}function Fv(t,o){for(var a=t.suspendedLanes,l=t.pingedLanes,u=t.expirationTimes,h=t.pendingLanes&-62914561;0<h;){var S=31-nt(h),T=1<<S,N=u[S];N===-1?((T&a)===0||(T&l)!==0)&&(u[S]=Io(T,o)):N<=o&&(t.expiredLanes|=T),h&=~T}if(o=jt,a=ut,a=no(t,t===o?a:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l=t.callbackNode,a===0||t===o&&(vt===2||vt===9)||t.cancelPendingCommit!==null)return l!==null&&l!==null&&$e(l),t.callbackNode=null,t.callbackPriority=0;if((a&3)===0||Zn(t,a)){if(o=a&-a,o===t.callbackPriority)return o;switch(l!==null&&$e(l),vo(a)){case 2:case 8:a=Ge;break;case 32:a=tt;break;case 268435456:a=Je;break;default:a=tt}return l=Xv.bind(null,t),a=Te(a,l),t.callbackPriority=o,t.callbackNode=a,o}return l!==null&&l!==null&&$e(l),t.callbackPriority=2,t.callbackNode=null,2}function Xv(t,o){if(Sn!==0&&Sn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var a=t.callbackNode;if(ec()&&t.callbackNode!==a)return null;var l=ut;return l=no(t,t===jt?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),l===0?null:(Nv(t,l,o),Fv(t,ge()),t.callbackNode!=null&&t.callbackNode===a?Xv.bind(null,t):null)}function Qv(t,o){if(ec())return null;Nv(t,o,!0)}function E_(){M_(function(){(gt&6)!==0?Te(Re,w_):Kv()})}function sf(){return ir===0&&(ir=at()),ir}function Jv(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:pl(""+t)}function Wv(t,o){var a=o.ownerDocument.createElement("input");return a.name=o.name,a.value=o.value,t.id&&a.setAttribute("form",t.id),o.parentNode.insertBefore(a,o),t=new FormData(t),a.parentNode.removeChild(a),t}function T_(t,o,a,l,u){if(o==="submit"&&a&&a.stateNode===u){var h=Jv((u[Ut]||null).action),S=l.submitter;S&&(o=(o=S[Ut]||null)?Jv(o.formAction):S.getAttribute("formAction"),o!==null&&(h=o,S=null));var T=new vl("action","action",null,l,u);t.push({event:T,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(ir!==0){var N=S?Wv(u,S):new FormData(u);Td(a,{pending:!0,data:N,method:u.method,action:h},null,N)}}else typeof h=="function"&&(T.preventDefault(),N=S?Wv(u,S):new FormData(u),Td(a,{pending:!0,data:N,method:u.method,action:h},h,N))},currentTarget:u}]})}}for(var rf=0;rf<Bu.length;rf++){var af=Bu[rf],__=af.toLowerCase(),R_=af[0].toUpperCase()+af.slice(1);yo(__,"on"+R_)}yo(Nm,"onAnimationEnd"),yo(Mm,"onAnimationIteration"),yo(zm,"onAnimationStart"),yo("dblclick","onDoubleClick"),yo("focusin","onFocus"),yo("focusout","onBlur"),yo(BT,"onTransitionRun"),yo(ZT,"onTransitionStart"),yo(VT,"onTransitionCancel"),yo(Im,"onTransitionEnd"),se("onMouseEnter",["mouseout","mouseover"]),se("onMouseLeave",["mouseout","mouseover"]),se("onPointerEnter",["pointerout","pointerover"]),se("onPointerLeave",["pointerout","pointerover"]),J("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),J("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),J("onBeforeInput",["compositionend","keypress","textInput","paste"]),J("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),J("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),J("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var li="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(" "),C_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(li));function ey(t,o){o=(o&4)!==0;for(var a=0;a<t.length;a++){var l=t[a],u=l.event;l=l.listeners;e:{var h=void 0;if(o)for(var S=l.length-1;0<=S;S--){var T=l[S],N=T.instance,F=T.currentTarget;if(T=T.listener,N!==h&&u.isPropagationStopped())break e;h=T,u.currentTarget=F;try{h(u)}catch(ue){Bl(ue)}u.currentTarget=null,h=N}else for(S=0;S<l.length;S++){if(T=l[S],N=T.instance,F=T.currentTarget,T=T.listener,N!==h&&u.isPropagationStopped())break e;h=T,u.currentTarget=F;try{h(u)}catch(ue){Bl(ue)}u.currentTarget=null,h=N}}}}function st(t,o){var a=o[To];a===void 0&&(a=o[To]=new Set);var l=t+"__bubble";a.has(l)||(ty(o,t,2,!1),a.add(l))}function lf(t,o,a){var l=0;o&&(l|=4),ty(a,t,l,o)}var oc="_reactListening"+Math.random().toString(36).slice(2);function cf(t){if(!t[oc]){t[oc]=!0,Ra.forEach(function(a){a!=="selectionchange"&&(C_.has(a)||lf(a,!1,t),lf(a,!0,t))});var o=t.nodeType===9?t:t.ownerDocument;o===null||o[oc]||(o[oc]=!0,lf("selectionchange",!1,o))}}function ty(t,o,a,l){switch(_y(o)){case 2:var u=eR;break;case 8:u=tR;break;default:u=Ef}a=u.bind(null,o,a,t),u=void 0,!ju||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(u=!0),l?u!==void 0?t.addEventListener(o,a,{capture:!0,passive:u}):t.addEventListener(o,a,!0):u!==void 0?t.addEventListener(o,a,{passive:u}):t.addEventListener(o,a,!1)}function uf(t,o,a,l,u){var h=l;if((o&1)===0&&(o&2)===0&&l!==null)e:for(;;){if(l===null)return;var S=l.tag;if(S===3||S===4){var T=l.stateNode.containerInfo;if(T===u)break;if(S===4)for(S=l.return;S!==null;){var N=S.tag;if((N===3||N===4)&&S.stateNode.containerInfo===u)return;S=S.return}for(;T!==null;){if(S=Po(T),S===null)return;if(N=S.tag,N===5||N===6||N===26||N===27){l=h=S;continue e}T=T.parentNode}}l=l.return}lm(function(){var F=h,ue=Au(a),pe=[];e:{var X=Dm.get(t);if(X!==void 0){var W=vl,He=t;switch(t){case"keypress":if(ml(a)===0)break e;case"keydown":case"keyup":W=xT;break;case"focusin":He="focus",W=zu;break;case"focusout":He="blur",W=zu;break;case"beforeblur":case"afterblur":W=zu;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=dm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=cT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=TT;break;case Nm:case Mm:case zm:W=fT;break;case Im:W=RT;break;case"scroll":case"scrollend":W=iT;break;case"wheel":W=AT;break;case"copy":case"cut":case"paste":W=hT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=pm;break;case"toggle":case"beforetoggle":W=jT}var Ue=(o&4)!==0,Et=!Ue&&(t==="scroll"||t==="scrollend"),L=Ue?X!==null?X+"Capture":null:X;Ue=[];for(var I=F,Z;I!==null;){var fe=I;if(Z=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||Z===null||L===null||(fe=Ca(I,L),fe!=null&&Ue.push(ci(I,fe,Z))),Et)break;I=I.return}0<Ue.length&&(X=new W(X,He,null,a,ue),pe.push({event:X,listeners:Ue}))}}if((o&7)===0){e:{if(X=t==="mouseover"||t==="pointerover",W=t==="mouseout"||t==="pointerout",X&&a!==Cu&&(He=a.relatedTarget||a.fromElement)&&(Po(He)||He[pn]))break e;if((W||X)&&(X=ue.window===ue?ue:(X=ue.ownerDocument)?X.defaultView||X.parentWindow:window,W?(He=a.relatedTarget||a.toElement,W=F,He=He?Po(He):null,He!==null&&(Et=c(He),Ue=He.tag,He!==Et||Ue!==5&&Ue!==27&&Ue!==6)&&(He=null)):(W=null,He=F),W!==He)){if(Ue=dm,fe="onMouseLeave",L="onMouseEnter",I="mouse",(t==="pointerout"||t==="pointerover")&&(Ue=pm,fe="onPointerLeave",L="onPointerEnter",I="pointer"),Et=W==null?X:cs(W),Z=He==null?X:cs(He),X=new Ue(fe,I+"leave",W,a,ue),X.target=Et,X.relatedTarget=Z,fe=null,Po(ue)===F&&(Ue=new Ue(L,I+"enter",He,a,ue),Ue.target=Z,Ue.relatedTarget=Et,fe=Ue),Et=fe,W&&He)t:{for(Ue=W,L=He,I=0,Z=Ue;Z;Z=ta(Z))I++;for(Z=0,fe=L;fe;fe=ta(fe))Z++;for(;0<I-Z;)Ue=ta(Ue),I--;for(;0<Z-I;)L=ta(L),Z--;for(;I--;){if(Ue===L||L!==null&&Ue===L.alternate)break t;Ue=ta(Ue),L=ta(L)}Ue=null}else Ue=null;W!==null&&ny(pe,X,W,Ue,!1),He!==null&&Et!==null&&ny(pe,Et,He,Ue,!0)}}e:{if(X=F?cs(F):window,W=X.nodeName&&X.nodeName.toLowerCase(),W==="select"||W==="input"&&X.type==="file")var ke=xm;else if(bm(X))if(wm)ke=LT;else{ke=PT;var et=UT}else W=X.nodeName,!W||W.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?F&&Ru(F.elementType)&&(ke=xm):ke=$T;if(ke&&(ke=ke(t,F))){Sm(pe,ke,a,ue);break e}et&&et(t,X,F),t==="focusout"&&F&&X.type==="number"&&F.memoizedProps.value!=null&&_u(X,"number",X.value)}switch(et=F?cs(F):window,t){case"focusin":(bm(et)||et.contentEditable==="true")&&(Or=et,Lu=F,Ia=null);break;case"focusout":Ia=Lu=Or=null;break;case"mousedown":qu=!0;break;case"contextmenu":case"mouseup":case"dragend":qu=!1,jm(pe,a,ue);break;case"selectionchange":if(HT)break;case"keydown":case"keyup":jm(pe,a,ue)}var ze;if(Du)e:{switch(t){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else jr?vm(t,a)&&(Pe="onCompositionEnd"):t==="keydown"&&a.keyCode===229&&(Pe="onCompositionStart");Pe&&(hm&&a.locale!=="ko"&&(jr||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&jr&&(ze=cm()):(us=ue,Ou="value"in us?us.value:us.textContent,jr=!0)),et=sc(F,Pe),0<et.length&&(Pe=new fm(Pe,t,null,a,ue),pe.push({event:Pe,listeners:et}),ze?Pe.data=ze:(ze=ym(a),ze!==null&&(Pe.data=ze)))),(ze=NT?MT(t,a):zT(t,a))&&(Pe=sc(F,"onBeforeInput"),0<Pe.length&&(et=new fm("onBeforeInput","beforeinput",null,a,ue),pe.push({event:et,listeners:Pe}),et.data=ze)),T_(pe,t,F,a,ue)}ey(pe,o)})}function ci(t,o,a){return{instance:t,listener:o,currentTarget:a}}function sc(t,o){for(var a=o+"Capture",l=[];t!==null;){var u=t,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=Ca(t,a),u!=null&&l.unshift(ci(t,u,h)),u=Ca(t,o),u!=null&&l.push(ci(t,u,h))),t.tag===3)return l;t=t.return}return[]}function ta(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function ny(t,o,a,l,u){for(var h=o._reactName,S=[];a!==null&&a!==l;){var T=a,N=T.alternate,F=T.stateNode;if(T=T.tag,N!==null&&N===l)break;T!==5&&T!==26&&T!==27||F===null||(N=F,u?(F=Ca(a,h),F!=null&&S.unshift(ci(a,F,N))):u||(F=Ca(a,h),F!=null&&S.push(ci(a,F,N)))),a=a.return}S.length!==0&&t.push({event:o,listeners:S})}var A_=/\r\n?/g,k_=/\u0000|\uFFFD/g;function oy(t){return(typeof t=="string"?t:""+t).replace(A_,`
|
|
25
|
+
`).replace(k_,"")}function sy(t,o){return o=oy(o),oy(t)===o}function rc(){}function wt(t,o,a,l,u,h){switch(a){case"children":typeof l=="string"?o==="body"||o==="textarea"&&l===""||Cr(t,l):(typeof l=="number"||typeof l=="bigint")&&o!=="body"&&Cr(t,""+l);break;case"className":It(t,"class",l);break;case"tabIndex":It(t,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":It(t,a,l);break;case"style":am(t,l,h);break;case"data":if(o!=="object"){It(t,"data",l);break}case"src":case"href":if(l===""&&(o!=="a"||a!=="href")){t.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=pl(""+l),t.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){t.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof h=="function"&&(a==="formAction"?(o!=="input"&&wt(t,o,"name",u.name,u,null),wt(t,o,"formEncType",u.formEncType,u,null),wt(t,o,"formMethod",u.formMethod,u,null),wt(t,o,"formTarget",u.formTarget,u,null)):(wt(t,o,"encType",u.encType,u,null),wt(t,o,"method",u.method,u,null),wt(t,o,"target",u.target,u,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){t.removeAttribute(a);break}l=pl(""+l),t.setAttribute(a,l);break;case"onClick":l!=null&&(t.onclick=rc);break;case"onScroll":l!=null&&st("scroll",t);break;case"onScrollEnd":l!=null&&st("scrollend",t);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(u.children!=null)throw Error(r(60));t.innerHTML=a}}break;case"multiple":t.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":t.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){t.removeAttribute("xlink:href");break}a=pl(""+l),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""+l):t.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,""):t.removeAttribute(a);break;case"capture":case"download":l===!0?t.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?t.setAttribute(a,l):t.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?t.setAttribute(a,l):t.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?t.removeAttribute(a):t.setAttribute(a,l);break;case"popover":st("beforetoggle",t),st("toggle",t),St(t,"popover",l);break;case"xlinkActuate":In(t,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":In(t,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":In(t,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":In(t,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":In(t,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":In(t,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":In(t,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":In(t,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":In(t,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":St(t,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=rT.get(a)||a,St(t,a,l))}}function df(t,o,a,l,u,h){switch(a){case"style":am(t,l,h);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(u.children!=null)throw Error(r(60));t.innerHTML=a}}break;case"children":typeof l=="string"?Cr(t,l):(typeof l=="number"||typeof l=="bigint")&&Cr(t,""+l);break;case"onScroll":l!=null&&st("scroll",t);break;case"onScrollEnd":l!=null&&st("scrollend",t);break;case"onClick":l!=null&&(t.onclick=rc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ul.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(u=a.endsWith("Capture"),o=a.slice(2,u?a.length-7:void 0),h=t[Ut]||null,h=h!=null?h[a]:null,typeof h=="function"&&t.removeEventListener(o,h,u),typeof l=="function")){typeof h!="function"&&h!==null&&(a in t?t[a]=null:t.hasAttribute(a)&&t.removeAttribute(a)),t.addEventListener(o,l,u);break e}a in t?t[a]=l:l===!0?t.setAttribute(a,""):St(t,a,l)}}}function xn(t,o,a){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":st("error",t),st("load",t);var l=!1,u=!1,h;for(h in a)if(a.hasOwnProperty(h)){var S=a[h];if(S!=null)switch(h){case"src":l=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:wt(t,o,h,S,a,null)}}u&&wt(t,o,"srcSet",a.srcSet,a,null),l&&wt(t,o,"src",a.src,a,null);return;case"input":st("invalid",t);var T=h=S=u=null,N=null,F=null;for(l in a)if(a.hasOwnProperty(l)){var ue=a[l];if(ue!=null)switch(l){case"name":u=ue;break;case"type":S=ue;break;case"checked":N=ue;break;case"defaultChecked":F=ue;break;case"value":h=ue;break;case"defaultValue":T=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,o));break;default:wt(t,o,l,ue,a,null)}}nm(t,h,T,N,F,S,u,!1),dl(t);return;case"select":st("invalid",t),l=S=h=null;for(u in a)if(a.hasOwnProperty(u)&&(T=a[u],T!=null))switch(u){case"value":h=T;break;case"defaultValue":S=T;break;case"multiple":l=T;default:wt(t,o,u,T,a,null)}o=h,a=S,t.multiple=!!l,o!=null?Rr(t,!!l,o,!1):a!=null&&Rr(t,!!l,a,!0);return;case"textarea":st("invalid",t),h=u=l=null;for(S in a)if(a.hasOwnProperty(S)&&(T=a[S],T!=null))switch(S){case"value":l=T;break;case"defaultValue":u=T;break;case"children":h=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(r(91));break;default:wt(t,o,S,T,a,null)}sm(t,l,u,h),dl(t);return;case"option":for(N in a)if(a.hasOwnProperty(N)&&(l=a[N],l!=null))switch(N){case"selected":t.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:wt(t,o,N,l,a,null)}return;case"dialog":st("beforetoggle",t),st("toggle",t),st("cancel",t),st("close",t);break;case"iframe":case"object":st("load",t);break;case"video":case"audio":for(l=0;l<li.length;l++)st(li[l],t);break;case"image":st("error",t),st("load",t);break;case"details":st("toggle",t);break;case"embed":case"source":case"link":st("error",t),st("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in a)if(a.hasOwnProperty(F)&&(l=a[F],l!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,o));default:wt(t,o,F,l,a,null)}return;default:if(Ru(o)){for(ue in a)a.hasOwnProperty(ue)&&(l=a[ue],l!==void 0&&df(t,o,ue,l,a,void 0));return}}for(T in a)a.hasOwnProperty(T)&&(l=a[T],l!=null&&wt(t,o,T,l,a,null))}function j_(t,o,a,l){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,S=null,T=null,N=null,F=null,ue=null;for(W in a){var pe=a[W];if(a.hasOwnProperty(W)&&pe!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":N=pe;default:l.hasOwnProperty(W)||wt(t,o,W,null,l,pe)}}for(var X in l){var W=l[X];if(pe=a[X],l.hasOwnProperty(X)&&(W!=null||pe!=null))switch(X){case"type":h=W;break;case"name":u=W;break;case"checked":F=W;break;case"defaultChecked":ue=W;break;case"value":S=W;break;case"defaultValue":T=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,o));break;default:W!==pe&&wt(t,o,X,W,l,pe)}}Tu(t,S,T,N,F,ue,h,u);return;case"select":W=S=T=X=null;for(h in a)if(N=a[h],a.hasOwnProperty(h)&&N!=null)switch(h){case"value":break;case"multiple":W=N;default:l.hasOwnProperty(h)||wt(t,o,h,null,l,N)}for(u in l)if(h=l[u],N=a[u],l.hasOwnProperty(u)&&(h!=null||N!=null))switch(u){case"value":X=h;break;case"defaultValue":T=h;break;case"multiple":S=h;default:h!==N&&wt(t,o,u,h,l,N)}o=T,a=S,l=W,X!=null?Rr(t,!!a,X,!1):!!l!=!!a&&(o!=null?Rr(t,!!a,o,!0):Rr(t,!!a,a?[]:"",!1));return;case"textarea":W=X=null;for(T in a)if(u=a[T],a.hasOwnProperty(T)&&u!=null&&!l.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:wt(t,o,T,null,l,u)}for(S in l)if(u=l[S],h=a[S],l.hasOwnProperty(S)&&(u!=null||h!=null))switch(S){case"value":X=u;break;case"defaultValue":W=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(r(91));break;default:u!==h&&wt(t,o,S,u,l,h)}om(t,X,W);return;case"option":for(var He in a)if(X=a[He],a.hasOwnProperty(He)&&X!=null&&!l.hasOwnProperty(He))switch(He){case"selected":t.selected=!1;break;default:wt(t,o,He,null,l,X)}for(N in l)if(X=l[N],W=a[N],l.hasOwnProperty(N)&&X!==W&&(X!=null||W!=null))switch(N){case"selected":t.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:wt(t,o,N,X,l,W)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ue in a)X=a[Ue],a.hasOwnProperty(Ue)&&X!=null&&!l.hasOwnProperty(Ue)&&wt(t,o,Ue,null,l,X);for(F in l)if(X=l[F],W=a[F],l.hasOwnProperty(F)&&X!==W&&(X!=null||W!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,o));break;default:wt(t,o,F,X,l,W)}return;default:if(Ru(o)){for(var Et in a)X=a[Et],a.hasOwnProperty(Et)&&X!==void 0&&!l.hasOwnProperty(Et)&&df(t,o,Et,void 0,l,X);for(ue in l)X=l[ue],W=a[ue],!l.hasOwnProperty(ue)||X===W||X===void 0&&W===void 0||df(t,o,ue,X,l,W);return}}for(var L in a)X=a[L],a.hasOwnProperty(L)&&X!=null&&!l.hasOwnProperty(L)&&wt(t,o,L,null,l,X);for(pe in l)X=l[pe],W=a[pe],!l.hasOwnProperty(pe)||X===W||X==null&&W==null||wt(t,o,pe,X,l,W)}var ff=null,pf=null;function ac(t){return t.nodeType===9?t:t.ownerDocument}function ry(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ay(t,o){if(t===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&o==="foreignObject"?0:t}function hf(t,o){return t==="textarea"||t==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var mf=null;function O_(){var t=window.event;return t&&t.type==="popstate"?t===mf?!1:(mf=t,!0):(mf=null,!1)}var iy=typeof setTimeout=="function"?setTimeout:void 0,N_=typeof clearTimeout=="function"?clearTimeout:void 0,ly=typeof Promise=="function"?Promise:void 0,M_=typeof queueMicrotask=="function"?queueMicrotask:typeof ly<"u"?function(t){return ly.resolve(null).then(t).catch(z_)}:iy;function z_(t){setTimeout(function(){throw t})}function Rs(t){return t==="head"}function cy(t,o){var a=o,l=0,u=0;do{var h=a.nextSibling;if(t.removeChild(a),h&&h.nodeType===8)if(a=h.data,a==="/$"){if(0<l&&8>l){a=l;var S=t.ownerDocument;if(a&1&&ui(S.documentElement),a&2&&ui(S.body),a&4)for(a=S.head,ui(a),S=a.firstChild;S;){var T=S.nextSibling,N=S.nodeName;S[Ro]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&S.rel.toLowerCase()==="stylesheet"||a.removeChild(S),S=T}}if(u===0){t.removeChild(h),yi(o);return}u--}else a==="$"||a==="$?"||a==="$!"?u++:l=a.charCodeAt(0)-48;else l=0;a=h}while(a);yi(o)}function gf(t){var o=t.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var a=o;switch(o=o.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":gf(a),ls(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}t.removeChild(a)}}function I_(t,o,a,l){for(;t.nodeType===1;){var u=a;if(t.nodeName.toLowerCase()!==o.toLowerCase()){if(!l&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(l){if(!t[Ro])switch(o){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(h=t.getAttribute("rel"),h==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(h!==u.rel||t.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||t.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||t.getAttribute("title")!==(u.title==null?null:u.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(h=t.getAttribute("src"),(h!==(u.src==null?null:u.src)||t.getAttribute("type")!==(u.type==null?null:u.type)||t.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(o==="input"&&t.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&t.getAttribute("name")===h)return t}else return t;if(t=So(t.nextSibling),t===null)break}return null}function D_(t,o,a){if(o==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=So(t.nextSibling),t===null))return null;return t}function vf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState==="complete"}function U_(t,o){var a=t.ownerDocument;if(t.data!=="$?"||a.readyState==="complete")o();else{var l=function(){o(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),t._reactRetry=l}}function So(t){for(;t!=null;t=t.nextSibling){var o=t.nodeType;if(o===1||o===3)break;if(o===8){if(o=t.data,o==="$"||o==="$!"||o==="$?"||o==="F!"||o==="F")break;if(o==="/$")return null}}return t}var yf=null;function uy(t){t=t.previousSibling;for(var o=0;t;){if(t.nodeType===8){var a=t.data;if(a==="$"||a==="$!"||a==="$?"){if(o===0)return t;o--}else a==="/$"&&o++}t=t.previousSibling}return null}function dy(t,o,a){switch(o=ac(a),t){case"html":if(t=o.documentElement,!t)throw Error(r(452));return t;case"head":if(t=o.head,!t)throw Error(r(453));return t;case"body":if(t=o.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function ui(t){for(var o=t.attributes;o.length;)t.removeAttributeNode(o[0]);ls(t)}var fo=new Map,fy=new Set;function ic(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var es=G.d;G.d={f:P_,r:$_,D:L_,C:q_,L:H_,m:B_,X:V_,S:Z_,M:Y_};function P_(){var t=es.f(),o=Jl();return t||o}function $_(t){var o=$o(t);o!==null&&o.tag===5&&o.type==="form"?Ng(o):es.r(t)}var na=typeof document>"u"?null:document;function py(t,o,a){var l=na;if(l&&typeof o=="string"&&o){var u=so(o);u='link[rel="'+t+'"][href="'+u+'"]',typeof a=="string"&&(u+='[crossorigin="'+a+'"]'),fy.has(u)||(fy.add(u),t={rel:t,crossOrigin:a,href:o},l.querySelector(u)===null&&(o=l.createElement("link"),xn(o,"link",t),Xt(o),l.head.appendChild(o)))}}function L_(t){es.D(t),py("dns-prefetch",t,null)}function q_(t,o){es.C(t,o),py("preconnect",t,o)}function H_(t,o,a){es.L(t,o,a);var l=na;if(l&&t&&o){var u='link[rel="preload"][as="'+so(o)+'"]';o==="image"&&a&&a.imageSrcSet?(u+='[imagesrcset="'+so(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(u+='[imagesizes="'+so(a.imageSizes)+'"]')):u+='[href="'+so(t)+'"]';var h=u;switch(o){case"style":h=oa(t);break;case"script":h=sa(t)}fo.has(h)||(t=y({rel:"preload",href:o==="image"&&a&&a.imageSrcSet?void 0:t,as:o},a),fo.set(h,t),l.querySelector(u)!==null||o==="style"&&l.querySelector(di(h))||o==="script"&&l.querySelector(fi(h))||(o=l.createElement("link"),xn(o,"link",t),Xt(o),l.head.appendChild(o)))}}function B_(t,o){es.m(t,o);var a=na;if(a&&t){var l=o&&typeof o.as=="string"?o.as:"script",u='link[rel="modulepreload"][as="'+so(l)+'"][href="'+so(t)+'"]',h=u;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=sa(t)}if(!fo.has(h)&&(t=y({rel:"modulepreload",href:t},o),fo.set(h,t),a.querySelector(u)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(fi(h)))return}l=a.createElement("link"),xn(l,"link",t),Xt(l),a.head.appendChild(l)}}}function Z_(t,o,a){es.S(t,o,a);var l=na;if(l&&t){var u=Lo(l).hoistableStyles,h=oa(t);o=o||"default";var S=u.get(h);if(!S){var T={loading:0,preload:null};if(S=l.querySelector(di(h)))T.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":o},a),(a=fo.get(h))&&bf(t,a);var N=S=l.createElement("link");Xt(N),xn(N,"link",t),N._p=new Promise(function(F,ue){N.onload=F,N.onerror=ue}),N.addEventListener("load",function(){T.loading|=1}),N.addEventListener("error",function(){T.loading|=2}),T.loading|=4,lc(S,o,l)}S={type:"stylesheet",instance:S,count:1,state:T},u.set(h,S)}}}function V_(t,o){es.X(t,o);var a=na;if(a&&t){var l=Lo(a).hoistableScripts,u=sa(t),h=l.get(u);h||(h=a.querySelector(fi(u)),h||(t=y({src:t,async:!0},o),(o=fo.get(u))&&Sf(t,o),h=a.createElement("script"),Xt(h),xn(h,"link",t),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function Y_(t,o){es.M(t,o);var a=na;if(a&&t){var l=Lo(a).hoistableScripts,u=sa(t),h=l.get(u);h||(h=a.querySelector(fi(u)),h||(t=y({src:t,async:!0,type:"module"},o),(o=fo.get(u))&&Sf(t,o),h=a.createElement("script"),Xt(h),xn(h,"link",t),a.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},l.set(u,h))}}function hy(t,o,a,l){var u=(u=me.current)?ic(u):null;if(!u)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(o=oa(a.href),a=Lo(u).hoistableStyles,l=a.get(o),l||(l={type:"style",instance:null,count:0,state:null},a.set(o,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){t=oa(a.href);var h=Lo(u).hoistableStyles,S=h.get(t);if(S||(u=u.ownerDocument||u,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(t,S),(h=u.querySelector(di(t)))&&!h._p&&(S.instance=h,S.state.loading=5),fo.has(t)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},fo.set(t,a),h||G_(u,t,a,S.state))),o&&l===null)throw Error(r(528,""));return S}if(o&&l!==null)throw Error(r(529,""));return null;case"script":return o=a.async,a=a.src,typeof a=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=sa(a),a=Lo(u).hoistableScripts,l=a.get(o),l||(l={type:"script",instance:null,count:0,state:null},a.set(o,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function oa(t){return'href="'+so(t)+'"'}function di(t){return'link[rel="stylesheet"]['+t+"]"}function my(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function G_(t,o,a,l){t.querySelector('link[rel="preload"][as="style"]['+o+"]")?l.loading=1:(o=t.createElement("link"),l.preload=o,o.addEventListener("load",function(){return l.loading|=1}),o.addEventListener("error",function(){return l.loading|=2}),xn(o,"link",a),Xt(o),t.head.appendChild(o))}function sa(t){return'[src="'+so(t)+'"]'}function fi(t){return"script[async]"+t}function gy(t,o,a){if(o.count++,o.instance===null)switch(o.type){case"style":var l=t.querySelector('style[data-href~="'+so(a.href)+'"]');if(l)return o.instance=l,Xt(l),l;var u=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(t.ownerDocument||t).createElement("style"),Xt(l),xn(l,"style",u),lc(l,a.precedence,t),o.instance=l;case"stylesheet":u=oa(a.href);var h=t.querySelector(di(u));if(h)return o.state.loading|=4,o.instance=h,Xt(h),h;l=my(a),(u=fo.get(u))&&bf(l,u),h=(t.ownerDocument||t).createElement("link"),Xt(h);var S=h;return S._p=new Promise(function(T,N){S.onload=T,S.onerror=N}),xn(h,"link",l),o.state.loading|=4,lc(h,a.precedence,t),o.instance=h;case"script":return h=sa(a.src),(u=t.querySelector(fi(h)))?(o.instance=u,Xt(u),u):(l=a,(u=fo.get(h))&&(l=y({},a),Sf(l,u)),t=t.ownerDocument||t,u=t.createElement("script"),Xt(u),xn(u,"link",l),t.head.appendChild(u),o.instance=u);case"void":return null;default:throw Error(r(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(l=o.instance,o.state.loading|=4,lc(l,a.precedence,t));return o.instance}function lc(t,o,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=l.length?l[l.length-1]:null,h=u,S=0;S<l.length;S++){var T=l[S];if(T.dataset.precedence===o)h=T;else if(h!==u)break}h?h.parentNode.insertBefore(t,h.nextSibling):(o=a.nodeType===9?a.head:a,o.insertBefore(t,o.firstChild))}function bf(t,o){t.crossOrigin==null&&(t.crossOrigin=o.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=o.referrerPolicy),t.title==null&&(t.title=o.title)}function Sf(t,o){t.crossOrigin==null&&(t.crossOrigin=o.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=o.referrerPolicy),t.integrity==null&&(t.integrity=o.integrity)}var cc=null;function vy(t,o,a){if(cc===null){var l=new Map,u=cc=new Map;u.set(a,l)}else u=cc,l=u.get(a),l||(l=new Map,u.set(a,l));if(l.has(t))return l;for(l.set(t,null),a=a.getElementsByTagName(t),u=0;u<a.length;u++){var h=a[u];if(!(h[Ro]||h[We]||t==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var S=h.getAttribute(o)||"";S=t+S;var T=l.get(S);T?T.push(h):l.set(S,[h])}}return l}function yy(t,o,a){t=t.ownerDocument||t,t.head.insertBefore(a,o==="title"?t.querySelector("head > title"):null)}function K_(t,o,a){if(a===1||o.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;switch(o.rel){case"stylesheet":return t=o.disabled,typeof o.precedence=="string"&&t==null;default:return!0}case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function by(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}var pi=null;function F_(){}function X_(t,o,a){if(pi===null)throw Error(r(475));var l=pi;if(o.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var u=oa(a.href),h=t.querySelector(di(u));if(h){t=h._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(l.count++,l=uc.bind(l),t.then(l,l)),o.state.loading|=4,o.instance=h,Xt(h);return}h=t.ownerDocument||t,a=my(a),(u=fo.get(u))&&bf(a,u),h=h.createElement("link"),Xt(h);var S=h;S._p=new Promise(function(T,N){S.onload=T,S.onerror=N}),xn(h,"link",a),o.instance=h}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(o,t),(t=o.state.preload)&&(o.state.loading&3)===0&&(l.count++,o=uc.bind(l),t.addEventListener("load",o),t.addEventListener("error",o))}}function Q_(){if(pi===null)throw Error(r(475));var t=pi;return t.stylesheets&&t.count===0&&xf(t,t.stylesheets),0<t.count?function(o){var a=setTimeout(function(){if(t.stylesheets&&xf(t,t.stylesheets),t.unsuspend){var l=t.unsuspend;t.unsuspend=null,l()}},6e4);return t.unsuspend=o,function(){t.unsuspend=null,clearTimeout(a)}}:null}function uc(){if(this.count--,this.count===0){if(this.stylesheets)xf(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var dc=null;function xf(t,o){t.stylesheets=null,t.unsuspend!==null&&(t.count++,dc=new Map,o.forEach(J_,t),dc=null,uc.call(t))}function J_(t,o){if(!(o.state.loading&4)){var a=dc.get(t);if(a)var l=a.get(null);else{a=new Map,dc.set(t,a);for(var u=t.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var S=u[h];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(a.set(S.dataset.precedence,S),l=S)}l&&a.set(null,l)}u=o.instance,S=u.getAttribute("data-precedence"),h=a.get(S)||l,h===l&&a.set(null,u),a.set(S,u),this.count++,l=uc.bind(this),u.addEventListener("load",l),u.addEventListener("error",l),h?h.parentNode.insertBefore(u,h.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(u,t.firstChild)),o.state.loading|=4}}var hi={$$typeof:O,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function W_(t,o,a,l,u,h,S,T){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=yn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=yn(0),this.hiddenUpdates=yn(null),this.identifierPrefix=l,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=T,this.incompleteTransitions=new Map}function Sy(t,o,a,l,u,h,S,T,N,F,ue,pe){return t=new W_(t,o,a,S,T,N,F,pe),o=1,h===!0&&(o|=24),h=Gn(3,null,null,o),t.current=h,h.stateNode=t,o=td(),o.refCount++,t.pooledCache=o,o.refCount++,h.memoizedState={element:l,isDehydrated:a,cache:o},rd(h),t}function xy(t){return t?(t=Ir,t):Ir}function wy(t,o,a,l,u,h){u=xy(u),l.context===null?l.context=u:l.pendingContext=u,l=ps(o),l.payload={element:a},h=h===void 0?null:h,h!==null&&(l.callback=h),a=hs(t,l,o),a!==null&&(Jn(a,t,o),Za(a,t,o))}function Ey(t,o){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var a=t.retryLane;t.retryLane=a!==0&&a<o?a:o}}function wf(t,o){Ey(t,o),(t=t.alternate)&&Ey(t,o)}function Ty(t){if(t.tag===13){var o=zr(t,67108864);o!==null&&Jn(o,t,67108864),wf(t,67108864)}}var fc=!0;function eR(t,o,a,l){var u=z.T;z.T=null;var h=G.p;try{G.p=2,Ef(t,o,a,l)}finally{G.p=h,z.T=u}}function tR(t,o,a,l){var u=z.T;z.T=null;var h=G.p;try{G.p=8,Ef(t,o,a,l)}finally{G.p=h,z.T=u}}function Ef(t,o,a,l){if(fc){var u=Tf(l);if(u===null)uf(t,o,l,pc,a),Ry(t,l);else if(oR(u,t,o,a,l))l.stopPropagation();else if(Ry(t,l),o&4&&-1<nR.indexOf(t)){for(;u!==null;){var h=$o(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var S=on(h.pendingLanes);if(S!==0){var T=h;for(T.pendingLanes|=2,T.entangledLanes|=2;S;){var N=1<<31-nt(S);T.entanglements[1]|=N,S&=~N}Oo(h),(gt&6)===0&&(Xl=ge()+500,ii(0))}}break;case 13:T=zr(h,2),T!==null&&Jn(T,h,2),Jl(),wf(h,2)}if(h=Tf(l),h===null&&uf(t,o,l,pc,a),h===u)break;u=h}u!==null&&l.stopPropagation()}else uf(t,o,l,null,a)}}function Tf(t){return t=Au(t),_f(t)}var pc=null;function _f(t){if(pc=null,t=Po(t),t!==null){var o=c(t);if(o===null)t=null;else{var a=o.tag;if(a===13){if(t=d(o),t!==null)return t;t=null}else if(a===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;t=null}else o!==t&&(t=null)}}return pc=t,null}function _y(t){switch(t){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Oe()){case Re:return 2;case Ge:return 8;case tt:case ye:return 32;case Je:return 268435456;default:return 32}default:return 32}}var Rf=!1,Cs=null,As=null,ks=null,mi=new Map,gi=new Map,js=[],nR="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".split(" ");function Ry(t,o){switch(t){case"focusin":case"focusout":Cs=null;break;case"dragenter":case"dragleave":As=null;break;case"mouseover":case"mouseout":ks=null;break;case"pointerover":case"pointerout":mi.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":gi.delete(o.pointerId)}}function vi(t,o,a,l,u,h){return t===null||t.nativeEvent!==h?(t={blockedOn:o,domEventName:a,eventSystemFlags:l,nativeEvent:h,targetContainers:[u]},o!==null&&(o=$o(o),o!==null&&Ty(o)),t):(t.eventSystemFlags|=l,o=t.targetContainers,u!==null&&o.indexOf(u)===-1&&o.push(u),t)}function oR(t,o,a,l,u){switch(o){case"focusin":return Cs=vi(Cs,t,o,a,l,u),!0;case"dragenter":return As=vi(As,t,o,a,l,u),!0;case"mouseover":return ks=vi(ks,t,o,a,l,u),!0;case"pointerover":var h=u.pointerId;return mi.set(h,vi(mi.get(h)||null,t,o,a,l,u)),!0;case"gotpointercapture":return h=u.pointerId,gi.set(h,vi(gi.get(h)||null,t,o,a,l,u)),!0}return!1}function Cy(t){var o=Po(t.target);if(o!==null){var a=c(o);if(a!==null){if(o=a.tag,o===13){if(o=d(a),o!==null){t.blockedOn=o,is(t.priority,function(){if(a.tag===13){var l=Qn();l=Vn(l);var u=zr(a,l);u!==null&&Jn(u,a,l),wf(a,l)}});return}}else if(o===3&&a.stateNode.current.memoizedState.isDehydrated){t.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}t.blockedOn=null}function hc(t){if(t.blockedOn!==null)return!1;for(var o=t.targetContainers;0<o.length;){var a=Tf(t.nativeEvent);if(a===null){a=t.nativeEvent;var l=new a.constructor(a.type,a);Cu=l,a.target.dispatchEvent(l),Cu=null}else return o=$o(a),o!==null&&Ty(o),t.blockedOn=a,!1;o.shift()}return!0}function Ay(t,o,a){hc(t)&&a.delete(o)}function sR(){Rf=!1,Cs!==null&&hc(Cs)&&(Cs=null),As!==null&&hc(As)&&(As=null),ks!==null&&hc(ks)&&(ks=null),mi.forEach(Ay),gi.forEach(Ay)}function mc(t,o){t.blockedOn===o&&(t.blockedOn=null,Rf||(Rf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,sR)))}var gc=null;function ky(t){gc!==t&&(gc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){gc===t&&(gc=null);for(var o=0;o<t.length;o+=3){var a=t[o],l=t[o+1],u=t[o+2];if(typeof l!="function"){if(_f(l||a)===null)continue;break}var h=$o(a);h!==null&&(t.splice(o,3),o-=3,Td(h,{pending:!0,data:u,method:a.method,action:l},l,u))}}))}function yi(t){function o(N){return mc(N,t)}Cs!==null&&mc(Cs,t),As!==null&&mc(As,t),ks!==null&&mc(ks,t),mi.forEach(o),gi.forEach(o);for(var a=0;a<js.length;a++){var l=js[a];l.blockedOn===t&&(l.blockedOn=null)}for(;0<js.length&&(a=js[0],a.blockedOn===null);)Cy(a),a.blockedOn===null&&js.shift();if(a=(t.ownerDocument||t).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var u=a[l],h=a[l+1],S=u[Ut]||null;if(typeof h=="function")S||ky(a);else if(S){var T=null;if(h&&h.hasAttribute("formAction")){if(u=h,S=h[Ut]||null)T=S.formAction;else if(_f(u)!==null)continue}else T=S.action;typeof T=="function"?a[l+1]=T:(a.splice(l,3),l-=3),ky(a)}}}function Cf(t){this._internalRoot=t}vc.prototype.render=Cf.prototype.render=function(t){var o=this._internalRoot;if(o===null)throw Error(r(409));var a=o.current,l=Qn();wy(a,l,t,o,null,null)},vc.prototype.unmount=Cf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var o=t.containerInfo;wy(t.current,2,null,t,null,null),Jl(),o[pn]=null}};function vc(t){this._internalRoot=t}vc.prototype.unstable_scheduleHydration=function(t){if(t){var o=Do();t={blockedOn:null,target:t,priority:o};for(var a=0;a<js.length&&o!==0&&o<js[a].priority;a++);js.splice(a,0,t),a===0&&Cy(t)}};var jy=n.version;if(jy!=="19.1.0")throw Error(r(527,jy,"19.1.0"));G.findDOMNode=function(t){var o=t._reactInternals;if(o===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=g(o),t=t!==null?m(t):null,t=t===null?null:t.stateNode,t};var rR={bundleType:0,version:"19.1.0",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.1.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yc.isDisabled&&yc.supportsFiber)try{rt=yc.inject(rR),Ne=yc}catch{}}return Si.createRoot=function(t,o){if(!i(t))throw Error(r(299));var a=!1,l="",u=Yg,h=Gg,S=Kg,T=null;return o!=null&&(o.unstable_strictMode===!0&&(a=!0),o.identifierPrefix!==void 0&&(l=o.identifierPrefix),o.onUncaughtError!==void 0&&(u=o.onUncaughtError),o.onCaughtError!==void 0&&(h=o.onCaughtError),o.onRecoverableError!==void 0&&(S=o.onRecoverableError),o.unstable_transitionCallbacks!==void 0&&(T=o.unstable_transitionCallbacks)),o=Sy(t,1,!1,null,null,a,l,u,h,S,T,null),t[pn]=o.current,cf(t),new Cf(o)},Si.hydrateRoot=function(t,o,a){if(!i(t))throw Error(r(299));var l=!1,u="",h=Yg,S=Gg,T=Kg,N=null,F=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(h=a.onUncaughtError),a.onCaughtError!==void 0&&(S=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(N=a.unstable_transitionCallbacks),a.formState!==void 0&&(F=a.formState)),o=Sy(t,1,!0,o,a??null,l,u,h,S,T,N,F),o.context=xy(null),a=o.current,l=Qn(),l=Vn(l),u=ps(l),u.callback=null,hs(a,u,l),a=l,o.current.lanes=a,Ft(o,a),Oo(o),t[pn]=o.current,cf(t),new vc(o)},Si.version="19.1.0",Si}var Uy;function qR(){if(Uy)return Of.exports;Uy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),Of.exports=LR(),Of.exports}var HR=qR();const BR="modulepreload",ZR=function(e){return"/"+e},Py={},VR=function(n,s,r){let i=Promise.resolve();if(s&&s.length>0){let d=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),g=p?.nonce||p?.getAttribute("nonce");i=d(s.map(m=>{if(m=ZR(m),m in Py)return;Py[m]=!0;const y=m.endsWith(".css"),b=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${b}`))return;const x=document.createElement("link");if(x.rel=y?"stylesheet":BR,y||(x.as="script"),x.crossOrigin="",x.href=m,g&&x.setAttribute("nonce",g),document.head.appendChild(x),y)return new Promise((w,E)=>{x.addEventListener("load",w),x.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return i.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return n().catch(c)})};function YR(e={}){const{immediate:n=!1,onNeedRefresh:s,onOfflineReady:r,onRegistered:i,onRegisteredSW:c,onRegisterError:d}=e;let p,g;const m=async(b=!0)=>{await g};async function y(){if("serviceWorker"in navigator){if(p=await VR(async()=>{const{Workbox:b}=await import("./workbox-window.prod.es5-BBnX5xw4.js");return{Workbox:b}},[]).then(({Workbox:b})=>new b("/sw.js",{scope:"/",type:"classic"})).catch(b=>{d?.(b)}),!p)return;p.addEventListener("activated",b=>{(b.isUpdate||b.isExternal)&&window.location.reload()}),p.addEventListener("installed",b=>{b.isUpdate||r?.()}),p.register({immediate:n}).then(b=>{c?c("/sw.js",b):i?.(b)}).catch(b=>{d?.(b)})}}return g=y(),m}const V0=72,Y0=240,GR=160,G0="mono-agent.web.agent-rail-width",K0=()=>{if(typeof window>"u")return null;try{return window.localStorage}catch{return null}},KR=(e=K0())=>{if(!e)return!1;try{const n=e.getItem(G0);if(n===null||n.trim()==="")return!1;const s=Number(n);return Number.isFinite(s)&&Number.isInteger(s)&&s>=GR}catch{return!1}},FR=(e,n=K0())=>{if(n)try{n.setItem(G0,String(e?Y0:V0))}catch{}},XR=e=>e?Y0:V0;class Sa extends Error{status;code;constructor(n,s,r){super(n),this.name="ApiError",this.status=s,this.code=r}}const fr=async e=>{let n=`${e.status} ${e.statusText}`.trim(),s;try{const r=await e.json();typeof r.error=="string"&&(n=r.error),r.error&&typeof r.error=="object"&&(n=r.error.message??n,s=r.error.code),n=r.message??n,s=r.code??s}catch{}return new Sa(n,e.status,s)},Rt=async(e,n)=>{const s=await fetch(e,{...n,headers:{Accept:"application/json",...n?.body?{"Content-Type":"application/json"}:{},...n?.headers}});if(!s.ok)throw await fr(s);return await s.json()},vr=e=>{const n=new URL(e,window.location.origin);if(n.origin!==window.location.origin||!n.pathname.startsWith("/api/v1/threads/"))throw new Error("The reply part endpoint is not on this console origin.");return`${n.pathname}${n.search}`},zf=new WeakMap,cp=e=>{const n=vr(e),s=new URL(n,window.location.origin),r=/^\/api\/v1\/threads\/([^/]+)\/messages\/([^/]+)\/(reply-attachments|mcp-apps)\/([^/]+)(\/content|\/requests)?$/u.exec(s.pathname);if(r===null)throw new Error("The reply part endpoint has an invalid route.");const[,,,i,c,d=""]=r,p=i==="reply-attachments"?"attachment":"mcp_app";if(p==="attachment"&&d!=="/content"||p==="mcp_app"&&d==="/content")throw new Error("The reply part endpoint has an invalid route.");let g;try{g=decodeURIComponent(c)}catch{throw new Error("The reply part endpoint has an invalid identifier.")}const m=d.length===0?s.pathname:s.pathname.slice(0,-d.length);return{type:p,partId:g,accessPath:`${m}/access`}},Di=e=>e instanceof Sa&&e.code==="reply_access_expired",$y=async(e,n,s)=>{const r=cp(e);if(r.type!==n)throw new Error("The reply part endpoint type changed.");const c=(await Rt(r.accessPath,{method:"POST",headers:{"X-Mono-Agent-Web-Origin":window.location.origin},...s===void 0?{}:{signal:s}})).part;if(c.type!==n||c.id!==r.partId)throw new Error("The refreshed reply part identity changed.");let d;if(c.type==="attachment"){if(c.contentUrl===void 0)throw new Error("The refreshed reply part has no private endpoint.");d=[c.contentUrl]}else{if(c.resourceUrl===void 0||c.bridgeUrl===void 0)throw new Error("The refreshed MCP App has incomplete private endpoints.");d=[c.resourceUrl,c.bridgeUrl]}for(const p of d){const g=cp(p);if(g.type!==r.type||g.partId!==r.partId||g.accessPath!==r.accessPath)throw new Error("The refreshed reply part binding changed.")}return c},QR=async(e,n,s)=>{if(s===void 0)return await $y(e,n);const r=cp(e),i=`${n}:${r.accessPath}`;let c=zf.get(s);c===void 0&&(c=new Map,zf.set(s,c));let d=c.get(i);d===void 0&&(d=$y(e,n,s).finally(()=>{c?.get(i)===d&&c.delete(i),c?.size===0&&zf.delete(s)}),c.set(i,d));const p=await d;if(p.type!==n)throw new Error("The refreshed reply part type changed.");return p},If=async(e,n,s,r,i,c)=>{try{return await r(vr(e))}catch(m){if(!Di(m)||i?.aborted===!0)throw m}const d=await QR(e,n,i),p=s(d);if(p===void 0)throw new Error("The refreshed reply part has no private endpoint.");const g=vr(p);return i?.throwIfAborted(),c?.(d),await r(g)},Ly=async(e,n)=>{const s=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Mono-Agent-Web-Origin":window.location.origin},body:JSON.stringify(n)});if(!s.ok&&s.status!==428)throw await fr(s);return await s.json()},Ze={bootstrap:e=>Rt("/api/v1/bootstrap",{signal:e}),thread:(e,n)=>Rt(`/api/v1/threads/${encodeURIComponent(e)}`,{signal:n}),threads:(e,n,s,r)=>{const i=new URLSearchParams({sourceId:e,archived:String(n),limit:"200"});return s!==void 0&&i.set("before",s),Rt(`/api/v1/threads?${i.toString()}`,{signal:r})},searchThreads:(e,n,s)=>{const r=new URLSearchParams({sourceId:e,q:n});return Rt(`/api/v1/threads/search?${r.toString()}`,{signal:s})},messages:(e,n,s)=>{const r=new URLSearchParams({before:n,limit:"100"});return Rt(`/api/v1/threads/${encodeURIComponent(e)}/messages?${r.toString()}`,{signal:s})},threadJob:async(e,n,s)=>(await Rt(`/api/v1/threads/${encodeURIComponent(e)}/jobs/${encodeURIComponent(n)}`,{signal:s})).job,createThread:async e=>(await Rt("/api/v1/threads",{method:"POST",body:JSON.stringify({sourceId:e})})).thread,patchAgent:async(e,n)=>(await Rt(`/api/v1/agents/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({pinned:n})})).agent,agentSkills:(e,n)=>Rt(`/api/v1/agents/${encodeURIComponent(e)}/skills`,{signal:n}),patchThread:async(e,n)=>(await Rt(`/api/v1/threads/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(n)})).thread,deleteThread:async e=>{const n=await fetch(`/api/v1/threads/${encodeURIComponent(e)}`,{method:"DELETE",headers:{Accept:"application/json"}});if(!n.ok)throw await fr(n)},startTurn:async(e,n)=>Rt(`/api/v1/threads/${encodeURIComponent(e)}/turns`,{method:"POST",body:JSON.stringify(n)}),liveInput:async(e,n)=>Rt(`/api/v1/threads/${encodeURIComponent(e)}/live-input`,{method:"POST",body:JSON.stringify({text:n})}),cancelTurn:async e=>Rt(`/api/v1/threads/${encodeURIComponent(e)}/cancel`,{method:"POST"}),pendingAsk:async(e,n)=>(await Rt(`/api/v1/threads/${encodeURIComponent(e)}/ask`,{signal:n})).ask??void 0,ask:async(e,n,s)=>(await Rt(`/api/v1/threads/${encodeURIComponent(e)}/ask/${encodeURIComponent(n)}`,{signal:s})).ask??void 0,submitAsk:async(e,n,s)=>Rt(`/api/v1/threads/${encodeURIComponent(e)}/ask`,{method:"POST",body:JSON.stringify({interactionId:n,answers:s})}),cronOverview:(e,n)=>Rt(`/api/v1/agents/${encodeURIComponent(e)}/cron`,{signal:n}),cronRuns:(e,n,s,r)=>{const i=new URLSearchParams({limit:"100"});return s!==void 0&&i.set("before",s),Rt(`/api/v1/agents/${encodeURIComponent(e)}/cron/jobs/${encodeURIComponent(n)}/runs?${i.toString()}`,{signal:r})},cronRun:async(e,n,s,r)=>(await Rt(`/api/v1/agents/${encodeURIComponent(e)}/cron/jobs/${encodeURIComponent(n)}/runs/${encodeURIComponent(s)}`,{signal:r})).message,cronConfigView:async(e,n)=>(await Rt(`/api/v1/agents/${encodeURIComponent(e)}/cron/config-view`,{signal:n})).configView,cronRunNow:(e,n,s,r)=>Ly(`/api/v1/agents/${encodeURIComponent(e)}/cron/jobs/${encodeURIComponent(n)}/run`,{idempotencyKey:s,...r===void 0?{}:{confirmationToken:r}}),cronSetEnabled:(e,n,s,r,i)=>Ly(`/api/v1/agents/${encodeURIComponent(e)}/cron/jobs/${encodeURIComponent(n)}/effective-enabled`,{enabled:s,idempotencyKey:r,...i===void 0?{}:{confirmationToken:i}}),registerPushSubscription:async(e,n)=>{const s=e.toJSON(),r=s.keys?.p256dh,i=s.keys?.auth;if(typeof r!="string"||typeof i!="string")throw new Error("The browser returned an incomplete push subscription.");return(await Rt("/api/v1/push/subscriptions",{method:"PUT",headers:{"X-Mono-Agent-Web-Origin":window.location.origin},body:JSON.stringify({endpoint:e.endpoint,expirationTime:e.expirationTime,keys:{p256dh:r,auth:i},...n===void 0?{}:{previousSubscriptionId:n}})})).subscription},pushSubscription:async e=>(await Rt(`/api/v1/push/subscriptions/${encodeURIComponent(e)}`,{headers:{"X-Mono-Agent-Web-Origin":window.location.origin}})).subscription,deletePushSubscription:async e=>{const n=await fetch(`/api/v1/push/subscriptions/${encodeURIComponent(e)}`,{method:"DELETE",headers:{Accept:"application/json"}});if(!n.ok)throw await fr(n)},testPushSubscription:async e=>(await Rt(`/api/v1/push/subscriptions/${encodeURIComponent(e)}/test`,{method:"POST"})).subscription,acknowledgePushEvent:async(e,n,s)=>{const r=await fetch(`/api/v1/push/events/${encodeURIComponent(e)}/ack`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({subscriptionId:n,ackToken:s})});if(!r.ok)throw await fr(r)},createUpload:async e=>(await Rt("/api/v1/uploads",{method:"POST",body:JSON.stringify({name:e.name,contentType:e.type||"application/octet-stream",sizeBytes:e.size})})).attachment,deleteUpload:async e=>{const n=await fetch(`/api/v1/uploads/${encodeURIComponent(e)}`,{method:"DELETE",headers:{Accept:"application/json"}});if(!n.ok)throw await fr(n)},replyAttachmentContent:(e,n,s)=>If(e,"attachment",r=>r.contentUrl,async r=>{const i=await fetch(r,{headers:{Accept:"application/octet-stream"},...n===void 0?{}:{signal:n}});if(!i.ok)throw await fr(i);return i},n,s),mcpAppResource:(e,n,s)=>If(e,"mcp_app",r=>r.resourceUrl,r=>Rt(r,{signal:n}),n,s),mcpAppRequest:async(e,n,s,r,i,c)=>await If(e,"mcp_app",d=>d.bridgeUrl,async d=>(await Rt(d,{method:"POST",headers:{"X-Mono-Agent-Web-Origin":window.location.origin},body:JSON.stringify({method:n,params:s,confirmed:r}),signal:i})).result,i,c)},JR=(e,n,s,r)=>new Promise((i,c)=>{const d=new XMLHttpRequest,p=()=>d.abort(),g=()=>r?.removeEventListener("abort",p);if(r?.aborted){c(new DOMException("The upload was cancelled.","AbortError"));return}r?.addEventListener("abort",p,{once:!0}),d.open("PUT",`/api/v1/uploads/${encodeURIComponent(e.id)}/content`),d.responseType="json",d.setRequestHeader("Content-Type","application/octet-stream"),d.setRequestHeader("Accept","application/json"),d.upload.onprogress=m=>{m.lengthComputable&&m.total>0&&s(Math.min(99,Math.round(m.loaded/m.total*100)))},d.onerror=()=>{g(),c(new Error("The upload connection was interrupted."))},d.onabort=()=>{g(),c(new DOMException("The upload was cancelled.","AbortError"))},d.onload=()=>{g();const m=d.response;if(d.status<200||d.status>=300||!m?.attachment){const y=typeof m?.error=="string"?m.error:m?.error?.message??`Upload failed with status ${d.status}.`;c(new Sa(y,d.status));return}s(100),i(m.attachment)},d.send(n)}),WR={maxFileBytes:20*1024*1024,maxFilesPerTurn:10,maxTurnBytes:64*1024*1024,accept:[]},F0=v.createContext(null),Dc=(e,n)=>Date.parse(n.updatedAt)-Date.parse(e.updatedAt),Df=(e,n)=>`${e}\0${n?"archived":"active"}`,qy=(e,n)=>`${e}\0${n}`,Uf=(e,n)=>{const s=new Map(e.map(r=>[r.id,r]));for(const r of n)s.set(r.id,r);return[...s.values()].sort(Dc)},e1=(e,n)=>`/agents/${encodeURIComponent(e)}/cron/${encodeURIComponent(n)}`,t1=e=>e?.trigger?.kind==="cron"&&e.trigger.jobId!==void 0?e1(e.sourceId,e.trigger.jobId):"/",lr=(e,n=!1)=>{const s=t1(e);window.location.pathname!==s&&window.history[n?"replaceState":"pushState"](window.history.state,"",s)},Pf=()=>{const e=/^\/agents\/([^/]+)\/cron\/([^/]+)\/?$/u.exec(window.location.pathname);if(e!==null)try{return{sourceId:decodeURIComponent(e[1]),jobId:decodeURIComponent(e[2])}}catch{return}},xi="mono-agent.web.selected-agent",X0="mono-agent.web.selected-threads",Q0="mono-agent.web.run-preferences",bc=(e,n)=>JSON.stringify([e,n??"new"]),Hy=e=>e.replace(/[A-Z]/g,n=>String.fromCharCode(n.charCodeAt(0)+32)),By=e=>[...e].sort((n,s)=>{const r=Number(s.pinned)-Number(n.pinned);if(r!==0)return r;const i=Hy(n.label),c=Hy(s.label);return i<c?-1:i>c?1:n.sourceId<s.sourceId?-1:n.sourceId>s.sourceId?1:0}),n1=(e,n,s)=>{const r=new Set(e.flatMap(i=>i.status==="offline"&&!i.pinned&&i.sourceId!==n?[i.sourceId]:[]));return{visibleAgents:s?e:e.filter(i=>!r.has(i.sourceId)),hiddenOfflineAgentCount:r.size}},Zy=()=>{try{const e=JSON.parse(localStorage.getItem(Q0)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([n,s])=>{if(!s||typeof s!="object"||Array.isArray(s))return[];const r=s;return typeof r.model!="string"||typeof r.effort!="string"?[]:[[n,{model:r.model,effort:r.effort}]]}))}catch{return{}}},Ci=()=>{try{const e=JSON.parse(localStorage.getItem(X0)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(n=>typeof n[1]=="string"))}catch{return{}}},ts=(e,n)=>{const s=Ci();n?s[e]=n:delete s[e],localStorage.setItem(X0,JSON.stringify(s))},o1=(e,n,s,r={})=>{const c=e.agents.find(m=>m.sourceId===n)?.sourceId??e.agents.find(m=>m.status!=="offline")?.sourceId??e.agents[0]?.sourceId??null,d=e.threads.find(m=>m.id===s&&m.sourceId===c),p=e.threads.find(m=>m.id===r[c??""]&&m.sourceId===c&&!m.archivedAt),g=d??p??[...e.threads].filter(m=>m.sourceId===c&&!m.archivedAt).sort(Dc)[0];return{agentId:c,threadId:g?.id??null}},An=e=>e instanceof Error?e.message:"The web console request failed.",s1=["none","minimal","low","medium","high","xhigh","max","ultra"],Uc=(e,n)=>{if(!e)return[];if(e.modelOptions===void 0)return e.efforts??s1;const s=e.modelOptions[n];return s?s.reasoning===!1||s.reasoningMode==="none"||s.effortLevels?.length===0?[]:s.reasoningMode==="toggle"?["high","none"]:s.effortLevels??[]:[]},r1=(e,n)=>{if(!e)return{model:"",effort:""};const s=n.model&&e.models?.includes(n.model)?n.model:"",r=s||e.defaultModel||e.models?.[0]||"",i=Uc(e,r);return{model:s,effort:n.effort&&i.includes(n.effort)?n.effort:""}};function a1({children:e}){const[n,s]=v.useState(null),[r,i]=v.useState(()=>Pf()?.sourceId??localStorage.getItem(xi)),[c,d]=v.useState(null),[p,g]=v.useState(null),[m,y]=v.useState(!0),[b,x]=v.useState(!1),[w,E]=v.useState(null),[C,A]=v.useState(null),[j,_]=v.useState("connecting"),[O,R]=v.useState({sourceId:null,registry:{status:"loading",items:[]}}),[M,U]=v.useState(0),[k,Y]=v.useState(0),[H,$]=v.useState(!1),[B,P]=v.useState({}),[oe,le]=v.useState({}),[ee,z]=v.useState(null),[G,Q]=v.useState(!1),[q,re]=v.useState(null),[Se,D]=v.useState(0),[ne,de]=v.useState(!1),[ae,me]=v.useState(()=>Object.fromEntries(Object.entries(Zy()).map(([J,se])=>[J,se.model]))),[Ce,be]=v.useState(()=>Object.fromEntries(Object.entries(Zy()).map(([J,se])=>[J,se.effort]))),xe=v.useRef(null),qe=v.useRef(r),it=v.useRef(0),Me=v.useRef(O),Te=v.useRef(null),$e=v.useRef(!1),_e=v.useRef(!1),Be=v.useRef(()=>{});v.useEffect(()=>{const J=new Set([...Object.keys(ae),...Object.keys(Ce)]),se=Object.fromEntries([...J].flatMap(ve=>{const ie={model:ae[ve]??"",effort:Ce[ve]??""};return ie.model||ie.effort?[[ve,ie]]:[]}));localStorage.setItem(Q0,JSON.stringify(se))},[Ce,ae]),v.useEffect(()=>{xe.current=c},[c]),v.useEffect(()=>{qe.current=r},[r]),v.useEffect(()=>{Me.current=O},[O]);const ge=v.useCallback(J=>{s(J),E(null),y(!1);const se=o1(J,qe.current,xe.current,Ci()),ve=Pf(),ie=ve===void 0?void 0:J.threads.find(Le=>Le.sourceId===ve.sourceId&&Le.trigger?.kind==="cron"&&Le.trigger.jobId===ve.jobId),he=ie===void 0?se:{agentId:ie.sourceId,threadId:ie.id};if(qe.current=he.agentId,xe.current=he.threadId,i(he.agentId),d(he.threadId),he.agentId){localStorage.setItem(xi,he.agentId);const Le=J.threads.find(St=>St.id===he.threadId);ts(he.agentId,Le&&!Le.archivedAt?Le.id:null)}},[]),Oe=v.useCallback(async()=>{try{const J=await Ze.bootstrap();ge(J),_("live")}catch(J){E(An(J)),y(!1),_(navigator.onLine?"reconnecting":"offline")}},[ge]);v.useEffect(()=>{Oe()},[Oe]),v.useEffect(()=>{const J=()=>D(se=>se+1);return window.addEventListener("popstate",J),()=>window.removeEventListener("popstate",J)},[]);const Re=v.useCallback(async(J,se,ve)=>{const ie=await Ze.threads(J,se,ve),he=Df(J,se);s(Le=>{if(Le===null)return Le;const St=ve===void 0?Le.threads.filter(It=>It.sourceId!==J||!!It.archivedAt!==se):Le.threads;return{...Le,threads:Uf(St,ie.threads)}}),P(Le=>({...Le,[he]:ie.nextCursor??null}))},[]);v.useEffect(()=>{r!==null&&Re(r,H).catch(J=>{A(An(J))})},[Re,r,H]);const Ge=v.useCallback(async(J,se)=>{x(!0);try{const ve=await Ze.thread(J,se);xe.current===J&&g(ve)}catch(ve){se.aborted||A(An(ve))}finally{xe.current===J&&x(!1)}},[]);v.useEffect(()=>{if(!c){g(null),x(!1);return}g(se=>se?.thread.id===c?se:null);const J=new AbortController;return Ge(c,J.signal),()=>J.abort()},[Ge,c]);const tt=v.useCallback(async()=>{if($e.current){_e.current=!0;return}$e.current=!0;try{const[J,se]=await Promise.all([Ze.bootstrap(),xe.current?Ze.thread(xe.current):Promise.resolve(null)]);ge(J),se&&xe.current===se.thread.id&&g(se)}catch(J){A(An(J))}finally{$e.current=!1,_e.current&&(_e.current=!1,Be.current())}},[ge]),ye=v.useCallback(()=>{if($e.current){_e.current=!0;return}Te.current===null&&(Te.current=window.setTimeout(()=>{Te.current=null,tt()},300))},[tt]);Be.current=ye,v.useEffect(()=>{const J=new EventSource("/api/v1/events"),se=Le=>{let St;try{const It=JSON.parse(Le.data);if(It.version!==1)return;if(St=It.type,It.type==="push.pending"){window.dispatchEvent(new CustomEvent("mono-agent:push-pending",{detail:It.payload})),_("live");return}}catch{}_("live"),(St==="ready"||St==="agents.changed")&&U(It=>It+1),(St==="ready"||St==="agents.changed"||St==="cron.changed")&&Y(It=>It+1),ye()},ve=["ready","agents.changed","cron.changed","threads.changed","thread.changed","message.changed","turn.changed","attachment.changed","push.pending"];J.onopen=()=>{_("live"),U(Le=>Le+1)},J.onmessage=se;for(const Le of ve)J.addEventListener(Le,se);J.onerror=()=>_(navigator.onLine?"reconnecting":"offline");const ie=()=>{_("reconnecting"),U(Le=>Le+1),ye()},he=()=>_("offline");return window.addEventListener("online",ie),window.addEventListener("offline",he),()=>{J.close();for(const Le of ve)J.removeEventListener(Le,se);window.removeEventListener("online",ie),window.removeEventListener("offline",he),Te.current!==null&&window.clearTimeout(Te.current)}},[ye]);const Je=v.useMemo(()=>By(n?.agents??[]),[n?.agents]),we=n?.threads??[],Ee=Je.find(J=>J.sourceId===r)??null,rt=O.sourceId===r?O.registry:{status:"loading",items:[]},{visibleAgents:Ne,hiddenOfflineAgentCount:Fe}=v.useMemo(()=>n1(Je,r,ne),[Je,r,ne]),nt=we.find(J=>J.id===c)??p?.thread??null,ht=v.useMemo(()=>[...we].filter(J=>J.sourceId===r&&!!J.archivedAt===H).sort(Dc),[r,H,we]),zt=r===null?void 0:Df(r,H),fn=zt!==void 0&&typeof B[zt]=="string",kt=nt?.trigger?.kind==="cron"?nt.trigger.jobId:void 0,Tn=kt===void 0?void 0:nt?.id,on=r===null||kt===void 0?void 0:qy(r,kt),no=p?.messagesNextCursor!==void 0||Ee?.cron?.read===!0&&on!==void 0&&typeof oe[on]=="string",Zn=v.useCallback(async()=>{if(r===null)return;const J=B[Df(r,H)];typeof J=="string"&&await Re(r,H,J)},[Re,r,H,B]),Io=v.useCallback(async()=>{const J=p;if(J===null)return;if(J.messagesNextCursor!==void 0){const ie=await Ze.messages(J.thread.id,J.messagesNextCursor);g(he=>{if(he?.thread.id!==J.thread.id)return he;const Le=new Set(he.messages.map(Vs=>Vs.id)),St=[...ie.messages.filter(Vs=>!Le.has(Vs.id)),...he.messages];if(ie.nextCursor!==void 0)return{...he,messages:St,messagesNextCursor:ie.nextCursor};const{messagesNextCursor:It,...In}=he;return{...In,messages:St}});return}if(Ee?.cron?.read!==!0||r===null||kt===void 0||Tn!==J.thread.id||on===void 0)return;const se=oe[on];if(typeof se!="string")return;const ve=await Ze.cronRuns(r,kt,se);le(ie=>({...ie,[on]:ve.nextCursor??null})),g(ie=>{if(ie?.thread.id!==J.thread.id)return ie;const he=new Set(ie.messages.map(St=>St.id)),Le=[...(ve.messages??[]).filter(St=>!he.has(St.id)),...ie.messages];return{...ie,messages:Le}})},[oe,p,Ee?.cron?.read,r,on,kt,Tn]),at=v.useCallback(async()=>{const J=r,se=kt;if(J===null||Ee?.cron?.read!==!0){z(null),re(null);return}Q(!0),re(null);try{const ve=await Ze.cronOverview(J);if(z(ve),await Re(J,H),se!==void 0){const ie=await Ze.cronRuns(J,se),he=qy(J,se);le(St=>Object.prototype.hasOwnProperty.call(St,he)?St:{...St,[he]:ie.nextCursor??null});const Le=await Ze.thread(Tn);xe.current===Le.thread.id&&g(Le)}}catch(ve){re(An(ve))}finally{Q(!1)}},[Re,Ee?.cron?.read,r,kt,Tn,H]),Kt=v.useCallback(async J=>{const se=r,ve=kt,ie=Tn;if(!(se===null||ve===void 0||ie===void 0)){Q(!0),re(null);try{const he=await Ze.cronRun(se,ve,J);g(Le=>{if(Le?.thread.id!==ie)return Le;const St=Le.messages.some(It=>It.id===he.id);return{...Le,messages:St?Le.messages.map(It=>It.id===he.id?he:It):[...Le.messages,he].sort((It,In)=>It.createdAt.localeCompare(In.createdAt)||It.id.localeCompare(In.id))}})}catch(he){re(An(he))}finally{Q(!1)}}},[r,kt,Tn]);v.useEffect(()=>{at()},[k,at]),v.useEffect(()=>{const J=++it.current,se=r,ve=Me.current,ie=()=>ve.sourceId===se&&(ve.registry.status==="ready"||ve.registry.status==="stale")?{status:"stale",items:ve.registry.items,total:ve.registry.total,...ve.registry.truncated===!0?{truncated:!0}:{}}:Ee?.status==="offline"?{status:"offline",items:[]}:{status:"loading",items:[]};if(se===null){R({sourceId:null,registry:{status:"loading",items:[]}});return}if(Ee?.status==="offline"||j!=="live"){R({sourceId:se,registry:ie()});return}const he=new AbortController;return R({sourceId:se,registry:ve.sourceId===se&&(ve.registry.status==="ready"||ve.registry.status==="stale")?ie():{status:"loading",items:[]}}),Ze.agentSkills(se,he.signal).then(Le=>{he.signal.aborted||J!==it.current||R({sourceId:se,registry:Le})}).catch(()=>{he.signal.aborted||J!==it.current||R({sourceId:se,registry:ve.sourceId===se&&(ve.registry.status==="ready"||ve.registry.status==="stale")?ie():{status:"error",items:[]}})}),()=>he.abort()},[j,Ee?.status,r,M]);const yn=v.useCallback(J=>{qe.current=J,i(J),localStorage.setItem(xi,J);const se=Ci()[J],ie=we.find(he=>he.id===se&&he.sourceId===J&&!he.archivedAt)??[...we].filter(he=>he.sourceId===J&&!he.archivedAt).sort(Dc)[0];xe.current=ie?.id??null,d(ie?.id??null),ts(J,ie?.id??null),lr(ie),$(!1),A(null)},[we]),Ft=v.useCallback(async(J,se)=>{try{const ve=await Ze.patchAgent(J,se);s(ie=>ie&&{...ie,agents:By(ie.agents.map(he=>he.sourceId===J?{...he,pinned:ve.pinned}:he))}),A(null),ye()}catch(ve){throw A(An(ve)),ve}},[ye]),_n=v.useCallback(J=>{const se=we.find(ve=>ve.id===J);se&&(qe.current=se.sourceId,i(se.sourceId),localStorage.setItem(xi,se.sourceId),se.archivedAt||ts(se.sourceId,se.id),lr(se)),xe.current=J,d(J),A(null),se===void 0&&Ze.thread(J).then(ve=>{const ie=ve.thread;s(he=>he===null?he:{...he,threads:Uf(he.threads,[ie])}),g(ve),qe.current=ie.sourceId,xe.current=ie.id,i(ie.sourceId),d(ie.id),localStorage.setItem(xi,ie.sourceId),ie.archivedAt||ts(ie.sourceId,ie.id),lr(ie,!0)}).catch(ve=>A(An(ve)))},[we]);v.useEffect(()=>{const J=Pf();if(J===void 0)return;const se=ee?.jobs.find(ve=>ve.jobId===J.jobId);se===void 0||J.sourceId!==r||xe.current!==se.threadId&&_n(se.threadId)},[ee,Se,_n,r]);const sn=v.useCallback(async()=>{if(!r)throw new Error("Select an agent before starting a conversation.");try{const J=await Ze.createThread(r),se=bc(r,null),ve=bc(r,J.id);return me(ie=>{if(ie[se]===void 0)return ie;const he={...ie,[ve]:ie[se]??""};return delete he[se],he}),be(ie=>{if(ie[se]===void 0)return ie;const he={...ie,[ve]:ie[se]??""};return delete he[se],he}),xe.current=J.id,d(J.id),ts(r,J.id),$(!1),lr(J),s(ie=>ie&&{...ie,threads:[J,...ie.threads]}),g({thread:J,messages:[]}),A(null),J}catch(J){throw A(An(J)),J}},[r]),rn=v.useCallback(async J=>{const se=we.find(ie=>ie.id===J)??(p?.thread.id===J?p.thread:void 0);if(se!==void 0)return se;const ve=await Ze.thread(J);return s(ie=>ie===null?ie:{...ie,threads:Uf(ie.threads,[ve.thread])}),ve.thread},[p,we]),Vn=v.useCallback(async(J,se)=>{const ve=se.trim();if(ve)try{await rn(J);const ie=await Ze.patchThread(J,{title:ve});s(he=>he&&{...he,threads:he.threads.map(Le=>Le.id===ie.id?ie:Le)}),g(he=>he?.thread.id===ie.id?{...he,thread:ie}:he)}catch(ie){throw A(An(ie)),ie}},[rn]),vo=v.useCallback(async J=>{try{const se=await rn(J),ve=await Ze.patchThread(se.id,{archived:!0});if(s(ie=>ie&&{...ie,threads:ie.threads.map(he=>he.id===ve.id?ve:he)}),xe.current===se.id||xe.current===J){const ie=ht.find(he=>he.id!==se.id);xe.current=ie?.id??null,d(ie?.id??null),ts(ve.sourceId,ie?.id??null),lr(ie,!0)}else Ci()[ve.sourceId]===se.id&&ts(ve.sourceId,null)}catch(se){throw A(An(se)),se}},[rn,ht]),Do=v.useCallback(async J=>{try{const se=await rn(J),ve=await Ze.patchThread(se.id,{archived:!1});s(ie=>ie&&{...ie,threads:ie.threads.map(he=>he.id===ve.id?ve:he)}),xe.current=ve.id,d(ve.id),ts(ve.sourceId,ve.id),$(!1),lr(ve,!0)}catch(se){throw A(An(se)),se}},[rn]),is=v.useCallback(async J=>{try{const se=await rn(J);await Ze.deleteThread(se.id);const ve=bc(se.sourceId,se.id);if(me(ie=>{const he={...ie};return delete he[ve],he}),be(ie=>{const he={...ie};return delete he[ve],he}),s(ie=>ie&&{...ie,threads:ie.threads.filter(he=>he.id!==se.id)}),xe.current===se.id||xe.current===J){const ie=ht.find(he=>he.id!==se.id);xe.current=ie?.id??null,d(ie?.id??null),g(null),lr(ie,!0)}Ci()[se.sourceId]===se.id&&ts(se.sourceId,null),A(null)}catch(se){throw A(An(se)),se}},[rn,ht]),Rn=Ee?.models??[],We=r?bc(r,c):"",Ut={model:ae[We]??"",effort:Ce[We]??""},pn=r1(Ee,Ut),To=pn.model,Zs=Ee&&(To||Ee.defaultModel||Rn[0])||"",_o=Uc(Ee,Zs),Uo=pn.effort,Ro=Uo||Ee?.defaultEffort||"",ls=To.length>0||Uo.length>0;v.useEffect(()=>{We&&(Ut.model!==pn.model&&me(J=>({...J,[We]:pn.model})),Ut.effort!==pn.effort&&be(J=>({...J,[We]:pn.effort})))},[We,Ut.effort,Ut.model,pn.effort,pn.model]);const Po=v.useCallback(J=>{if(!r||!We)return;me(ie=>({...ie,[We]:J}));const se=J||Ee?.defaultModel||Ee?.models?.[0]||"",ve=Uc(Ee,se);be(ie=>({...ie,[We]:ve.includes(ie[We]??"")?ie[We]??"":""}))},[We,Ee,r]),$o=v.useCallback(()=>{We&&(me(J=>{const se={...J};return delete se[We],se}),be(J=>{const se={...J};return delete se[We],se}))},[We]),cs=v.useCallback(J=>{!r||!We||be(se=>({...se,[We]:J}))},[We,r]),Lo=v.useCallback(async(J,se)=>{let ve=nt;if(ve||(ve=await sn()),ve.archivedAt)throw new Error("Unarchive this conversation before sending.");se?.(ve.id);try{const ie=await Ze.startTurn(ve.id,{...J});s(he=>he&&{...he,threads:he.threads.map(Le=>Le.id===ie.thread.id?ie.thread:Le)}),g(he=>he?.thread.id===ie.thread.id?{...he,thread:ie.thread}:he),A(null),ye()}catch(ie){throw A(An(ie)),ie}},[sn,ye,nt]),Xt=v.useCallback(async()=>{if(c)try{const J=await Ze.cancelTurn(c);g(se=>se?.thread.id===J.thread.id?{...se,thread:J.thread}:se),ye()}catch(J){throw A(An(J)),J}},[ye,c]),Ra=v.useCallback(async J=>{if(!c)throw new Error("Select a conversation before sending a follow-up.");try{const se=await Ze.liveInput(c,J);g(ve=>{if(ve?.thread.id!==c)return ve;const ie=ve.messages.some(he=>he.id===se.message.id);return{...ve,messages:ie?ve.messages.map(he=>he.id===se.message.id?se.message:he):[...ve.messages,se.message]}}),A(null),ye()}catch(se){throw A(An(se)),se}},[ye,c]),ul=v.useMemo(()=>({bootstrap:n,agents:Je,visibleAgents:Ne,threads:we,visibleThreads:ht,selectedAgent:Ee,selectedThread:nt,detail:p,selectedAgentId:r,selectedThreadId:c,loading:m,detailLoading:b,error:w,actionError:C,connection:j,showArchived:H,showOfflineAgents:ne,hiddenOfflineAgentCount:Fe,model:To,effort:Uo,effectiveModel:Zs,effectiveEffort:Ro,hasRunOverride:ls,resetRunOverride:$o,modelOptions:Rn,effortOptions:_o,skillRegistry:rt,cronOverview:ee,cronLoading:G,cronError:q,hasMoreThreads:fn,hasOlderMessages:no,selectAgent:yn,setAgentPinned:Ft,selectThread:_n,createThread:sn,renameThread:Vn,archiveThread:vo,unarchiveThread:Do,deleteThread:is,sendTurn:Lo,sendLiveInput:Ra,cancelTurn:Xt,setShowArchived:$,setShowOfflineAgents:de,setModel:Po,setEffort:cs,retry:()=>{y(!0),E(null),Oe()},clearActionError:()=>A(null),loadMoreThreads:Zn,loadOlderMessages:Io,refreshCron:at,loadCronRunActivity:Kt}),[C,Je,vo,n,Xt,j,sn,G,q,ee,p,b,is,Uo,Ro,Zs,_o,w,Fe,fn,no,Oe,Zn,Io,Kt,m,ls,To,Rn,$o,rt,Vn,at,yn,_n,Ee,r,nt,c,Lo,Ra,cs,Ft,Po,H,ne,we,Do,Ne,ht]);return f.jsx(F0.Provider,{value:ul,children:e})}function nn(){const e=v.useContext(F0);if(!e)throw new Error("useConsoleStore must be used inside ConsoleStoreProvider.");return e}const i1=()=>nn().bootstrap?.limits??WR,l1={activity:f.jsx("path",{d:"M3 12h4l3-8 4 16 3-8h4"}),agent:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"5",y:"7",width:"14",height:"12",rx:"4"}),f.jsx("path",{d:"M9 7V5m6 2V5M8.5 12h.01M15.5 12h.01M9 16c2 1 4 1 6 0"})]}),archive:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M4 7h16M6 7v12h12V7M4 4h16v3H4z"}),f.jsx("path",{d:"M9 11h6"})]}),"arrow-down":f.jsx("path",{d:"m7 10 5 5 5-5"}),attach:f.jsx("path",{d:"m9 12 5.5-5.5a3 3 0 0 1 4.2 4.2l-7.5 7.5a5 5 0 0 1-7.1-7.1l7.6-7.6M8 15l7.5-7.5"}),bell:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M18 8a6 6 0 0 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9"}),f.jsx("path",{d:"M10 21h4"})]}),"bell-off":f.jsx(f.Fragment,{children:f.jsx("path",{d:"m3 3 18 18M8.3 5.1A6 6 0 0 1 18 8c0 2.5.4 4.1 1 5.2M6 8c0 7-3 7-3 9h14M10 21h4"})}),bulb:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M12 4a6 6 0 0 1 6 6c0 2.2-1.2 3.5-2.2 4.7-.6.8-.8 1.3-.8 2.3h-6c0-1-.2-1.5-.8-2.3C7.2 13.5 6 12.2 6 10a6 6 0 0 1 6-6z"}),f.jsx("path",{d:"M10 20h4"})]}),check:f.jsx("path",{d:"m5 12 4 4L19 6"}),chevron:f.jsx("path",{d:"m9 18 6-6-6-6"}),"chevron-down":f.jsx("path",{d:"m6 9 6 6 6-6"}),"chevron-left":f.jsx("path",{d:"m15 18-6-6 6-6"}),download:f.jsx("path",{d:"M12 4v11m0 0-4-4m4 4 4-4M5 19h14"}),close:f.jsx("path",{d:"m6 6 12 12M18 6 6 18"}),command:f.jsx(f.Fragment,{children:f.jsx("path",{d:"M9 6V5a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3v14a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3z"})}),copy:f.jsxs(f.Fragment,{children:[f.jsx("rect",{x:"8",y:"8",width:"11",height:"11",rx:"2"}),f.jsx("path",{d:"M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3"})]}),eye:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6z"}),f.jsx("circle",{cx:"12",cy:"12",r:"2.5"})]}),"eye-off":f.jsx(f.Fragment,{children:f.jsx("path",{d:"m3 3 18 18M10.6 6.2A9.4 9.4 0 0 1 12 6c6 0 9.5 6 9.5 6a17 17 0 0 1-2.1 2.8M6.2 6.2C3.9 7.8 2.5 12 2.5 12s3.5 6 9.5 6c1.2 0 2.3-.2 3.3-.7M9.9 9.9a3 3 0 0 0 4.2 4.2"})}),file:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M6 3h8l4 4v14H6z"}),f.jsx("path",{d:"M14 3v5h5M9 13h6M9 17h5"})]}),menu:f.jsx("path",{d:"M4 7h16M4 12h16M4 17h16"}),more:f.jsx("path",{d:"M5 12h.01M12 12h.01M19 12h.01"}),new:f.jsx("path",{d:"M12 5v14M5 12h14"}),quote:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M7 10h4v8H5v-6c0-4 2-6 6-7"}),f.jsx("path",{d:"M17 10h4v8h-6v-6c0-4 2-6 6-7"})]}),restore:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M4 8v5h5"}),f.jsx("path",{d:"M5.5 13a7 7 0 1 0 1-6"})]}),search:f.jsxs(f.Fragment,{children:[f.jsx("circle",{cx:"11",cy:"11",r:"6"}),f.jsx("path",{d:"m16 16 4 4"})]}),send:f.jsx("path",{d:"m4 4 17 8-17 8 3-8zM7 12h14"}),settings:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M4 7h10M18 7h2M4 17h2M10 17h10M4 12h4M12 12h8"}),f.jsx("circle",{cx:"16",cy:"7",r:"2"}),f.jsx("circle",{cx:"8",cy:"17",r:"2"}),f.jsx("circle",{cx:"10",cy:"12",r:"2"})]}),spark:f.jsx("path",{d:"M12 2c.6 5.4 4.6 9.4 10 10-5.4.6-9.4 4.6-10 10-.6-5.4-4.6-9.4-10-10 5.4-.6 9.4-4.6 10-10z"}),star:f.jsx("path",{d:"m12 3 2.7 5.5 6.1.9-4.4 4.3 1 6.1-5.4-2.9-5.4 2.9 1-6.1-4.4-4.3 6.1-.9z"}),stop:f.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),trash:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M4 7h16M9 7V4h6v3M7 7l1 13h8l1-13"}),f.jsx("path",{d:"M10 11v5M14 11v5"})]}),threads:f.jsxs(f.Fragment,{children:[f.jsx("path",{d:"M5 5h14v10H9l-4 4z"}),f.jsx("path",{d:"M8 9h8M8 12h5"})]})};function Ae({name:e,size:n=18,...s}){return f.jsx("svg",{viewBox:"0 0 24 24",width:n,height:n,fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...s,children:l1[e]})}const J0=e=>e.split(/[\s_-]+/u).filter(Boolean).slice(0,2).map(n=>n[0]?.toUpperCase()).join("")||"A";function nu(){return f.jsxs("span",{className:"brand-mark","aria-hidden":"true",children:[f.jsx("span",{}),f.jsx("span",{}),f.jsx("span",{})]})}function c1({expanded:e=!1,onToggleExpanded:n,onSelect:s}){const{bootstrap:r,visibleAgents:i,connection:c,hiddenOfflineAgentCount:d,selectedAgentId:p,showOfflineAgents:g,selectAgent:m,setAgentPinned:y,setShowOfflineAgents:b}=nn(),x=r?.console.hostName??"mono-agent";return f.jsxs("nav",{className:`agent-rail${e?" is-expanded":""}`,"aria-label":"Agents",children:[f.jsxs("div",{className:"rail-brand",title:x,children:[f.jsx(nu,{}),f.jsx("span",{className:"rail-brand-copy",children:x})]}),f.jsxs("div",{className:"agent-list",role:"list",children:[i.map(w=>{const E=!!w.pinned;return f.jsxs("div",{className:"agent-item",role:"listitem",children:[f.jsxs("button",{type:"button",className:`agent-button${p===w.sourceId?" is-active":""}`,onClick:()=>{m(w.sourceId),s?.()},"aria-pressed":p===w.sourceId,"aria-label":`${w.label}, ${w.status}${E?", pinned":""}`,title:`${w.label} · ${w.status}`,children:[f.jsxs("span",{className:"agent-avatar-wrap",children:[f.jsx("span",{className:"agent-avatar",children:J0(w.label)}),f.jsx("span",{className:`agent-status is-${w.status}`})]}),f.jsx("span",{className:"agent-label",children:w.label})]}),f.jsx("button",{type:"button",className:`agent-pin${E?" is-pinned":""}`,"aria-pressed":E,"aria-label":`${E?"Unpin":"Pin"} ${w.label}`,title:`${E?"Remove from":"Add to"} favorites`,onClick:()=>{y(w.sourceId,!E).catch(()=>{})},children:f.jsx(Ae,{name:"star",size:14,fill:E?"currentColor":"none"})})]},w.sourceId)}),i.length===0&&f.jsx("span",{className:"rail-empty",title:"No agents discovered",children:f.jsx(Ae,{name:"agent",size:19})}),d>0&&f.jsxs("button",{type:"button",className:`rail-offline-toggle${g?" is-active":""}`,"aria-pressed":g,"aria-label":g?"Hide offline agents":`Show ${d} offline agent${d===1?"":"s"}`,title:g?"Hide offline agents":`Show ${d} offline`,onClick:()=>b(!g),children:[f.jsx(Ae,{name:g?"eye-off":"eye",size:16}),f.jsx("span",{className:"rail-offline-copy",children:g?"Hide offline":`Show ${d} offline`}),!e&&f.jsx("span",{className:"rail-offline-count",children:d})]})]}),n&&f.jsxs("button",{type:"button",className:"rail-toggle","aria-expanded":e,"aria-label":e?"Collapse agent sidebar":"Expand agent sidebar",title:e?"Collapse agent sidebar":"Expand agent sidebar",onClick:n,children:[f.jsx(Ae,{name:"chevron",size:17}),f.jsx("span",{className:"rail-toggle-copy",children:e?"Collapse":"Expand"})]}),f.jsx("button",{type:"button",className:"rail-command","aria-label":"Open command palette",title:"Command palette (⌘K)",onClick:()=>window.dispatchEvent(new Event("mono-agent:command")),children:f.jsx(Ae,{name:"command",size:18})}),f.jsx("span",{className:`rail-connection is-${c}`,"aria-label":`Console connection: ${c}`,title:`Console ${c}`})]})}function u1({onSelect:e}){const{bootstrap:n,visibleAgents:s,hiddenOfflineAgentCount:r,selectedAgentId:i,showOfflineAgents:c,selectAgent:d,setAgentPinned:p,setShowOfflineAgents:g}=nn(),m=n?.console.hostName??"mono-agent";return f.jsxs("aside",{className:"mobile-agent-picker","aria-label":"Choose an agent",children:[f.jsxs("header",{children:[f.jsx(nu,{}),f.jsxs("div",{children:[f.jsx("span",{className:"eyebrow",children:m}),f.jsx("h2",{children:"Agents"})]})]}),f.jsxs("div",{className:"mobile-agent-list",children:[s.map(y=>{const b=!!y.pinned;return f.jsxs("div",{className:"mobile-agent-row",children:[f.jsxs("button",{type:"button",className:`mobile-agent-select${i===y.sourceId?" is-active":""}`,"aria-pressed":i===y.sourceId,"aria-label":`${y.label}, ${y.status}${b?", pinned":""}`,onClick:()=>{d(y.sourceId),e()},children:[f.jsx("span",{className:"mobile-agent-avatar",children:J0(y.label)}),f.jsxs("span",{className:"mobile-agent-copy",children:[f.jsx("strong",{children:y.label}),f.jsx("small",{children:y.status==="degraded"?"Available with warnings":y.status})]}),f.jsx("span",{className:`agent-status is-${y.status}`}),i===y.sourceId&&f.jsx(Ae,{name:"check",size:16})]}),f.jsx("button",{type:"button",className:`mobile-agent-pin${b?" is-pinned":""}`,"aria-pressed":b,"aria-label":`${b?"Unpin":"Pin"} ${y.label}`,title:`${b?"Remove from":"Add to"} favorites`,onClick:()=>{p(y.sourceId,!b).catch(()=>{})},children:f.jsx(Ae,{name:"star",size:17,fill:b?"currentColor":"none"})})]},y.sourceId)}),s.length===0&&f.jsx("p",{children:"No agents discovered. Running agents will appear automatically."}),r>0&&f.jsxs("button",{type:"button",className:`mobile-offline-toggle${c?" is-active":""}`,"aria-pressed":c,onClick:()=>g(!c),children:[f.jsx(Ae,{name:c?"eye-off":"eye",size:16}),f.jsx("span",{children:c?"Hide offline agents":`Show ${r} offline agent${r===1?"":"s"}`})]})]})]})}const Ms="mono-agent.web.notifications-enabled",pr="mono-agent.web.push-subscription-id",Sc="mono-agent.web.push-endpoint-sha256",up="mono-agent.web.push-pending-delete",d1="mono-agent:select-thread",f1="mono-agent:push-subscription-change",Vy="mono-agent:push-pending",p1="mono-agent:notification-sw-version",h1=e=>new Map(e.map(n=>[n.id,{...n.runState.id===void 0?{}:{id:n.runState.id},status:n.runState.status}])),m1=(e,n)=>n.flatMap(s=>{const r=s.runState.id;if(!r||s.runState.status!=="complete")return[];const i=e.get(s.id);return i?.id===r&&i.status==="complete"?[]:[{thread:s,turnId:r}]}),g1=(e,n)=>{const r=[...e.messages].reverse().find(i=>i.turnId===n&&i.role==="assistant"&&i.status==="complete")?.parts.flatMap(i=>i.type==="text"?[i.text]:[]).join(" ");return r?T1(r):void 0},v1=(e,n)=>n.trigger===void 0?`${e} replied`:`${e} · ${n.trigger.kind.toUpperCase()}`,Bp=()=>window.isSecureContext===!0&&typeof Notification<"u"&&"serviceWorker"in navigator,Yy=()=>Bp()&&"PushManager"in window,y1=()=>Bp()?Notification.permission==="denied"?"denied":Notification.permission==="default"?"prompt":localStorage.getItem(Ms)==="1"?"enabled":"disabled":"unsupported",cr=e=>{window.dispatchEvent(new CustomEvent("mono-agent:notice",{detail:{message:e}}))},W0=v.createContext(null);function b1({children:e}){const n=nn(),[s,r]=v.useState(y1),[i,c]=v.useState(!1),d=v.useRef(null),p=v.useRef(new Set),g=v.useRef(null),m=v.useRef(null),y=v.useRef(!1),b=v.useCallback(async w=>{if(y.current||!n.bootstrap||!Yy())return;y.current=!0;const E=localStorage.getItem(Ms)==="1"&&Notification.permission==="granted";try{if(await Gy(),!E){c(!1);return}const C=await navigator.serviceWorker.ready;if(!await x1(n.bootstrap.push)){c(!1),r("degraded");return}let j=await C.pushManager.getSubscription(),_=localStorage.getItem(pr);const O=_??void 0;let R;if(_)try{R=await Ze.pushSubscription(_)}catch(oe){if(!eS(oe))throw oe}let M=j===null?void 0:await Ky(j.endpoint);const U=localStorage.getItem(Sc),k=j!==null&&U!==null&&M!==U,Y=R!==void 0&&R.keyFingerprint!==n.bootstrap.push.keyFingerprint,H=R!==void 0&&R.state!=="active"&&!k;j&&(Y||H)&&(await j.unsubscribe().catch(()=>!1),j=null,R=void 0,M=void 0),!j&&w&&(j=await C.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:w1(n.bootstrap.push.applicationServerKey)}),M=await Ky(j.endpoint));const $=j!==null&&(R===void 0||_===null||k||U===null||R.state!=="active"||Y);j&&$&&(R=await Ze.registerPushSubscription(j,O),_=R.id,localStorage.setItem(pr,_)),j&&M!==void 0?localStorage.setItem(Sc,M):localStorage.removeItem(Sc);const B=R?.lastErrorCode==="push_service_401"||R?.lastErrorCode==="push_service_403",P=!!(j&&R?.state==="active"&&!B&&R.keyFingerprint===n.bootstrap.push.keyFingerprint);c(P),r(P?"enabled":"degraded")}catch{c(!1),E&&r("degraded")}finally{y.current=!1}},[n.bootstrap]),x=v.useCallback(async()=>{if(!Bp()){cr("Push notifications require a secure browser context."),r("unsupported");return}if(Notification.permission==="denied"){localStorage.removeItem(Ms),r("denied"),cr("Notifications are blocked in this browser's site settings.");return}if(s==="enabled"&&localStorage.getItem(Ms)==="1"){localStorage.removeItem(Ms),c(!1),r("disabled");const C=localStorage.getItem(pr);C&&(localStorage.setItem(up,C),await Gy().catch(()=>{})),await(await(await navigator.serviceWorker.ready).pushManager.getSubscription())?.unsubscribe().catch(()=>!1),localStorage.removeItem(Sc);return}const w=Notification.permission==="granted"?"granted":await Notification.requestPermission();if(w!=="granted"){localStorage.removeItem(Ms),r(w==="denied"?"denied":"prompt"),w==="denied"&&cr("Notifications are blocked in this browser's site settings.");return}if(localStorage.setItem(Ms,"1"),!Yy()){c(!1),r("enabled"),cr("Background push is unavailable here. On iPhone or iPad, add the console to the Home Screen over HTTPS; until then the page must remain open.");return}await b(!0);const E=localStorage.getItem(pr);E?await Ze.testPushSubscription(E).catch(()=>{cr("Push was connected, but the test notification could not be queued.")}):(localStorage.removeItem(Ms),r("degraded"),cr("Push could not be connected. Reload after the service worker finishes updating and try again."))},[s,b]);return v.useEffect(()=>{n.bootstrap&&b(Notification.permission==="granted")},[b,n.bootstrap]),v.useEffect(()=>{const w=E=>{if(!i||document.visibilityState!=="visible"||!document.hasFocus())return;const C=E.detail;if(!E1(C)||n.selectedThread?.id!==C.threadId)return;const A=localStorage.getItem(pr);A&&Ze.acknowledgePushEvent(C.eventId,A,C.ackToken).catch(()=>{})};return window.addEventListener(Vy,w),()=>window.removeEventListener(Vy,w)},[i,n.selectedThread?.id]),v.useEffect(()=>{const w=E=>{const C=E.data;if(typeof C!="object"||C===null||Array.isArray(C))return;const A=C;if(A.type===f1){b(!0);return}A.type!==d1||typeof A.threadId!="string"||(m.current=A.threadId,n.selectThread(A.threadId),m.current=null)};return navigator.serviceWorker?.addEventListener("message",w),()=>navigator.serviceWorker?.removeEventListener("message",w)},[b,n]),v.useEffect(()=>{const w=m.current;w&&(n.selectThread(w),m.current=null)},[n]),v.useEffect(()=>{const w=new URL(window.location.href),E=w.searchParams.get("thread");!E||g.current===E||(g.current=E,n.selectThread(E),w.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",w))},[n]),v.useEffect(()=>{if(!n.bootstrap)return;const w=h1(n.bootstrap.threads),E=d.current;if(d.current=w,E!==null)for(const C of m1(E,n.bootstrap.threads)){if(p.current.has(C.turnId)||(p.current.add(C.turnId),i||s!=="enabled"&&s!=="degraded"||Notification.permission!=="granted"||document.visibilityState==="visible"&&document.hasFocus()))continue;const A=n.agents.find(j=>j.sourceId===C.thread.sourceId);(async()=>{try{const j=await Ze.thread(C.thread.id),_=await navigator.serviceWorker.ready,O=`mono-agent-turn-${C.turnId}`;if((await _.getNotifications({tag:O})).length>0)return;const R=new URL(window.location.href);R.searchParams.set("thread",C.thread.id),await _.showNotification(v1(A?.label??"mono-agent",C.thread),{body:g1(j,C.turnId)??`Response ready in ${C.thread.title}.`,tag:O,icon:"/icon-192.png",badge:"/icon-192.png",data:{threadId:C.thread.id,url:R.href}})}catch{cr("The response arrived, but its notification could not be shown.")}})()}},[s,i,n]),f.jsx(W0.Provider,{value:{preference:s,toggle:x},children:e})}function S1(){const e=v.useContext(W0);if(!e)throw new Error("NotificationBell must be used inside NotificationsProvider.");const n=e.preference==="enabled",s=e.preference==="unsupported",r=e.preference==="denied",i=e.preference==="degraded",c=n?"Disable push notifications":r?"Push notifications blocked":s?"Push notifications unavailable":i?"Reconnect push notifications":"Enable push notifications";return f.jsx("button",{type:"button",className:`icon-button header-notifications${n?" is-enabled":""}${i?" is-degraded":""}`,"aria-label":c,"aria-pressed":n,title:c,disabled:s,onClick:()=>void e.toggle(),children:f.jsx(Ae,{name:r?"bell-off":"bell",size:17})})}async function x1(e){const n=navigator.serviceWorker.controller;return!n||typeof MessageChannel>"u"?!1:await new Promise(s=>{const r=new MessageChannel,i=window.setTimeout(()=>s(!1),1e3);r.port1.onmessage=c=>{window.clearTimeout(i);const d=c.data;s(d?.version===e.serviceWorkerVersion)},n.postMessage({type:p1},[r.port2])})}async function Gy(){const e=localStorage.getItem(up);if(e){try{await Ze.deletePushSubscription(e)}catch(n){if(!eS(n))throw n}localStorage.removeItem(up),localStorage.getItem(pr)===e&&localStorage.removeItem(pr)}}function eS(e){return e instanceof Sa&&e.status===404}async function Ky(e){const n=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(n))).replace(/\+/gu,"-").replace(/\//gu,"_").replace(/=+$/gu,"")}function w1(e){const n=e.replace(/-/gu,"+").replace(/_/gu,"/"),s=n.padEnd(Math.ceil(n.length/4)*4,"="),r=atob(s),i=new Uint8Array(new ArrayBuffer(r.length));for(let c=0;c<r.length;c+=1)i[c]=r.charCodeAt(c);return i}function E1(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const n=e;return typeof n.eventId=="string"&&typeof n.threadId=="string"&&typeof n.ackToken=="string"}function T1(e){let n=A1([...e].slice(0,8192).join("")).replace(/\b(basic|bearer|token)[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\p{Cf}\p{Default_Ignorable_Code_Point}]+(?=[a-z\d._~+\/-])/giu,"$1 ").replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f-\u009f\p{Cf}\p{Default_Ignorable_Code_Point}]/gu,"").replace(/```[^\n]*\n?/gu," ").replace(/~~~[^\n]*\n?/gu," ").replace(/!\[([^\]]*)\]\([^)]*\)/gu,"$1").replace(/\[([^\]]+)\]\([^)]*\)/gu,"$1").replace(/<https?:\/\/[^>]+>/giu," ").replace(/<[^>]*>/gu," ").replace(/^\s{0,3}(?:#{1,6}|>|[-+*]|\d+[.)])\s+/gmu,"").replace(/(^|\s)[*_~]{1,3}([^\s][\s\S]*?)[*_~]{1,3}(?=\s|$|[.,!?;:])/gu,"$1$2").replace(/`+/gu,"");n=Fy(n).replace(/\s+/gu," ").trim(),n=Fy(n);const s=[...n];return s.length<=180?n:`${s.slice(0,179).join("").trimEnd()}…`}function Fy(e){let n=e.replace(/(https?:\/\/)[^\s/@:]+(?::[^\s/@]*)?@/giu,"$1[redacted]@").replace(/([?&](?:access_token|api[_-]?key|auth|key|password|secret|signature|token)=)[^&#\s]*/giu,"$1[redacted]").replace(/\b(authorization\s*:\s*)(?:basic|bearer|token)\s+[^\s,;]+/giu,"$1[redacted]").replace(/\b(basic|bearer|token)\s+[a-z\d._~+\/-]{8,}={0,2}\b/giu,"$1 [redacted]");return n=_1(n),n.replace(/\b(?:gh[opusr]_[a-z\d]{20,}|sk-[a-z\d_-]{20,}|xox[baprs]-[a-z\d-]{20,})\b/giu,"[redacted]")}function _1(e){return R1(e,/(^|[\s,.;:{}()[\]])(?:(['"])(?:api[_-]?key|access[_-]?token|auth[_-]?token|client[_-]?secret|password|passwd|secret|token)\2[ \t]*[:=][ \t]*|--(?:api[_-]?key|token|password|secret)(?:=|[ \t]+)|(?:api[_-]?key|access[_-]?token|auth[_-]?token|client[_-]?secret|password|passwd|secret|token)[ \t]*[:=][ \t]*)/gimu)}function R1(e,n){let s=0,r="";const i=new RegExp(n.source,n.flags.replace("g","y"));n.lastIndex=0;for(let c=n.exec(e);c!==null;c=n.exec(e)){if(c.index<s)continue;const d=c.index+c[0].length,p=C1(e,d,i);p.end!==d&&(r+=e.slice(s,d),r+=p.quote===void 0?"[redacted]":`${p.quote}[redacted]${p.quote}`,s=p.end,n.lastIndex=p.end)}return s===0?e:r+e.slice(s)}function C1(e,n,s){let r=n,i=0,c;for(;r<e.length;){const d=e[r];if(/\s/u.test(d)||/[,;]/u.test(d)||i>0&&/[}\])]/u.test(d))break;if(i+=1,d!=='"'&&d!=="'"){for(c=void 0;r<e.length;){const m=e[r];if(/\s/u.test(m)||/[,;]/u.test(m)||m==='"'||m==="'")break;if(/[.:{}()[\]]/u.test(m)&&(s.lastIndex=r,s.exec(e)!==null))return{end:r};r+=m==="\\"?Math.min(2,e.length-r):1}continue}const p=d;r+=1;let g=!1;for(;r<e.length;){const m=e[r];if(m==="\\"){r+=Math.min(2,e.length-r);continue}if(m===p){r+=1,g=!0;break}r+=1}if(!g)return{end:r};c=i===1?p:void 0}return c===void 0?{end:r}:{end:r,quote:c}}function A1(e){const n={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:'"'};return e.replace(/&(?:#(\d{1,7})|#x([\da-f]{1,6})|([a-z]+));/giu,(s,r,i,c)=>{if(typeof c=="string")return n[c.toLowerCase()]??s;const d=Number.parseInt(r??i,r===void 0?16:10);if(!Number.isSafeInteger(d)||d<=0||d>1114111)return" ";try{return String.fromCodePoint(d)}catch{return" "}})}function Gt(){}const Pc=Object.freeze([]),Dt=Object.freeze({}),Xy={};function po(e,n){const s=v.useRef(Xy);return s.current===Xy&&(s.current=e(n)),s}const k1=[];function Zp(e){v.useEffect(e,k1)}const wi=0;class Eo{static create(){return new Eo}currentId=wi;start(n,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=wi,s()},n)}isStarted(){return this.currentId!==wi}clear=()=>{this.currentId!==wi&&(clearTimeout(this.currentId),this.currentId=wi)};disposeEffect=()=>this.clear}function ha(){const e=po(Eo.create).current;return Zp(e.disposeEffect),e}const j1=()=>{},Ie=typeof document<"u"?v.useLayoutEffect:j1;function O1(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:N1,platform:M1,maxTouchPoints:z1}=O1(),ou=N1.toLowerCase(),Ui=M1.toLowerCase(),su=/^i(os$|p)/.test(Ui)||Ui==="macintel"&&z1>1,Qy="android",dp=Ui===Qy||ou.includes(Qy),I1=!su&&Ui.startsWith("mac");Ui.startsWith("win");const D1=I1||su,xa=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!xa&&ou.includes("firefox");!xa&&ou.includes("chrom");const U1=D1,P1=/jsdom|happydom/.test(ou);function $1(e){e.preventDefault(),e.stopPropagation()}function L1(e){return"nativeEvent"in e}function q1(e){return e.pointerType===""&&e.isTrusted?!0:dp&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function H1(e){return P1?!1:!dp&&e.width===0&&e.height===0||dp&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Pi(e,n){const s=["mouse","pen"];return n||s.push("",void 0),s.includes(e)}function B1(e){const n=e.type;return n==="click"||n==="mousedown"||n==="keydown"||n==="keyup"}const fp="data-base-ui-focusable",tS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function ns(e){let n=e.activeElement;for(;n?.shadowRoot?.activeElement!=null;)n=n.shadowRoot.activeElement;return n}function Ke(e,n){if(!e||!n)return!1;const s=n.getRootNode?.();if(e.contains(n))return!0;if(s&&tu(s)){let r=n;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function Hn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function nS(e,n){if(!qt(e))return!1;const s=e;if(n.hasElement(s))return!s.hasAttribute("data-trigger-disabled");for(const[,r]of n.entries())if(Ke(r,s))return!r.hasAttribute("data-trigger-disabled");return!1}function $f(e,n){if(n==null)return!1;if("composedPath"in e)return e.composedPath().includes(n);const s=e;return s.target!=null&&n.contains(s.target)}function Z1(e){return e.matches("html,body")}function Vp(e){return kn(e)&&e.matches(tS)}function V1(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${tS}`)!=null}function Jy(e){return e?e.getAttribute("role")==="combobox"&&Vp(e):!1}function Wy(e){return e?e.hasAttribute(fp)?e:e.querySelector(`[${fp}]`)||e:null}function Y1(e,n){return n!=null&&!Pi(n)?0:typeof e=="function"?e():e}function pp(e,n,s){const r=Y1(e,s);return typeof r=="number"?r:r?.[n]}function eb(e){return typeof e=="function"?e():e}function oS(e,n){return n||e==="click"||e==="mousedown"}function G1(e){return e?.includes("mouse")&&e!=="mousedown"}const Yp="none",ma="trigger-press",Nn="trigger-hover",sS="outside-press",rS="close-press",$i="focus-out",aS="escape-key",iS="imperative-action";function Ht(e,n,s,r){let i=!1,c=!1;const d=Dt;return{reason:e,event:n??new Event("base-ui"),cancel(){i=!0},allowPropagation(){c=!0},get isCanceled(){return i},get isPropagationAllowed(){return c},trigger:s,...d}}function lt(e,n,s,r){return e.addEventListener(n,s,r),()=>{e.removeEventListener(n,s,r)}}function ss(...e){return()=>{for(let n=0;n<e.length;n+=1){const s=e[n];s&&s()}}}function Ds(e,n,s,r){const i=po(lS).current;return F1(i,e,n,s,r)&&cS(i,[e,n,s,r]),i.callback}function K1(e){const n=po(lS).current;return X1(n,e)&&cS(n,e),n.callback}function lS(){return{callback:null,cleanup:null,refs:[]}}function F1(e,n,s,r,i){return e.refs[0]!==n||e.refs[1]!==s||e.refs[2]!==r||e.refs[3]!==i}function X1(e,n){return e.refs.length!==n.length||e.refs.some((s,r)=>s!==n[r])}function cS(e,n){if(e.refs=n,n.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const r=Array(n.length).fill(null);for(let i=0;i<n.length;i+=1){const c=n[i];if(c!=null)switch(typeof c){case"function":{const d=c(s);typeof d=="function"&&(r[i]=d);break}case"object":{c.current=s;break}}}e.cleanup=()=>{for(let i=0;i<n.length;i+=1){const c=n[i];if(c!=null)switch(typeof c){case"function":{const d=r[i];typeof d=="function"?d():c(null);break}case"object":{c.current=null;break}}}}}}}function Mn(e){const n=po(Q1,e).current;return n.next=e,Ie(n.effect),n}function Q1(e){const n={current:e,next:e,effect:()=>{n.current=n.next}};return n}const Gp={...lR},Lf=Gp.useInsertionEffect,J1=Lf&&Lf!==Gp.useLayoutEffect?Lf:e=>e();function De(e){const n=po(W1).current;return n.next=e,J1(n.effect),n.trampoline}function W1(){const e={next:void 0,callback:eC,trampoline:(...n)=>e.callback?.(...n),effect:()=>{e.callback=e.next}};return e}function eC(){}const xc=null;class tC{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const s=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<s.length;i+=1)s[i]?.(n)};request(n){const s=this.nextId;return this.nextId+=1,this.callbacks.push(n),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(n){const s=n-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const wc=new tC;class Ln{static create(){return new Ln}static request(n){return wc.request(n)}static cancel(n){return wc.cancel(n)}currentId=xc;request(n){this.cancel(),this.currentId=wc.request(()=>{this.currentId=xc,n()})}cancel=()=>{this.currentId!==xc&&(wc.cancel(this.currentId),this.currentId=xc)};disposeEffect=()=>this.cancel}function Kp(){const e=po(Ln.create).current;return Zp(e.disposeEffect),e}function Ct(e){return e?.ownerDocument||document}const uS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},dS={...uS,position:"fixed",top:0,left:0},nC={...uS,position:"absolute"},ga=v.forwardRef(function(n,s){const[r,i]=v.useState();Ie(()=>{U1&&xa&&i("button")},[]);const c={tabIndex:0,role:r};return f.jsx("span",{...n,ref:s,style:dS,"aria-hidden":r?void 0:!0,...c,"data-base-ui-focus-guard":""})});function qf(e,n){return n<0||n>=e.length}function oC(e,n){return Oi(e.current,{disabledIndices:n})}function sC(e,n){return Oi(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}function Oi(e,{startingIndex:n=-1,decrement:s=!1,disabledIndices:r,amount:i=1}={}){let c=n;do c+=s?-i:i;while(c>=0&&c<=e.length-1&&hp(e,c,r));return c}function hp(e,n,s){if(typeof s=="function"?s(n):s?.includes(n)??!1)return!0;const i=e[n];return i?Fp(i)?!s&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!0:!1}function rC(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Fp(e,n=e?Lp(e):null){return!e||!e.isConnected||!n||rC(n)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():n.display!=="none"&&n.display!=="contents"}const aC='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function iC(e){const n=e.assignedSlot;if(n)return n;if(e.parentElement)return e.parentElement;const s=e.getRootNode();return tu(s)?s.host:null}function mp(e){for(const n of Array.from(e.children))if(wo(n)==="summary")return n;return null}function lC(e,n){const s=mp(n);return!!s&&(e===s||Ke(s,e))}function fS(e){const n=e?wo(e):"";return e!=null&&e.matches(aC)&&(n!=="summary"||e.parentElement!=null&&wo(e.parentElement)==="details"&&mp(e.parentElement)===e)&&(n!=="details"||mp(e)==null)&&(n!=="input"||e.type!=="hidden")}function pS(e){if(!fS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let n=e;n;n=iC(n)){const s=n!==e,r=wo(n)==="slot";if(n.hasAttribute("inert")||s&&wo(n)==="details"&&!n.open&&!lC(e,n)||n.hasAttribute("hidden")||!r&&!cC(n,s))return!1}return!0}function cC(e,n){const s=Lp(e);return n?s.display!=="none":Fp(e,s)}function hS(e){const n=e.tabIndex;if(n<0){const s=wo(e);if(s==="details"||s==="audio"||s==="video"||kn(e)&&e.isContentEditable)return 0}return n}function Hf(e){if(wo(e)!=="input")return null;const n=e;return n.type==="radio"&&n.name!==""?n:null}function uC(e,n){const s=Hf(e);if(!s)return!0;const r=n.find(i=>{const c=Hf(i);return c?.name===s.name&&c.form===s.form&&c.checked});return r?r===s:n.find(i=>{const c=Hf(i);return c?.name===s.name&&c.form===s.form})===s}function mS(e){if(kn(e)&&wo(e)==="slot"){const n=e.assignedElements({flatten:!0});if(n.length>0)return n}return kn(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function gS(e,n){mS(e).forEach(s=>{fS(s)&&n.push(s),gS(s,n)})}function vS(e,n,s){mS(e).forEach(r=>{kn(r)&&r.matches(n)&&s.push(r),vS(r,n,s)})}function Xp(e){return pS(e)&&hS(e)>=0}function yS(e){const n=[];return gS(e,n),n.filter(pS)}function Gi(e){const n=yS(e);return n.filter(s=>hS(s)>=0&&uC(s,n))}function bS(e,n){const s=Gi(e),r=s.length;if(r===0)return;const i=ns(Ct(e)),c=s.indexOf(i),d=c===-1?n===1?0:r-1:c+n;return s[d]}function Qp(e){return bS(Ct(e).body,1)||e}function SS(e){return bS(Ct(e).body,-1)||e}function xS(e,n){if(!e)return null;const s=Gi(Ct(e).body),r=s.length;if(r===0)return null;const i=s.indexOf(e);if(i===-1)return null;const c=(i+n+r)%r;return s[c]}function dC(e){return xS(e,1)}function fC(e){return xS(e,-1)}function fa(e,n){const s=n||e.currentTarget,r=e.relatedTarget;return!r||!Ke(s,r)}function pC(e){Gi(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function tb(e){const n=[];vS(e,"[data-tabindex]",n),n.forEach(s=>{const r=s.dataset.tabindex;delete s.dataset.tabindex,r?s.setAttribute("tabindex",r):s.removeAttribute("tabindex")})}function Us(e,n,s=!0){return e.filter(i=>i.parentId===n).flatMap(i=>[...!s||i.context?.open?[i]:[],...Us(e,i.id,s)])}function nb(e,n){let s=[],r=e.find(i=>i.id===n)?.parentId;for(;r;){const i=e.find(c=>c.id===r);r=i?.parentId,i&&(s=s.concat(i))}return s}function $c(e){return`data-base-ui-${e}`}let Ec=0;function Bf(e,n={}){const{preventScroll:s=!1,sync:r=!1,shouldFocus:i}=n;cancelAnimationFrame(Ec);function c(){i&&!i()||e?.focus({preventScroll:s})}if(r)return c(),Gt;const d=requestAnimationFrame(c);return Ec=d,()=>{Ec===d&&(cancelAnimationFrame(d),Ec=0)}}const Zf={inert:new WeakMap,"aria-hidden":new WeakMap},ob="data-base-ui-inert",gp={inert:new WeakSet,"aria-hidden":new WeakSet};let Ei=new WeakMap,Vf=0;function hC(e){return gp[e]}function wS(e){return e?tu(e)?e.host:wS(e.parentNode):null}const sb=(e,n)=>n.map(s=>{if(e.contains(s))return s;const r=wS(s);return e.contains(r)?r:null}).filter(s=>s!=null),rb=e=>{const n=new Set;return e.forEach(s=>{let r=s;for(;r&&!n.has(r);)n.add(r),r=r.parentNode}),n},ab=(e,n,s)=>{const r=[],i=c=>{!c||s.has(c)||Array.from(c.children).forEach(d=>{wo(d)!=="script"&&(n.has(d)?i(d):r.push(d))})};return i(e),r};function mC(e,n,s,r,{mark:i=!0}){let c=null;r?c="inert":s&&(c="aria-hidden");let d=null,p=null;const g=sb(n,e),m=i?ab(n,rb(g),new Set(g)):[],y=[],b=[];if(c){const x=Zf[c],w=hC(c);p=w,d=x;const E=sb(n,Array.from(n.querySelectorAll("[aria-live]"))),C=g.concat(E);ab(n,rb(C),new Set(C)).forEach(j=>{const _=j.getAttribute(c),O=_!==null&&_!=="false",R=(x.get(j)||0)+1;x.set(j,R),y.push(j),R===1&&O&&w.add(j),O||j.setAttribute(c,c==="inert"?"":"true")})}return i&&m.forEach(x=>{const w=(Ei.get(x)||0)+1;Ei.set(x,w),b.push(x),w===1&&x.setAttribute(ob,"")}),Vf+=1,()=>{d&&y.forEach(x=>{const E=(d.get(x)||0)-1;d.set(x,E),E||(!p?.has(x)&&c&&x.removeAttribute(c),p?.delete(x))}),i&&b.forEach(x=>{const w=(Ei.get(x)||0)-1;Ei.set(x,w),w||x.removeAttribute(ob)}),Vf-=1,Vf||(Zf.inert=new WeakMap,Zf["aria-hidden"]=new WeakMap,gp.inert=new WeakSet,gp["aria-hidden"]=new WeakSet,Ei=new WeakMap)}}function ib(e,n={}){const{ariaHidden:s=!1,inert:r=!1,mark:i=!0}=n,c=Ct(e[0]).body;return mC(e,c,s,r,{mark:i})}let lb=0;function gC(e,n="mui"){const[s,r]=v.useState(e),i=e||s;return v.useEffect(()=>{s==null&&(lb+=1,r(`${n}-${lb}`))},[s,n]),i}const cb=Gp.useId;function Ki(e,n){if(cb!==void 0){const s=cb();return e??(n?`${n}-${s}`:s)}return gC(e,n)}function vC(e,n){return function(r,...i){const c=new URL(e);return c.searchParams.set("code",r.toString()),i.forEach(d=>c.searchParams.append("args[]",d)),`${n} error #${r}; visit ${c} for the full message.`}}const Wn=vC("https://base-ui.com/production-error","Base UI"),yC=parseInt(v.version,10);function Jp(e){return yC>=e}function ub(e){if(!v.isValidElement(e))return null;const n=e,s=n.props;return(Jp(19)?s?.ref:n.ref)??null}function vp(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function bC(e,n){const s={};for(const r in e){const i=e[r];if(n?.hasOwnProperty(r)){const c=n[r](i);c!=null&&Object.assign(s,c);continue}i===!0?s[`data-${r.toLowerCase()}`]="":i&&(s[`data-${r.toLowerCase()}`]=i.toString())}return s}function SC(e,n){return typeof e=="function"?e(n):e}function ES(e,n){return typeof e=="function"?e(n):e}const Wp={};function ru(e,n,s,r,i){if(!s&&!r&&!e)return Lc(n);let c=Lc(e);return n&&(c=Mc(c,n)),s&&(c=Mc(c,s)),r&&(c=Mc(c,r)),c}function xC(e){if(e.length===0)return Wp;if(e.length===1)return Lc(e[0]);let n=Lc(e[0]);for(let s=1;s<e.length;s+=1)n=Mc(n,e[s]);return n}function Lc(e){return eh(e)?{..._S(e,Wp)}:wC(e)}function Mc(e,n){return eh(n)?_S(n,e):EC(e,n)}function wC(e){const n={...e};for(const s in n){const r=n[s];TS(s,r)&&(n[s]=RS(r))}return n}function EC(e,n){if(!n)return e;for(const s in n){const r=n[s];switch(s){case"style":{e[s]=vp(e.style,r);break}case"className":{e[s]=CS(e.className,r);break}default:TS(s,r)?e[s]=TC(e[s],r):e[s]=r}}return e}function TS(e,n){const s=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return s===111&&r===110&&i>=65&&i<=90&&(typeof n=="function"||typeof n>"u")}function eh(e){return typeof e=="function"}function _S(e,n){return eh(e)?e(n):e??Wp}function TC(e,n){return n?e?(...s)=>{const r=s[0];if(AS(r)){const c=r;qc(c);const d=n(...s);return c.baseUIHandlerPrevented||e?.(...s),d}const i=n(...s);return e?.(...s),i}:RS(n):e}function RS(e){return e&&((...n)=>{const s=n[0];return AS(s)&&qc(s),e(...n)})}function qc(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function CS(e,n){return n?e?n+" "+e:n:e}function AS(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function vn(e,n,s={}){const r=n.render,i=_C(n,s);if(s.enabled===!1)return null;const c=s.state??Dt;return AC(e,r,i,c)}function _C(e,n={}){const{className:s,style:r,render:i}=e,{state:c=Dt,ref:d,props:p,stateAttributesMapping:g,enabled:m=!0}=n,y=m?SC(s,c):void 0,b=m?ES(r,c):void 0,x=m?bC(c,g):Dt,w=m&&p?RC(p):void 0,E=m?vp(x,w)??{}:Dt;return typeof document<"u"&&(m?Array.isArray(d)?E.ref=K1([E.ref,ub(i),...d]):E.ref=Ds(E.ref,ub(i),d):Ds(null,null)),m?(y!==void 0&&(E.className=CS(E.className,y)),b!==void 0&&(E.style=vp(E.style,b)),E):Dt}function RC(e){return Array.isArray(e)?xC(e):ru(void 0,e)}const CC=Symbol.for("react.lazy");function AC(e,n,s,r){if(n){if(typeof n=="function")return n(s,r);const i=ru(s,n.props);i.ref=s.ref;let c=n;return c?.$$typeof===CC&&(c=v.Children.toArray(n)[0]),v.cloneElement(c,i)}if(e&&typeof e=="string")return kC(e,s);throw new Error(Wn(8))}function kC(e,n){return e==="button"?v.createElement("button",{type:"button",...n,key:n.key}):e==="img"?v.createElement("img",{alt:"",...n,key:n.key}):v.createElement(e,n)}const jC=500,OC={style:{transition:"none"}},th="data-base-ui-click-trigger",NC={fallbackAxisSide:"end"},MC={clipPath:"inset(50%)",position:"fixed",top:0,left:0},kS=v.createContext(null),jS=()=>v.useContext(kS),zC=$c("portal");function IC(e={}){const{ref:n,container:s,componentProps:r=Dt,elementProps:i}=e,c=Ki(),p=jS()?.portalNode,[g,m]=v.useState(null),[y,b]=v.useState(null),x=De(A=>{A!==null&&b(A)}),w=v.useRef(null);Ie(()=>{if(s===null){w.current&&(w.current=null,b(null),m(null));return}if(c==null)return;const A=(s&&(cR(s)?s:s.current))??p??document.body;if(A==null){w.current&&(w.current=null,b(null),m(null));return}w.current!==A&&(w.current=A,b(null),m(A))},[s,p,c]);const E=vn("div",r,{ref:[n,x],props:[{id:c,[zC]:""},i]});return{portalNode:y,portalSubtree:g&&E?gr.createPortal(E,g):null}}const OS=v.forwardRef(function(n,s){const{render:r,className:i,style:c,children:d,container:p,renderGuards:g,...m}=n,{portalNode:y,portalSubtree:b}=IC({container:p,ref:s,componentProps:n,elementProps:m}),x=v.useRef(null),w=v.useRef(null),E=v.useRef(null),C=v.useRef(null),[A,j]=v.useState(null),_=v.useRef(!1),O=A?.modal,R=A?.open,M=typeof g=="boolean"?g:!!A&&!A.modal&&A.open&&!!y;v.useEffect(()=>{if(!y||O)return;function k(Y){y&&Y.relatedTarget&&fa(Y)&&(Y.type==="focusin"?_.current&&(tb(y),_.current=!1):(pC(y),_.current=!0))}return ss(lt(y,"focusin",k,!0),lt(y,"focusout",k,!0))},[y,O]),Ie(()=>{!y||R!==!0||!_.current||(tb(y),_.current=!1)},[R,y]);const U=v.useMemo(()=>({beforeOutsideRef:x,afterOutsideRef:w,beforeInsideRef:E,afterInsideRef:C,portalNode:y,setFocusManagerState:j}),[y]);return f.jsxs(v.Fragment,{children:[b,f.jsxs(kS.Provider,{value:U,children:[M&&y&&f.jsx(ga,{"data-type":"outside",ref:x,onFocus:k=>{if(fa(k,y))E.current?.focus();else{const Y=A?A.domReference:null;SS(Y)?.focus()}}}),M&&y&&f.jsx("span",{"aria-owns":y.id,style:MC}),y&&gr.createPortal(d,y),M&&y&&f.jsx(ga,{"data-type":"outside",ref:w,onFocus:k=>{if(fa(k,y))C.current?.focus();else{const Y=A?A.domReference:null;Qp(Y)?.focus(),A?.closeOnFocusOut&&A?.onOpenChange(!1,Ht($i,k.nativeEvent))}}})]})]})});function NS(){const e=new Map;return{emit(n,s){e.get(n)?.forEach(r=>r(s))},on(n,s){e.has(n)||e.set(n,new Set),e.get(n).add(s)},off(n,s){e.get(n)?.delete(s)}}}class DC{nodesRef={current:[]};events=NS();addNode(n){this.nodesRef.current.push(n)}removeNode(n){const s=this.nodesRef.current.findIndex(r=>r===n);s!==-1&&this.nodesRef.current.splice(s,1)}}const MS=v.createContext(null),zS=v.createContext(null),wa=()=>v.useContext(MS)?.id||null,Ea=e=>{const n=v.useContext(zS);return e??n};function UC(e){const n=Ki(),s=Ea(e),r=wa();return Ie(()=>{if(!n)return;const i={id:n,parentId:r};return s?.addNode(i),()=>{s?.removeNode(i)}},[s,n,r]),n}function PC(e){const{children:n,id:s}=e,r=wa();return f.jsx(MS.Provider,{value:v.useMemo(()=>({id:s,parentId:r}),[s,r]),children:n})}function $C(e){const{children:n,externalTree:s}=e,r=po(()=>s??new DC).current;return f.jsx(zS.Provider,{value:r,children:n})}function os(e){return e==null?e:"current"in e?e.current:e}function LC(e,n){const s=$s(Hn(e));return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?n||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?n||(e.detail===0?"keyboard":"mouse"):""}const db=20;let zs=[];function nh(){zs=zs.filter(e=>e.deref()?.isConnected)}function fb(e){nh(),e&&wo(e)!=="body"&&(zs.push(new WeakRef(e)),zs.length>db&&(zs=zs.slice(-db)))}function pb(){return nh(),zs[zs.length-1]?.deref()}function qC(e){return e?Xp(e)?e:Gi(e)[0]||e:null}function hb(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const s=yS(e).filter(i=>{const c=i.getAttribute("data-tabindex")||"";return Xp(i)||i.hasAttribute("data-tabindex")&&!c.startsWith("-")}),r=e.getAttribute("tabindex");s.length===0?r!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(r!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function IS(e){const{context:n,children:s,disabled:r=!1,initialFocus:i=!0,returnFocus:c=!0,restoreFocus:d=!1,modal:p=!0,closeOnFocusOut:g=!0,openInteractionType:m="",nextFocusableElement:y,previousFocusableElement:b,beforeContentFocusGuardRef:x,externalTree:w,getInsideElements:E}=e,C="rootStore"in n?n.rootStore:n,A=C.useState("open"),j=C.useState("domReferenceElement"),_=C.useState("floatingElement"),{events:O,dataRef:R}=C.context,M=De(()=>R.current.floatingContext?.nodeId),U=i===!1,k=Jy(j)&&U,Y=Mn(i),H=Mn(c),$=Mn(m),B=Mn(A),P=Ea(w),oe=jS(),le=v.useRef(!1),ee=v.useRef(!1),z=v.useRef(!1),G=v.useRef(null),Q=v.useRef(""),q=v.useRef(""),re=v.useRef(null),Se=v.useRef(null),D=Ds(re,x,oe?.beforeInsideRef),ne=Ds(Se,oe?.afterInsideRef),de=ha(),ae=ha(),me=Kp(),Ce=oe!=null,be=Wy(_),xe=De((Me=be)=>Me?Gi(Me):[]),qe=De(()=>E?.().filter(Me=>Me!=null)??[]);v.useEffect(()=>{if(r||!p)return;function Me($e){$e.key==="Tab"&&Ke(be,ns(Ct(be)))&&xe().length===0&&!k&&$1($e)}const Te=Ct(be);return lt(Te,"keydown",Me)},[r,be,p,k,xe]),v.useEffect(()=>{if(r||!A)return;const Me=Ct(be);function Te(){z.current=!1}function $e(Be){const ge=Hn(Be),Oe=qe(),Re=Ke(_,ge)||Ke(j,ge)||Ke(oe?.portalNode,ge)||Oe.some(Ge=>Ge===ge||Ke(Ge,ge));z.current=!Re,q.current=Be.pointerType||"keyboard",ge?.closest(`[${th}]`)&&(ee.current=!0,ae.start(0,()=>{ee.current=!1}))}function _e(){q.current="keyboard"}return ss(lt(Me,"pointerdown",$e,!0),lt(Me,"pointerup",Te,!0),lt(Me,"pointercancel",Te,!0),lt(Me,"keydown",_e,!0),Te)},[r,_,j,be,A,oe,ae,qe]),v.useEffect(()=>{if(r||!g)return;const Me=Ct(be);function Te(){ee.current=!0,ae.start(0,()=>{ee.current=!1})}function $e(Oe){const Re=Hn(Oe);Xp(Re)&&(G.current=Re)}function _e(Oe){const Re=Oe.relatedTarget,Ge=Oe.currentTarget,tt=Hn(Oe);p&&Re==null&&tt!=null&&Ke(_,tt)&&fb(tt),queueMicrotask(()=>{const ye=M(),Je=C.context.triggerElements,we=qe(),Ee=Re?.hasAttribute($c("focus-guard"))&&[re.current,Se.current,oe?.beforeInsideRef.current,oe?.afterInsideRef.current,oe?.beforeOutsideRef.current,oe?.afterOutsideRef.current,os(b),os(y)].includes(Re),rt=!(Ke(j,Re)||Ke(_,Re)||Ke(Re,_)||Ke(oe?.portalNode,Re)||we.some(Ne=>Ne===Re||Ke(Ne,Re))||Re!=null&&Je.hasElement(Re)||Je.hasMatchingElement(Ne=>Ke(Ne,Re))||Ee||P&&(Us(P.nodesRef.current,ye).find(Ne=>Ke(Ne.context?.elements.floating,Re)||Ke(Ne.context?.elements.domReference,Re))||nb(P.nodesRef.current,ye).find(Ne=>[Ne.context?.elements.floating,Wy(Ne.context?.elements.floating)].includes(Re)||Ne.context?.elements.domReference===Re)));if(Ge===j&&be&&hb(be),d&&Ge!==j&&!Fp(tt)&&ns(Me)===Me.body){if(kn(be)&&(be.focus(),d==="popup")){me.request(()=>{be.focus()});return}const Ne=xe(),Fe=G.current,nt=(Fe&&Ne.includes(Fe)?Fe:null)||Ne[Ne.length-1]||be;kn(nt)&&nt.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(k||!p)&&Re&&rt&&!ee.current&&(k||Re!==pb())&&(le.current=!0,C.setOpen(!1,Ht($i,Oe)))})}function Be(){z.current||(R.current.insideReactTree=!0,de.start(0,()=>{R.current.insideReactTree=!1}))}const ge=kn(j)?j:null;if(!(!_&&!ge))return ss(ge&<(ge,"focusout",_e),ge&<(ge,"pointerdown",Te),_&<(_,"focusin",$e),_&<(_,"focusout",_e),_&&oe&<(_,"focusout",Be,!0))},[r,j,_,be,p,P,oe,C,g,d,xe,k,M,R,de,ae,me,y,b,qe]),v.useEffect(()=>{if(r||!_||!A)return;const Me=Array.from(oe?.portalNode?.querySelectorAll(`[${$c("portal")}]`)||[]),$e=(P?nb(P.nodesRef.current,M()):[]).find(Ge=>Jy(Ge.context?.elements.domReference||null))?.context?.elements.domReference,Be=[...[_,...Me,re.current,Se.current,oe?.beforeOutsideRef.current,oe?.afterOutsideRef.current,...qe()],$e,os(b),os(y),k?j:null].filter(Ge=>Ge!=null),ge=ib(Be,{ariaHidden:p||k,mark:!1}),Oe=[_,...Me].filter(Ge=>Ge!=null),Re=ib(Oe);return()=>{Re(),ge()}},[A,r,j,_,p,oe,k,P,M,y,b,qe]),Ie(()=>{if(!A||r||!kn(be))return;const Me=Ct(be),Te=ns(Me);queueMicrotask(()=>{const $e=Y.current,_e=typeof $e=="function"?$e($.current||""):$e;if(_e===void 0||_e===!1||Ke(be,Te))return;let ge=null;const Oe=()=>(ge==null&&(ge=xe(be)),ge[0]||be);let Re;_e===!0||_e===null?Re=Oe():Re=os(_e),Re=Re||Oe();const Ge=Ke(be,ns(Me));Bf(Re,{preventScroll:Re===be,shouldFocus(){if(!B.current)return!1;if(Ge)return!0;const tt=ns(Me);return!(tt!==Re&&Ke(be,tt))}})})},[r,A,be,xe,Y,$,B]),Ie(()=>{if(r||!be)return;const Me=Ct(be),Te=ns(Me),$e=$.current==null;fb(Te);function _e(ge){if(ge.open||(Q.current=LC(ge.nativeEvent,q.current)),ge.reason===Nn&&ge.nativeEvent.type==="mouseleave"&&(le.current=!0),ge.reason===sS)if(ge.nested)le.current=!1;else if(q1(ge.nativeEvent)||H1(ge.nativeEvent))le.current=!1;else{let Oe=!1;Ct(be).createElement("div").focus({get preventScroll(){return Oe=!0,!1}}),Oe?le.current=!1:le.current=!0}}O.on("openchange",_e);function Be(){const ge=H.current;let Oe=typeof ge=="function"?ge(Q.current):ge;if(Oe===void 0||Oe===!1)return null;Oe===null&&(Oe=!0);const Re=j?.isConnected?j:null,Ge=Te?.isConnected&&wo(Te)!=="body"?Te:null;let tt=$e?Ge||Re:Re||Ge;return tt||(tt=pb()||null),typeof Oe=="boolean"?tt:os(Oe)||tt||null}return()=>{O.off("openchange",_e);const ge=ns(Me),Oe=qe(),Re=Ke(_,ge)||Oe.some(ye=>ye===ge||Ke(ye,ge))||P&&Us(P.nodesRef.current,M(),!1).some(ye=>Ke(ye.context?.elements.floating,ge)),Ge=H.current,tt=Be();queueMicrotask(()=>{const ye=qC(tt),Je=typeof Ge!="boolean";Ge&&!le.current&&kn(ye)&&(!(!Je&&ye!==ge&&ge!==Me.body)||Re)&&ye.focus({preventScroll:!0}),le.current=!1})}},[r,_,be,H,$,O,P,j,M,qe]),Ie(()=>{if(!xa||A||!_)return;const Me=ns(Ct(_));!kn(Me)||!Vp(Me)||Ke(_,Me)&&Me.blur()},[A,_]),Ie(()=>{if(!(r||!oe))return oe.setFocusManagerState({modal:p,closeOnFocusOut:g,open:A,onOpenChange:C.setOpen,domReference:j}),()=>{oe.setFocusManagerState(null)}},[r,oe,p,A,C,g,j]),Ie(()=>{if(!(r||!be))return hb(be),()=>{queueMicrotask(nh)}},[r,be]);const it=!r&&(p?!k:!0)&&(Ce||p);return f.jsxs(v.Fragment,{children:[it&&f.jsx(ga,{"data-type":"inside",ref:D,onFocus:Me=>{if(p){const Te=xe();Bf(Te[Te.length-1])}else oe?.portalNode&&(le.current=!1,fa(Me,oe.portalNode)?Qp(j)?.focus():os(b??oe.beforeOutsideRef)?.focus())}}),s,it&&f.jsx(ga,{"data-type":"inside",ref:ne,onFocus:Me=>{p?Bf(xe()[0]):oe?.portalNode&&(g&&(le.current=!0),fa(Me,oe.portalNode)?SS(j)?.focus():os(y??oe.afterOutsideRef)?.focus())}})]})}function DS(e,n={}){const{enabled:s=!0,event:r="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:p=0,reason:g=ma}=n,m="rootStore"in e?e.rootStore:e,y=m.context.dataRef,b=v.useRef(void 0),x=Kp(),w=ha(),E=v.useMemo(()=>{function C(j,_,O,R){const M=Ht(g,_,O);j&&R==="touch"&&p>0?w.start(p,()=>{m.setOpen(!0,M)}):m.setOpen(j,M)}function A(j,_,O){const R=y.current.openEvent,M=m.select("domReferenceElement")!==_;return j&&M||!j||!i?!0:R&&d?!O(R.type):!1}return{onPointerDown(j){b.current=j.pointerType},onMouseDown(j){const _=b.current,O=j.nativeEvent,R=m.select("open");if(j.button!==0||r==="click"||Pi(_,!0)&&c)return;const M=A(R,j.currentTarget,Y=>Y==="click"||Y==="mousedown"),U=Hn(O);if(Vp(U)){C(M,O,U,_);return}const k=j.currentTarget;x.request(()=>{C(M,O,k,_)})},onClick(j){if(r==="mousedown-only")return;const _=b.current;if(r==="mousedown"&&_){b.current=void 0;return}if(Pi(_,!0)&&c)return;const O=m.select("open"),R=A(O,j.currentTarget,M=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");C(R,j.nativeEvent,j.currentTarget,_)},onKeyDown(){b.current=void 0}}},[y,r,c,g,m,d,i,x,w,p]);return v.useMemo(()=>s?{reference:E}:Dt,[s,E])}function HC(){return!1}function BC(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function US(e,n={}){const{enabled:s=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:c="sloppy",referencePress:d=HC,bubbles:p,externalTree:g}=n,m="rootStore"in e?e.rootStore:e,y=m.useState("open"),b=m.useState("floatingElement"),{dataRef:x}=m.context,w=Ea(g),E=De(typeof i=="function"?i:()=>!1),C=typeof i=="function"?E:i,A=C!==!1,j=De(()=>c),{escapeKey:_,outsidePress:O}=BC(p),R=v.useRef(!1),M=v.useRef(!1),U=v.useRef(!1),k=v.useRef(!1),Y=v.useRef(""),H=v.useRef(null),$=ha(),B=ha(),P=De(()=>{B.clear(),x.current.insideReactTree=!1}),oe=De(D=>{const ne=x.current.floatingContext?.nodeId;return(w?Us(w.nodesRef.current,ne):[]).some(ae=>ae.context?.open&&!ae.context.dataRef.current[D])}),le=De(D=>$f(D,m.select("floatingElement"))||$f(D,m.select("domReferenceElement"))),ee=De(D=>{d()&&m.setOpen(!1,Ht(ma,D.nativeEvent))}),z=De(D=>{if(!y||!s||!r||D.key!=="Escape"||k.current||!_&&oe("__escapeKeyBubbles"))return;const ne=L1(D)?D.nativeEvent:D,de=Ht(aS,ne);m.setOpen(!1,de),de.isCanceled||D.preventDefault(),!_&&!de.isPropagationAllowed&&D.stopPropagation()}),G=De(()=>{x.current.insideReactTree=!0,B.start(0,P)}),Q=De(D=>{if(!y||!s||D.button!==0)return;const ne=Hn(D.nativeEvent);Ke(m.select("floatingElement"),ne)&&(R.current||(R.current=!0,M.current=!1))}),q=De(D=>{!y||!s||(D.defaultPrevented||D.nativeEvent.defaultPrevented)&&R.current&&(M.current=!0)});v.useEffect(()=>{if(!y||!s)return;x.current.__escapeKeyBubbles=_,x.current.__outsidePressBubbles=O;const D=new Eo,ne=new Eo;function de(){D.clear(),k.current=!0}function ae(){D.start(xa?5:0,()=>{k.current=!1})}function me(){U.current=!0,ne.start(0,()=>{U.current=!1})}function Ce(){R.current=!1,M.current=!1}function be(){const we=Y.current,Ee=we==="pen"||!we?"mouse":we,rt=j(),Ne=typeof rt=="function"?rt():rt;return typeof Ne=="string"?Ne:Ne[Ee]}function xe(we){const Ee=be();return Ee==="intentional"&&we.type!=="click"||Ee==="sloppy"&&we.type==="click"}function qe(we){const Ee=x.current.floatingContext?.nodeId,rt=w&&Us(w.nodesRef.current,Ee).some(Ne=>$f(we,Ne.context?.elements.floating));return le(we)||rt}function it(we){if(xe(we)){we.type!=="click"&&!le(we)&&(ne.clear(),U.current=!1),P();return}if(x.current.insideReactTree){P();return}const Ee=Hn(we),rt=`[${$c("inert")}]`,Ne=qt(Ee)?Ee.getRootNode():null,Fe=Array.from((tu(Ne)?Ne:Ct(m.select("floatingElement"))).querySelectorAll(rt)),nt=m.context.triggerElements;if(Ee&&(nt.hasElement(Ee)||nt.hasMatchingElement(zt=>Ke(zt,Ee))))return;let ht=qt(Ee)?Ee:null;for(;ht&&!Af(ht);){const zt=uR(ht);if(Af(zt)||!qt(zt))break;ht=zt}if(!(Fe.length&&qt(Ee)&&!Z1(Ee)&&!Ke(Ee,m.select("floatingElement"))&&Fe.every(zt=>!Ke(ht,zt)))){if(kn(Ee)&&!("touches"in we)){const zt=Af(Ee),fn=Lp(Ee),kt=/auto|scroll/,Tn=zt||kt.test(fn.overflowX),on=zt||kt.test(fn.overflowY),no=Tn&&Ee.clientWidth>0&&Ee.scrollWidth>Ee.clientWidth,Zn=on&&Ee.clientHeight>0&&Ee.scrollHeight>Ee.clientHeight,Io=fn.direction==="rtl",at=Zn&&(Io?we.offsetX<=Ee.offsetWidth-Ee.clientWidth:we.offsetX>Ee.clientWidth),Kt=no&&we.offsetY>Ee.clientHeight;if(at||Kt)return}if(!qe(we)){if(be()==="intentional"&&U.current){ne.clear(),U.current=!1;return}typeof C=="function"&&!C(we)||oe("__outsidePressBubbles")||(m.setOpen(!1,Ht(sS,we)),P())}}}function Me(we){be()!=="sloppy"||we.pointerType==="touch"||!m.select("open")||!s||le(we)||it(we)}function Te(we){if(be()!=="sloppy"||!m.select("open")||!s||le(we))return;const Ee=we.touches[0];Ee&&(H.current={startTime:Date.now(),startX:Ee.clientX,startY:Ee.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},$.start(1e3,()=>{H.current&&(H.current.dismissOnTouchEnd=!1,H.current.dismissOnMouseDown=!1)}))}function $e(we,Ee){const rt=Hn(we);if(!rt)return;const Ne=lt(rt,we.type,()=>{Ee(we),Ne()})}function _e(we){Y.current="touch",$e(we,Te)}function Be(we){$.clear(),we.type==="pointerdown"&&(Y.current=we.pointerType),!(we.type==="mousedown"&&H.current&&!H.current.dismissOnMouseDown)&&$e(we,Ee=>{Ee.type==="pointerdown"?Me(Ee):it(Ee)})}function ge(we){if(!R.current)return;const Ee=M.current;if(Ce(),be()==="intentional"){if(we.type==="pointercancel"){Ee&&me();return}if(!qe(we)){if(Ee){me();return}typeof C=="function"&&!C(we)||(ne.clear(),U.current=!0,P())}}}function Oe(we){if(be()!=="sloppy"||!H.current||le(we))return;const Ee=we.touches[0];if(!Ee)return;const rt=Math.abs(Ee.clientX-H.current.startX),Ne=Math.abs(Ee.clientY-H.current.startY),Fe=Math.sqrt(rt*rt+Ne*Ne);Fe>5&&(H.current.dismissOnTouchEnd=!0),Fe>10&&(it(we),$.clear(),H.current=null)}function Re(we){$e(we,Oe)}function Ge(we){be()!=="sloppy"||!H.current||le(we)||(H.current.dismissOnTouchEnd&&it(we),$.clear(),H.current=null)}function tt(we){$e(we,Ge)}const ye=Ct(b),Je=ss(r&&ss(lt(ye,"keydown",z),lt(ye,"compositionstart",de),lt(ye,"compositionend",ae)),A&&ss(lt(ye,"click",Be,!0),lt(ye,"pointerdown",Be,!0),lt(ye,"pointerup",ge,!0),lt(ye,"pointercancel",ge,!0),lt(ye,"mousedown",Be,!0),lt(ye,"mouseup",ge,!0),lt(ye,"touchstart",_e,!0),lt(ye,"touchmove",Re,!0),lt(ye,"touchend",tt,!0)));return()=>{Je(),D.clear(),ne.clear(),Ce(),U.current=!1}},[x,b,r,A,C,y,s,_,O,z,P,j,oe,le,w,m,$]),v.useEffect(P,[C,P]);const re=v.useMemo(()=>({onKeyDown:z,onPointerDown:ee,onClick:ee}),[z,ee]),Se=v.useMemo(()=>({onKeyDown:z,onPointerDown:q,onMouseDown:q,onClickCapture:G,onMouseDownCapture(D){G(),Q(D)},onPointerDownCapture(D){G(),Q(D)},onMouseUpCapture:G,onTouchEndCapture:G,onTouchMoveCapture:G}),[z,G,Q,q]);return v.useMemo(()=>s?{reference:re,floating:Se,trigger:re}:{},[s,re,Se])}function PS(e){const n=v.useRef(!0);n.current&&(n.current=!1,e())}const Ve=(e,n,s,r,i,c,...d)=>{if(d.length>0)throw new Error(Wn(1));let p;if(e)p=e;else throw new Error("Missing arguments");return p};var Yf={exports:{}},Gf={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* use-sync-external-store-shim.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var mb;function ZC(){if(mb)return Gf;mb=1;var e=$p();function n(b,x){return b===x&&(b!==0||1/b===1/x)||b!==b&&x!==x}var s=typeof Object.is=="function"?Object.is:n,r=e.useState,i=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function p(b,x){var w=x(),E=r({inst:{value:w,getSnapshot:x}}),C=E[0].inst,A=E[1];return c(function(){C.value=w,C.getSnapshot=x,g(C)&&A({inst:C})},[b,w,x]),i(function(){return g(C)&&A({inst:C}),b(function(){g(C)&&A({inst:C})})},[b]),d(w),w}function g(b){var x=b.getSnapshot;b=b.value;try{var w=x();return!s(b,w)}catch{return!0}}function m(b,x){return x()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:p;return Gf.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,Gf}var gb;function $S(){return gb||(gb=1,Yf.exports=ZC()),Yf.exports}var VC=$S(),Kf={exports:{}},Ff={};/**
|
|
34
|
+
* @license React
|
|
35
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
36
|
+
*
|
|
37
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the MIT license found in the
|
|
40
|
+
* LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/var vb;function YC(){if(vb)return Ff;vb=1;var e=$p(),n=$S();function s(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var r=typeof Object.is=="function"?Object.is:s,i=n.useSyncExternalStore,c=e.useRef,d=e.useEffect,p=e.useMemo,g=e.useDebugValue;return Ff.useSyncExternalStoreWithSelector=function(m,y,b,x,w){var E=c(null);if(E.current===null){var C={hasValue:!1,value:null};E.current=C}else C=E.current;E=p(function(){function j(U){if(!_){if(_=!0,O=U,U=x(U),w!==void 0&&C.hasValue){var k=C.value;if(w(k,U))return R=k}return R=U}if(k=R,r(O,U))return k;var Y=x(U);return w!==void 0&&w(k,Y)?(O=U,k):(O=U,R=Y)}var _=!1,O,R,M=b===void 0?null:b;return[function(){return j(y())},M===null?void 0:function(){return j(M())}]},[y,b,x,w]);var A=i(m,E[0],E[1]);return d(function(){C.hasValue=!0,C.value=A},[A]),g(A),A},Ff}var yb;function GC(){return yb||(yb=1,Kf.exports=YC()),Kf.exports}var KC=GC();const FC=Jp(19),XC=FC?JC:WC;function LS(e,n,s,r,i){return XC(e,n,s,r,i)}function QC(e,n,s,r,i){const c=v.useCallback(()=>n(e.getSnapshot(),s,r,i),[e,n,s,r,i]);return VC.useSyncExternalStore(e.subscribe,c,c)}function JC(e,n,s,r,i){return QC(e,n,s,r,i)}function WC(e,n,s,r,i){return KC.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>n(c,s,r,i))}class eA{constructor(n){this.state=n,this.listeners=new Set,this.updateTick=0}subscribe=n=>(this.listeners.add(n),()=>{this.listeners.delete(n)});getSnapshot=()=>this.state;setState(n){if(this.state===n)return;this.state=n,this.updateTick+=1;const s=this.updateTick;for(const r of this.listeners){if(s!==this.updateTick)return;r(n)}}update(n){for(const s in n)if(!Object.is(this.state[s],n[s])){this.setState({...this.state,...n});return}}set(n,s){Object.is(this.state[n],s)||this.setState({...this.state,[n]:s})}notifyAll(){const n={...this.state};this.setState(n)}use(n,s,r,i){return LS(this,n,s,r,i)}}class oh extends eA{constructor(n,s={},r){super(n),this.context=s,this.selectors=r}useSyncedValue(n,s){v.useDebugValue(n);const r=this;Ie(()=>{r.state[n]!==s&&r.set(n,s)},[r,n,s])}useSyncedValueWithCleanup(n,s){const r=this;Ie(()=>(r.state[n]!==s&&r.set(n,s),()=>{r.set(n,void 0)}),[r,n,s])}useSyncedValues(n){const s=this,r=Object.values(n);Ie(()=>{s.update(n)},[s,...r])}useControlledProp(n,s){v.useDebugValue(n);const r=this,i=s!==void 0;Ie(()=>{i&&!Object.is(r.state[n],s)&&r.setState({...r.state,[n]:s})},[r,n,s,i])}select(n,s,r,i){const c=this.selectors[n];return c(this.state,s,r,i)}useState(n,s,r,i){return v.useDebugValue(n),LS(this,this.selectors[n],s,r,i)}useContextCallback(n,s){v.useDebugValue(n);const r=De(s??Gt);this.context[n]=r}useStateSetter(n){const s=v.useRef(void 0);return s.current===void 0&&(s.current=r=>{this.set(n,r)}),s.current}observe(n,s){let r;typeof n=="function"?r=n:r=this.selectors[n];let i=r(this.state);return s(i,i,this),this.subscribe(c=>{const d=r(c);if(!Object.is(i,d)){const p=i;i=d,s(d,p,this)}})}}const tA={open:Ve(e=>e.open),transitionStatus:Ve(e=>e.transitionStatus),domReferenceElement:Ve(e=>e.domReferenceElement),referenceElement:Ve(e=>e.positionReference??e.referenceElement),floatingElement:Ve(e=>e.floatingElement),floatingId:Ve(e=>e.floatingId)};class au extends oh{constructor(n){const{syncOnly:s,nested:r,onOpenChange:i,triggerElements:c,...d}=n;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:NS(),nested:r,triggerElements:c},tA),this.syncOnly=s}syncOpenEvent=(n,s)=>{(!n||!this.state.open||s!=null&&B1(s))&&(this.context.dataRef.current.openEvent=n?s:void 0)};dispatchOpenChange=(n,s)=>{this.syncOpenEvent(n,s.event);const r={open:n,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",r)};setOpen=(n,s)=>{if(this.syncOnly){this.context.onOpenChange?.(n,s);return}this.dispatchOpenChange(n,s),this.context.onOpenChange?.(n,s)}}function nA(e){const{popupStore:n,treatPopupAsFloatingElement:s=!1,floatingRootContext:r,floatingId:i,nested:c,onOpenChange:d}=e,p=n.useState("open"),g=n.useState("activeTriggerElement"),m=n.useState(s?"popupElement":"positionerElement"),y=n.context.triggerElements,b=d,x=v.useRef(null);r===void 0&&x.current===null&&(x.current=new au({open:p,transitionStatus:void 0,referenceElement:g,floatingElement:m,triggerElements:y,onOpenChange:b,floatingId:i,syncOnly:!0,nested:c}));const w=r??x.current;return n.useSyncedValue("floatingId",i),Ie(()=>{const E={open:p,floatingId:i,referenceElement:g,floatingElement:m};qt(g)&&(E.domReferenceElement=g),w.state.positionReference===w.state.referenceElement&&(E.positionReference=g),w.update(E)},[p,i,g,m,w]),w.context.onOpenChange=b,w.context.nested=c,w}function qS(e,n=!1,s=!1){const[r,i]=v.useState(e&&n?"idle":void 0),[c,d]=v.useState(e);return e&&!c&&(d(!0),i("starting")),!e&&c&&r!=="ending"&&!s&&i("ending"),!e&&!c&&r==="ending"&&i(void 0),Ie(()=>{if(!e&&c&&r!=="ending"&&s){const p=Ln.request(()=>{i("ending")});return()=>{Ln.cancel(p)}}},[e,c,r,s]),Ie(()=>{if(!e||n)return;const p=Ln.request(()=>{i(void 0)});return()=>{Ln.cancel(p)}},[n,e]),Ie(()=>{if(!e||!n)return;e&&c&&r!=="idle"&&i("starting");const p=Ln.request(()=>{i("idle")});return()=>{Ln.cancel(p)}},[n,e,c,r]),{mounted:c,setMounted:d,transitionStatus:r}}let yr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const oA={[yr.startingStyle]:""},sA={[yr.endingStyle]:""},wr={transitionStatus(e){return e==="starting"?oA:e==="ending"?sA:null}};function sh(e,n=!1,s=!0){const r=Kp();return De((i,c=null)=>{r.cancel();const d=os(e);if(d==null)return;const p=d,g=()=>{gr.flushSync(i)};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function m(){Promise.all(p.getAnimations().map(y=>y.finished)).then(()=>{c?.aborted||g()}).catch(()=>{if(s){c?.aborted||g();return}const y=p.getAnimations();!c?.aborted&&y.length>0&&y.some(b=>b.pending||b.playState!=="finished")&&m()})}if(n){const y=yr.startingStyle;if(!p.hasAttribute(y)){r.request(m);return}const b=new MutationObserver(()=>{p.hasAttribute(y)||(b.disconnect(),m())});b.observe(p,{attributes:!0,attributeFilter:[y]}),c?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}r.request(m)})}function iu(e){const{enabled:n=!0,open:s,ref:r,onComplete:i}=e,c=De(i),d=sh(r,s,!1);v.useEffect(()=>{if(!n)return;const p=new AbortController;return d(c,p.signal),()=>{p.abort()}},[n,s,c,d])}const rh={tabIndex:-1,[fp]:""};function HS(e){return n=>n==="touch"?e.current:!0}function BS(e,n,s=!1){const r=Ki(),i=wa()!=null,c=v.useRef(null);e===void 0&&c.current===null&&(c.current=n(r,i));const d=e??c.current;return nA({popupStore:d,treatPopupAsFloatingElement:s,floatingRootContext:d.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:d.setOpen}),{store:d,internalStore:c.current}}function rA(e,n){const s=v.useRef(null),r=v.useRef(null);return v.useCallback(i=>{if(e===void 0)return;let c=!1;if(s.current!==null){const d=s.current,p=r.current,g=n.context.triggerElements.getById(d);p&&g===p&&(n.context.triggerElements.delete(d),c=!0),s.current=null,r.current=null}if(i!==null&&(s.current=e,r.current=i,n.context.triggerElements.add(e,i),c=!0),c){const d=n.context.triggerElements.size;n.select("open")&&n.state.triggerCount!==d&&n.set("triggerCount",d)}},[n,e])}function ZS(e,n,s,r=!1){n?e.preventUnmountingOnClose=!1:r&&(e.preventUnmountingOnClose=!0);const i=s?.id??null;(i||n)&&(e.activeTriggerId=i,e.activeTriggerElement=s??null)}function aA(e){let n=!1;return e.preventUnmountOnClose=()=>{n=!0},()=>n}function iA(e,n,s,r){PS(()=>{n===void 0&&e.state.open===!1&&s&&(e.state={...e.state,open:!0,activeTriggerId:r,preventUnmountingOnClose:!1})})}function VS(e,n,s,r){const i=s.useState("isMountedByTrigger",e),c=rA(e,s),d=De(p=>{if(c(p),!p)return;const g=s.select("open"),m=s.select("activeTriggerId");if(m===e){s.update({activeTriggerElement:p,...g?r:null});return}m==null&&g&&s.update({activeTriggerId:e,activeTriggerElement:p,...r})});return Ie(()=>{i&&s.update({activeTriggerElement:n.current,...r})},[i,s,n,...Object.values(r)]),{registerTrigger:d,isMountedByThisTrigger:i}}function YS(e,n={}){const{closeOnActiveTriggerUnmount:s=!1}=n,r=e.useState("open"),i=e.useState("triggerCount");Ie(()=>{if(!r){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const c=e.context.triggerElements.size,d={};e.state.triggerCount!==c&&(d.triggerCount=c);const p=e.select("activeTriggerId");let g=null;if(p){const m=e.context.triggerElements.getById(p);m?m!==e.state.activeTriggerElement&&(d.activeTriggerElement=m):g=p}if(!g&&!p&&c===1){const m=e.context.triggerElements.entries().next();if(!m.done){const[y,b]=m.value;d.activeTriggerId=y,d.activeTriggerElement=b}}(d.triggerCount!==void 0||d.activeTriggerId!==void 0||d.activeTriggerElement!==void 0)&&e.update(d),g&&s&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===g&&!e.context.triggerElements.getById(g)){const m=Ht(Yp);e.setOpen(!1,m),m.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[r,e,i,s])}function GS(e,n,s){const{mounted:r,setMounted:i,transitionStatus:c}=qS(e),d=n.useState("preventUnmountingOnClose"),p=e?!1:d;n.useSyncedValues({mounted:r,transitionStatus:c,preventUnmountingOnClose:p});const g=De(()=>{i(!1),n.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),s?.(),n.context.onOpenChangeComplete?.(!1)});return iu({enabled:r&&!e&&!p,open:e,ref:n.context.popupRef,onComplete(){e||g()}}),{forceUnmount:g,transitionStatus:c}}function KS(e,n){e.useSyncedValues(n),Ie(()=>()=>{e.update({activeTriggerProps:Dt,inactiveTriggerProps:Dt,popupProps:Dt})},[e])}function FS(e,n){Ie(()=>{!n&&e.state.openMethod!==null&&e.set("openMethod",null)},[n,e]),Ie(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class lu{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(n,s){const r=this.idMap.get(n);r!==s&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(s),this.idMap.set(n,s))}delete(n){const s=this.idMap.get(n);s&&(this.elementsSet.delete(s),this.idMap.delete(n))}hasElement(n){return this.elementsSet.has(n)}hasMatchingElement(n){for(const s of this.elementsSet)if(n(s))return!0;return!1}getById(n){return this.idMap.get(n)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function lA(){return new au({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new lu,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function XS(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:lA(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Dt,inactiveTriggerProps:Dt,popupProps:Dt}}function QS(e,n,s=!1){return new au({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:s,onOpenChange:void 0})}const Ni=Ve(e=>e.triggerIdProp??e.activeTriggerId),ah=Ve(e=>e.openProp??e.open),bb=Ve(e=>(e.popupElement?.id??e.floatingId)||void 0);function JS(e,n){return n!==void 0&&ah(e)&&Ni(e)===n}function cA(e,n){return JS(e,n)?!0:n!==void 0&&ah(e)&&Ni(e)==null&&e.triggerCount===1}const WS={open:ah,mounted:Ve(e=>e.mounted),transitionStatus:Ve(e=>e.transitionStatus),floatingRootContext:Ve(e=>e.floatingRootContext),triggerCount:Ve(e=>e.triggerCount),preventUnmountingOnClose:Ve(e=>e.preventUnmountingOnClose),payload:Ve(e=>e.payload),activeTriggerId:Ni,activeTriggerElement:Ve(e=>e.mounted?e.activeTriggerElement:null),popupId:bb,isTriggerActive:Ve((e,n)=>n!==void 0&&Ni(e)===n),isOpenedByTrigger:Ve((e,n)=>JS(e,n)),isMountedByTrigger:Ve((e,n)=>n!==void 0&&Ni(e)===n&&e.mounted),triggerProps:Ve((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Ve((e,n)=>cA(e,n)?bb(e):void 0),popupProps:Ve(e=>e.popupProps),popupElement:Ve(e=>e.popupElement),positionerElement:Ve(e=>e.positionerElement)};function uA(e){const{open:n=!1,onOpenChange:s,elements:r={}}=e,i=Ki(),c=wa()!=null,d=po(()=>new au({open:n,transitionStatus:void 0,onOpenChange:s,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new lu,floatingId:i,syncOnly:!1,nested:c})).current;return Ie(()=>{const p={open:n,floatingId:i};r.reference!==void 0&&(p.referenceElement=r.reference,p.domReferenceElement=qt(r.reference)?r.reference:null),r.floating!==void 0&&(p.floatingElement=r.floating),d.update(p)},[n,i,r.reference,r.floating,d]),d.context.onOpenChange=s,d.context.nested=c,d}function dA(e={}){const{nodeId:n,externalTree:s}=e,r=uA(e),i=e.rootContext||r,c=i.useState("referenceElement"),d=i.useState("floatingElement"),p=i.useState("domReferenceElement"),g=i.useState("open"),m=i.useState("floatingId"),[y,b]=v.useState(null),[x,w]=v.useState(void 0),[E,C]=v.useState(void 0),A=v.useRef(null),j=Ea(s),_=v.useMemo(()=>({reference:c,floating:d,domReference:p}),[c,d,p]),O=dR({...e,elements:{..._,...y&&{reference:y}}}),R=qt(x)?x:null,M=E===void 0?i.state.floatingElement:E;i.useSyncedValue("referenceElement",x??null),i.useSyncedValue("domReferenceElement",x===void 0?p:R),i.useSyncedValue("floatingElement",M);const U=v.useCallback(P=>{const oe=qt(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;b(oe),O.refs.setReference(oe)},[O.refs]),k=v.useCallback(P=>{(qt(P)||P===null)&&(A.current=P,w(P)),(qt(O.refs.reference.current)||O.refs.reference.current===null||P!==null&&!qt(P))&&O.refs.setReference(P)},[O.refs,w]),Y=v.useCallback(P=>{C(P),O.refs.setFloating(P)},[O.refs]),H=v.useMemo(()=>({...O.refs,setReference:k,setFloating:Y,setPositionReference:U,domReference:A}),[O.refs,k,Y,U]),$=v.useMemo(()=>({...O.elements,domReference:p}),[O.elements,p]),B=v.useMemo(()=>({...O,dataRef:i.context.dataRef,open:g,onOpenChange:i.setOpen,events:i.context.events,floatingId:m,refs:H,elements:$,nodeId:n,rootStore:i}),[O,H,$,n,i,g,m]);return Ie(()=>{p&&(A.current=p)},[p]),Ie(()=>{i.context.dataRef.current.floatingContext=B;const P=j?.nodesRef.current.find(oe=>oe.id===n);P&&(P.context=B)}),v.useMemo(()=>({...O,context:B,refs:H,elements:$,rootStore:i}),[O,H,$,B,i])}class ih{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Eo,this.restTimeout=new Eo,this.handleCloseOptions=void 0}static create(){return new ih}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Hc=new WeakMap;function Bc(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&Hc.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Hc.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ex(e,n){const{scopeElement:s,referenceElement:r,floatingElement:i}=n,c=Hc.get(s);c&&c!==e&&Bc(c),Bc(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,Hc.set(s,e),s.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function tx(e){const n=e.context.dataRef.current,s=po(()=>n.hoverInteractionState??ih.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=s),Zp(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function fA(e,n={}){const{enabled:s=!0,closeDelay:r=0,nodeId:i}=n,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),p=c.useState("floatingElement"),g=c.useState("domReferenceElement"),{dataRef:m}=c.context,y=Ea(),b=wa(),x=tx(c),w=ha(),E=De(()=>oS(m.current.openEvent?.type,x.interactedInside)),C=De(()=>G1(m.current.openEvent?.type)),A=De(()=>{Bc(x)});Ie(()=>{d||(x.pointerType=void 0,x.restTimeoutPending=!1,x.interactedInside=!1,A())},[d,x,A]),v.useEffect(()=>A,[A]),Ie(()=>{if(s&&d&&x.handleCloseOptions?.blockPointerEvents&&C()&&qt(g)&&p){const j=g,_=p,O=Ct(p),R=y?.nodesRef.current.find(Y=>Y.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const M=x.pointerEventsScopeElement!==_?x.pointerEventsScopeElement:null,U=R!==_?R:null,k=x.handleCloseOptions?.getScope?.()??M??U??j.closest("[data-rootownerid]")??O.body;return ex(x,{scopeElement:k,referenceElement:j,floatingElement:_}),()=>{A()}}},[s,d,g,p,x,C,y,b,A]),v.useEffect(()=>{if(!s)return;function j(){return!!(y&&b&&Us(y.nodesRef.current,b).length>0)}function _(Y){const H=pp(r,"close",x.pointerType),$=()=>{c.setOpen(!1,Ht(Nn,Y)),y?.events.emit("floating.closed",Y)};H?x.openChangeTimeout.start(H,$):(x.openChangeTimeout.clear(),$())}function O(Y){const H=Hn(Y);if(!V1(H)){x.interactedInside=!1;return}x.interactedInside=H?.closest("[aria-haspopup]")!=null}function R(){x.openChangeTimeout.clear(),w.clear(),y?.events.off("floating.closed",U),A()}function M(Y){if(j()&&y){y.events.on("floating.closed",U);return}if(nS(Y.relatedTarget,c.context.triggerElements))return;const H=m.current.floatingContext?.nodeId??i,$=Y.relatedTarget;if(!(y&&H&&qt($)&&Us(y.nodesRef.current,H,!1).some(P=>Ke(P.context?.elements.floating,$)))){if(x.handler){x.handler(Y);return}A(),C()&&!E()&&_(Y)}}function U(Y){!y||!b||j()||w.start(0,()=>{y.events.off("floating.closed",U),c.setOpen(!1,Ht(Nn,Y)),y.events.emit("floating.closed",Y)})}const k=p;return ss(k&<(k,"mouseenter",R),k&<(k,"mouseleave",M),k&<(k,"pointerdown",O,!0),()=>{y?.events.off("floating.closed",U)})},[s,p,c,m,r,i,C,E,A,x,y,b,w])}const pA={current:null};function hA(e,n={}){const{enabled:s=!0,delay:r=0,handleClose:i=null,mouseOnly:c=!1,restMs:d=0,move:p=!0,triggerElementRef:g=pA,externalTree:m,isActiveTrigger:y=!0,getHandleCloseContext:b,isClosing:x,shouldOpen:w}=n,E="rootStore"in e?e.rootStore:e,{dataRef:C,events:A}=E.context,j=Ea(m),_=tx(E),O=v.useRef(!1),R=Mn(i),M=Mn(r),U=Mn(d),k=Mn(s),Y=Mn(w),H=Mn(x),$=De(()=>oS(C.current.openEvent?.type,_.interactedInside)),B=De(()=>Y.current?.()!==!1),P=De((ee,z,G)=>{const Q=E.context.triggerElements;if(Q.hasElement(z))return!ee||!Ke(ee,z);if(!qt(G))return!1;const q=G;return Q.hasMatchingElement(re=>Ke(re,q))&&(!ee||!Ke(ee,q))}),oe=De(()=>{if(!_.handler)return;Ct(E.select("domReferenceElement")).removeEventListener("mousemove",_.handler),_.handler=void 0}),le=De(()=>{Bc(_)});return y&&(_.handleCloseOptions=R.current?.__options),v.useEffect(()=>oe,[oe]),v.useEffect(()=>{if(!s)return;function ee(z){z.open?O.current=!1:(O.current=z.reason===Nn,oe(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return A.on("openchange",ee),()=>{A.off("openchange",ee)}},[s,A,_,oe]),v.useEffect(()=>{if(!s)return;function ee(q,re=!0){const Se=pp(M.current,"close",_.pointerType);Se?_.openChangeTimeout.start(Se,()=>{E.setOpen(!1,Ht(Nn,q)),j?.events.emit("floating.closed",q)}):re&&(_.openChangeTimeout.clear(),E.setOpen(!1,Ht(Nn,q)),j?.events.emit("floating.closed",q))}const z=g.current??(y?E.select("domReferenceElement"):null);if(!qt(z))return;function G(q){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!Pi(_.pointerType))return;const re=eb(U.current),Se=pp(M.current,"open",_.pointerType),D=Hn(q),ne=q.currentTarget??null,de=E.select("domReferenceElement");let ae=ne;if(qt(D)&&!E.context.triggerElements.hasElement(D)){for(const $e of E.context.triggerElements.elements())if(Ke($e,D)){ae=$e;break}}qt(ne)&&qt(de)&&!E.context.triggerElements.hasElement(ne)&&Ke(ne,de)&&(ae=de);const me=ae==null?!1:P(de,ae,D),Ce=E.select("open"),be=H.current?.()??E.select("transitionStatus")==="ending",xe=!Ce&&be&&O.current,qe=!me&&qt(ae)&&qt(de)&&Ke(de,ae)&&xe,it=re>0&&!Se,Me=me&&(Ce||xe)||qe,Te=!Ce||me;if(Me){B()&&E.setOpen(!0,Ht(Nn,q,ae));return}it||(Se?_.openChangeTimeout.start(Se,()=>{Te&&B()&&E.setOpen(!0,Ht(Nn,q,ae))}):Te&&B()&&E.setOpen(!0,Ht(Nn,q,ae)))}function Q(q){if($()){le();return}oe();const re=E.select("domReferenceElement"),Se=Ct(re);_.restTimeout.clear(),_.restTimeoutPending=!1;const D=C.current.floatingContext??b?.();if(nS(q.relatedTarget,E.context.triggerElements))return;if(R.current&&D){E.select("open")||_.openChangeTimeout.clear();const de=g.current;_.handler=R.current({...D,tree:j,x:q.clientX,y:q.clientY,onClose(){le(),oe(),k.current&&!$()&&de===E.select("domReferenceElement")&&ee(q,!0)}}),Se.addEventListener("mousemove",_.handler),_.handler(q);return}(_.pointerType==="touch"?!Ke(E.select("floatingElement"),q.relatedTarget):!0)&&ee(q)}return p?ss(lt(z,"mousemove",G,{once:!0}),lt(z,"mouseenter",G),lt(z,"mouseleave",Q)):ss(lt(z,"mouseenter",G),lt(z,"mouseleave",Q))},[oe,le,C,M,E,s,R,_,y,P,$,c,p,U,g,j,k,b,H,B]),v.useMemo(()=>{if(!s)return;function ee(z){_.pointerType=z.pointerType}return{onPointerDown:ee,onPointerEnter:ee,onMouseMove(z){const{nativeEvent:G}=z,Q=z.currentTarget,q=E.select("domReferenceElement"),re=E.select("open"),Se=P(q,Q,z.target);if(c&&!Pi(_.pointerType))return;if(re&&Se&&_.handleCloseOptions?.blockPointerEvents){const de=E.select("floatingElement");if(de){const ae=_.handleCloseOptions?.getScope?.()??Q.ownerDocument.body;ex(_,{scopeElement:ae,referenceElement:Q,floatingElement:de})}}const D=eb(U.current);if(re&&!Se||D===0||!Se&&_.restTimeoutPending&&z.movementX**2+z.movementY**2<2)return;_.restTimeout.clear();function ne(){if(_.restTimeoutPending=!1,$())return;const de=E.select("open");!_.blockMouseMove&&(!de||Se)&&B()&&E.setOpen(!0,Ht(Nn,G,Q))}_.pointerType==="touch"?gr.flushSync(()=>{ne()}):Se&&re?ne():(_.restTimeoutPending=!0,_.restTimeout.start(D,ne))}}},[s,_,$,P,c,E,U,B])}const Sb=.1,mA=Sb*Sb,Tt=.5;function Tc(e,n,s,r,i,c){return r>=n!=c>=n&&e<=(i-s)*(n-r)/(c-r)+s}function _c(e,n,s,r,i,c,d,p,g,m){let y=!1;return Tc(e,n,s,r,i,c)&&(y=!y),Tc(e,n,i,c,d,p)&&(y=!y),Tc(e,n,d,p,g,m)&&(y=!y),Tc(e,n,g,m,s,r)&&(y=!y),y}function gA(e,n,s){return e>=s.x&&e<=s.x+s.width&&n>=s.y&&n<=s.y+s.height}function Rc(e,n,s,r,i,c){const d=Math.min(s,i),p=Math.max(s,i),g=Math.min(r,c),m=Math.max(r,c);return e>=d&&e<=p&&n>=g&&n<=m}function vA(e={}){const{blockPointerEvents:n=!1}=e,s=new Eo,r=({x:i,y:c,placement:d,elements:p,onClose:g,nodeId:m,tree:y})=>{const b=d?.split("-")[0];let x=!1,w=null,E=null,C=typeof performance<"u"?performance.now():0;function A(_,O){const R=performance.now(),M=R-C;if(w===null||E===null||M===0)return w=_,E=O,C=R,!1;const U=_-w,k=O-E,Y=U*U+k*k,H=M*M*mA;return w=_,E=O,C=R,Y<H}function j(){s.clear(),g()}return function(O){s.clear();const R=p.domReference,M=p.floating;if(!R||!M||b==null||i==null||c==null)return;const{clientX:U,clientY:k}=O,Y=Hn(O),H=O.type==="mouseleave",$=Ke(M,Y),B=Ke(R,Y);if($&&(x=!0,!H))return;if(B&&(x=!1,!H)){x=!0;return}if(H&&qt(O.relatedTarget)&&Ke(M,O.relatedTarget))return;function P(){return!!(y&&Us(y.nodesRef.current,m).length>0)}function oe(){P()||j()}if(P())return;const le=R.getBoundingClientRect(),ee=M.getBoundingClientRect(),z=i>ee.right-ee.width/2,G=c>ee.bottom-ee.height/2,Q=ee.width>le.width,q=ee.height>le.height,re=(Q?le:ee).left,Se=(Q?le:ee).right,D=(q?le:ee).top,ne=(q?le:ee).bottom;if(b==="top"&&c>=le.bottom-1||b==="bottom"&&c<=le.top+1||b==="left"&&i>=le.right-1||b==="right"&&i<=le.left+1){oe();return}let de=!1;switch(b){case"top":de=Rc(U,k,re,le.top+1,Se,ee.bottom-1);break;case"bottom":de=Rc(U,k,re,ee.top+1,Se,le.bottom-1);break;case"left":de=Rc(U,k,ee.right-1,ne,le.left+1,D);break;case"right":de=Rc(U,k,le.right-1,ne,ee.left+1,D);break}if(de)return;if(x&&!gA(U,k,le)){oe();return}if(!H&&A(U,k)){oe();return}let ae=!1;switch(b){case"top":{const me=Q?Tt/2:Tt*4,Ce=Q||z?i+me:i-me,be=Q?i-me:z?i+me:i-me,xe=c+Tt+1,qe=z||Q?ee.bottom-Tt:ee.top,it=z?Q?ee.bottom-Tt:ee.top:ee.bottom-Tt;ae=_c(U,k,Ce,xe,be,xe,ee.left,qe,ee.right,it);break}case"bottom":{const me=Q?Tt/2:Tt*4,Ce=Q||z?i+me:i-me,be=Q?i-me:z?i+me:i-me,xe=c-Tt,qe=z||Q?ee.top+Tt:ee.bottom,it=z?Q?ee.top+Tt:ee.bottom:ee.top+Tt;ae=_c(U,k,Ce,xe,be,xe,ee.left,qe,ee.right,it);break}case"left":{const me=q?Tt/2:Tt*4,Ce=q||G?c+me:c-me,be=q?c-me:G?c+me:c-me,xe=i+Tt+1,qe=G||q?ee.right-Tt:ee.left,it=G?q?ee.right-Tt:ee.left:ee.right-Tt;ae=_c(U,k,qe,ee.top,it,ee.bottom,xe,Ce,xe,be);break}case"right":{const me=q?Tt/2:Tt*4,Ce=q||G?c+me:c-me,be=q?c-me:G?c+me:c-me,xe=i-Tt,qe=G||q?ee.left+Tt:ee.right,it=G?q?ee.left+Tt:ee.right:ee.left+Tt;ae=_c(U,k,xe,Ce,xe,be,qe,ee.top,it,ee.bottom);break}}ae?x||s.start(40,oe):oe()}};return r.__options={...e,blockPointerEvents:n},r}const nx=v.createContext(void 0);function Er(e){const n=v.useContext(nx);if(n===void 0&&!e)throw new Error(Wn(47));return n}function yA(){return{...XS(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const bA={...WS,disabled:Ve(e=>e.disabled),instantType:Ve(e=>e.instantType),openMethod:Ve(e=>e.openMethod),openChangeReason:Ve(e=>e.openChangeReason),modal:Ve(e=>e.modal),focusManagerModal:Ve(e=>e.focusManagerModal),stickIfOpen:Ve(e=>e.stickIfOpen),titleElementId:Ve(e=>e.titleElementId),descriptionElementId:Ve(e=>e.descriptionElementId),openOnHover:Ve(e=>e.openOnHover),closeDelay:Ve(e=>e.closeDelay),hasViewport:Ve(e=>e.hasViewport)};class lh extends oh{constructor(n,s,r=!1){const i={...yA(),...n},c=new lu;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=QS(c,s,r),super(i,{popupRef:v.createRef(),backdropRef:v.createRef(),internalBackdropRef:v.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:v.createRef(),beforeContentFocusGuardRef:v.createRef(),stickIfOpenTimeout:new Eo,triggerElements:c},bA)}setOpen=(n,s)=>{const r=s.reason===Nn,i=s.reason===ma&&s.event.detail===0,c=!n&&(s.reason===aS||s.reason==null),d=aA(s),p=this.select("activeTriggerId");if(!n&&s.reason===rS&&s.trigger==null&&p!=null&&(s.trigger=this.context.triggerElements.getById(p)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const g=()=>{const m={open:n,openChangeReason:s.reason};ZS(m,n,s.trigger,d()),this.update(m)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(jC,()=>{this.set("stickIfOpen",!1)}),gr.flushSync(g)):g(),i||c?this.set("instantType",i?"click":"dismiss"):s.reason===$i?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,s){const{store:r,internalStore:i}=BS(n,(c,d)=>new lh(s,c,d));return v.useEffect(()=>i?.disposeEffect(),[i]),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function xb({props:e}){const{children:n,open:s,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:c,modal:d=!1,handle:p,triggerId:g,defaultTriggerId:m=null}=e,y=lh.useStore(p?.store,{modal:d,open:r,openProp:s,activeTriggerId:m,triggerIdProp:g});iA(y,s,r,m),y.useControlledProp("openProp",s),y.useControlledProp("triggerIdProp",g);const b=y.useState("open"),x=y.useState("mounted"),w=y.useState("payload"),E=wa()!=null;y.useContextCallback("onOpenChange",i),y.useContextCallback("onOpenChangeComplete",c),FS(y,b),YS(y);const{forceUnmount:C}=GS(b,y,()=>{y.update({stickIfOpen:!0,openChangeReason:null})});y.useSyncedValues({modal:d,nested:E}),v.useEffect(()=>{b||y.context.stickIfOpenTimeout.clear()},[y,b]);const A=v.useCallback(()=>{y.setOpen(!1,Ht(iS))},[y]);v.useImperativeHandle(e.actionsRef,()=>({unmount:C,close:A}),[C,A]);const j=b||x,_=v.useMemo(()=>({store:y}),[y]);return f.jsxs(nx.Provider,{value:_,children:[j&&f.jsx(SA,{store:y,modal:d}),typeof n=="function"?n({payload:w}):n]})}function ox(e){return Er(!0)?f.jsx(xb,{props:e}):f.jsx($C,{children:f.jsx(xb,{props:e})})}function SA({store:e,modal:n}){const s=e.useState("floatingRootContext"),r=US(s,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=r.reference??Dt,c=r.trigger??Dt,d=v.useMemo(()=>ru(rh,r.floating),[r.floating]);return KS(e,{activeTriggerProps:i,inactiveTriggerProps:c,popupProps:d}),null}const sx=v.createContext(void 0);function rx(e=!1){const n=v.useContext(sx);if(n===void 0&&!e)throw new Error(Wn(16));return n}function xA(e){const{focusableWhenDisabled:n,disabled:s,composite:r=!1,tabIndex:i=0,isNativeButton:c}=e,d=r&&n!==!1,p=r&&n===!1;return{props:v.useMemo(()=>{const m={onKeyDown(y){s&&n&&y.key!=="Tab"&&y.preventDefault()}};return r||(m.tabIndex=i,!c&&s&&(m.tabIndex=n?i:-1)),(c&&(n||d)||!c&&s)&&(m["aria-disabled"]=s),c&&(!n||p)&&(m.disabled=s),m},[r,s,n,d,p,c,i])}}function Fi(e={}){const{disabled:n=!1,focusableWhenDisabled:s,tabIndex:r=0,native:i=!0,composite:c}=e,d=v.useRef(null),p=rx(!0),g=c??p!==void 0,{props:m}=xA({focusableWhenDisabled:s,disabled:n,composite:g,tabIndex:r,isNativeButton:i}),y=v.useCallback(()=>{const w=d.current;Xf(w)&&g&&n&&m.disabled===void 0&&w.disabled&&(w.disabled=!1)},[n,m.disabled,g]);Ie(y,[y]);const b=v.useCallback((w={})=>{const{onClick:E,onMouseDown:C,onKeyUp:A,onKeyDown:j,onPointerDown:_,...O}=w;return ru({onClick(R){if(n){R.preventDefault();return}E?.(R)},onMouseDown(R){n||C?.(R)},onKeyDown(R){if(n||(qc(R),j?.(R),R.baseUIHandlerPrevented))return;const M=R.target===R.currentTarget,U=R.currentTarget,k=Xf(U),Y=!i&&wA(U),H=M&&(i?k:!Y),$=R.key==="Enter",B=R.key===" ",P=U.getAttribute("role"),oe=P?.startsWith("menuitem")||P==="option"||P==="gridcell";if(M&&g&&B){if(R.defaultPrevented&&oe)return;R.preventDefault(),Y||i&&k?(U.click(),R.preventBaseUIHandler()):H&&(E?.(R),R.preventBaseUIHandler());return}H&&(!i&&(B||$)&&R.preventDefault(),!i&&$&&E?.(R))},onKeyUp(R){if(!n){if(qc(R),A?.(R),R.target===R.currentTarget&&i&&g&&Xf(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!i&&!g&&R.key===" "&&E?.(R)}},onPointerDown(R){if(n){R.preventDefault();return}_?.(R)}},i?{type:"button"}:{role:"button"},m,O)},[n,m,g,i]),x=De(w=>{d.current=w,y()});return{getButtonProps:b,buttonRef:x}}function Xf(e){return kn(e)&&e.tagName==="BUTTON"}function wA(e){return!!(e?.tagName==="A"&&e?.href)}let mr=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=yr.startingStyle]="startingStyle",e[e.endingStyle=yr.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),yp=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const EA={[yp.popupOpen]:""},TA={[yp.popupOpen]:"",[yp.pressed]:""},_A={[mr.open]:""},RA={[mr.closed]:""},CA={[mr.anchorHidden]:""},ax={open(e){return e?EA:null}},AA={open(e){return e?TA:null}},Xi={open(e){return e?_A:RA},anchorHidden(e){return e?CA:null}},kA=300;function zo(e){return Ki(e,"base-ui")}function jA(e,n){const s=v.useRef(null);function r(c){gr.flushSync(()=>{e.setOpen(!1,Ht($i,c.nativeEvent,c.currentTarget))}),fC(s.current)?.focus()}function i(c){const d=e.select("positionerElement");if(d&&fa(c,d))e.context.beforeContentFocusGuardRef.current?.focus();else{gr.flushSync(()=>{e.setOpen(!1,Ht($i,c.nativeEvent,c.currentTarget))});let p=dC(e.context.triggerFocusTargetRef.current||n.current);for(;p!==null&&Ke(d,p);){const g=p;if(p=Qp(p),p===g)break}p?.focus()}}return{preFocusGuardRef:s,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function OA(e){const n=v.useRef(""),s=v.useCallback(i=>{i.defaultPrevented||(n.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:v.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,n.current),n.current=""},[e]),onPointerDown:s}}function NA(e,n){const s=v.useRef(e),r=De(n);Ie(()=>{s.current!==e&&r(s.current)},[e,r]),Ie(()=>{s.current=e},[e])}function ix(e,n){const s=De((c,d)=>{(typeof e=="function"?e():e)||n(d||(su?"touch":""))}),{onClick:r,onPointerDown:i}=OA(s);return v.useMemo(()=>({onClick:r,onPointerDown:i}),[r,i])}const lx=v.forwardRef(function(n,s){const{render:r,className:i,style:c,disabled:d=!1,nativeButton:p=!0,handle:g,payload:m,openOnHover:y=!1,delay:b=kA,closeDelay:x=0,id:w,...E}=n,C=Er(!0),A=g?.store??C?.store;if(!A)throw new Error(Wn(74));const j=zo(w),_=A.useState("isTriggerActive",j),O=A.useState("floatingRootContext"),R=A.useState("isOpenedByTrigger",j),M=A.useState("triggerPopupId",j),U=v.useRef(null),{registerTrigger:k,isMountedByThisTrigger:Y}=VS(j,U,A,{payload:m,disabled:d,openOnHover:y,closeDelay:x}),H=A.useState("openChangeReason"),$=A.useState("stickIfOpen"),B=A.useState("openMethod"),P=A.useState("focusManagerModal"),oe=hA(O,{enabled:!d&&O!=null&&y&&(B!=="touch"||H!==ma),mouseOnly:!0,move:!1,handleClose:vA(),restMs:b,delay:{close:x},triggerElementRef:U,isActiveTrigger:_,isClosing:()=>A.select("transitionStatus")==="ending"}),le=DS(O,{enabled:O!=null,stickIfOpen:$}),ee=ix(()=>A.select("open"),ae=>{A.set("openMethod",ae)}),z=A.useState("triggerProps",Y),{getButtonProps:G,buttonRef:Q}=Fi({disabled:d,native:p}),q={open(ae){return ae&&H===ma?AA.open(ae):ax.open(ae)}},{preFocusGuardRef:re,handlePreFocusGuardFocus:Se,handleFocusTargetFocus:D}=jA(A,U),de=vn("button",n,{state:{disabled:d,open:R},ref:[Q,s,k,U],props:[le.reference,oe,z,ee,{[th]:"",id:j,"aria-haspopup":"dialog","aria-expanded":R,"aria-controls":M},E,G],stateAttributesMapping:q});return Y&&!P?f.jsxs(v.Fragment,{children:[f.jsx(ga,{ref:re,onFocus:Se}),f.jsx(v.Fragment,{children:de},j),f.jsx(ga,{ref:A.context.triggerFocusTargetRef,onFocus:D})]}):f.jsx(v.Fragment,{children:de},j)}),cx=v.createContext(void 0);function MA(){const e=v.useContext(cx);if(e===void 0)throw new Error(Wn(45));return e}const ux=v.forwardRef(function(n,s){const{keepMounted:r=!1,...i}=n,{store:c}=Er();return c.useState("mounted")||r?f.jsx(cx.Provider,{value:r,children:f.jsx(OS,{ref:s,...i})}):null});function dx(e){return Jp(19)?e:e?"true":void 0}const fx=v.createContext(void 0);function zA(){const e=v.useContext(fx);if(!e)throw new Error(Wn(46));return e}const IA=v.createContext(void 0);function px(){return v.useContext(IA)?.direction??"ltr"}const DA=e=>({name:"arrow",options:e,async fn(n){const{x:s,y:r,placement:i,rects:c,platform:d,elements:p,middlewareData:g}=n,{element:m,padding:y=0,offsetParent:b="real"}=fR(e,n)||{};if(m==null)return{};const x=pR(y),w={x:s,y:r},E=hR(i),C=mR(E),A=await d.getDimensions(m),j=E==="y",_=j?"top":"left",O=j?"bottom":"right",R=j?"clientHeight":"clientWidth",M=c.reference[C]+c.reference[E]-w[E]-c.floating[C],U=w[E]-c.reference[E],k=b==="real"?await d.getOffsetParent?.(m):p.floating;let Y=p.floating[R]||c.floating[C];(!Y||!await d.isElement?.(k))&&(Y=p.floating[R]||c.floating[C]);const H=M/2-U/2,$=Y/2-A[C]/2-1,B=Math.min(x[_],$),P=Math.min(x[O],$),oe=B,le=Y-A[C]-P,ee=Y/2-A[C]/2+H,z=gR(oe,ee,le),G=!g.arrow&&qp(i)!=null&&ee!==z&&c.reference[C]/2-(ee<oe?B:P)-A[C]/2<0,Q=G?ee<oe?ee-oe:ee-le:0;return{[E]:w[E]+Q,data:{[E]:z,centerOffset:ee-z-Q,...G&&{alignmentOffset:Q}},reset:G}}}),UA=(e,n)=>({...DA(e),options:[e,n]}),PA=vR().fn,$A={name:"hide",async fn(e){const{width:n,height:s,x:r,y:i}=e.rects.reference,c=n===0&&s===0&&r===0&&i===0;return{data:{referenceHidden:(await PA(e)).data?.referenceHidden||c}}}},zc={sideX:"left",sideY:"top"},LA={name:"adaptiveOrigin",async fn(e){const{x:n,y:s,rects:{floating:r},elements:{floating:i},platform:c,strategy:d,placement:p}=e,g=$s(i),m=g.getComputedStyle(i);if(!(m.transitionDuration!=="0s"&&m.transitionDuration!==""))return{x:n,y:s,data:zc};const b=await c.getOffsetParent?.(i);let x={width:0,height:0};if(d==="fixed"&&g?.visualViewport)x={width:g.visualViewport.width,height:g.visualViewport.height};else if(b===g){const _=Ct(i);x={width:_.documentElement.clientWidth,height:_.documentElement.clientHeight}}else await c.isElement?.(b)&&(x=await c.getDimensions(b));const w=ji(p);let E=n,C=s;w==="left"&&(E=x.width-(n+r.width)),w==="top"&&(C=x.height-(s+r.height));const A=w==="left"?"right":zc.sideX,j=w==="top"?"bottom":zc.sideY;return{x:E,y:C,data:{sideX:A,sideY:j}}}};function hx(e,n,s){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?s?"inline-start":"inline-end":"right",bottom:"bottom",left:r?s?"inline-end":"inline-start":"left"}[n]}function wb(e,n,s){const{rects:r,placement:i}=e;return{side:hx(n,ji(i),s),align:qp(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function qA(e){const{anchor:n,positionMethod:s="absolute",side:r="bottom",sideOffset:i=0,align:c="center",alignOffset:d=0,collisionBoundary:p,collisionPadding:g=5,sticky:m=!1,arrowPadding:y=5,disableAnchorTracking:b=!1,inline:x,keepMounted:w=!1,floatingRootContext:E,mounted:C,collisionAvoidance:A,shiftCrossAxis:j=!1,nodeId:_,adaptiveOrigin:O,lazyFlip:R=!1,externalTree:M}=e,[U,k]=v.useState(null);!C&&U!==null&&k(null);const Y=A.side||"flip",H=A.align||"flip",$=A.fallbackAxisSide||"end",B=typeof n=="function"?n:void 0,P=De(B),oe=B?P:n,le=Mn(n),ee=Mn(C),G=px()==="rtl",Q=U||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":G?"left":"right","inline-start":G?"right":"left"}[r],q=c==="center"?Q:`${Q}-${c}`;let re=g;const Se=1,D=r==="bottom"?Se:0,ne=r==="top"?Se:0,de=r==="right"?Se:0,ae=r==="left"?Se:0;typeof re=="number"?re={top:re+D,right:re+ae,bottom:re+ne,left:re+de}:re&&(re={top:(re.top||0)+D,right:(re.right||0)+ae,bottom:(re.bottom||0)+ne,left:(re.left||0)+de});const me={boundary:p==="clipping-ancestors"?"clippingAncestors":p,padding:re},Ce=v.useRef(null),be=Mn(i),xe=Mn(d),qe=typeof i!="function"?i:0,it=typeof d!="function"?d:0,Me=[];x&&Me.push(x),Me.push(SR(at=>{const Kt=wb(at,r,G),yn=typeof be.current=="function"?be.current(Kt):be.current,Ft=typeof xe.current=="function"?xe.current(Kt):xe.current;return{mainAxis:yn,crossAxis:Ft,alignmentAxis:Ft}},[qe,it,G,r]));const Te=H==="none"&&Y!=="shift",$e=!Te&&(m||j||Y==="shift"),_e=Y==="none"?null:yR({...me,padding:{top:re.top+Se,right:re.right+Se,bottom:re.bottom+Se,left:re.left+Se},mainAxis:!j&&Y==="flip",crossAxis:H==="flip"?"alignment":!1,fallbackAxisSideDirection:$}),Be=Te?null:xR(at=>{const Kt=Ct(at.elements.floating).documentElement;return{...me,rootBoundary:j?{x:0,y:0,width:Kt.clientWidth,height:Kt.clientHeight}:void 0,mainAxis:H!=="none",crossAxis:$e,limiter:m||j?void 0:wR(yn=>{if(!Ce.current)return{};const{width:Ft,height:_n}=Ce.current.getBoundingClientRect(),sn=Oy(ji(yn.placement)),rn=sn==="y"?Ft:_n,Vn=sn==="y"?re.left+re.right:re.top+re.bottom;return{offset:rn/2+Vn/2}})}},[me,m,j,re,H]);Y==="shift"||H==="shift"||c==="center"?Me.push(Be,_e):Me.push(_e,Be),Me.push(bR({...me,apply({elements:{floating:at},availableWidth:Kt,availableHeight:yn,rects:Ft}){if(!ee.current)return;const _n=at.style;_n.setProperty("--available-width",`${Kt}px`),_n.setProperty("--available-height",`${yn}px`);const sn=$s(at).devicePixelRatio||1,{x:rn,y:Vn,width:vo,height:Do}=Ft.reference,is=(Math.round((rn+vo)*sn)-Math.round(rn*sn))/sn,Rn=(Math.round((Vn+Do)*sn)-Math.round(Vn*sn))/sn;_n.setProperty("--anchor-width",`${is}px`),_n.setProperty("--anchor-height",`${Rn}px`)}}),UA(at=>({element:Ce.current||Ct(at.elements.floating).createElement("div"),padding:y,offsetParent:"floating"}),[y]),{name:"transformOrigin",fn(at){const{elements:Kt,middlewareData:yn,placement:Ft,rects:_n,y:sn}=at,rn=ji(Ft),Vn=Oy(rn),vo=Ce.current,Do=yn.arrow?.x||0,is=yn.arrow?.y||0,Rn=vo?.clientWidth||0,We=vo?.clientHeight||0,Ut=Do+Rn/2,pn=is+We/2,To=Math.abs(yn.shift?.y||0),Zs=_n.reference.height/2,_o=typeof i=="function"?i(wb(at,r,G)):i,Uo=To>_o,Ro={top:`${Ut}px calc(100% + ${_o}px)`,bottom:`${Ut}px ${-_o}px`,left:`calc(100% + ${_o}px) ${pn}px`,right:`${-_o}px ${pn}px`}[rn],ls=`${Ut}px ${_n.reference.y+Zs-sn}px`;return Kt.floating.style.setProperty("--transform-origin",$e&&Vn==="y"&&Uo?ls:Ro),{}}},$A,O),Ie(()=>{!C&&E&&E.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[C,E]);const ge=v.useMemo(()=>({elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:Oe,elements:Re,x:Ge,y:tt,middlewareData:ye,update:Je,placement:we,context:Ee,isPositioned:rt,floatingStyles:Ne}=dA({rootContext:E,open:w?C:void 0,placement:q,middleware:Me,strategy:s,whileElementsMounted:w?void 0:(...at)=>Ny(...at,ge),nodeId:_,externalTree:M}),{sideX:Fe,sideY:nt}=ye.adaptiveOrigin||zc,ht=rt?s:"fixed",zt=v.useMemo(()=>{const at=O?{position:ht,[Fe]:Ge,[nt]:tt}:{position:ht,...Ne};return rt||(at.opacity=0),at},[O,ht,Fe,Ge,nt,tt,Ne,rt]),fn=v.useRef(null);Ie(()=>{if(!C)return;const at=le.current,Kt=typeof at=="function"?at():at,Ft=(Eb(Kt)?Kt.current:Kt)||null||null;Ft!==fn.current&&(Oe.setPositionReference(Ft),fn.current=Ft)},[C,Oe,oe,le]),v.useEffect(()=>{if(!C)return;const at=le.current;typeof at!="function"&&Eb(at)&&at.current!==fn.current&&(Oe.setPositionReference(at.current),fn.current=at.current)},[C,Oe,oe,le]),v.useEffect(()=>{if(w&&C&&Re.reference&&Re.floating)return Ny(Re.reference,Re.floating,Je,ge)},[w,C,Re,Je,ge]);const kt=ji(we),Tn=hx(r,kt,G),on=qp(we)||"center",no=!!ye.hide?.referenceHidden;Ie(()=>{R&&C&&rt&&k(kt)},[R,C,rt,kt]);const Zn=v.useMemo(()=>({position:"absolute",top:ye.arrow?.y,left:ye.arrow?.x}),[ye.arrow]),Io=ye.arrow?.centerOffset!==0;return v.useMemo(()=>({positionerStyles:zt,arrowStyles:Zn,arrowRef:Ce,arrowUncentered:Io,side:Tn,align:on,physicalSide:kt,anchorHidden:no,refs:Oe,context:Ee,isPositioned:rt,update:Je}),[zt,Zn,Ce,Io,Tn,on,kt,no,Oe,Ee,rt,Je])}function Eb(e){return e!=null&&"current"in e}const mx=v.forwardRef(function(n,s){const{cutout:r,...i}=n;let c;if(r){const d=r.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${d.left}px ${d.top}px,${d.left}px ${d.bottom}px,${d.right}px ${d.bottom}px,${d.right}px ${d.top}px,${d.left}px ${d.top}px)`}return f.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});function gx(e){return e==="starting"?OC:Dt}function HA(e,n,{styles:s,transitionStatus:r,props:i,refs:c,hidden:d,inert:p=!1}){const g={...s};return p&&(g.pointerEvents="none"),vn("div",e,{state:n,ref:c,props:[{role:"presentation",hidden:d,style:g},gx(r),i],stateAttributesMapping:Xi})}let Tb={},_b={},Rb="";function BA(e){if(typeof document>"u")return!1;const n=Ct(e);return $s(n).innerWidth-n.documentElement.clientWidth>0}function ZA(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=Ct(e),r=s.documentElement,i=s.body,c=Hp(r)?r:i,d=c.style.overflowY,p=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",c.style.overflowY="scroll";const g=c.offsetWidth;c.style.overflowY="hidden";const m=c.offsetWidth;return c.style.overflowY=d,r.style.scrollbarGutter=p,g===m}function VA(e){const n=Ct(e),s=n.documentElement,r=n.body,i=Hp(s)?s:r,c={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,c)}}function YA(e){const n=Ct(e),s=n.documentElement,r=n.body,i=$s(s);let c=0,d=0,p=!1;const g=Ln.create();if(xa&&(i.visualViewport?.scale??1)!==1)return()=>{};function m(){const w=i.getComputedStyle(s),E=i.getComputedStyle(r),j=(w.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=s.scrollTop,d=s.scrollLeft,Tb={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},Rb=s.style.scrollBehavior,_b={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const _=s.scrollHeight>s.clientHeight,O=s.scrollWidth>s.clientWidth,R=w.overflowY==="scroll"||E.overflowY==="scroll",M=w.overflowX==="scroll"||E.overflowX==="scroll",U=Math.max(0,i.innerWidth-r.clientWidth),k=Math.max(0,i.innerHeight-r.clientHeight),Y=parseFloat(E.marginTop)+parseFloat(E.marginBottom),H=parseFloat(E.marginLeft)+parseFloat(E.marginRight),$=Hp(s)?s:r;if(p=ZA(e),p){s.style.scrollbarGutter=j,$.style.overflowY="hidden",$.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:j,overflowY:"hidden",overflowX:"hidden"}),(_||R)&&(s.style.overflowY="scroll"),(O||M)&&(s.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:Y||k?`calc(100dvh - ${Y+k}px)`:"100dvh",width:H||U?`calc(100vw - ${H+U}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=c,r.scrollLeft=d,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function y(){Object.assign(s.style,Tb),Object.assign(r.style,_b),p||(s.scrollTop=c,s.scrollLeft=d,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=Rb)}function b(){y(),g.request(m)}m();const x=lt(i,"resize",b);return()=>{g.cancel(),y(),typeof i.removeEventListener=="function"&&x()}}class GA{lockCount=0;restore=null;timeoutLock=Eo.create();timeoutUnlock=Eo.create();acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(n){if(this.lockCount===0||this.restore!==null)return;const r=Ct(n).documentElement,i=$s(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=Gt;return}const c=su||!BA(n);this.restore=c?VA(n):YA(n)}}const KA=new GA;function vx(e=!0,n=null){Ie(()=>{if(e)return KA.acquire(n)},[e,n])}const FA=20;function XA(e,n,s,r){const[i,c]=v.useState(!1);Ie(()=>{if(!e||!n||s==null){c(!1);return}const d=Ct(s).documentElement.clientWidth,p=s.offsetWidth;c(d>0&&p>0&&p>=d-FA)},[e,n,s]),vx(e&&(!n||i),r)}const yx=v.forwardRef(function(n,s){const{render:r,className:i,style:c,anchor:d,positionMethod:p="absolute",side:g="bottom",align:m="center",sideOffset:y=0,alignOffset:b=0,collisionBoundary:x="clipping-ancestors",collisionPadding:w=5,arrowPadding:E=5,sticky:C=!1,disableAnchorTracking:A=!1,collisionAvoidance:j=NC,..._}=n,{store:O}=Er(),R=MA(),M=UC(),U=O.useState("floatingRootContext"),k=O.useState("mounted"),Y=O.useState("open"),H=O.useState("openChangeReason"),$=O.useState("activeTriggerElement"),B=O.useState("modal"),P=O.useState("openMethod"),oe=O.useState("positionerElement"),le=O.useState("instantType"),ee=O.useState("transitionStatus"),z=O.useState("hasViewport"),G=v.useRef(null),Q=sh(oe,!1,!1),q=qA({anchor:d,floatingRootContext:U,positionMethod:p,mounted:k,side:g,sideOffset:y,align:m,alignOffset:b,arrowPadding:E,collisionBoundary:x,collisionPadding:w,sticky:C,disableAnchorTracking:A,keepMounted:R,nodeId:M,collisionAvoidance:j,adaptiveOrigin:z?LA:void 0}),re=U.useState("domReferenceElement");Ie(()=>{const de=re,ae=G.current;if(de&&(G.current=de),ae&&de&&de!==ae){O.set("instantType",void 0);const me=new AbortController;return Q(()=>{O.set("instantType","trigger-change")},me.signal),()=>{me.abort()}}},[re,Q,O]),XA(Y&&B===!0&&H!==Nn,P==="touch",oe,$);const Se=v.useCallback(de=>{O.set("positionerElement",de)},[O]),D={open:Y,side:q.side,align:q.align,anchorHidden:q.anchorHidden,instant:le},ne=HA(n,D,{styles:q.positionerStyles,transitionStatus:ee,props:_,refs:[s,Se],hidden:!k,inert:!Y});return f.jsxs(fx.Provider,{value:q,children:[k&&B===!0&&H!==Nn&&f.jsx(mx,{ref:O.context.internalBackdropRef,inert:dx(!Y),cutout:$}),f.jsx(PC,{id:M,children:ne})]})}),Mi="ArrowUp",zi="ArrowDown",Zc="ArrowLeft",Vc="ArrowRight",cu="Home",uu="End",bx=new Set([Zc,Vc]),QA=new Set([Zc,Vc,cu,uu]),Sx=new Set([Mi,zi]),JA=new Set([Mi,zi,cu,uu]),xx=new Set([...bx,...Sx]),ch=new Set([...xx,cu,uu]),wx="Shift",WA="Control",ek="Alt",tk="Meta",nk=new Set([wx,WA,ek,tk]);function ok(e){return kn(e)&&e.tagName==="INPUT"}function Cb(e){return!!(ok(e)&&e.selectionStart!=null||kn(e)&&e.tagName==="TEXTAREA")}function Ab(e,n,s,r){if(!e||!n||!n.scrollTo)return;let i=e.scrollLeft,c=e.scrollTop;const d=e.clientWidth<e.scrollWidth,p=e.clientHeight<e.scrollHeight;if(d&&r!=="vertical"){const g=kb(e,n,"left"),m=Cc(e),y=Cc(n);s==="ltr"&&(g+n.offsetWidth+y.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight?i=g+n.offsetWidth+y.scrollMarginRight-e.clientWidth+m.scrollPaddingRight:g-y.scrollMarginLeft<e.scrollLeft+m.scrollPaddingLeft&&(i=g-y.scrollMarginLeft-m.scrollPaddingLeft)),s==="rtl"&&(g-y.scrollMarginRight<e.scrollLeft+m.scrollPaddingLeft?i=g-y.scrollMarginLeft-m.scrollPaddingLeft:g+n.offsetWidth+y.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight&&(i=g+n.offsetWidth+y.scrollMarginRight-e.clientWidth+m.scrollPaddingRight))}if(p&&r!=="horizontal"){const g=kb(e,n,"top"),m=Cc(e),y=Cc(n);g-y.scrollMarginTop<e.scrollTop+m.scrollPaddingTop?c=g-y.scrollMarginTop-m.scrollPaddingTop:g+n.offsetHeight+y.scrollMarginBottom>e.scrollTop+e.clientHeight-m.scrollPaddingBottom&&(c=g+n.offsetHeight+y.scrollMarginBottom-e.clientHeight+m.scrollPaddingBottom)}e.scrollTo({left:i,top:c,behavior:"auto"})}function kb(e,n,s){const r=s==="left"?"offsetLeft":"offsetTop";let i=0;for(;n.offsetParent&&(i+=n[r],n.offsetParent!==e);)n=n.offsetParent;return i}function Cc(e){const n=getComputedStyle(e);return{scrollMarginTop:parseFloat(n.scrollMarginTop)||0,scrollMarginRight:parseFloat(n.scrollMarginRight)||0,scrollMarginBottom:parseFloat(n.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(n.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(n.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(n.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(n.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(n.scrollPaddingLeft)||0}}const sk=v.createContext(void 0);function rk(e){return v.useContext(sk)}const ak=v.createContext(void 0);function ik(){const[e,n]=v.useState(0),s=De(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:v.useMemo(()=>({register:s}),[s]),hasClosePart:e>0}}function lk(e){const{value:n,children:s}=e;return f.jsx(ak.Provider,{value:n,children:s})}const ck={...Xi,...wr},Ex=v.forwardRef(function(n,s){const{render:r,className:i,style:c,initialFocus:d,finalFocus:p,...g}=n,{store:m}=Er(),y=zA(),b=rk()!=null,{context:x,hasClosePart:w}=ik(),E=m.useState("open"),C=m.useState("openMethod"),A=m.useState("instantType"),j=m.useState("transitionStatus"),_=m.useState("popupProps"),O=m.useState("titleElementId"),R=m.useState("descriptionElementId"),M=m.useState("modal"),U=m.useState("mounted"),k=m.useState("openChangeReason"),Y=m.useState("activeTriggerElement"),H=m.useState("floatingRootContext"),$=H.useState("floatingId"),B=m.useState("disabled"),P=m.useState("openOnHover"),oe=m.useState("closeDelay"),le=g.id??$;iu({open:E,ref:m.context.popupRef,onComplete(){E&&m.context.onOpenChangeComplete?.(!0)}}),fA(H,{enabled:P&&!B,closeDelay:oe});const ee=d===void 0?HS(m.context.popupRef):d,z=M!==!1&&w;m.useSyncedValue("focusManagerModal",z);const G=v.useCallback(re=>{m.set("popupElement",re)},[m]),Q={open:E,side:y.side,align:y.align,instant:A,transitionStatus:j},q=vn("div",n,{state:Q,ref:[s,m.context.popupRef,G],props:[_,{id:le,role:"dialog",...rh,"aria-labelledby":O,"aria-describedby":R,onKeyDown(re){b&&ch.has(re.key)&&re.stopPropagation()}},gx(j),g],stateAttributesMapping:ck});return f.jsx(IS,{context:H,openInteractionType:C,modal:z,disabled:!U||k===Nn,initialFocus:ee,returnFocus:p,restoreFocus:"popup",previousFocusableElement:kn(Y)?Y:void 0,nextFocusableElement:m.context.triggerFocusTargetRef,beforeContentFocusGuardRef:m.context.beforeContentFocusGuardRef,children:f.jsx(lk,{value:x,children:q})})}),uk={...Xi,...wr},dk=v.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,{store:p}=Er(),g=p.useState("open"),m=p.useState("mounted"),y=p.useState("transitionStatus"),b=p.useState("openChangeReason");return vn("div",n,{state:{open:g,transitionStatus:y},ref:[p.context.backdropRef,s],props:[{role:"presentation",hidden:!m,style:{pointerEvents:b===Nn?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},d],stateAttributesMapping:uk})}),fk=v.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,{store:p}=Er(),g=zo(d.id);return p.useSyncedValueWithCleanup("titleElementId",g),vn("h2",n,{ref:s,props:[{id:g},d]})}),bp=e=>`$${e.toFixed(e>0&&e<.01?4:2)}`,pk=["input","input_tokens","inputTokens"],hk=["cachedInput","cached_input","cachedInputTokens","cached_input_tokens","cacheRead","cache_read","cacheReadTokens","cache_read_tokens"],mk=["cacheCreation","cache_creation","cacheCreationTokens","cache_creation_tokens","cacheWrite","cache_write","cacheWriteTokens","cache_write_tokens"],gk=["output","output_tokens","outputTokens"],vk=["reasoning","reasoning_tokens","reasoningTokens"],yk=["total","total_tokens","totalTokens"],bk=["contextWindow","context_window"],Sk=["cumulativeUsd","cumulative_usd","totalUsd","total_usd","costUsd","cost_usd","cost"],xk=["model","modelId","model_id"],Yc=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)?e:void 0,Qi=e=>{const n=[],s=new Set;let r=Yc(e);for(;r!==void 0&&n.length<8&&!s.has(r);)n.push(r),s.add(r),r=Yc(r.data);return n},xo=(e,n)=>{for(const s of e)for(const r of n){const i=s[r];if(typeof i=="number"&&Number.isFinite(i))return i}},Tx=(e,n)=>{for(const s of e)for(const r of n){const i=s[r];if(typeof i=="string"&&i.trim().length>0)return i}},_x=(e,n)=>[e,...n.flatMap(s=>[s.type,s.event,s.kind].filter(r=>typeof r=="string"))],Rx=(e,n,s)=>_x(e,n).some(r=>r.toLowerCase()===s),Cx=(e,n)=>Rx(e,n,"context_usage"),wk=(e,n)=>Rx(e,n,"context_compaction"),Ax=(e,n)=>!Cx(e,n)&&_x(e,n).some(s=>{const r=s.toLowerCase();return r.includes("usage")||r.includes("cost")}),uh=e=>{const s=[...Qi(e)].reverse(),r=[...s.flatMap(E=>{const C=Yc(E.tokens);return C===void 0?[]:[C]}),...s],i=xo(r,pk),c=xo(r,hk),d=xo(r,mk),p=xo(r,gk),g=xo(r,vk),m=xo(r,yk),y=xo(s,bk),b=xo(s,Sk),x=Tx(s,xk),w={...i===void 0?{}:{input:i},...c===void 0?{}:{cachedInput:c},...d===void 0?{}:{cacheCreation:d},...p===void 0?{}:{output:p},...g===void 0?{}:{reasoning:g},...m===void 0?{}:{total:m},...y===void 0?{}:{contextWindow:y},...b===void 0?{}:{cost:b},...x===void 0?{}:{model:x}};return Object.keys(w).length===0?null:w},Ek=e=>{const n=uh(e),s=Qi(e).flatMap(c=>{const d=Yc(c.context);return d===void 0?[]:[d]}),r=n?.total??xo(s,["used"]),i=n?.contextWindow??xo(s,["window"]);if(!(r===void 0||r<0))return{total:r,...n?.input===void 0?{}:{input:n.input},...n?.cachedInput===void 0?{}:{cachedInput:n.cachedInput},...n?.cacheCreation===void 0?{}:{cacheCreation:n.cacheCreation},...n?.output===void 0?{}:{output:n.output},...n?.reasoning===void 0?{}:{reasoning:n.reasoning},...n?.model===void 0?{}:{model:n.model},...i===void 0?{}:{contextWindow:i}}},Tk=e=>e.input!==void 0||e.cachedInput!==void 0||e.cacheCreation!==void 0||e.output!==void 0||e.reasoning!==void 0,_k=e=>{for(let n=e.length-1;n>=0;n-=1){const s=e[n];if(s?.type!=="telemetry")continue;const r=Qi(s.data);if(!Ax(s.event,r))continue;const i=uh(s.data);if(!(i===null||!Tk(i)))return{...i.input===void 0?{}:{input:i.input},...i.cachedInput===void 0?{}:{cachedInput:i.cachedInput},...i.cacheCreation===void 0?{}:{cacheCreation:i.cacheCreation},...i.output===void 0?{}:{output:i.output},...i.reasoning===void 0?{}:{reasoning:i.reasoning},...i.model===void 0?{}:{model:i.model}}}return null},Rk=e=>{for(let n=e.length-1;n>=0;n-=1){const s=e[n];if(s?.type!=="telemetry")continue;const r=Qi(s.data);if(!Ax(s.event,r))continue;const i=uh(s.data)?.cost;if(i!==void 0)return i}},kx=(e,n)=>e.timestamp!==void 0&&n.timestamp!==void 0&&e.timestamp!==n.timestamp?e.timestamp>n.timestamp:e.order>n.order,jb=e=>e.reduce((n,s)=>n===void 0||kx(s,n)?s:n,void 0),Ck=(e,n)=>{const s=[],r=[];let i=0;for(const b of e.messages)if(b.role==="assistant")for(const x of b.parts){if(x.type!=="telemetry")continue;i+=1;const w=Qi(x.data),E=[...w].reverse(),C=xo(E,["timestamp"]);if(Cx(x.event,w)){const A=Ek(x.data);A!==void 0&&s.push({usage:A,messageStatus:b.status,order:i,...C===void 0?{}:{timestamp:C}})}if(wk(x.event,w)){const A=Tx(E,["status"]);(A==="running"||A==="succeeded")&&r.push({status:A,order:i,...C===void 0?{}:{timestamp:C}})}}const c=jb(s.filter(b=>b.messageStatus==="complete"||b.messageStatus==="running")),d=jb(r);if(d!==void 0&&(c===void 0||kx(d,c)))return{status:"awaiting_measurement",reason:"Context changed during compaction; waiting for the next exact provider measurement."};const g=e.thread.runState.status;if(g==="running"||e.messages.some(b=>b.status==="running"))return c===void 0?{status:"updating",reason:"The current turn has not reported an exact provider measurement yet."}:{status:"updating",usage:c.usage,...c.usage.model===void 0?{}:{measuredModel:c.usage.model},reason:"The provider measurement is exact, but the current turn is still updating context."};if(c!==void 0){const b=c.usage.model,x=n?.trim()||void 0,w=x!==void 0&&b!==x;return g==="failed"||g==="cancelled"||g==="interrupted"||w?{status:"last_measured",usage:c.usage,...b===void 0?{}:{measuredModel:b},reason:w?b===void 0?`The exact measurement did not identify its model; the next turn is set to ${x}.`:`This measurement belongs to ${b}; the next turn is set to ${x}.`:"The latest turn did not complete, so this is the last successful provider measurement."}:{status:"current",usage:c.usage,...b===void 0?{}:{measuredModel:b}}}return{status:"unavailable",reason:n?.trim()?.startsWith("claude:")?"This Claude runtime does not expose exact context measurements.":"Exact context usage has not been reported for this conversation."}},Ak=(e,n={})=>{if(e===null)return null;let s,r;for(const i of e.messages){const c=_k(i.parts);c!==null&&(s=c);const d=Rk(i.parts);d!==void 0&&(r=(r??0)+d)}return{context:Ck(e,n.selectedModel),...s===void 0?{}:{processed:s},...r===void 0?{}:{cost:r}}},hr=e=>e>=1e6?`${(e/1e6).toFixed(1).replace(/\.0$/u,"")}M`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/u,"")}k`:String(e),Mo=e=>typeof e=="number"&&Number.isFinite(e)&&e>0?Math.round(e):0,kk=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,jk=e=>{if(typeof e!="number"||!Number.isFinite(e))return;const n=Math.round(e);return n>0?n:void 0},Ok=(...e)=>e.filter(n=>!!n).join(" "),Nk=e=>[{key:"input",label:"Input",tokens:Mo(e?.input)},{key:"cachedInput",label:"Cache read",tokens:Mo(e?.cachedInput)},{key:"cacheCreation",label:"Cache write",tokens:Mo(e?.cacheCreation)},{key:"output",label:"Output",tokens:Mo(e?.output)},{key:"reasoning",label:"Reasoning",tokens:Mo(e?.reasoning)}].filter(s=>s.tokens>0),Mk=e=>Mo(e?.input)+Mo(e?.cachedInput)+Mo(e?.cacheCreation)+Mo(e?.output);function Ob({usage:e,total:n,totalLabel:s="Total"}){return f.jsxs("dl",{className:"context-display-breakdown","data-slot":"context-display-breakdown",children:[Nk(e).map(r=>f.jsxs("div",{className:"context-display-breakdown-row","data-slot":"context-display-breakdown-row","data-segment":r.key,children:[f.jsx("dt",{children:r.label}),f.jsx("dd",{children:hr(r.tokens)})]},r.key)),f.jsxs("div",{className:"context-display-breakdown-row context-display-breakdown-total",children:[f.jsx("dt",{children:s}),f.jsx("dd",{children:hr(n)})]})]})}function Nb({children:e}){return f.jsx("h3",{className:"context-display-section-title",children:e})}function zk({context:e,processed:n,conversationCost:s,className:r}){const i=e.usage,c=Mo(i?.total),d=kk(s),p=jk(i?.contextWindow),g=i===void 0||p===void 0?void 0:Math.min(c/p*100,100),m=g===void 0?void 0:Math.round(g),y=e.status==="updating"?"Updating":e.status==="awaiting_measurement"?"Awaiting":e.status==="last_measured"?"Last measured":void 0,x=[i===void 0?e.status==="updating"?"updating":e.status==="awaiting_measurement"?"awaiting provider measurement":"unavailable":[`${hr(c)} tokens`,...y===void 0?[]:[y.toLowerCase()],...m===void 0?[]:[`${m}%`]].join(", "),...d===void 0?[]:[bp(d)]].join(", "),w=e.status==="current"?"Current context":e.status==="updating"?"Latest provider measurement":"Last measured",E=w;return f.jsxs(ox,{children:[f.jsxs(lx,{type:"button",className:Ok("context-display-trigger",r),"data-slot":"context-display-trigger","data-state":e.status,"aria-label":`Context usage: ${x}`,children:[f.jsx(Ae,{name:"spark",size:14,className:"context-display-icon"}),f.jsx("span",{className:"context-display-trigger-percent","data-slot":"context-display-percent",children:m===void 0?"—":`${m}%`})]}),f.jsx(ux,{children:f.jsx(yx,{className:"context-display-positioner",side:"bottom",align:"end",sideOffset:8,children:f.jsxs(Ex,{className:"context-display-popover",children:[f.jsxs("div",{className:"context-display-header",children:[f.jsx(fk,{className:"context-display-title",children:"Context usage"}),y!==void 0&&f.jsx("span",{className:"context-display-status","data-state":e.status,children:y})]}),i===void 0?f.jsx("p",{className:"context-display-unavailable","data-slot":"context-display-unavailable",children:e.reason??"Exact context usage has not been reported for this conversation."}):f.jsxs("section",{className:"context-display-section","aria-label":E,children:[f.jsx(Nb,{children:w}),e.reason!==void 0&&e.status!=="current"&&f.jsx("p",{className:"context-display-state-note",children:e.reason}),(e.measuredModel??i.model)!==void 0&&f.jsxs("p",{className:"context-display-model",children:[f.jsx("span",{children:"Measured model"}),f.jsx("code",{children:e.measuredModel??i.model})]}),p!==void 0&&g!==void 0&&m!==void 0&&f.jsxs("div",{className:"context-display-window","data-slot":"context-display-window",children:[f.jsxs("div",{className:"context-display-window-summary",children:[f.jsxs("span",{children:[hr(c)," of ",hr(p)," tokens"]}),f.jsxs("span",{className:"context-display-percent",children:[m,"%"]})]}),f.jsx("div",{className:"context-display-progress",role:"progressbar","aria-label":"Context window used","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Number(g.toFixed(1)),"aria-valuetext":`${hr(c)} of ${hr(p)} tokens (${m}%)`,children:f.jsx("span",{className:"context-display-progress-value",style:{width:`${g}%`}})})]}),f.jsx(Ob,{usage:i,total:c})]}),n!==void 0&&f.jsxs("section",{className:"context-display-section","aria-label":"Last turn processed",children:[f.jsx(Nb,{children:"Last turn processed"}),f.jsx(Ob,{usage:n,total:Mk(n),totalLabel:"Processed total"})]}),d!==void 0&&f.jsx("dl",{className:"context-display-breakdown context-display-cost-breakdown",children:f.jsxs("div",{className:"context-display-breakdown-row context-display-breakdown-cost",children:[f.jsx("dt",{children:"Conversation cost"}),f.jsx("dd",{children:bp(d)})]})})]})})})]})}let Mb=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ik={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ai={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Dk={disabled:!1,...Ai},jx={valid(e){return e===null?null:e?{[Mb.valid]:""}:{[Mb.invalid]:""}}};let zb=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Ib={checked(e){return e?{[zb.checked]:""}:{[zb.unchecked]:""}},...wr,...jx},Ox="data-composite-item-active",Nx=v.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Uk(){return v.useContext(Nx)}let Pk=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function $k(e={}){const{label:n,metadata:s,textRef:r,indexGuessBehavior:i,index:c}=e,{register:d,unregister:p,subscribeMapChange:g,elementsRef:m,labelsRef:y,nextIndexRef:b}=Uk(),x=v.useRef(-1),[w,E]=v.useState(c??(i===Pk.GuessFromOrder?()=>{if(x.current===-1){const j=b.current;b.current+=1,x.current=j}return x.current}:-1)),C=v.useRef(null),A=v.useCallback(j=>{if(C.current=j,w!==-1&&j!==null&&(m.current[w]=j,y)){const _=n!==void 0;y.current[w]=_?n:r?.current?.textContent??j.textContent}},[w,m,y,n,r]);return Ie(()=>{if(c!=null)return;const j=C.current;if(j)return d(j,s),()=>{p(j)}},[c,d,p,s]),Ie(()=>{if(c==null)return g(j=>{const _=C.current?j.get(C.current)?.index:null;_!=null&&E(_)})},[c,g,E]),{ref:A,index:w}}function Lk(e={}){const{highlightItemOnHover:n,highlightedIndex:s,onHighlightedIndexChange:r}=rx(),{ref:i,index:c}=$k(e),d=s===c,p=v.useRef(null),g=Ds(i,p);return{compositeProps:{tabIndex:d?0:-1,onFocus(){r(c)},onMouseMove(){const y=p.current;if(!n||!y)return;const b=y.hasAttribute("disabled")||y.ariaDisabled==="true";!d&&!b&&y.focus()}},compositeRef:g,index:c}}function qk(e){const{render:n,className:s,style:r,state:i=Dt,props:c=Pc,refs:d=Pc,metadata:p,stateAttributesMapping:g,tag:m="div",...y}=e,{compositeProps:b,compositeRef:x}=Lk({metadata:p});return vn(m,e,{state:i,ref:[...d,x],props:[b,...c,y],stateAttributesMapping:g})}const Hk={invalid:void 0,name:void 0,validityData:{state:Ik,errors:[],error:"",value:"",initialValue:null},setValidityData:Gt,disabled:void 0,touched:Ai.touched,setTouched:Gt,dirty:Ai.dirty,setDirty:Gt,filled:Ai.filled,setFilled:Gt,focused:Ai.focused,setFocused:Gt,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Dk,markedDirtyRef:{current:!1},registerFieldControl:Gt,validation:{getValidationProps:(e,n=Dt)=>n,inputRef:{current:null},registerInput:Gt,commit:async()=>{},change:Gt}},Bk=v.createContext(Hk);function dh(e=!0){const n=v.useContext(Bk);if(n.setValidityData===Gt&&!e)throw new Error(Wn(28));return n}const Zk=v.createContext({disabled:!1});function Vk(){return v.useContext(Zk)}const Yk=v.createContext({controlId:void 0,registerControlId:Gt,labelId:void 0,setLabelId:Gt,messageIds:[],setMessageIds:Gt,getDescriptionProps:e=>e});function fh(){return v.useContext(Yk)}function Gk(e,n,s,r=!0,i){const[c,d]=v.useState(),p=zo(i?`${i}-label`:void 0),g=e??n??c;return Ie(()=>{const m=e||n||!r?void 0:Kk(s.current,p);c!==m&&d(m)}),g}function Kk(e,n){const s=Fk(e);if(s)return!s.id&&n&&(s.id=n),s.id||void 0}function Fk(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const s=e.id;if(s){const i=e.nextElementSibling;if(i&&i.htmlFor===s)return i}const r=e.labels;return r&&r[0]}function Xk(e={}){const{id:n,implicit:s=!1,controlRef:r}=e,{controlId:i,registerControlId:c}=fh(),d=zo(n),p=s?i:void 0,g=po(()=>Symbol("labelable-control")),m=v.useRef(!1),y=v.useRef(n!=null),b=De(()=>{!m.current||c===Gt||(m.current=!1,c(g.current,void 0))});return Ie(()=>{if(c===Gt)return;let x;if(s){const w=r?.current;qt(w)&&w.closest("label")!=null?x=n??null:x=p??d}else if(n!=null)y.current=!0,x=n;else if(y.current)x=d;else{b();return}if(x===void 0){b();return}m.current=!0,c(g.current,x)},[n,r,p,c,s,d,g,b]),v.useEffect(()=>b,[b]),i??d}const Mx=v.createContext(void 0);function Qk(){return v.useContext(Mx)}function Jk(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}const Wk=v.createContext(void 0),ej=v.forwardRef(function(n,s){const{render:r,className:i,disabled:c=!1,readOnly:d=!1,required:p=!1,"aria-labelledby":g,value:m,inputRef:y,nativeButton:b=!1,id:x,style:w,...E}=n,C=Qk(),{disabled:A,readOnly:j,required:_,form:O,checkedValue:R,touched:M=!1,validation:U,name:k}=C??{},Y=C?.setCheckedValue??Gt,H=C?.setTouched??Gt,$=C?.registerControlRef??Gt,B=C?.registerInputRef??Gt,{setTouched:P,setFilled:oe,state:le,disabled:ee}=dh(),z=Vk(),{labelId:G,getDescriptionProps:Q}=fh(),q=ee||z.disabled||A||c,re=j||d,Se=_||p,D=O,ne=C?R===m:m==="",de=v.useRef(null),ae=v.useRef(null),me=De(ye=>{ye&&$(ye,q)}),Ce=Ds(y,ae,B);Ie(()=>{ae.current?.checked&&oe(!0)},[oe]),Ie(()=>{if(ae.current){if(q&&ne){B(null);return}de.current&&$(de.current,q),B(ae.current)}},[ne,q,$,B]);const be=zo(),xe=Xk({id:x,implicit:!1,controlRef:de}),qe=b?void 0:xe,it=Gk(g,G,ae,!b,qe),Me={role:"radio","aria-checked":ne,"aria-required":Se||void 0,"aria-readonly":re||void 0,"aria-labelledby":it,[Ox]:ne?"":void 0,id:b?xe:be,onKeyDown(ye){ye.key==="Enter"&&ye.preventDefault()},onClick(ye){if(ye.defaultPrevented||q||re)return;ye.preventDefault();const Je=ae.current;Je&&Je.dispatchEvent(new($s(Je)).PointerEvent("click",{bubbles:!0,shiftKey:ye.shiftKey,ctrlKey:ye.ctrlKey,altKey:ye.altKey,metaKey:ye.metaKey}))},onFocus(ye){ye.defaultPrevented||q||re||!M||(ae.current?.click(),H(!1))}},{getButtonProps:Te,buttonRef:$e}=Fi({disabled:q,native:b,composite:!1}),_e={type:"radio",ref:Ce,form:D,id:qe,name:k,tabIndex:-1,style:k?nC:dS,"aria-hidden":!0,...m!==void 0?{value:Jk(m)}:Dt,disabled:q,checked:ne,required:Se,readOnly:re,onChange(ye){if(ye.nativeEvent.defaultPrevented||q||re||m===void 0)return;const Je=Ht(Yp,ye.nativeEvent);Y(m,Je),!Je.isCanceled&&P(!0)},onFocus(){de.current?.focus()}},Be=v.useMemo(()=>({...le,required:Se,disabled:q,readOnly:re,checked:ne}),[le,q,re,ne,Se]),ge=Be,Oe=C!==void 0,Re=[s,de,$e,me],Ge=[Me,E,Te,Q,U?ye=>U.getValidationProps(q,ye):Dt],tt=vn("span",n,{enabled:!Oe,state:Be,ref:Re,props:Ge,stateAttributesMapping:Ib});return f.jsxs(Wk.Provider,{value:ge,children:[Oe?f.jsx(qk,{tag:"span",render:r,className:i,style:w,state:Be,refs:Re,props:Ge,stateAttributesMapping:Ib}):tt,f.jsx("input",{..._e,suppressHydrationWarning:!0})]})});function zx({controlled:e,default:n,name:s,state:r="value"}){const{current:i}=v.useRef(e!==void 0),[c,d]=v.useState(n),p=i?e:c,g=v.useCallback(m=>{i||d(m)},[]);return[p,g]}function tj(e){const{children:n,elementsRef:s,labelsRef:r,onMapChange:i}=e,c=De(i),d=v.useRef(0),p=po(oj).current,g=po(nj).current,[m,y]=v.useState(0),b=v.useRef(m),x=De((j,_)=>{g.set(j,_??null),b.current+=1,y(b.current)}),w=De(j=>{g.delete(j),b.current+=1,y(b.current)}),E=v.useMemo(()=>{const j=new Map;return Array.from(g.keys()).filter(O=>O.isConnected).sort(sj).forEach((O,R)=>{const M=g.get(O)??{};j.set(O,{...M,index:R})}),j},[g,m]);Ie(()=>{if(typeof MutationObserver!="function"||E.size===0)return;const j=new MutationObserver(_=>{const O=new Set,R=M=>O.has(M)?O.delete(M):O.add(M);_.forEach(M=>{M.removedNodes.forEach(R),M.addedNodes.forEach(R)}),O.size===0&&(b.current+=1,y(b.current))});return E.forEach((_,O)=>{O.parentElement&&j.observe(O.parentElement,{childList:!0})}),()=>{j.disconnect()}},[E]),Ie(()=>{b.current===m&&(s.current.length!==E.size&&(s.current.length=E.size),r&&r.current.length!==E.size&&(r.current.length=E.size),d.current=E.size),c(E)},[c,E,s,r,m]),Ie(()=>()=>{s.current=[]},[s]),Ie(()=>()=>{r&&(r.current=[])},[r]);const C=De(j=>(p.add(j),()=>{p.delete(j)}));Ie(()=>{p.forEach(j=>j(E))},[p,E]);const A=v.useMemo(()=>({register:x,unregister:w,subscribeMapChange:C,elementsRef:s,labelsRef:r,nextIndexRef:d}),[x,w,C,s,r,d]);return f.jsx(Nx.Provider,{value:A,children:n})}function nj(){return new Map}function oj(){return new Set}function sj(e,n){const s=e.compareDocumentPosition(n);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}function rj(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const aj=[];function ij(e){const{loopFocus:n=!0,orientation:s="both",grid:r,onLoop:i,direction:c,highlightedIndex:d,onHighlightedIndexChange:p,rootRef:g,enableHomeAndEndKeys:m=!1,stopEventPropagation:y=!1,disabledIndices:b,modifierKeys:x=aj}=e,[w,E]=v.useState(0),C=r!=null,A=v.useRef(null),j=Ds(A,g),_=v.useRef([]),O=v.useRef(!1),R=d??w,M=De(($,B=!1)=>{if((p??E)($),B){const P=_.current[$];Ab(A.current,P,c,s)}}),U=De($=>{if($.size===0||O.current)return;O.current=!0;const B=Array.from($.keys()),P=B.find(le=>le?.hasAttribute(Ox))??null,oe=P?B.indexOf(P):-1;if(oe!==-1)M(oe);else if(hp(B,R,b)){const le=Oi(B,{disabledIndices:b});qf(B,le)||M(le)}Ab(A.current,P,c,s)});Ie(()=>{if(b==null||d!=null||!O.current)return;const $=_.current;if(hp($,R,b)){const B=Oi($,{disabledIndices:b});qf($,B)||M(B)}},[b,d,R,_,M]);const k=De(($,B,P)=>i?i($,B,P,_):P),Y=De($=>{const B=m?ch:xx;if(!B.has($.key)||lj($,x)||!A.current)return;const oe=c==="rtl",le=oe?Zc:Vc,ee={horizontal:le,vertical:zi,both:le}[s],z=oe?Vc:Zc,G={horizontal:z,vertical:Mi,both:z}[s],Q=Hn($.nativeEvent);if(Q!=null&&Cb(Q)&&!rj(Q)){const ae=Q.selectionStart,me=Q.selectionEnd,Ce=Q.value??"";if(ae==null||$.shiftKey||ae!==me||$.key!==G&&ae<Ce.length||$.key!==ee&&ae>0)return}let q=R;const re=oC(_,b),Se=sC(_,b);r!=null&&(q=r({disabledIndices:b,elementsRef:_,event:$,highlightedIndex:R,loopFocus:n,maxIndex:Se,minIndex:re,onLoop:k,orientation:s,rtl:oe}));const D={horizontal:[le],vertical:[zi],both:[le,zi]}[s],ne={horizontal:[z],vertical:[Mi],both:[z,Mi]}[s],de=C?B:{horizontal:m?QA:bx,vertical:m?JA:Sx,both:B}[s];m&&($.key===cu?q=re:$.key===uu&&(q=Se)),q===R&&(D.includes($.key)||ne.includes($.key))&&(n&&q===Se&&D.includes($.key)?(q=re,i&&(q=i($,R,q,_))):n&&q===re&&ne.includes($.key)?(q=Se,i&&(q=i($,R,q,_))):q=Oi(_.current,{startingIndex:q,decrement:ne.includes($.key),disabledIndices:b})),q!==R&&!qf(_.current,q)&&(y&&$.stopPropagation(),de.has($.key)&&$.preventDefault(),M(q,!0),queueMicrotask(()=>{_.current[q]?.focus()}))});return{props:{ref:j,onFocus($){const B=A.current,P=Hn($.nativeEvent);!B||P==null||!Cb(P)||P.setSelectionRange(0,P.value.length??0)},onKeyDown:Y},highlightedIndex:R,onHighlightedIndexChange:M,elementsRef:_,disabledIndices:b,onMapChange:U,relayKeyboardEvent:Y}}function lj(e,n){for(const s of nk.values())if(!n.includes(s)&&e.getModifierState(s))return!0;return!1}function cj(e){const{render:n,className:s,style:r,refs:i=Pc,props:c=Pc,state:d=Dt,stateAttributesMapping:p,highlightedIndex:g,onHighlightedIndexChange:m,orientation:y,grid:b,loopFocus:x,onLoop:w,enableHomeAndEndKeys:E,onMapChange:C,stopEventPropagation:A=!0,rootRef:j,disabledIndices:_,modifierKeys:O,highlightItemOnHover:R=!1,tag:M="div",...U}=e,k=px(),{props:Y,highlightedIndex:H,onHighlightedIndexChange:$,elementsRef:B,onMapChange:P,relayKeyboardEvent:oe}=ij({grid:b,loopFocus:x,onLoop:w,orientation:y,highlightedIndex:g,onHighlightedIndexChange:m,rootRef:j,stopEventPropagation:A,enableHomeAndEndKeys:E,direction:k,disabledIndices:_,modifierKeys:O}),le=vn(M,e,{state:d,ref:i,props:[Y,...c,U],stateAttributesMapping:p}),ee=v.useMemo(()=>({highlightedIndex:H,onHighlightedIndexChange:$,highlightItemOnHover:R,relayKeyboardEvent:oe}),[H,$,R,oe]);return f.jsx(sx.Provider,{value:ee,children:f.jsx(tj,{elementsRef:B,onMapChange:z=>{C?.(z),P(z)},children:le})})}function uj(e,n,s,r,i=!0,c){const{registerFieldControl:d}=dh(),p=v.useRef(null);p.current||(p.current=Symbol()),Ie(()=>{const g=p.current;return!g||!i?void 0:(d(g,{controlRef:e,getValue:r,id:n,name:c,value:s}),()=>{d(g,void 0)})},[e,i,r,n,c,d,s])}const dj=v.createContext(void 0);function fj(e=!1){const n=v.useContext(dj);if(!n&&!e)throw new Error(Wn(86));return n}const pj=v.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Gt,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function hj(){return v.useContext(pj)}const mj=[wx],gj=v.forwardRef(function(n,s){const{render:r,className:i,disabled:c,readOnly:d,required:p,onValueChange:g,value:m,defaultValue:y,form:b,name:x,inputRef:w,id:E,style:C,...A}=n,{setTouched:j,setFocused:_,validationMode:O,name:R,disabled:M,state:U,validation:k,setDirty:Y,setFilled:H,validityData:$}=dh(),{labelId:B}=fh(),{clearErrors:P}=hj(),oe=fj(!0),le=M||c,ee=R??x,z=zo(E),[G,Q]=zx({controlled:m,default:y,name:"RadioGroup",state:"value"}),[q,re]=v.useState(!1),Se=De((Te,$e)=>{g?.(Te,$e),!$e.isCanceled&&Q(Te)}),D=v.useRef(null),ne=v.useRef(null),de=v.useRef(null);function ae(Te){let $e;return w&&(typeof w=="function"?$e=w(Te):w.current=Te),ne.current=Te,k.inputRef.current=Te,$e}const me=De((Te,$e=!1)=>{if(Te){if($e){D.current===Te&&(D.current=null);return}D.current==null&&(D.current=Te)}}),Ce=De(Te=>{if(!Te||Te.disabled)return;de.current||(de.current=Te);const $e=ne.current;if(Te.checked||$e==null||$e.disabled)return ae(Te)}),be=De(()=>{const Te=ne.current;return!Te||Te.disabled||!Te.checked?null:G??null});uj(D,z,G??null,be,!le,x),NA(G,()=>{P(ee),Y(G!==$.initialValue),H(G!=null),k.change(G);const Te=de.current;G==null&&Te&&!Te.disabled&&ae(Te)});const xe=A["aria-labelledby"]??B??oe?.legendId,qe={...U,disabled:le??!1,required:p??!1,readOnly:d??!1},it=v.useMemo(()=>({...U,checkedValue:G,disabled:le,form:b,validation:k,name:ee,readOnly:d,registerControlRef:me,registerInputRef:Ce,required:p,setCheckedValue:Se,setTouched:re,touched:q}),[G,le,b,k,U,ee,d,me,Ce,p,Se,re,q]),Me={id:E,role:"radiogroup","aria-required":p||void 0,"aria-disabled":le||void 0,"aria-readonly":d||void 0,"aria-labelledby":xe,onFocus(){_(!0)},onBlur(Te){Ke(Te.currentTarget,Te.relatedTarget)||(j(!0),_(!1),O==="onBlur"&&k.commit(G))},onKeyDownCapture(Te){Te.key.startsWith("Arrow")&&(re(!0),_(!0))}};return f.jsx(Mx.Provider,{value:it,children:f.jsx(cj,{render:r,className:i,style:C,state:qe,props:[Me,A,Te=>k.getValidationProps(le??!1,Te)],refs:[s],stateAttributesMapping:jx,enableHomeAndEndKeys:!1,modifierKeys:mj})})});var Db=1,vj=.9,yj=.8,bj=.17,Qf=.1,Jf=.999,Sj=.9999,xj=.99,wj=/[\\\/_+.#"@\[\(\{&]/,Ej=/[\\\/_+.#"@\[\(\{&]/g,Tj=/[\s-]/,Ix=/[\s-]/g;function Sp(e,n,s,r,i,c,d){if(c===n.length)return i===e.length?Db:xj;var p=`${i},${c}`;if(d[p]!==void 0)return d[p];for(var g=r.charAt(c),m=s.indexOf(g,i),y=0,b,x,w,E;m>=0;)b=Sp(e,n,s,r,m+1,c+1,d),b>y&&(m===i?b*=Db:wj.test(e.charAt(m-1))?(b*=yj,w=e.slice(i,m-1).match(Ej),w&&i>0&&(b*=Math.pow(Jf,w.length))):Tj.test(e.charAt(m-1))?(b*=vj,E=e.slice(i,m-1).match(Ix),E&&i>0&&(b*=Math.pow(Jf,E.length))):(b*=bj,i>0&&(b*=Math.pow(Jf,m-i))),e.charAt(m)!==n.charAt(c)&&(b*=Sj)),(b<Qf&&s.charAt(m-1)===r.charAt(c+1)||r.charAt(c+1)===r.charAt(c)&&s.charAt(m-1)!==r.charAt(c))&&(x=Sp(e,n,s,r,m+1,c+2,d),x*Qf>b&&(b=x*Qf)),b>y&&(y=b),m=s.indexOf(g,m+1);return d[p]=y,y}function Ub(e){return e.toLowerCase().replace(Ix," ")}function _j(e,n,s){return e=s&&s.length>0?`${e+" "+s.join(" ")}`:e,Sp(e,n,Ub(e),Ub(n),0,0,{})}var Ti='[cmdk-group=""]',Wf='[cmdk-group-items=""]',Rj='[cmdk-group-heading=""]',Dx='[cmdk-item=""]',Pb=`${Dx}:not([aria-disabled="true"])`,xp="cmdk-item-select",ia="data-value",Cj=(e,n,s)=>_j(e,n,s),Ux=v.createContext(void 0),Ji=()=>v.useContext(Ux),Px=v.createContext(void 0),ph=()=>v.useContext(Px),$x=v.createContext(void 0),Lx=v.forwardRef((e,n)=>{let s=la(()=>{var D,ne;return{search:"",value:(ne=(D=e.value)!=null?D:e.defaultValue)!=null?ne:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=la(()=>new Set),i=la(()=>new Map),c=la(()=>new Map),d=la(()=>new Set),p=qx(e),{label:g,children:m,value:y,onValueChange:b,filter:x,shouldFilter:w,loop:E,disablePointerSelection:C=!1,vimBindings:A=!0,...j}=e,_=da(),O=da(),R=da(),M=v.useRef(null),U=Pj();br(()=>{if(y!==void 0){let D=y.trim();s.current.value=D,k.emit()}},[y]),br(()=>{U(6,oe)},[]);let k=v.useMemo(()=>({subscribe:D=>(d.current.add(D),()=>d.current.delete(D)),snapshot:()=>s.current,setState:(D,ne,de)=>{var ae,me,Ce,be;if(!Object.is(s.current[D],ne)){if(s.current[D]=ne,D==="search")P(),$(),U(1,B);else if(D==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let xe=document.getElementById(R);xe?xe.focus():(ae=document.getElementById(_))==null||ae.focus()}if(U(7,()=>{var xe;s.current.selectedItemId=(xe=le())==null?void 0:xe.id,k.emit()}),de||U(5,oe),((me=p.current)==null?void 0:me.value)!==void 0){let xe=ne??"";(be=(Ce=p.current).onValueChange)==null||be.call(Ce,xe);return}}k.emit()}},emit:()=>{d.current.forEach(D=>D())}}),[]),Y=v.useMemo(()=>({value:(D,ne,de)=>{var ae;ne!==((ae=c.current.get(D))==null?void 0:ae.value)&&(c.current.set(D,{value:ne,keywords:de}),s.current.filtered.items.set(D,H(ne,de)),U(2,()=>{$(),k.emit()}))},item:(D,ne)=>(r.current.add(D),ne&&(i.current.has(ne)?i.current.get(ne).add(D):i.current.set(ne,new Set([D]))),U(3,()=>{P(),$(),s.current.value||B(),k.emit()}),()=>{c.current.delete(D),r.current.delete(D),s.current.filtered.items.delete(D);let de=le();U(4,()=>{P(),de?.getAttribute("id")===D&&B(),k.emit()})}),group:D=>(i.current.has(D)||i.current.set(D,new Set),()=>{c.current.delete(D),i.current.delete(D)}),filter:()=>p.current.shouldFilter,label:g||e["aria-label"],getDisablePointerSelection:()=>p.current.disablePointerSelection,listId:_,inputId:R,labelId:O,listInnerRef:M}),[]);function H(D,ne){var de,ae;let me=(ae=(de=p.current)==null?void 0:de.filter)!=null?ae:Cj;return D?me(D,s.current.search,ne):0}function $(){if(!s.current.search||p.current.shouldFilter===!1)return;let D=s.current.filtered.items,ne=[];s.current.filtered.groups.forEach(ae=>{let me=i.current.get(ae),Ce=0;me.forEach(be=>{let xe=D.get(be);Ce=Math.max(xe,Ce)}),ne.push([ae,Ce])});let de=M.current;ee().sort((ae,me)=>{var Ce,be;let xe=ae.getAttribute("id"),qe=me.getAttribute("id");return((Ce=D.get(qe))!=null?Ce:0)-((be=D.get(xe))!=null?be:0)}).forEach(ae=>{let me=ae.closest(Wf);me?me.appendChild(ae.parentElement===me?ae:ae.closest(`${Wf} > *`)):de.appendChild(ae.parentElement===de?ae:ae.closest(`${Wf} > *`))}),ne.sort((ae,me)=>me[1]-ae[1]).forEach(ae=>{var me;let Ce=(me=M.current)==null?void 0:me.querySelector(`${Ti}[${ia}="${encodeURIComponent(ae[0])}"]`);Ce?.parentElement.appendChild(Ce)})}function B(){let D=ee().find(de=>de.getAttribute("aria-disabled")!=="true"),ne=D?.getAttribute(ia);k.setState("value",ne||void 0)}function P(){var D,ne,de,ae;if(!s.current.search||p.current.shouldFilter===!1){s.current.filtered.count=r.current.size;return}s.current.filtered.groups=new Set;let me=0;for(let Ce of r.current){let be=(ne=(D=c.current.get(Ce))==null?void 0:D.value)!=null?ne:"",xe=(ae=(de=c.current.get(Ce))==null?void 0:de.keywords)!=null?ae:[],qe=H(be,xe);s.current.filtered.items.set(Ce,qe),qe>0&&me++}for(let[Ce,be]of i.current)for(let xe of be)if(s.current.filtered.items.get(xe)>0){s.current.filtered.groups.add(Ce);break}s.current.filtered.count=me}function oe(){var D,ne,de;let ae=le();ae&&(((D=ae.parentElement)==null?void 0:D.firstChild)===ae&&((de=(ne=ae.closest(Ti))==null?void 0:ne.querySelector(Rj))==null||de.scrollIntoView({block:"nearest"})),ae.scrollIntoView({block:"nearest"}))}function le(){var D;return(D=M.current)==null?void 0:D.querySelector(`${Dx}[aria-selected="true"]`)}function ee(){var D;return Array.from(((D=M.current)==null?void 0:D.querySelectorAll(Pb))||[])}function z(D){let ne=ee()[D];ne&&k.setState("value",ne.getAttribute(ia))}function G(D){var ne;let de=le(),ae=ee(),me=ae.findIndex(be=>be===de),Ce=ae[me+D];(ne=p.current)!=null&&ne.loop&&(Ce=me+D<0?ae[ae.length-1]:me+D===ae.length?ae[0]:ae[me+D]),Ce&&k.setState("value",Ce.getAttribute(ia))}function Q(D){let ne=le(),de=ne?.closest(Ti),ae;for(;de&&!ae;)de=D>0?Dj(de,Ti):Uj(de,Ti),ae=de?.querySelector(Pb);ae?k.setState("value",ae.getAttribute(ia)):G(D)}let q=()=>z(ee().length-1),re=D=>{D.preventDefault(),D.metaKey?q():D.altKey?Q(1):G(1)},Se=D=>{D.preventDefault(),D.metaKey?z(0):D.altKey?Q(-1):G(-1)};return v.createElement(Ls.div,{ref:n,tabIndex:-1,...j,"cmdk-root":"",onKeyDown:D=>{var ne;(ne=j.onKeyDown)==null||ne.call(j,D);let de=D.nativeEvent.isComposing||D.keyCode===229;if(!(D.defaultPrevented||de))switch(D.key){case"n":case"j":{A&&D.ctrlKey&&re(D);break}case"ArrowDown":{re(D);break}case"p":case"k":{A&&D.ctrlKey&&Se(D);break}case"ArrowUp":{Se(D);break}case"Home":{D.preventDefault(),z(0);break}case"End":{D.preventDefault(),q();break}case"Enter":{D.preventDefault();let ae=le();if(ae){let me=new Event(xp);ae.dispatchEvent(me)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:Y.inputId,id:Y.labelId,style:Lj},g),du(e,D=>v.createElement(Px.Provider,{value:k},v.createElement(Ux.Provider,{value:Y},D))))}),Aj=v.forwardRef((e,n)=>{var s,r;let i=da(),c=v.useRef(null),d=v.useContext($x),p=Ji(),g=qx(e),m=(r=(s=g.current)==null?void 0:s.forceMount)!=null?r:d?.forceMount;br(()=>{if(!m)return p.item(i,d?.id)},[m]);let y=Hx(i,c,[e.value,e.children,c],e.keywords),b=ph(),x=Ps(U=>U.value&&U.value===y.current),w=Ps(U=>m||p.filter()===!1?!0:U.search?U.filtered.items.get(i)>0:!0);v.useEffect(()=>{let U=c.current;if(!(!U||e.disabled))return U.addEventListener(xp,E),()=>U.removeEventListener(xp,E)},[w,e.onSelect,e.disabled]);function E(){var U,k;C(),(k=(U=g.current).onSelect)==null||k.call(U,y.current)}function C(){b.setState("value",y.current,!0)}if(!w)return null;let{disabled:A,value:j,onSelect:_,forceMount:O,keywords:R,...M}=e;return v.createElement(Ls.div,{ref:Ii(c,n),...M,id:i,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!x,"data-disabled":!!A,"data-selected":!!x,onPointerMove:A||p.getDisablePointerSelection()?void 0:C,onClick:A?void 0:E},e.children)}),kj=v.forwardRef((e,n)=>{let{heading:s,children:r,forceMount:i,...c}=e,d=da(),p=v.useRef(null),g=v.useRef(null),m=da(),y=Ji(),b=Ps(w=>i||y.filter()===!1?!0:w.search?w.filtered.groups.has(d):!0);br(()=>y.group(d),[]),Hx(d,p,[e.value,e.heading,g]);let x=v.useMemo(()=>({id:d,forceMount:i}),[i]);return v.createElement(Ls.div,{ref:Ii(p,n),...c,"cmdk-group":"",role:"presentation",hidden:b?void 0:!0},s&&v.createElement("div",{ref:g,"cmdk-group-heading":"","aria-hidden":!0,id:m},s),du(e,w=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":s?m:void 0},v.createElement($x.Provider,{value:x},w))))}),jj=v.forwardRef((e,n)=>{let{alwaysRender:s,...r}=e,i=v.useRef(null),c=Ps(d=>!d.search);return!s&&!c?null:v.createElement(Ls.div,{ref:Ii(i,n),...r,"cmdk-separator":"",role:"separator"})}),Oj=v.forwardRef((e,n)=>{let{onValueChange:s,...r}=e,i=e.value!=null,c=ph(),d=Ps(m=>m.search),p=Ps(m=>m.selectedItemId),g=Ji();return v.useEffect(()=>{e.value!=null&&c.setState("search",e.value)},[e.value]),v.createElement(Ls.input,{ref:n,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":g.listId,"aria-labelledby":g.labelId,"aria-activedescendant":p,id:g.inputId,type:"text",value:i?e.value:d,onChange:m=>{i||c.setState("search",m.target.value),s?.(m.target.value)}})}),Nj=v.forwardRef((e,n)=>{let{children:s,label:r="Suggestions",...i}=e,c=v.useRef(null),d=v.useRef(null),p=Ps(m=>m.selectedItemId),g=Ji();return v.useEffect(()=>{if(d.current&&c.current){let m=d.current,y=c.current,b,x=new ResizeObserver(()=>{b=requestAnimationFrame(()=>{let w=m.offsetHeight;y.style.setProperty("--cmdk-list-height",w.toFixed(1)+"px")})});return x.observe(m),()=>{cancelAnimationFrame(b),x.unobserve(m)}}},[]),v.createElement(Ls.div,{ref:Ii(c,n),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":p,"aria-label":r,id:g.listId},du(e,m=>v.createElement("div",{ref:Ii(d,g.listInnerRef),"cmdk-list-sizer":""},m)))}),Mj=v.forwardRef((e,n)=>{let{open:s,onOpenChange:r,overlayClassName:i,contentClassName:c,container:d,...p}=e;return v.createElement(ER,{open:s,onOpenChange:r},v.createElement(TR,{container:d},v.createElement(_R,{"cmdk-overlay":"",className:i}),v.createElement(RR,{"aria-label":e.label,"cmdk-dialog":"",className:c},v.createElement(Lx,{ref:n,...p}))))}),zj=v.forwardRef((e,n)=>Ps(s=>s.filtered.count===0)?v.createElement(Ls.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),Ij=v.forwardRef((e,n)=>{let{progress:s,children:r,label:i="Loading...",...c}=e;return v.createElement(Ls.div,{ref:n,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":s,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},du(e,d=>v.createElement("div",{"aria-hidden":!0},d)))}),No=Object.assign(Lx,{List:Nj,Item:Aj,Input:Oj,Group:kj,Separator:jj,Dialog:Mj,Empty:zj,Loading:Ij});function Dj(e,n){let s=e.nextElementSibling;for(;s;){if(s.matches(n))return s;s=s.nextElementSibling}}function Uj(e,n){let s=e.previousElementSibling;for(;s;){if(s.matches(n))return s;s=s.previousElementSibling}}function qx(e){let n=v.useRef(e);return br(()=>{n.current=e}),n}var br=typeof window>"u"?v.useEffect:v.useLayoutEffect;function la(e){let n=v.useRef();return n.current===void 0&&(n.current=e()),n}function Ps(e){let n=ph(),s=()=>e(n.snapshot());return v.useSyncExternalStore(n.subscribe,s,s)}function Hx(e,n,s,r=[]){let i=v.useRef(),c=Ji();return br(()=>{var d;let p=(()=>{var m;for(let y of s){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(m=y.current.textContent)==null?void 0:m.trim():i.current}})(),g=r.map(m=>m.trim());c.value(e,p,g),(d=n.current)==null||d.setAttribute(ia,p),i.current=p}),i}var Pj=()=>{let[e,n]=v.useState(),s=la(()=>new Map);return br(()=>{s.current.forEach(r=>r()),s.current=new Map},[e]),(r,i)=>{s.current.set(r,i),n({})}};function $j(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function du({asChild:e,children:n},s){return e&&v.isValidElement(n)?v.cloneElement($j(n),{ref:n.ref},s(n.props.children)):s(n)}var Lj={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const $b=(e,n)=>`model-${n}:${e.id||"automatic"}`;function qj({models:e,value:n,effort:s,onValueChange:r,onEffortChange:i,disabled:c=!1,open:d,onOpenChange:p,badge:g,agentDefaultId:m,onReset:y}){const[b,x]=v.useState(!1),[w,E]=v.useState(""),C=v.useRef(null),A=v.useRef(null),j=d??b,_=v.useCallback(k=>{d===void 0&&x(k),p?.(k)},[d,p]),O=v.useMemo(()=>e.find(k=>k.id===n)??e[0],[e,n]),R=O?.efforts.find(k=>k.id===s),M=O?$b(O,Math.max(e.indexOf(O),0)):void 0;v.useEffect(()=>{if(c){_(!1);return}if(!j){E("");return}A.current?.focus()},[c,j,_]);const U=k=>{r(k.id),_(!1),window.requestAnimationFrame(()=>C.current?.focus())};return f.jsxs(ox,{open:j,onOpenChange:_,children:[f.jsxs(lx,{type:"button",ref:C,"data-slot":"model-selector-trigger",className:"model-selector__trigger","aria-label":"Model and reasoning effort","aria-haspopup":"dialog",disabled:c,onKeyDown:k=>{k.key!=="ArrowDown"&&k.key!=="ArrowUp"||(k.preventDefault(),_(!0))},children:[f.jsxs("span",{"data-slot":"model-selector-value",className:"model-selector__value",children:[f.jsx("span",{className:"model-selector__model-name",children:O?.name??"Select model"}),R&&f.jsx("span",{className:"model-selector__effort-value",children:R.name}),g!==void 0&&f.jsx("span",{className:`model-selector__badge is-${g}`,children:g})]}),f.jsx(Ae,{name:"arrow-down",size:14})]}),f.jsxs(ux,{children:[f.jsx(dk,{"data-slot":"model-selector-backdrop",className:"model-selector__backdrop"}),f.jsx(yx,{"data-slot":"model-selector-positioner",className:"model-selector__positioner",align:"start",side:"bottom",sideOffset:6,children:f.jsx(Ex,{"data-slot":"model-selector-content",className:"model-selector__content","aria-label":"Model and reasoning effort",children:f.jsxs(No,{"data-slot":"model-selector-command",className:"model-selector__command",label:"Search models",loop:!0,shouldFilter:!0,...M?{defaultValue:M}:{},children:[f.jsxs("div",{"data-slot":"model-selector-search-wrapper",className:"model-selector__search-wrapper",children:[f.jsx(Ae,{name:"search",size:15}),f.jsx(No.Input,{ref:A,"data-slot":"model-selector-search",className:"model-selector__search",value:w,onValueChange:E,placeholder:"Search models…","aria-label":"Search models"})]}),f.jsxs(No.List,{"data-slot":"model-selector-list",className:"model-selector__list",children:[f.jsx(No.Empty,{"data-slot":"model-selector-empty",className:"model-selector__empty",children:"No models found."}),f.jsx(No.Group,{"data-slot":"model-selector-group",className:"model-selector__group",children:e.map((k,Y)=>{const H=k.id===n;return f.jsxs(No.Item,{"data-slot":"model-selector-item","data-model-selected":H||void 0,className:"model-selector__item",value:$b(k,Y),keywords:[k.id,k.name,...k.description?[k.description]:[]],onSelect:()=>U(k),children:[f.jsxs("span",{className:"model-selector__item-copy",children:[f.jsx("span",{className:"model-selector__item-name",children:k.name}),k.description&&f.jsx("span",{className:"model-selector__item-description",children:k.description})]}),k.id!==""&&k.id===m&&f.jsx("span",{className:"model-selector__item-default",children:"agent default"}),H&&f.jsx("span",{"data-slot":"model-selector-selected-indicator",className:"model-selector__selected-indicator","aria-hidden":"true",children:f.jsx(Ae,{name:"check",size:15})})]},`${k.id}:${k.name}`)})})]}),(O?.efforts.length??0)>0&&f.jsxs("div",{"data-slot":"model-selector-effort",className:"model-selector__effort",onKeyDown:k=>{(k.key==="Home"||k.key==="End")&&k.stopPropagation(),(k.key==="ArrowUp"||k.key==="ArrowDown")&&A.current?.focus()},children:[f.jsx("span",{className:"model-selector__effort-label",children:"Thinking"}),f.jsx(gj,{className:"model-selector__effort-options",value:R?.id??"",onValueChange:k=>i(k),"aria-label":"Reasoning effort",children:O?.efforts.map(k=>f.jsx(ej,{"data-slot":"model-selector-effort-option",className:"model-selector__effort-option",value:k.id,children:k.name},`${k.id}:${k.name}`))})]}),y!==void 0&&f.jsx("div",{className:"model-selector__reset",children:f.jsxs("button",{type:"button",onClick:()=>{y(),_(!1)},children:[f.jsx(Ae,{name:"restore",size:13}),"Reset to agent default"]})})]})})})]})]})}function Hj({text:e}){return f.jsxs("blockquote",{className:"message-quote",children:[f.jsx(Ae,{name:"quote",size:14}),f.jsx("span",{children:e})]})}function Bj(){return f.jsx(My.Root,{className:"selection-toolbar",children:f.jsxs(My.Quote,{className:"selection-toolbar-quote",children:[f.jsx(Ae,{name:"quote",size:14}),"Quote"]})})}function Zj(){return f.jsxs(cn.Quote,{className:"composer-quote",children:[f.jsx(Ae,{name:"quote",size:14}),f.jsx(cn.QuoteText,{className:"composer-quote-text"}),f.jsx(cn.QuoteDismiss,{className:"composer-quote-dismiss","aria-label":"Remove quote",title:"Remove quote",children:f.jsx(Ae,{name:"close",size:13})})]})}const Bx=v.createContext(!1),Zx=v.createContext(void 0);function qs(e){const n=v.useContext(Zx);if(e===!1&&n===void 0)throw new Error(Wn(27));return n}const Vj={...Xi,...wr},Vx=v.forwardRef(function(n,s){const{render:r,className:i,style:c,forceRender:d=!1,...p}=n,{store:g}=qs(),m=g.useState("open"),y=g.useState("nested"),b=g.useState("mounted"),x=g.useState("transitionStatus");return vn("div",n,{state:{open:m,transitionStatus:x},ref:[g.context.backdropRef,s],stateAttributesMapping:Vj,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:d||!y})}),Yx=v.forwardRef(function(n,s){const{render:r,className:i,style:c,disabled:d=!1,nativeButton:p=!0,...g}=n,{store:m}=qs(),y=m.useState("open"),{getButtonProps:b,buttonRef:x}=Fi({disabled:d,native:p}),w={disabled:d};function E(C){y&&m.setOpen(!1,Ht(rS,C.nativeEvent))}return vn("button",n,{state:w,ref:[s,x],props:[{onClick:E},g,b]})}),Yj=v.forwardRef(function(n,s){const{render:r,className:i,style:c,id:d,...p}=n,{store:g}=qs(),m=zo(d);return g.useSyncedValueWithCleanup("descriptionElementId",m),vn("p",n,{ref:s,props:[{id:m},p]})});let Gj=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Kj=(function(e){return e[e.open=mr.open]="open",e[e.closed=mr.closed]="closed",e[e.startingStyle=mr.startingStyle]="startingStyle",e[e.endingStyle=mr.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Gx=v.createContext(void 0);function Fj(){const e=v.useContext(Gx);if(e===void 0)throw new Error(Wn(26));return e}const Xj={...Xi,...wr,nestedDialogOpen(e){return e?{[Kj.nestedDialogOpen]:""}:null}},Kx=v.forwardRef(function(n,s){const{render:r,className:i,style:c,finalFocus:d,initialFocus:p,...g}=n,{store:m}=qs(),y=m.useState("descriptionElementId"),b=m.useState("disablePointerDismissal"),x=m.useState("floatingRootContext"),w=m.useState("popupProps"),E=m.useState("modal"),C=m.useState("mounted"),A=m.useState("nested"),j=m.useState("nestedOpenDialogCount"),_=m.useState("open"),O=m.useState("openMethod"),R=m.useState("titleElementId"),M=m.useState("transitionStatus"),U=m.useState("role"),k=x.useState("floatingId"),Y=g.id??k;Fj(),iu({open:_,ref:m.context.popupRef,onComplete(){_&&m.context.onOpenChangeComplete?.(!0)}});const H=p===void 0?HS(m.context.popupRef):p,$=j>0,B=m.useStateSetter("popupElement"),oe=vn("div",n,{state:{open:_,nested:A,transitionStatus:M,nestedDialogOpen:$},props:[w,{id:Y,"aria-labelledby":R??void 0,"aria-describedby":y??void 0,role:U,...rh,hidden:!C,onKeyDown(le){ch.has(le.key)&&le.stopPropagation()},style:{[Gj.nestedDialogs]:j}},g],ref:[s,m.context.popupRef,B],stateAttributesMapping:Xj});return f.jsx(IS,{context:x,openInteractionType:O,disabled:!C,closeOnFocusOut:!b,initialFocus:H,returnFocus:d,modal:E!==!1,restoreFocus:"popup",children:oe})}),Fx=v.forwardRef(function(n,s){const{keepMounted:r=!1,...i}=n,{store:c}=qs(),d=c.useState("mounted"),p=c.useState("modal"),g=c.useState("open");return d||r?f.jsx(Gx.Provider,{value:r,children:f.jsxs(OS,{ref:s,...i,children:[d&&p===!0&&f.jsx(mx,{ref:c.context.internalBackdropRef,inert:dx(!g)}),n.children]})}):null});function Qj(e){const{store:n,actionsRef:s}=e,r=n.useState("open");FS(n,r),YS(n);const{forceUnmount:i}=GS(r,n),c=v.useCallback(()=>{n.setOpen(!1,Ht(iS))},[n]);v.useImperativeHandle(s,()=>({unmount:i,close:c}),[i,c])}function Jj({store:e,parentContext:n,isDrawer:s}){const r=e.useState("open"),i=e.useState("disablePointerDismissal"),c=e.useState("modal"),d=e.useState("popupElement"),p=e.useState("floatingRootContext"),[g,m]=v.useState(0),[y,b]=v.useState(0),x=g===0,w=US(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(j){if(!e.context.outsidePressEnabledRef.current||"button"in j&&j.button!==0||"touches"in j&&j.touches.length!==1)return!1;const _=Hn(j);return x&&!i?c&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===_||e.context.backdropRef.current===_||Ke(_,d)&&!_?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:x});vx(r&&c===!0,d),e.useContextCallback("onNestedDialogOpen",(j,_)=>{m(j),b(_)}),e.useContextCallback("onNestedDialogClose",()=>{m(0),b(0)}),v.useEffect(()=>(n?.onNestedDialogOpen&&r&&n.onNestedDialogOpen(g+1,y+(s?1:0)),n?.onNestedDialogClose&&!r&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&r&&n.onNestedDialogClose()}),[s,r,g,y,n]);const E=w.reference??Dt,C=w.trigger??Dt,A=w.floating??Dt;return KS(e,{activeTriggerProps:E,inactiveTriggerProps:C,popupProps:A,nestedOpenDialogCount:g,nestedOpenDrawerCount:y}),null}const Wj={...WS,modal:Ve(e=>e.modal),nested:Ve(e=>e.nested),nestedOpenDialogCount:Ve(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Ve(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Ve(e=>e.disablePointerDismissal),openMethod:Ve(e=>e.openMethod),descriptionElementId:Ve(e=>e.descriptionElementId),titleElementId:Ve(e=>e.titleElementId),viewportElement:Ve(e=>e.viewportElement),role:Ve(e=>e.role)};class hh extends oh{constructor(n,s,r=!1){const i=new lu,c=eO(n);c.floatingRootContext=QS(i,s,r),super(c,{popupRef:v.createRef(),backdropRef:v.createRef(),internalBackdropRef:v.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:i,onOpenChange:void 0,onOpenChangeComplete:void 0},Wj)}setOpen=(n,s)=>{if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&s.trigger==null&&this.state.activeTriggerId!=null&&(s.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const r={open:n};ZS(r,n,s.trigger),this.update(r)};static useStore(n,s){return BS(n,(i,c)=>new hh(s,i,c),!0).store}}function eO(e={}){return{...XS(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function tO(e,n="dialog"){const{children:s,open:r,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:d,disablePointerDismissal:p=!1,modal:g=!0,actionsRef:m,handle:y,triggerId:b,defaultTriggerId:x=null}=e,w=n==="drawer",E=n==="alert-dialog",C=E?!0:g,A=E||p,j=E?"alertdialog":"dialog",_=qs(!0),R={modal:C,disablePointerDismissal:A,nested:!!_,role:j},M=hh.useStore(y?.store,{open:i,openProp:r,activeTriggerId:x,triggerIdProp:b,...R});PS(()=>{const B=r===void 0&&M.state.open===!1&&i===!0?{open:!0,activeTriggerId:x}:null;E?M.update(B?{...R,...B}:R):B&&M.update(B)}),M.useControlledProp("openProp",r),M.useControlledProp("triggerIdProp",b),M.useSyncedValues(R),M.useContextCallback("onOpenChange",c),M.useContextCallback("onOpenChangeComplete",d);const U=M.useState("open"),k=M.useState("mounted"),Y=M.useState("payload");Qj({store:M,actionsRef:m});const H=U||k,$=v.useMemo(()=>({store:M}),[M]);return f.jsx(Bx.Provider,{value:!1,children:f.jsxs(Zx.Provider,{value:$,children:[H&&f.jsx(Jj,{store:M,parentContext:_?.store.context,isDrawer:w}),typeof s=="function"?s({payload:Y}):s]})})}function Xx(e){const n=v.useContext(Bx)?"drawer":"dialog";return tO(e,n)}const Qx=v.forwardRef(function(n,s){const{render:r,className:i,style:c,id:d,...p}=n,{store:g}=qs(),m=zo(d);return g.useSyncedValueWithCleanup("titleElementId",m),vn("h2",n,{ref:s,props:[{id:m},p]})}),nO=v.forwardRef(function(n,s){const{render:r,className:i,style:c,disabled:d=!1,nativeButton:p=!0,id:g,payload:m,handle:y,...b}=n,x=qs(!0),w=y?.store??x?.store;if(!w)throw new Error(Wn(79));const E=zo(g),C=w.useState("floatingRootContext"),A=w.useState("isOpenedByTrigger",E),j=w.useState("triggerPopupId",E),_=v.useRef(null),{registerTrigger:O,isMountedByThisTrigger:R}=VS(E,_,w,{payload:m}),{getButtonProps:M,buttonRef:U}=Fi({disabled:d,native:p}),k=DS(C,{enabled:C!=null}),Y=ix(()=>w.select("open"),B=>{w.set("openMethod",B)}),H={disabled:d,open:A},$=w.useState("triggerProps",R);return vn("button",n,{state:H,ref:[U,s,O,_],props:[k.reference,$,Y,{[th]:"",id:E,"aria-haspopup":"dialog","aria-expanded":A,"aria-controls":j},b,M],stateAttributesMapping:ax})}),Jx=v.createContext(void 0);function Wx({children:e}){const[n,s]=v.useState([]),[r,i]=v.useState(void 0),c=v.useCallback(m=>{s(y=>{const b=y.findIndex(w=>w.key===m.key);if(b===-1)return[...y,m];if(y[b].src===m.src&&y[b].name===m.name)return y;const x=[...y];return x[b]=m,x})},[]),d=v.useCallback(m=>{s(y=>y.filter(b=>b.key!==m))},[]),p=v.useMemo(()=>({register:c,unregister:d,open:i}),[c,d]),g=r===void 0?-1:n.findIndex(m=>m.key===r);return f.jsxs(Jx.Provider,{value:p,children:[e,g>=0&&f.jsx(rO,{images:n,index:g,onIndexChange:m=>i(n[m]?.key),onClose:()=>i(void 0)})]})}function oO(e){const n=v.useContext(Jx),s=e?.key,r=e?.src,i=e?.name;return v.useEffect(()=>{if(!(n===void 0||s===void 0||r===void 0))return n.register({key:s,src:r,name:i??""}),()=>n.unregister(s)},[n,s,r,i]),v.useCallback(()=>{n!==void 0&&s!==void 0&&n.open(s)},[n,s])}function ew({image:e}){const n=oO(e);return f.jsx("button",{type:"button",className:"image-tile",onClick:n,"aria-label":`View ${e.name}`,children:f.jsx("img",{src:e.src,alt:e.name,loading:"lazy",decoding:"async"})})}function sO({images:e}){return e.length===0?null:f.jsx("div",{className:"image-row",children:e.map(n=>f.jsx(ew,{image:n},n.key))})}function rO({images:e,index:n,onIndexChange:s,onClose:r}){const i=e[n],c=e.length>1,d=v.useRef({index:n,length:e.length,onIndexChange:s});d.current={index:n,length:e.length,onIndexChange:s},v.useEffect(()=>{if(!c)return;const g=m=>{if(m.key!=="ArrowLeft"&&m.key!=="ArrowRight")return;m.preventDefault();const{index:y,length:b,onIndexChange:x}=d.current;x(m.key==="ArrowLeft"?(y-1+b)%b:(y+1)%b)};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[c]);const p=g=>s((n+g+e.length)%e.length);return f.jsx(Xx,{open:!0,onOpenChange:g=>{g||r()},children:f.jsxs(Fx,{children:[f.jsx(Vx,{className:"lightbox-backdrop"}),f.jsxs(Kx,{className:"lightbox-popup","aria-label":`Image ${n+1} of ${e.length}`,children:[f.jsx(Qx,{className:"sr-only",children:i.name}),f.jsx("img",{className:"lightbox-image",src:i.src,alt:i.name}),f.jsxs("div",{className:"lightbox-bar",children:[c&&f.jsx("button",{type:"button",className:"icon-button",onClick:()=>p(-1),"aria-label":"Previous image",children:f.jsx(Ae,{name:"chevron-left",size:18})}),f.jsx("span",{className:"lightbox-name",children:i.name}),c&&f.jsxs("span",{className:"lightbox-count",children:[n+1," / ",e.length]}),c&&f.jsx("button",{type:"button",className:"icon-button",onClick:()=>p(1),"aria-label":"Next image",children:f.jsx(Ae,{name:"chevron",size:18})}),f.jsx("a",{className:"icon-button",href:i.src,download:i.name,"aria-label":`Download ${i.name}`,children:f.jsx(Ae,{name:"download",size:17})}),f.jsx(Yx,{className:"icon-button","aria-label":"Close image",children:f.jsx(Ae,{name:"close",size:17})})]})]})]})})}const aO=e=>{window.dispatchEvent(new CustomEvent("mono-agent:notice",{detail:{message:e,tone:"error"}}))};function iO(){return CR("composer.attachmentAddError",({reason:e,message:n})=>{aO(e==="not-accepted"?"That file type is not supported by this agent.":n||"The attachment could not be uploaded.")}),null}function tw({removable:e}){const n=AR(),s=zn(E=>E.attachment.status),r=zn(E=>E.attachment.type),i=zn(E=>E.attachment.name),c=zn(E=>E.attachment.content),d=s.type==="running",p=s.type==="incomplete",g=d?s.progress:100,m=n.attachment.source==="message",y=c?.find(E=>E.type==="image"),b=c?.find(E=>E.type==="file"),x=y?.type==="image"?y.image:b?.type==="file"?b.data:void 0;if(m&&r==="image")return null;const w=f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"attachment-icon",children:y?.type==="image"&&x?f.jsx("img",{src:x,alt:"",loading:"lazy"}):f.jsx(Ae,{name:r==="image"?"spark":"file",size:15})}),f.jsx("span",{className:"attachment-name",children:f.jsx(kf.Name,{})})]});return f.jsxs(kf.Root,{className:`attachment-chip${p?" is-error":""}`,"aria-label":`${r} attachment${d?`, ${g}% uploaded`:""}`,children:[m&&x?f.jsx("a",{className:"attachment-link",href:x,target:r==="image"?"_blank":void 0,rel:r==="image"?"noreferrer":void 0,download:r==="image"?void 0:i,"aria-label":`${r==="image"?"Open":"Download"} ${i}`,children:w}):w,d&&f.jsx("span",{className:"attachment-progress",style:{"--upload-progress":`${g}%`},"aria-hidden":"true"}),p&&f.jsx("span",{className:"attachment-error",children:"Upload failed"}),e&&f.jsx(kf.Remove,{className:"icon-button attachment-remove","aria-label":"Remove file",children:f.jsx(Ae,{name:"close",size:14})})]})}function lO(){return f.jsx("div",{className:"composer-attachments",children:f.jsx(cn.Attachments,{children:()=>f.jsx(tw,{removable:!0})})})}function cO(){return(zn(n=>n.message.attachments)??[]).flatMap(n=>{if(n.type!=="image")return[];const s=n.content?.find(r=>r.type==="image");return s?.type!=="image"?[]:[{key:n.id,src:s.image,name:n.name}]})}function uO(){const e=cO();return f.jsxs(f.Fragment,{children:[f.jsx(sO,{images:e}),f.jsx("div",{className:"message-attachments",children:f.jsx(Is.Attachments,{children:()=>f.jsx(tw,{removable:!1})})})]})}function dO(e){const{open:n,defaultOpen:s,onOpenChange:r,disabled:i}=e,[c,d]=zx({controlled:n,default:s,name:"Collapsible",state:"open"}),{mounted:p,setMounted:g,transitionStatus:m}=qS(c,!0,!0),y=zo(),[b,x]=v.useState(),w=b??y,E=De(C=>{const A=!c,j=Ht(ma,C.nativeEvent);r(A,j),!j.isCanceled&&d(A)});return v.useMemo(()=>({disabled:i,handleTrigger:E,mounted:p,open:c,panelId:w,setMounted:g,setOpen:d,setPanelIdState:x,transitionStatus:m}),[i,E,p,c,w,g,d,x,m])}const nw=v.createContext(void 0);function ow(){const e=v.useContext(nw);if(e===void 0)throw new Error(Wn(15));return e}let mh=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=yr.startingStyle]="startingStyle",e[e.endingStyle=yr.endingStyle]="endingStyle",e})({}),fO=(function(e){return e.panelOpen="data-panel-open",e})({});const pO={[mh.open]:""},hO={[mh.closed]:""},mO={open(e){return e?{[fO.panelOpen]:""}:null}},gO={open(e){return e?pO:hO}},sw={...gO,...wr},vO=v.forwardRef(function(n,s){const{render:r,className:i,defaultOpen:c=!1,disabled:d=!1,onOpenChange:p,open:g,style:m,...y}=n,b=De(p),x=dO({open:g,defaultOpen:c,onOpenChange:b,disabled:d}),w=v.useMemo(()=>({open:x.open,disabled:x.disabled,transitionStatus:x.transitionStatus}),[x.open,x.disabled,x.transitionStatus]),E=v.useMemo(()=>({...x,onOpenChange:b,state:w}),[x,b,w]),C=vn("div",n,{state:w,ref:s,props:y,stateAttributesMapping:sw});return f.jsx(nw.Provider,{value:E,children:C})}),yO={...mO,...wr},bO=v.forwardRef(function(n,s){const{panelId:r,open:i,handleTrigger:c,state:d,disabled:p}=ow(),{className:g,disabled:m=p,render:y,nativeButton:b=!0,style:x,...w}=n,{getButtonProps:E,buttonRef:C}=Fi({disabled:m,focusableWhenDisabled:!0,native:b});return vn("button",n,{state:d,ref:[s,C],props:[{"aria-controls":i?r:void 0,"aria-expanded":i,onClick:c},w,E],stateAttributesMapping:yO})}),_i={height:void 0,width:void 0};function SO(e){const{externalRef:n,hiddenUntilFound:s,id:r,keepMounted:i,mounted:c,onOpenChange:d,open:p,setMounted:g,setOpen:m,transitionStatus:y}=e,b=v.useRef(null),x=v.useRef(null),[w,E]=v.useState(_i),C=v.useRef(_i),A=v.useRef(!1),j=v.useRef(p),_=v.useRef(!1),[O,R]=v.useState(!1),M=v.useRef(null),U=Ds(n,b),k=Mn({mounted:c,open:p}),Y=sh(b,!1,!1),H=!p&&!c,$=O?"idle":y,B=p&&(j.current||_.current),P=!p&&c&&x.current==="css-animation"&&w.height===void 0&&w.width===void 0?C.current:w,oe=s&&H&&x.current!=="css-animation",le=De((q,re=!0)=>{re&&(C.current=q),E(q)}),ee=De(()=>{M.current?.(),M.current=null}),z=De(q=>{ee(),M.current=()=>{M.current=null,q()}}),G=De(()=>{p&&c&&x.current==="css-animation"&&(_.current=!0)});Ie(()=>{!O||y==="starting"||R(!1)},[O,y]),v.useEffect(()=>()=>{G(),ee()},[G,ee]),Ie(()=>{const q=b.current;if(!q)return;!p&&M.current&&ee();const re=xO(q,B);if(x.current=re,p&&y==="idle"&&j.current&&re==="css-animation"){C.current=ra(q);return}if(p&&y==="starting"){const ne=A.current;if(A.current=!1,re==="none"){le(ra(q)),R(!0);return}if(re==="css-transition"){const de=wO(q);if(le(ra(q)),!ne)return de;const ae=Ri(q,"transition-duration","0s");return z(ae),R(!0),de}if(re==="css-animation"){if(le(ra(q)),!ne){Ri(q,"animation-name","none")();return}const de=Ri(q,"animation-name","none"),ae=Ri(q,"animation-duration","0s");de(),z(ae),R(!0);return}}if(!p&&c&&(y==="idle"||y==="starting")){if(j.current=!1,_.current=!1,re==="none"){le(_i,!1),g(!1);return}le(ra(q));return}if(y!=="ending")return;if(re==="none"){g(!1);return}const Se=ra(q);if(!((Se.height??0)>0||(Se.width??0)>0)){g(!1);return}le(Se),re==="css-animation"&&Ri(q,"animation-name","none")()},[c,p,ee,le,g,z,B,y]),iu({enabled:p&&c&&$==="idle",open:!0,ref:b,onComplete(){p&&le(_i,!1)}}),v.useEffect(()=>{if(p||!c||$!=="ending"||!b.current)return;const re=new AbortController;let Se=-1;function D(){k.current.open||(g(!1),le(_i,!1))}return Se=Ln.request(()=>{re.signal.aborted||Y(D,re.signal)}),()=>{Ln.cancel(Se),re.abort()}},[k,c,p,$,Y,le,g]),Ie(()=>{const q=b.current;!q||!s||!H||q.setAttribute("hidden","until-found")},[H,s]),v.useEffect(function(){const re=b.current;if(!re)return;function Se(D){const ne=Ht(Yp,D);d(!0,ne),!ne.isCanceled&&(A.current=!0,m(!0))}return lt(re,"beforematch",Se)},[d,m]);const Q=i||s||c||p;return{height:P.height,props:{...oe?{[mh.startingStyle]:""}:void 0,hidden:H,id:r},ref:U,shouldPreventOpenAnimation:B,shouldRender:Q,transitionStatus:$,width:P.width}}function ra(e){return{height:e.scrollHeight,width:e.scrollWidth}}function xO(e,n=!1){const s=$s(e).getComputedStyle(e),r=(s.animationName.split(",").map(c=>c.trim()).some(c=>c!==""&&c!=="none")||n)&&Lb(s.animationDuration),i=Lb(s.transitionDuration);return r&&i||i?"css-transition":r?"css-animation":"none"}function Lb(e){return e.split(",").map(n=>n.trim()).some(n=>n!==""&&Number.parseFloat(n)>0)}function Ri(e,n,s){const r=e.style.getPropertyValue(n),i=e.style.getPropertyPriority(n);return e.style.setProperty(n,s),()=>{if(r===""){e.style.removeProperty(n);return}e.style.setProperty(n,r,i)}}function wO(e){const n={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(n).forEach(i=>{e.style.setProperty(i,"initial","important")});function s(){Object.entries(n).forEach(([i,c])=>{if(c===""){e.style.removeProperty(i);return}e.style.setProperty(i,c)})}const r=Ln.request(s);return()=>{Ln.cancel(r),s()}}let qb=(function(e){return e.collapsiblePanelHeight="--collapsible-panel-height",e.collapsiblePanelWidth="--collapsible-panel-width",e})({});const EO=v.forwardRef(function(n,s){const{className:r,hiddenUntilFound:i,keepMounted:c,render:d,id:p,style:g,...m}=n,{mounted:y,onOpenChange:b,open:x,panelId:w,setMounted:E,setPanelIdState:C,setOpen:A,state:j,transitionStatus:_}=ow(),O=i??!1,R=c??!1;Ie(()=>{if(p)return C(p),()=>{C(void 0)}},[p,C]);const{height:M,props:U,ref:k,shouldPreventOpenAnimation:Y,shouldRender:H,transitionStatus:$,width:B}=SO({externalRef:s,hiddenUntilFound:O,id:w,keepMounted:R,mounted:y,onOpenChange:b,open:x,setMounted:E,setOpen:A,transitionStatus:_}),P={...j,transitionStatus:$},oe=ES(g,P),le=vn("div",{...n,style:void 0},{state:P,ref:k,props:[U,{style:{[qb.collapsiblePanelHeight]:M===void 0?"auto":`${M}px`,[qb.collapsiblePanelWidth]:B===void 0?"auto":`${B}px`}},m,oe?{style:oe}:void 0,Y?{style:{animationName:"none"}}:void 0],stateAttributesMapping:sw});return H?le:null}),Gc=e=>{try{return JSON.stringify(e,null,2)}catch{return String(e)}},Sr=e=>e<1e3?`${String(Math.round(e))}ms`:`${(e/1e3).toFixed(1)}s`,xr=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,TO={read_file:"Read",edit_file:"Edit",write_file:"Write",memory_search:"Memory search"},rw=e=>TO[e]??e.replaceAll(/[_-]+/gu," ").replace(/^./u,n=>n.toLocaleUpperCase()),_O=/^(?:\.{0,2}\/|~\/|\/)?[\p{L}\p{N}._@+-]+(?:\/[\p{L}\p{N}._@+-]+)+$/u,RO=/^[\d/]+$/u,CO=e=>{if(!_O.test(e)||RO.test(e))return e;const n=e.split("/").filter(Boolean).pop();return n===void 0||n.length===0?e:n},aw=e=>{const n=[...new Set(e.filter(r=>r.length>0).map(CO))];if(n.length===0)return;const s=n.length-2;return`${n.slice(0,2).join(", ")}${s>0?` +${String(s)}`:""}`},Li=(e,n)=>e===0?void 0:n?`${String(e)} failed`:"failed";function fu({variant:e="tool",status:n="complete",label:s,summary:r,failed:i,duration:c,open:d,children:p}){return f.jsxs("details",{className:`activity-row is-${e} is-${n}`,open:d,children:[f.jsxs("summary",{children:[f.jsxs("span",{className:"activity-row-glyph",children:[e==="tool"&&f.jsx("i",{className:"activity-dot"}),e==="thinking"&&f.jsx(Ae,{name:"bulb",size:14}),e==="subagent"&&f.jsx(Ae,{name:"agent",size:14})]}),s!==void 0&&f.jsx("strong",{className:"activity-row-label",children:s}),r!==void 0&&f.jsx("span",{className:"activity-row-summary",children:r}),i!==void 0&&f.jsx("span",{className:"failed-tag",children:i}),c!==void 0&&f.jsx("span",{className:"activity-row-time",children:c}),f.jsx(Ae,{className:"activity-row-chevron",name:"chevron-down",size:13})]}),p]})}function pu({args:e,result:n,resultIsError:s=!1,error:r,indented:i=!1}){return f.jsxs("div",{className:`activity-payload${i?" is-indented":""}`,children:[f.jsx("span",{children:"Input"}),f.jsx("pre",{children:Gc(e)}),n!==void 0&&f.jsxs(f.Fragment,{children:[f.jsx("span",{children:s?"Error":"Output"}),f.jsx("pre",{children:Gc(n)})]}),r!==void 0&&f.jsx("p",{className:"activity-error",children:r})]})}function hu({toolName:e,summary:n,failed:s,duration:r,children:i}){return f.jsxs("details",{className:"activity-step",children:[f.jsxs("summary",{children:[f.jsx("span",{className:"activity-step-tool",children:e}),f.jsx("span",{className:"activity-step-summary",children:n}),s===void 0?f.jsx("span",{}):f.jsx("span",{className:"failed-tag",children:s}),f.jsx("span",{className:"activity-step-time",children:r})]}),i]})}const AO=new Set(["image/png","image/jpeg","image/gif","image/webp"]),gh=e=>typeof e=="string"&&AO.has(e.toLowerCase()),kO=200,Wi=(...e)=>e.filter(n=>!!n).join(" "),iw=v.createContext(!1);B0({reasoning:["group-reasoning"]});const Hb=B0({reasoning:["group-activity"],"tool-call":["group-activity"],"standalone-tool-call":[]}),lw=new Set(["context-compaction","subagent","note","tool-cluster"]),jO=e=>e.name==="reply-attachment"&&gh(e.data?.mediaType),OO=(e,n)=>e.type!=="data"?Hb(e,n):jO(e)?["group-reply-images"]:lw.has(e.name)?["group-activity"]:Hb(e,n);function vh({className:e,open:n,onOpenChange:s,defaultOpen:r=!1,streaming:i,collapseOnSettle:c=!1,children:d,...p}){const g=v.useRef(null),m=v.useRef(r),y=v.useRef(i),[b,x]=v.useState(null),w=kR(g,kO),E=n!==void 0,C=E?n:b??i??m.current,j=i===!0&&C&&(E||b===null);v.useLayoutEffect(()=>{if(y.current===i)return;const O=y.current;y.current=i,c&&O===!0&&i===!1&&!E&&x(!1),!E&&b===null&&w()},[c,E,w,i,b]);const _=v.useCallback(O=>{w(),E||x(O),s?.(O)},[E,w,s]);return f.jsx(vO,{...p,ref:g,"data-slot":"reasoning-root","data-streaming":i?"true":void 0,open:C,onOpenChange:_,className:Wi("reasoning-root",e),children:f.jsx(iw.Provider,{value:j,children:d})})}function yh({active:e=!1,className:n,duration:s,children:r,...i}){const c=typeof s=="number"&&s>0?` (${s}s)`:"";return f.jsx(bO,{...i,"data-slot":"reasoning-trigger","data-active":e?"true":void 0,className:Wi("reasoning-trigger",n),children:r??f.jsxs(f.Fragment,{children:[f.jsx("span",{"data-slot":"reasoning-trigger-icon",className:"reasoning-trigger-icon","aria-hidden":"true",children:f.jsx(Ae,{name:"spark",size:14})}),f.jsxs("span",{"data-slot":"reasoning-trigger-label",className:"reasoning-trigger-label",children:["Reasoning",c,e&&f.jsx("span",{className:"sr-only",children:" in progress"})]}),f.jsx(Ae,{"data-slot":"reasoning-trigger-chevron",className:"reasoning-trigger-chevron",name:"chevron",size:14})]})})}function bh({className:e,children:n,...s}){return f.jsx(EO,{...s,"data-slot":"reasoning-content",className:Wi("reasoning-content",e),children:n})}function Sh({className:e,children:n,...s}){const r=v.useContext(iw),i=v.useRef(null),c=v.useRef(null);return v.useEffect(()=>{if(!r)return;const d=i.current,p=c.current;if(!d||!p)return;const g=()=>{d.scrollTop=d.scrollHeight};if(g(),typeof ResizeObserver>"u")return;const m=new ResizeObserver(g);return m.observe(p),()=>m.disconnect()},[r]),f.jsx("div",{...s,ref:i,"data-slot":"reasoning-text",className:Wi("reasoning-text",e),children:f.jsx("div",{ref:c,"data-slot":"reasoning-text-content",className:"reasoning-text-content",children:n})})}const NO=(e,n)=>f.jsx("p",{"data-slot":"reasoning-paragraph",children:e.split(`
|
|
42
|
+
`).map((s,r,i)=>f.jsxs(v.Fragment,{children:[s,r<i.length-1&&f.jsx("br",{})]},r))},n),Bb=52,MO=e=>e.replace(/```[\s\S]*?```/gu," ").replace(/[*_`>#]+/gu,"").replace(/\s+/gu," ").trim(),zO=({text:e,status:n})=>{if(e.length===0)return null;const s=MO(e),r=n?.type==="running";return f.jsx(fu,{variant:"thinking",status:r?"running":"complete",summary:s.length>Bb?`${s.slice(0,Bb-1)}…`:s,open:r||void 0,children:f.jsx("div",{"data-slot":"reasoning-part",className:"reasoning-part activity-thought",children:e.split(/\n{2,}/u).map(NO)})})},IO=({children:e,className:n,defaultOpen:s,duration:r,status:i,streaming:c})=>{const d=c??i?.type==="running";return f.jsxs(vh,{className:n,defaultOpen:s,streaming:d,children:[f.jsx(yh,{active:d,duration:r}),f.jsx(bh,{"aria-busy":d,children:f.jsx(Sh,{children:e})})]})},cw=Object.assign(v.memo(zO),{Root:vh,Trigger:yh,Content:bh,Text:Sh});cw.displayName="Reasoning";const DO=v.memo(IO);DO.displayName="ReasoningGroup";const UO=({children:e,className:n,elapsedMs:s,status:r,stepCount:i,streaming:c})=>{const d=c??r?.type==="running",p=s===void 0?void 0:Sr(s),g=[i===void 0?void 0:`${String(i)} ${i===1?"step":"steps"}`,p].filter(m=>m!==void 0).join(" · ");return f.jsxs(vh,{className:Wi("activity-root",n),collapseOnSettle:!0,open:d?!0:void 0,streaming:d,children:[f.jsxs(yh,{active:d,className:"activity-trigger",children:[f.jsx(Ae,{className:`activity-glyph${d?" is-running":""}`,name:"activity",size:13}),f.jsxs("span",{className:"reasoning-trigger-label",children:["Activity",d&&f.jsx("span",{className:"sr-only",children:" in progress"})]}),g.length>0&&f.jsx("span",{className:"activity-meta","aria-hidden":"true",children:g}),f.jsx(Ae,{className:"activity-chevron",name:"chevron-down",size:14})]}),f.jsx(bh,{className:"activity-content","aria-busy":d,children:f.jsx(Sh,{children:e})})]})},uw=v.memo(UO);uw.displayName="ActivityGroup";const el=e=>e?.persistence!=="failed"?void 0:`Tool history for this call was not saved${typeof e.errorCode=="string"?` (${e.errorCode})`:""}.`,Zb=e=>e==="complete"||e==="failed"?e:"running",Vb=e=>{if(typeof e!="string")return;const n=e.replace(/\s+/gu," ").trim();return n.length===0?void 0:n},PO=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return;const n=e.prompt;return typeof n=="string"&&n.trim().length>0?n.trim():void 0},ep=72,$O=["file_path","path","filePath","pattern","command","query","url","prompt","description","name"];function qi(e){if(e===null||typeof e!="object"||Array.isArray(e))return;const n=e,r=$O.map(i=>Vb(n[i])).find(i=>i!==void 0)??Object.values(n).map(Vb).find(i=>i!==void 0);return r===void 0||r.length<=ep?r:r.includes("/")?`…${r.slice(r.length-(ep-1))}`:`${r.slice(0,ep-1)}…`}const LO=e=>{if(e===null||typeof e!="object"||Array.isArray(e))return;const n=e;if(typeof n.name!="string")return;const s=Array.isArray(n.calls)?n.calls:[],r=PO(n.args);return{name:n.name,...typeof n.label=="string"&&n.label.length>0?{label:n.label}:{},...r===void 0?{}:{prompt:r},...n.result===void 0||n.result===null?{}:{result:n.result},...xr(n.executionMs)===void 0?{}:{executionMs:n.executionMs},...typeof n.costUsd=="number"&&Number.isFinite(n.costUsd)&&n.costUsd>0?{costUsd:n.costUsd}:{},...n.history!==null&&typeof n.history=="object"&&!Array.isArray(n.history)?{history:n.history}:{},status:Zb(n.status),calls:s.flatMap(i=>{if(i===null||typeof i!="object"||Array.isArray(i))return[];const c=i;return typeof c.toolCallId!="string"||typeof c.toolName!="string"?[]:[{toolCallId:c.toolCallId,toolName:c.toolName,...c.args===void 0||c.args===null?{}:{args:c.args},...c.result===void 0||c.result===null?{}:{result:c.result},...xr(c.executionMs)===void 0?{}:{executionMs:c.executionMs},...c.history!==null&&typeof c.history=="object"&&!Array.isArray(c.history)?{history:c.history}:{},status:Zb(c.status)}]})}},qO=e=>{const n=[];for(let s=0;s<e.length;){const r=e[s];if(r.toolName==="AskUser"){n.push(r),s+=1;continue}const i=[r];let c=s+1;for(;c<e.length&&e[c].toolName===r.toolName;)i.push(e[c]),c+=1;if(i.length===1)n.push(r);else{const d=i.flatMap(p=>p.executionMs===void 0?[]:[p.executionMs]);n.push({kind:"cluster",toolName:r.toolName,calls:i,failedCount:i.filter(p=>p.status==="failed").length,...d.length===0?{}:{executionMs:d.reduce((p,g)=>p+g,0)}})}s=c}return n},Yb=e=>e.length===1?e[0]:e.map(n=>Gc(n)).join(`
|
|
43
|
+
|
|
44
|
+
`);function HO({call:e}){const n=el(e.history);return f.jsx(hu,{toolName:e.toolName,summary:qi(e.args),failed:Li(e.status==="failed"?1:0,!1),duration:e.executionMs===void 0?e.status==="running"?"running":void 0:Sr(e.executionMs),children:f.jsx(pu,{args:e.args,result:e.result,resultIsError:e.status==="failed",error:n})})}function BO({cluster:e}){const n=e.calls.flatMap(r=>r.result===void 0?[]:[r.result]),s=e.calls.flatMap(r=>{const i=el(r.history);return i===void 0?[]:[i]});return f.jsx(hu,{toolName:`${e.toolName} ×${String(e.calls.length)}`,summary:aw(e.calls.flatMap(r=>{const i=qi(r.args);return i===void 0?[]:[i]})),failed:Li(e.failedCount,!0),duration:e.executionMs===void 0?void 0:Sr(e.executionMs),children:f.jsx(pu,{args:Yb(e.calls.map(r=>r.args)),result:n.length===0?void 0:Yb(n),resultIsError:e.failedCount>0,error:s.length===0?void 0:[...new Set(s)].join(`
|
|
45
|
+
`)})})}function tp({title:e,children:n}){return f.jsx(hu,{toolName:e,children:f.jsx("div",{className:"activity-payload",children:f.jsx("pre",{children:n})})})}function dw({data:e}){const n=LO(e);if(n===void 0)return null;const s=el(n.history),r=qO(n.calls),i=n.label??n.prompt?.replace(/\s+/gu," ").trim(),c=[`${String(n.calls.length)} tool${n.calls.length===1?"":"s"}`,...n.executionMs===void 0?[]:[Sr(n.executionMs)],...n.costUsd===void 0?[]:[bp(n.costUsd)],...s===void 0?[]:["history not saved"]].join(" · ");return f.jsx(fu,{variant:"subagent",status:n.status,label:"Subagent",summary:i===void 0?n.name:`${n.name} — ${i}`,failed:Li(n.status==="failed"?1:0,!1),duration:c,children:f.jsxs("div",{className:"activity-steps",children:[n.prompt!==void 0&&f.jsx(tp,{title:"Task",children:n.prompt}),n.calls.length===0?f.jsx("p",{className:"subagent-empty",children:"No tool calls recorded."}):r.map(d=>"kind"in d?f.jsx(BO,{cluster:d},d.calls[0].toolCallId):f.jsx(HO,{call:d},d.toolCallId)),n.result!==void 0&&f.jsx(tp,{title:"Report",children:Gc(n.result)}),s!==void 0&&f.jsx(tp,{title:"History",children:s})]})})}const Gb=()=>globalThis.crypto.randomUUID(),np=e=>{if(e===void 0)return"Unknown";const n=new Date(e);return Number.isFinite(n.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(n):"Unknown"},wp=e=>`cron-run-${encodeURIComponent(e)}`;function Kb({label:e,children:n,onClose:s}){const r=v.useRef(null),i=v.useRef(s);return v.useEffect(()=>{i.current=s},[s]),v.useLayoutEffect(()=>{const c=document.activeElement instanceof HTMLElement?document.activeElement:void 0;r.current?.focus();const d=p=>{p.key==="Escape"&&i.current()};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d),c?.focus()}},[]),f.jsx("div",{className:"dialog-layer",role:"presentation",onMouseDown:s,children:f.jsx("section",{ref:r,className:"cron-dialog",role:"dialog","aria-modal":"true","aria-label":e,tabIndex:-1,onMouseDown:c=>c.stopPropagation(),children:n})})}const Fb=e=>{window.dispatchEvent(new CustomEvent("mono-agent:notice",{detail:{message:e}}))};function ZO(){const{selectedAgent:e,selectedThread:n,cronOverview:s,cronLoading:r,cronError:i,connection:c,refreshCron:d}=nn(),p=n?.trigger?.kind==="cron"?n.trigger.jobId:void 0,g=v.useMemo(()=>s?.jobs.find(Q=>Q.jobId===p),[s?.jobs,p]),[m,y]=v.useState(),[b,x]=v.useState(),[w,E]=v.useState(!1),[C,A]=v.useState(!1),[j,_]=v.useState(),O=v.useId(),R=v.useId();if(v.useEffect(()=>{y(void 0),E(!1),_(void 0)},[p,e?.sourceId]),n?.trigger?.kind!=="cron")return null;const M=e?.sourceId,U=c==="live"&&e?.status!=="offline",k=M!==void 0&&g!==void 0&&g.configured&&U&&e?.cron?.actions===!0&&s?.actionsEnabled===!0,Y=M!==void 0&&U&&e?.cron?.read===!0,H=c!=="live"||e?.status==="offline",$=s?.degradedReason??(M===void 0?"Cron controls are unavailable because no agent is selected.":H?"Cron controls are unavailable while the agent is offline.":g===void 0?"Cron controls are unavailable while the authoritative job state is loading.":g.configured?s?.actionsEnabled!==!0?"Cron operator actions are disabled by agent configuration.":e?.cron?.actions!==!0?"Cron operator actions require an operator API key, which is not configured.":void 0:"Cron controls are unavailable for a historical job that is no longer configured."),B=M===void 0?"Cron configuration is unavailable because no agent is selected.":H?"Cron configuration is unavailable while the agent is offline.":e?.cron?.read!==!0?"Cron configuration is unavailable because this agent does not expose cron operator reads.":void 0,P=async(Q,q)=>{if(M===void 0||p===void 0)throw new Error("Cron job identity is unavailable.");return Q.kind==="run"?await Ze.cronRunNow(M,p,Q.idempotencyKey,q):await Ze.cronSetEnabled(M,p,Q.enabled,Q.idempotencyKey,q)},oe=async Q=>{A(!0),_(void 0);try{const q=await P(Q);if(q.kind==="confirmation_required"){y({action:Q,confirmation:q.confirmation});return}await d(),Fb(q.replayed?"Cron action was already applied.":"Cron action applied.")}catch(q){_(q instanceof Error?q.message:"Cron action failed.")}finally{A(!1)}},le=async()=>{if(m!==void 0){A(!0),_(void 0);try{const Q=await P(m.action,m.confirmation.token);if(Q.kind==="confirmation_required"){y({action:m.action,confirmation:Q.confirmation});return}y(void 0),await d(),Fb(Q.replayed?"Cron action was already applied.":"Cron action applied.")}catch(Q){_(Q instanceof Error?Q.message:"Cron action failed.")}finally{A(!1)}}},ee=async()=>{if(M!==void 0){A(!0),_(void 0);try{x(await Ze.cronConfigView(M)),E(!0)}catch(Q){_(Q instanceof Error?Q.message:"Cron configuration is unavailable.")}finally{A(!1)}}},z=g===void 0?"Unknown":g.effectiveEnabled?"Enabled":"Disabled",G=g!==void 0&&g.declaredEnabled!==g.effectiveEnabled;return f.jsxs(f.Fragment,{children:[f.jsxs("section",{className:"cron-channel-header","aria-label":"Cron job status",children:[f.jsxs("dl",{className:"cron-channel-facts",children:[f.jsxs("div",{children:[f.jsx("dt",{children:"Schedule"}),f.jsx("dd",{children:f.jsx("code",{children:g?.expression??"Unknown"})})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Timezone"}),f.jsx("dd",{children:g?.timezone??"Unknown"})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"State"}),f.jsxs("dd",{children:[z,G&&f.jsxs("small",{children:["Config ",g.declaredEnabled?"enabled":"disabled","; runtime override ",g.effectiveEnabled?"enabled":"disabled"]})]})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Last run"}),f.jsx("dd",{title:g?.lastRun?.orderedAt,children:g?.lastRun===void 0?"Unknown":f.jsx("a",{href:`#${wp(g.lastRun.runId)}`,children:np(g.lastRun.orderedAt)})})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Next run"}),f.jsx("dd",{title:g?.nextRunAt,children:np(g?.nextRunAt)})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Health"}),f.jsxs("dd",{className:`cron-health is-${g?.health??"unknown"}`,children:[g?.health??"unknown",s?.degradedReason!==void 0&&f.jsx("small",{children:s.degradedReason})]})]})]}),f.jsxs("div",{className:"cron-channel-actions","aria-label":"Cron controls",children:[f.jsxs("button",{type:"button",className:"cron-action-primary",disabled:!k||C,"aria-describedby":$===void 0?void 0:O,onClick:()=>void oe({kind:"run",idempotencyKey:Gb()}),children:[f.jsx(Ae,{name:"spark",size:14}),"Run now"]}),f.jsx("button",{type:"button",disabled:!k||C,"aria-describedby":$===void 0?void 0:O,onClick:()=>void oe({kind:"enabled",enabled:!(g?.effectiveEnabled??!1),idempotencyKey:Gb()}),children:g?.effectiveEnabled?"Disable":"Enable"}),f.jsx("button",{type:"button",disabled:!Y||C,"aria-describedby":B===void 0?void 0:R,onClick:()=>void ee(),children:"Configuration"}),g!==void 0&&f.jsxs("span",{className:"cron-session-link",title:g.conversationId,children:["Session ",f.jsx("code",{children:g.conversationId})]})]}),$!==void 0&&f.jsx("p",{id:O,className:"cron-unavailable-reason",role:"status",tabIndex:0,children:$}),B!==void 0&&f.jsx("p",{id:R,className:"cron-unavailable-reason",role:"status",tabIndex:0,children:B}),s?.jobsTruncated===!0&&f.jsx("p",{className:"cron-unavailable-reason",role:"status",children:"Older historical jobs are omitted from this bounded overview; their saved conversations remain available."}),r&&f.jsx("span",{className:"cron-refreshing",role:"status",children:"Refreshing cron state…"}),i!=null&&f.jsx("p",{className:"cron-action-error",role:"alert",children:i}),j!==void 0&&f.jsx("p",{className:"cron-action-error",role:"alert",children:j})]}),m!==void 0&&f.jsxs(Kb,{label:"Confirm cron action",onClose:()=>!C&&y(void 0),children:[f.jsxs("header",{children:[f.jsxs("div",{children:[f.jsx("span",{className:"eyebrow",children:"Confirmation required"}),f.jsx("h2",{children:"Confirm cron action"})]}),f.jsx("button",{type:"button",className:"icon-button","aria-label":"Close",disabled:C,onClick:()=>y(void 0),children:f.jsx(Ae,{name:"close",size:17})})]}),f.jsx("p",{children:m.confirmation.message}),f.jsxs("small",{children:["Confirmation expires ",np(m.confirmation.expiresAt),"."]}),j!==void 0&&f.jsx("p",{className:"cron-action-error",role:"alert",children:j}),f.jsxs("footer",{children:[f.jsx("button",{type:"button",disabled:C,onClick:()=>y(void 0),children:"Cancel"}),f.jsx("button",{type:"button",className:"cron-action-primary",disabled:C,onClick:()=>void le(),children:C?"Applying…":"Confirm"})]})]}),w&&b!==void 0&&f.jsxs(Kb,{label:"Cron configuration",onClose:()=>E(!1),children:[f.jsxs("header",{children:[f.jsxs("div",{children:[f.jsx("span",{className:"eyebrow",children:"Redacted agent view"}),f.jsx("h2",{children:b.label})]}),f.jsx("button",{type:"button",className:"icon-button","aria-label":"Close",onClick:()=>E(!1),children:f.jsx(Ae,{name:"close",size:17})})]}),f.jsx("dl",{className:"cron-config-fields",children:b.fields.map(Q=>f.jsxs("div",{children:[f.jsx("dt",{children:Q.label}),f.jsx("dd",{children:f.jsx("code",{children:Q.value})}),f.jsxs("small",{children:[Q.source,Q.redacted===!0?" · redacted":""]})]},Q.id))}),f.jsx("footer",{children:f.jsx("button",{type:"button",onClick:()=>E(!1),children:"Close"})})]})]})}var Xb;function ce(e,n,s){function r(p,g){if(p._zod||Object.defineProperty(p,"_zod",{value:{def:g,constr:d,traits:new Set},enumerable:!1}),p._zod.traits.has(e))return;p._zod.traits.add(e),n(p,g);const m=d.prototype,y=Object.keys(m);for(let b=0;b<y.length;b++){const x=y[b];x in p||(p[x]=m[x].bind(p))}}const i=s?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function d(p){var g;const m=s?.Parent?new c:this;r(m,p),(g=m._zod).deferred??(g.deferred=[]);for(const y of m._zod.deferred)y();return m}return Object.defineProperty(d,"init",{value:r}),Object.defineProperty(d,Symbol.hasInstance,{value:p=>s?.Parent&&p instanceof s.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}class pa extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fw extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}(Xb=globalThis).__zod_globalConfig??(Xb.__zod_globalConfig={});const xh=globalThis.__zod_globalConfig;function rs(e){return xh}function pw(e){const n=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,i])=>n.indexOf(+r)===-1).map(([r,i])=>i)}function Ep(e,n){return typeof n=="bigint"?n.toString():n}function mu(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function wh(e){return e==null}function Eh(e){const n=e.startsWith("^")?1:0,s=e.endsWith("$")?e.length-1:e.length;return e.slice(n,s)}function VO(e,n){const s=e/n,r=Math.round(s),i=Number.EPSILON*Math.max(Math.abs(s),1);return Math.abs(s-r)<i?0:s-r}const Qb=Symbol("evaluating");function bt(e,n,s){let r;Object.defineProperty(e,n,{get(){if(r!==Qb)return r===void 0&&(r=Qb,r=s()),r},set(i){Object.defineProperty(e,n,{value:i})},configurable:!0})}function Tr(e,n,s){Object.defineProperty(e,n,{value:s,writable:!0,enumerable:!0,configurable:!0})}function Hs(...e){const n={};for(const s of e){const r=Object.getOwnPropertyDescriptors(s);Object.assign(n,r)}return Object.defineProperties({},n)}function Jb(e){return JSON.stringify(e)}function YO(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const hw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Hi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const GO=mu(()=>{if(xh.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function va(e){if(Hi(e)===!1)return!1;const n=e.constructor;if(n===void 0||typeof n!="function")return!0;const s=n.prototype;return!(Hi(s)===!1||Object.prototype.hasOwnProperty.call(s,"isPrototypeOf")===!1)}function mw(e){return va(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const KO=new Set(["string","number","symbol"]);function ya(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bs(e,n,s){const r=new e._zod.constr(n??e._zod.def);return(!n||s?.parent)&&(r._zod.parent=e),r}function je(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function FO(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}const XO={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function QO(e,n){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const c=Hs(e._zod.def,{get shape(){const d={};for(const p in n){if(!(p in s.shape))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(d[p]=s.shape[p])}return Tr(this,"shape",d),d},checks:[]});return Bs(e,c)}function JO(e,n){const s=e._zod.def,r=s.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const c=Hs(e._zod.def,{get shape(){const d={...e._zod.def.shape};for(const p in n){if(!(p in s.shape))throw new Error(`Unrecognized key: "${p}"`);n[p]&&delete d[p]}return Tr(this,"shape",d),d},checks:[]});return Bs(e,c)}function WO(e,n){if(!va(n))throw new Error("Invalid input to extend: expected a plain object");const s=e._zod.def.checks;if(s&&s.length>0){const c=e._zod.def.shape;for(const d in n)if(Object.getOwnPropertyDescriptor(c,d)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=Hs(e._zod.def,{get shape(){const c={...e._zod.def.shape,...n};return Tr(this,"shape",c),c}});return Bs(e,i)}function eN(e,n){if(!va(n))throw new Error("Invalid input to safeExtend: expected a plain object");const s=Hs(e._zod.def,{get shape(){const r={...e._zod.def.shape,...n};return Tr(this,"shape",r),r}});return Bs(e,s)}function tN(e,n){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const s=Hs(e._zod.def,{get shape(){const r={...e._zod.def.shape,...n._zod.def.shape};return Tr(this,"shape",r),r},get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return Bs(e,s)}function nN(e,n,s){const i=n._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const d=Hs(n._zod.def,{get shape(){const p=n._zod.def.shape,g={...p};if(s)for(const m in s){if(!(m in p))throw new Error(`Unrecognized key: "${m}"`);s[m]&&(g[m]=e?new e({type:"optional",innerType:p[m]}):p[m])}else for(const m in p)g[m]=e?new e({type:"optional",innerType:p[m]}):p[m];return Tr(this,"shape",g),g},checks:[]});return Bs(n,d)}function oN(e,n,s){const r=Hs(n._zod.def,{get shape(){const i=n._zod.def.shape,c={...i};if(s)for(const d in s){if(!(d in c))throw new Error(`Unrecognized key: "${d}"`);s[d]&&(c[d]=new e({type:"nonoptional",innerType:i[d]}))}else for(const d in i)c[d]=new e({type:"nonoptional",innerType:i[d]});return Tr(this,"shape",c),c}});return Bs(n,r)}function ca(e,n=0){if(e.aborted===!0)return!0;for(let s=n;s<e.issues.length;s++)if(e.issues[s]?.continue!==!0)return!0;return!1}function sN(e,n=0){if(e.aborted===!0)return!0;for(let s=n;s<e.issues.length;s++)if(e.issues[s]?.continue===!1)return!0;return!1}function ua(e,n){return n.map(s=>{var r;return(r=s).path??(r.path=[]),s.path.unshift(e),s})}function Ac(e){return typeof e=="string"?e:e?.message}function as(e,n,s){const r=e.message?e.message:Ac(e.inst?._zod.def?.error?.(e))??Ac(n?.error?.(e))??Ac(s.customError?.(e))??Ac(s.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:d,...p}=e;return p.path??(p.path=[]),p.message=r,n?.reportInput&&(p.input=d),p}function Th(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Bi(...e){const[n,s,r]=e;return typeof n=="string"?{message:n,code:"custom",input:s,inst:r}:{...n}}const gw=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,Ep,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},vw=ce("$ZodError",gw),yw=ce("$ZodError",gw,{Parent:Error});function rN(e,n=s=>s.message){const s={},r=[];for(const i of e.issues)i.path.length>0?(s[i.path[0]]=s[i.path[0]]||[],s[i.path[0]].push(n(i))):r.push(n(i));return{formErrors:r,fieldErrors:s}}function aN(e,n=s=>s.message){const s={_errors:[]},r=(i,c=[])=>{for(const d of i.issues)if(d.code==="invalid_union"&&d.errors.length)d.errors.map(p=>r({issues:p},[...c,...d.path]));else if(d.code==="invalid_key")r({issues:d.issues},[...c,...d.path]);else if(d.code==="invalid_element")r({issues:d.issues},[...c,...d.path]);else{const p=[...c,...d.path];if(p.length===0)s._errors.push(n(d));else{let g=s,m=0;for(;m<p.length;){const y=p[m];m===p.length-1?(g[y]=g[y]||{_errors:[]},g[y]._errors.push(n(d))):g[y]=g[y]||{_errors:[]},g=g[y],m++}}}};return r(e),s}const _h=e=>(n,s,r,i)=>{const c=r?{...r,async:!1}:{async:!1},d=n._zod.run({value:s,issues:[]},c);if(d instanceof Promise)throw new pa;if(d.issues.length){const p=new(i?.Err??e)(d.issues.map(g=>as(g,c,rs())));throw hw(p,i?.callee),p}return d.value},Rh=e=>async(n,s,r,i)=>{const c=r?{...r,async:!0}:{async:!0};let d=n._zod.run({value:s,issues:[]},c);if(d instanceof Promise&&(d=await d),d.issues.length){const p=new(i?.Err??e)(d.issues.map(g=>as(g,c,rs())));throw hw(p,i?.callee),p}return d.value},gu=e=>(n,s,r)=>{const i=r?{...r,async:!1}:{async:!1},c=n._zod.run({value:s,issues:[]},i);if(c instanceof Promise)throw new pa;return c.issues.length?{success:!1,error:new(e??vw)(c.issues.map(d=>as(d,i,rs())))}:{success:!0,data:c.value}},bw=gu(yw),vu=e=>async(n,s,r)=>{const i=r?{...r,async:!0}:{async:!0};let c=n._zod.run({value:s,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(d=>as(d,i,rs())))}:{success:!0,data:c.value}},iN=vu(yw),lN=e=>(n,s,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return _h(e)(n,s,i)},cN=e=>(n,s,r)=>_h(e)(n,s,r),uN=e=>async(n,s,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return Rh(e)(n,s,i)},dN=e=>async(n,s,r)=>Rh(e)(n,s,r),fN=e=>(n,s,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return gu(e)(n,s,i)},pN=e=>(n,s,r)=>gu(e)(n,s,r),hN=e=>async(n,s,r)=>{const i=r?{...r,direction:"backward"}:{direction:"backward"};return vu(e)(n,s,i)},mN=e=>async(n,s,r)=>vu(e)(n,s,r),gN=/^[cC][0-9a-z]{6,}$/,vN=/^[0-9a-z]+$/,yN=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bN=/^[0-9a-vA-V]{20}$/,SN=/^[A-Za-z0-9]{27}$/,xN=/^[a-zA-Z0-9_-]{21}$/,wN=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,EN=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Wb=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,TN=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_N="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function RN(){return new RegExp(_N,"u")}const CN=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,AN=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,kN=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,jN=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ON=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Sw=/^[A-Za-z0-9_-]*$/,NN=/^https?$/,MN=/^\+[1-9]\d{6,14}$/,xw="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",zN=new RegExp(`^${xw}$`);function ww(e){const n="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${n}`:e.precision===0?`${n}:[0-5]\\d`:`${n}:[0-5]\\d\\.\\d{${e.precision}}`:`${n}(?::[0-5]\\d(?:\\.\\d+)?)?`}function IN(e){return new RegExp(`^${ww(e)}$`)}function DN(e){const n=ww({precision:e.precision}),s=["Z"];e.local&&s.push(""),e.offset&&s.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${n}(?:${s.join("|")})`;return new RegExp(`^${xw}T(?:${r})$`)}const UN=e=>{const n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},PN=/^-?\d+$/,Ew=/^-?\d+(?:\.\d+)?$/,$N=/^(?:true|false)$/i,LN=/^null$/i,qN=/^undefined$/i,HN=/^[^A-Z]*$/,BN=/^[^a-z]*$/,Bn=ce("$ZodCheck",(e,n)=>{var s;e._zod??(e._zod={}),e._zod.def=n,(s=e._zod).onattach??(s.onattach=[])}),Tw={number:"number",bigint:"bigint",object:"date"},_w=ce("$ZodCheckLessThan",(e,n)=>{Bn.init(e,n);const s=Tw[typeof n.value];e._zod.onattach.push(r=>{const i=r._zod.bag,c=(n.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;n.value<c&&(n.inclusive?i.maximum=n.value:i.exclusiveMaximum=n.value)}),e._zod.check=r=>{(n.inclusive?r.value<=n.value:r.value<n.value)||r.issues.push({origin:s,code:"too_big",maximum:typeof n.value=="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Rw=ce("$ZodCheckGreaterThan",(e,n)=>{Bn.init(e,n);const s=Tw[typeof n.value];e._zod.onattach.push(r=>{const i=r._zod.bag,c=(n.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;n.value>c&&(n.inclusive?i.minimum=n.value:i.exclusiveMinimum=n.value)}),e._zod.check=r=>{(n.inclusive?r.value>=n.value:r.value>n.value)||r.issues.push({origin:s,code:"too_small",minimum:typeof n.value=="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),ZN=ce("$ZodCheckMultipleOf",(e,n)=>{Bn.init(e,n),e._zod.onattach.push(s=>{var r;(r=s._zod.bag).multipleOf??(r.multipleOf=n.value)}),e._zod.check=s=>{if(typeof s.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof s.value=="bigint"?s.value%n.value===BigInt(0):VO(s.value,n.value)===0)||s.issues.push({origin:typeof s.value,code:"not_multiple_of",divisor:n.value,input:s.value,inst:e,continue:!n.abort})}}),VN=ce("$ZodCheckNumberFormat",(e,n)=>{Bn.init(e,n),n.format=n.format||"float64";const s=n.format?.includes("int"),r=s?"int":"number",[i,c]=XO[n.format];e._zod.onattach.push(d=>{const p=d._zod.bag;p.format=n.format,p.minimum=i,p.maximum=c,s&&(p.pattern=PN)}),e._zod.check=d=>{const p=d.value;if(s){if(!Number.isInteger(p)){d.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:p,inst:e});return}if(!Number.isSafeInteger(p)){p>0?d.issues.push({input:p,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort}):d.issues.push({input:p,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});return}}p<i&&d.issues.push({origin:"number",input:p,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!n.abort}),p>c&&d.issues.push({origin:"number",input:p,code:"too_big",maximum:c,inclusive:!0,inst:e,continue:!n.abort})}}),YN=ce("$ZodCheckMaxLength",(e,n)=>{var s;Bn.init(e,n),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!wh(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<i&&(r._zod.bag.maximum=n.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=n.maximum)return;const d=Th(i);r.issues.push({origin:d,code:"too_big",maximum:n.maximum,inclusive:!0,input:i,inst:e,continue:!n.abort})}}),GN=ce("$ZodCheckMinLength",(e,n)=>{var s;Bn.init(e,n),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!wh(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>i&&(r._zod.bag.minimum=n.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=n.minimum)return;const d=Th(i);r.issues.push({origin:d,code:"too_small",minimum:n.minimum,inclusive:!0,input:i,inst:e,continue:!n.abort})}}),KN=ce("$ZodCheckLengthEquals",(e,n)=>{var s;Bn.init(e,n),(s=e._zod.def).when??(s.when=r=>{const i=r.value;return!wh(i)&&i.length!==void 0}),e._zod.onattach.push(r=>{const i=r._zod.bag;i.minimum=n.length,i.maximum=n.length,i.length=n.length}),e._zod.check=r=>{const i=r.value,c=i.length;if(c===n.length)return;const d=Th(i),p=c>n.length;r.issues.push({origin:d,...p?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),yu=ce("$ZodCheckStringFormat",(e,n)=>{var s,r;Bn.init(e,n),e._zod.onattach.push(i=>{const c=i._zod.bag;c.format=n.format,n.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(n.pattern))}),n.pattern?(s=e._zod).check??(s.check=i=>{n.pattern.lastIndex=0,!n.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:n.format,input:i.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})}):(r=e._zod).check??(r.check=()=>{})}),FN=ce("$ZodCheckRegex",(e,n)=>{yu.init(e,n),e._zod.check=s=>{n.pattern.lastIndex=0,!n.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:"regex",input:s.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),XN=ce("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=HN),yu.init(e,n)}),QN=ce("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=BN),yu.init(e,n)}),JN=ce("$ZodCheckIncludes",(e,n)=>{Bn.init(e,n);const s=ya(n.includes),r=new RegExp(typeof n.position=="number"?`^.{${n.position}}${s}`:s);n.pattern=r,e._zod.onattach.push(i=>{const c=i._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(r)}),e._zod.check=i=>{i.value.includes(n.includes,n.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:i.value,inst:e,continue:!n.abort})}}),WN=ce("$ZodCheckStartsWith",(e,n)=>{Bn.init(e,n);const s=new RegExp(`^${ya(n.prefix)}.*`);n.pattern??(n.pattern=s),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),e._zod.check=r=>{r.value.startsWith(n.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:r.value,inst:e,continue:!n.abort})}}),eM=ce("$ZodCheckEndsWith",(e,n)=>{Bn.init(e,n);const s=new RegExp(`.*${ya(n.suffix)}$`);n.pattern??(n.pattern=s),e._zod.onattach.push(r=>{const i=r._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),e._zod.check=r=>{r.value.endsWith(n.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:r.value,inst:e,continue:!n.abort})}}),tM=ce("$ZodCheckOverwrite",(e,n)=>{Bn.init(e,n),e._zod.check=s=>{s.value=n.tx(s.value)}});class nM{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const r=n.split(`
|
|
46
|
+
`).filter(d=>d),i=Math.min(...r.map(d=>d.length-d.trimStart().length)),c=r.map(d=>d.slice(i)).map(d=>" ".repeat(this.indent*2)+d);for(const d of c)this.content.push(d)}compile(){const n=Function,s=this?.args,i=[...(this?.content??[""]).map(c=>` ${c}`)];return new n(...s,i.join(`
|
|
47
|
+
`))}}const oM={major:4,minor:4,patch:3},Nt=ce("$ZodType",(e,n)=>{var s;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=oM;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const c of i._zod.onattach)c(e);if(r.length===0)(s=e._zod).deferred??(s.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(d,p,g)=>{let m=ca(d),y;for(const b of p){if(b._zod.def.when){if(sN(d)||!b._zod.def.when(d))continue}else if(m)continue;const x=d.issues.length,w=b._zod.check(d);if(w instanceof Promise&&g?.async===!1)throw new pa;if(y||w instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await w,d.issues.length!==x&&(m||(m=ca(d,x)))});else{if(d.issues.length===x)continue;m||(m=ca(d,x))}}return y?y.then(()=>d):d},c=(d,p,g)=>{if(ca(d))return d.aborted=!0,d;const m=i(p,r,g);if(m instanceof Promise){if(g.async===!1)throw new pa;return m.then(y=>e._zod.parse(y,g))}return e._zod.parse(m,g)};e._zod.run=(d,p)=>{if(p.skipChecks)return e._zod.parse(d,p);if(p.direction==="backward"){const m=e._zod.parse({value:d.value,issues:[]},{...p,skipChecks:!0});return m instanceof Promise?m.then(y=>c(y,d,p)):c(m,d,p)}const g=e._zod.parse(d,p);if(g instanceof Promise){if(p.async===!1)throw new pa;return g.then(m=>i(m,r,p))}return i(g,r,p)}}bt(e,"~standard",()=>({validate:i=>{try{const c=bw(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return iN(e,i).then(d=>d.success?{value:d.data}:{issues:d.error?.issues})}},vendor:"zod",version:1}))}),Ch=ce("$ZodString",(e,n)=>{Nt.init(e,n),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??UN(e._zod.bag),e._zod.parse=(s,r)=>{if(n.coerce)try{s.value=String(s.value)}catch{}return typeof s.value=="string"||s.issues.push({expected:"string",code:"invalid_type",input:s.value,inst:e}),s}}),$t=ce("$ZodStringFormat",(e,n)=>{yu.init(e,n),Ch.init(e,n)}),sM=ce("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=EN),$t.init(e,n)}),rM=ce("$ZodUUID",(e,n)=>{if(n.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(r===void 0)throw new Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=Wb(r))}else n.pattern??(n.pattern=Wb());$t.init(e,n)}),aM=ce("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=TN),$t.init(e,n)}),iM=ce("$ZodURL",(e,n)=>{$t.init(e,n),e._zod.check=s=>{try{const r=s.value.trim();if(!n.normalize&&n.protocol?.source===NN.source&&!/^https?:\/\//i.test(r)){s.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:s.value,inst:e,continue:!n.abort});return}const i=new URL(r);n.hostname&&(n.hostname.lastIndex=0,n.hostname.test(i.hostname)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:s.value,inst:e,continue:!n.abort})),n.protocol&&(n.protocol.lastIndex=0,n.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||s.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:s.value,inst:e,continue:!n.abort})),n.normalize?s.value=i.href:s.value=r;return}catch{s.issues.push({code:"invalid_format",format:"url",input:s.value,inst:e,continue:!n.abort})}}}),lM=ce("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=RN()),$t.init(e,n)}),cM=ce("$ZodNanoID",(e,n)=>{n.pattern??(n.pattern=xN),$t.init(e,n)}),uM=ce("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=gN),$t.init(e,n)}),dM=ce("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=vN),$t.init(e,n)}),fM=ce("$ZodULID",(e,n)=>{n.pattern??(n.pattern=yN),$t.init(e,n)}),pM=ce("$ZodXID",(e,n)=>{n.pattern??(n.pattern=bN),$t.init(e,n)}),hM=ce("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=SN),$t.init(e,n)}),mM=ce("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=DN(n)),$t.init(e,n)}),gM=ce("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=zN),$t.init(e,n)}),vM=ce("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=IN(n)),$t.init(e,n)}),yM=ce("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=wN),$t.init(e,n)}),bM=ce("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=CN),$t.init(e,n),e._zod.bag.format="ipv4"}),SM=ce("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=AN),$t.init(e,n),e._zod.bag.format="ipv6",e._zod.check=s=>{try{new URL(`http://[${s.value}]`)}catch{s.issues.push({code:"invalid_format",format:"ipv6",input:s.value,inst:e,continue:!n.abort})}}}),xM=ce("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=kN),$t.init(e,n)}),wM=ce("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=jN),$t.init(e,n),e._zod.check=s=>{const r=s.value.split("/");try{if(r.length!==2)throw new Error;const[i,c]=r;if(!c)throw new Error;const d=Number(c);if(`${d}`!==c)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch{s.issues.push({code:"invalid_format",format:"cidrv6",input:s.value,inst:e,continue:!n.abort})}}});function Cw(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const EM=ce("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=ON),$t.init(e,n),e._zod.bag.contentEncoding="base64",e._zod.check=s=>{Cw(s.value)||s.issues.push({code:"invalid_format",format:"base64",input:s.value,inst:e,continue:!n.abort})}});function TM(e){if(!Sw.test(e))return!1;const n=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),s=n.padEnd(Math.ceil(n.length/4)*4,"=");return Cw(s)}const _M=ce("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=Sw),$t.init(e,n),e._zod.bag.contentEncoding="base64url",e._zod.check=s=>{TM(s.value)||s.issues.push({code:"invalid_format",format:"base64url",input:s.value,inst:e,continue:!n.abort})}}),RM=ce("$ZodE164",(e,n)=>{n.pattern??(n.pattern=MN),$t.init(e,n)});function CM(e,n=null){try{const s=e.split(".");if(s.length!==3)return!1;const[r]=s;if(!r)return!1;const i=JSON.parse(atob(r));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||n&&(!("alg"in i)||i.alg!==n))}catch{return!1}}const AM=ce("$ZodJWT",(e,n)=>{$t.init(e,n),e._zod.check=s=>{CM(s.value,n.alg)||s.issues.push({code:"invalid_format",format:"jwt",input:s.value,inst:e,continue:!n.abort})}}),Aw=ce("$ZodNumber",(e,n)=>{Nt.init(e,n),e._zod.pattern=e._zod.bag.pattern??Ew,e._zod.parse=(s,r)=>{if(n.coerce)try{s.value=Number(s.value)}catch{}const i=s.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return s;const c=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return s.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...c?{received:c}:{}}),s}}),kM=ce("$ZodNumberFormat",(e,n)=>{VN.init(e,n),Aw.init(e,n)}),jM=ce("$ZodBoolean",(e,n)=>{Nt.init(e,n),e._zod.pattern=$N,e._zod.parse=(s,r)=>{if(n.coerce)try{s.value=!!s.value}catch{}const i=s.value;return typeof i=="boolean"||s.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),s}}),OM=ce("$ZodUndefined",(e,n)=>{Nt.init(e,n),e._zod.pattern=qN,e._zod.values=new Set([void 0]),e._zod.parse=(s,r)=>{const i=s.value;return typeof i>"u"||s.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),s}}),NM=ce("$ZodNull",(e,n)=>{Nt.init(e,n),e._zod.pattern=LN,e._zod.values=new Set([null]),e._zod.parse=(s,r)=>{const i=s.value;return i===null||s.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),s}}),MM=ce("$ZodAny",(e,n)=>{Nt.init(e,n),e._zod.parse=s=>s}),zM=ce("$ZodUnknown",(e,n)=>{Nt.init(e,n),e._zod.parse=s=>s}),IM=ce("$ZodNever",(e,n)=>{Nt.init(e,n),e._zod.parse=(s,r)=>(s.issues.push({expected:"never",code:"invalid_type",input:s.value,inst:e}),s)});function e0(e,n,s){e.issues.length&&n.issues.push(...ua(s,e.issues)),n.value[s]=e.value}const DM=ce("$ZodArray",(e,n)=>{Nt.init(e,n),e._zod.parse=(s,r)=>{const i=s.value;if(!Array.isArray(i))return s.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),s;s.value=Array(i.length);const c=[];for(let d=0;d<i.length;d++){const p=i[d],g=n.element._zod.run({value:p,issues:[]},r);g instanceof Promise?c.push(g.then(m=>e0(m,s,d))):e0(g,s,d)}return c.length?Promise.all(c).then(()=>s):s}});function Kc(e,n,s,r,i,c){const d=s in r;if(e.issues.length){if(i&&c&&!d)return;n.issues.push(...ua(s,e.issues))}if(!d&&!i){e.issues.length||n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[s]});return}e.value===void 0?d&&(n.value[s]=void 0):n.value[s]=e.value}function kw(e){const n=Object.keys(e.shape);for(const r of n)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const s=FO(e.shape);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(s)}}function jw(e,n,s,r,i,c){const d=[],p=i.keySet,g=i.catchall._zod,m=g.def.type,y=g.optin==="optional",b=g.optout==="optional";for(const x in n){if(x==="__proto__"||p.has(x))continue;if(m==="never"){d.push(x);continue}const w=g.run({value:n[x],issues:[]},r);w instanceof Promise?e.push(w.then(E=>Kc(E,s,x,n,y,b))):Kc(w,s,x,n,y,b)}return d.length&&s.issues.push({code:"unrecognized_keys",keys:d,input:n,inst:c}),e.length?Promise.all(e).then(()=>s):s}const UM=ce("$ZodObject",(e,n)=>{if(Nt.init(e,n),!Object.getOwnPropertyDescriptor(n,"shape")?.get){const p=n.shape;Object.defineProperty(n,"shape",{get:()=>{const g={...p};return Object.defineProperty(n,"shape",{value:g}),g}})}const r=mu(()=>kw(n));bt(e._zod,"propValues",()=>{const p=n.shape,g={};for(const m in p){const y=p[m]._zod;if(y.values){g[m]??(g[m]=new Set);for(const b of y.values)g[m].add(b)}}return g});const i=Hi,c=n.catchall;let d;e._zod.parse=(p,g)=>{d??(d=r.value);const m=p.value;if(!i(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p;p.value={};const y=[],b=d.shape;for(const x of d.keys){const w=b[x],E=w._zod.optin==="optional",C=w._zod.optout==="optional",A=w._zod.run({value:m[x],issues:[]},g);A instanceof Promise?y.push(A.then(j=>Kc(j,p,x,m,E,C))):Kc(A,p,x,m,E,C)}return c?jw(y,m,p,g,r.value,e):y.length?Promise.all(y).then(()=>p):p}}),PM=ce("$ZodObjectJIT",(e,n)=>{UM.init(e,n);const s=e._zod.parse,r=mu(()=>kw(n)),i=x=>{const w=new nM(["shape","payload","ctx"]),E=r.value,C=O=>{const R=Jb(O);return`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`};w.write("const input = payload.value;");const A=Object.create(null);let j=0;for(const O of E.keys)A[O]=`key_${j++}`;w.write("const newResult = {};");for(const O of E.keys){const R=A[O],M=Jb(O),U=x[O],k=U?._zod?.optin==="optional",Y=U?._zod?.optout==="optional";w.write(`const ${R} = ${C(O)};`),k&&Y?w.write(`
|
|
48
|
+
if (${R}.issues.length) {
|
|
49
|
+
if (${M} in input) {
|
|
50
|
+
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
51
|
+
...iss,
|
|
52
|
+
path: iss.path ? [${M}, ...iss.path] : [${M}]
|
|
53
|
+
})));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (${R}.value === undefined) {
|
|
58
|
+
if (${M} in input) {
|
|
59
|
+
newResult[${M}] = undefined;
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
newResult[${M}] = ${R}.value;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
`):k?w.write(`
|
|
66
|
+
if (${R}.issues.length) {
|
|
67
|
+
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
68
|
+
...iss,
|
|
69
|
+
path: iss.path ? [${M}, ...iss.path] : [${M}]
|
|
70
|
+
})));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (${R}.value === undefined) {
|
|
74
|
+
if (${M} in input) {
|
|
75
|
+
newResult[${M}] = undefined;
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
newResult[${M}] = ${R}.value;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
`):w.write(`
|
|
82
|
+
const ${R}_present = ${M} in input;
|
|
83
|
+
if (${R}.issues.length) {
|
|
84
|
+
payload.issues = payload.issues.concat(${R}.issues.map(iss => ({
|
|
85
|
+
...iss,
|
|
86
|
+
path: iss.path ? [${M}, ...iss.path] : [${M}]
|
|
87
|
+
})));
|
|
88
|
+
}
|
|
89
|
+
if (!${R}_present && !${R}.issues.length) {
|
|
90
|
+
payload.issues.push({
|
|
91
|
+
code: "invalid_type",
|
|
92
|
+
expected: "nonoptional",
|
|
93
|
+
input: undefined,
|
|
94
|
+
path: [${M}]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (${R}_present) {
|
|
99
|
+
if (${R}.value === undefined) {
|
|
100
|
+
newResult[${M}] = undefined;
|
|
101
|
+
} else {
|
|
102
|
+
newResult[${M}] = ${R}.value;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
`)}w.write("payload.value = newResult;"),w.write("return payload;");const _=w.compile();return(O,R)=>_(x,O,R)};let c;const d=Hi,p=!xh.jitless,m=p&&GO.value,y=n.catchall;let b;e._zod.parse=(x,w)=>{b??(b=r.value);const E=x.value;return d(E)?p&&m&&w?.async===!1&&w.jitless!==!0?(c||(c=i(n.shape)),x=c(x,w),y?jw([],E,x,w,b,e):x):s(x,w):(x.issues.push({expected:"object",code:"invalid_type",input:E,inst:e}),x)}});function t0(e,n,s,r){for(const c of e)if(c.issues.length===0)return n.value=c.value,n;const i=e.filter(c=>!ca(c));return i.length===1?(n.value=i[0].value,i[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:s,errors:e.map(c=>c.issues.map(d=>as(d,r,rs())))}),n)}const Ow=ce("$ZodUnion",(e,n)=>{Nt.init(e,n),bt(e._zod,"optin",()=>n.options.some(r=>r._zod.optin==="optional")?"optional":void 0),bt(e._zod,"optout",()=>n.options.some(r=>r._zod.optout==="optional")?"optional":void 0),bt(e._zod,"values",()=>{if(n.options.every(r=>r._zod.values))return new Set(n.options.flatMap(r=>Array.from(r._zod.values)))}),bt(e._zod,"pattern",()=>{if(n.options.every(r=>r._zod.pattern)){const r=n.options.map(i=>i._zod.pattern);return new RegExp(`^(${r.map(i=>Eh(i.source)).join("|")})$`)}});const s=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(s)return s(r,i);let c=!1;const d=[];for(const p of n.options){const g=p._zod.run({value:r.value,issues:[]},i);if(g instanceof Promise)d.push(g),c=!0;else{if(g.issues.length===0)return g;d.push(g)}}return c?Promise.all(d).then(p=>t0(p,r,e,i)):t0(d,r,e,i)}}),$M=ce("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,Ow.init(e,n);const s=e._zod.parse;bt(e._zod,"propValues",()=>{const i={};for(const c of n.options){const d=c._zod.propValues;if(!d||Object.keys(d).length===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(c)}"`);for(const[p,g]of Object.entries(d)){i[p]||(i[p]=new Set);for(const m of g)i[p].add(m)}}return i});const r=mu(()=>{const i=n.options,c=new Map;for(const d of i){const p=d._zod.propValues?.[n.discriminator];if(!p||p.size===0)throw new Error(`Invalid discriminated union option at index "${n.options.indexOf(d)}"`);for(const g of p){if(c.has(g))throw new Error(`Duplicate discriminator value "${String(g)}"`);c.set(g,d)}}return c});e._zod.parse=(i,c)=>{const d=i.value;if(!Hi(d))return i.issues.push({code:"invalid_type",expected:"object",input:d,inst:e}),i;const p=r.value.get(d?.[n.discriminator]);return p?p._zod.run(i,c):n.unionFallback||c.direction==="backward"?s(i,c):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,options:Array.from(r.value.keys()),input:d,path:[n.discriminator],inst:e}),i)}}),LM=ce("$ZodIntersection",(e,n)=>{Nt.init(e,n),e._zod.parse=(s,r)=>{const i=s.value,c=n.left._zod.run({value:i,issues:[]},r),d=n.right._zod.run({value:i,issues:[]},r);return c instanceof Promise||d instanceof Promise?Promise.all([c,d]).then(([g,m])=>n0(s,g,m)):n0(s,c,d)}});function Tp(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(va(e)&&va(n)){const s=Object.keys(n),r=Object.keys(e).filter(c=>s.indexOf(c)!==-1),i={...e,...n};for(const c of r){const d=Tp(e[c],n[c]);if(!d.valid)return{valid:!1,mergeErrorPath:[c,...d.mergeErrorPath]};i[c]=d.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const s=[];for(let r=0;r<e.length;r++){const i=e[r],c=n[r],d=Tp(i,c);if(!d.valid)return{valid:!1,mergeErrorPath:[r,...d.mergeErrorPath]};s.push(d.data)}return{valid:!0,data:s}}return{valid:!1,mergeErrorPath:[]}}function n0(e,n,s){const r=new Map;let i;for(const p of n.issues)if(p.code==="unrecognized_keys"){i??(i=p);for(const g of p.keys)r.has(g)||r.set(g,{}),r.get(g).l=!0}else e.issues.push(p);for(const p of s.issues)if(p.code==="unrecognized_keys")for(const g of p.keys)r.has(g)||r.set(g,{}),r.get(g).r=!0;else e.issues.push(p);const c=[...r].filter(([,p])=>p.l&&p.r).map(([p])=>p);if(c.length&&i&&e.issues.push({...i,keys:c}),ca(e))return e;const d=Tp(n.value,s.value);if(!d.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(d.mergeErrorPath)}`);return e.value=d.data,e}const qM=ce("$ZodRecord",(e,n)=>{Nt.init(e,n),e._zod.parse=(s,r)=>{const i=s.value;if(!va(i))return s.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),s;const c=[],d=n.keyType._zod.values;if(d){s.value={};const p=new Set;for(const m of d)if(typeof m=="string"||typeof m=="number"||typeof m=="symbol"){p.add(typeof m=="number"?m.toString():m);const y=n.keyType._zod.run({value:m,issues:[]},r);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(y.issues.length){s.issues.push({code:"invalid_key",origin:"record",issues:y.issues.map(w=>as(w,r,rs())),input:m,path:[m],inst:e});continue}const b=y.value,x=n.valueType._zod.run({value:i[m],issues:[]},r);x instanceof Promise?c.push(x.then(w=>{w.issues.length&&s.issues.push(...ua(m,w.issues)),s.value[b]=w.value})):(x.issues.length&&s.issues.push(...ua(m,x.issues)),s.value[b]=x.value)}let g;for(const m in i)p.has(m)||(g=g??[],g.push(m));g&&g.length>0&&s.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:g})}else{s.value={};for(const p of Reflect.ownKeys(i)){if(p==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,p))continue;let g=n.keyType._zod.run({value:p,issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof p=="string"&&Ew.test(p)&&g.issues.length){const b=n.keyType._zod.run({value:Number(p),issues:[]},r);if(b instanceof Promise)throw new Error("Async schemas not supported in object keys currently");b.issues.length===0&&(g=b)}if(g.issues.length){n.mode==="loose"?s.value[p]=i[p]:s.issues.push({code:"invalid_key",origin:"record",issues:g.issues.map(b=>as(b,r,rs())),input:p,path:[p],inst:e});continue}const y=n.valueType._zod.run({value:i[p],issues:[]},r);y instanceof Promise?c.push(y.then(b=>{b.issues.length&&s.issues.push(...ua(p,b.issues)),s.value[g.value]=b.value})):(y.issues.length&&s.issues.push(...ua(p,y.issues)),s.value[g.value]=y.value)}}return c.length?Promise.all(c).then(()=>s):s}}),HM=ce("$ZodEnum",(e,n)=>{Nt.init(e,n);const s=pw(n.entries),r=new Set(s);e._zod.values=r,e._zod.pattern=new RegExp(`^(${s.filter(i=>KO.has(typeof i)).map(i=>typeof i=="string"?ya(i):i.toString()).join("|")})$`),e._zod.parse=(i,c)=>{const d=i.value;return r.has(d)||i.issues.push({code:"invalid_value",values:s,input:d,inst:e}),i}}),BM=ce("$ZodLiteral",(e,n)=>{if(Nt.init(e,n),n.values.length===0)throw new Error("Cannot create literal schema with no valid values");const s=new Set(n.values);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.values.map(r=>typeof r=="string"?ya(r):r?ya(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,i)=>{const c=r.value;return s.has(c)||r.issues.push({code:"invalid_value",values:n.values,input:c,inst:e}),r}}),ZM=ce("$ZodTransform",(e,n)=>{Nt.init(e,n),e._zod.optin="optional",e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new fw(e.constructor.name);const i=n.transform(s.value,s);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(d=>(s.value=d,s.fallback=!0,s));if(i instanceof Promise)throw new pa;return s.value=i,s.fallback=!0,s}});function o0(e,n){return n===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Nw=ce("$ZodOptional",(e,n)=>{Nt.init(e,n),e._zod.optin="optional",e._zod.optout="optional",bt(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),bt(e._zod,"pattern",()=>{const s=n.innerType._zod.pattern;return s?new RegExp(`^(${Eh(s.source)})?$`):void 0}),e._zod.parse=(s,r)=>{if(n.innerType._zod.optin==="optional"){const i=s.value,c=n.innerType._zod.run(s,r);return c instanceof Promise?c.then(d=>o0(d,i)):o0(c,i)}return s.value===void 0?s:n.innerType._zod.run(s,r)}}),VM=ce("$ZodExactOptional",(e,n)=>{Nw.init(e,n),bt(e._zod,"values",()=>n.innerType._zod.values),bt(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(s,r)=>n.innerType._zod.run(s,r)}),YM=ce("$ZodNullable",(e,n)=>{Nt.init(e,n),bt(e._zod,"optin",()=>n.innerType._zod.optin),bt(e._zod,"optout",()=>n.innerType._zod.optout),bt(e._zod,"pattern",()=>{const s=n.innerType._zod.pattern;return s?new RegExp(`^(${Eh(s.source)}|null)$`):void 0}),bt(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(s,r)=>s.value===null?s:n.innerType._zod.run(s,r)}),GM=ce("$ZodDefault",(e,n)=>{Nt.init(e,n),e._zod.optin="optional",bt(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return n.innerType._zod.run(s,r);if(s.value===void 0)return s.value=n.defaultValue,s;const i=n.innerType._zod.run(s,r);return i instanceof Promise?i.then(c=>s0(c,n)):s0(i,n)}});function s0(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const KM=ce("$ZodPrefault",(e,n)=>{Nt.init(e,n),e._zod.optin="optional",bt(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(s,r)=>(r.direction==="backward"||s.value===void 0&&(s.value=n.defaultValue),n.innerType._zod.run(s,r))}),FM=ce("$ZodNonOptional",(e,n)=>{Nt.init(e,n),bt(e._zod,"values",()=>{const s=n.innerType._zod.values;return s?new Set([...s].filter(r=>r!==void 0)):void 0}),e._zod.parse=(s,r)=>{const i=n.innerType._zod.run(s,r);return i instanceof Promise?i.then(c=>r0(c,e)):r0(i,e)}});function r0(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const XM=ce("$ZodCatch",(e,n)=>{Nt.init(e,n),e._zod.optin="optional",bt(e._zod,"optout",()=>n.innerType._zod.optout),bt(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(s,r)=>{if(r.direction==="backward")return n.innerType._zod.run(s,r);const i=n.innerType._zod.run(s,r);return i instanceof Promise?i.then(c=>(s.value=c.value,c.issues.length&&(s.value=n.catchValue({...s,error:{issues:c.issues.map(d=>as(d,r,rs()))},input:s.value}),s.issues=[],s.fallback=!0),s)):(s.value=i.value,i.issues.length&&(s.value=n.catchValue({...s,error:{issues:i.issues.map(c=>as(c,r,rs()))},input:s.value}),s.issues=[],s.fallback=!0),s)}}),Mw=ce("$ZodPipe",(e,n)=>{Nt.init(e,n),bt(e._zod,"values",()=>n.in._zod.values),bt(e._zod,"optin",()=>n.in._zod.optin),bt(e._zod,"optout",()=>n.out._zod.optout),bt(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(s,r)=>{if(r.direction==="backward"){const c=n.out._zod.run(s,r);return c instanceof Promise?c.then(d=>kc(d,n.in,r)):kc(c,n.in,r)}const i=n.in._zod.run(s,r);return i instanceof Promise?i.then(c=>kc(c,n.out,r)):kc(i,n.out,r)}});function kc(e,n,s){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},s)}const QM=ce("$ZodPreprocess",(e,n)=>{Mw.init(e,n)}),JM=ce("$ZodReadonly",(e,n)=>{Nt.init(e,n),bt(e._zod,"propValues",()=>n.innerType._zod.propValues),bt(e._zod,"values",()=>n.innerType._zod.values),bt(e._zod,"optin",()=>n.innerType?._zod?.optin),bt(e._zod,"optout",()=>n.innerType?._zod?.optout),e._zod.parse=(s,r)=>{if(r.direction==="backward")return n.innerType._zod.run(s,r);const i=n.innerType._zod.run(s,r);return i instanceof Promise?i.then(a0):a0(i)}});function a0(e){return e.value=Object.freeze(e.value),e}const WM=ce("$ZodCustom",(e,n)=>{Bn.init(e,n),Nt.init(e,n),e._zod.parse=(s,r)=>s,e._zod.check=s=>{const r=s.value,i=n.fn(r);if(i instanceof Promise)return i.then(c=>i0(c,s,r,e));i0(i,s,r,e)}});function i0(e,n,s,r){if(!e){const i={code:"custom",input:s,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),n.issues.push(Bi(i))}}var l0;class ez{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...s){const r=s[0];return this._map.set(n,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const s=this._map.get(n);return s&&typeof s=="object"&&"id"in s&&this._idmap.delete(s.id),this._map.delete(n),this}get(n){const s=n._zod.parent;if(s){const r={...this.get(s)??{}};delete r.id;const i={...r,...this._map.get(n)};return Object.keys(i).length?i:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function tz(){return new ez}(l0=globalThis).__zod_globalRegistry??(l0.__zod_globalRegistry=tz());const ki=globalThis.__zod_globalRegistry;function nz(e,n){return new e({type:"string",...je(n)})}function oz(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...je(n)})}function c0(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...je(n)})}function sz(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...je(n)})}function rz(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...je(n)})}function az(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...je(n)})}function iz(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...je(n)})}function lz(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...je(n)})}function cz(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...je(n)})}function uz(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...je(n)})}function dz(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...je(n)})}function fz(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...je(n)})}function pz(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...je(n)})}function hz(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...je(n)})}function mz(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...je(n)})}function gz(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...je(n)})}function vz(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...je(n)})}function yz(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...je(n)})}function bz(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...je(n)})}function Sz(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...je(n)})}function xz(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...je(n)})}function wz(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...je(n)})}function Ez(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...je(n)})}function Tz(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...je(n)})}function _z(e,n){return new e({type:"string",format:"date",check:"string_format",...je(n)})}function Rz(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...je(n)})}function Cz(e,n){return new e({type:"string",format:"duration",check:"string_format",...je(n)})}function Az(e,n){return new e({type:"number",checks:[],...je(n)})}function kz(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...je(n)})}function jz(e,n){return new e({type:"boolean",...je(n)})}function Oz(e,n){return new e({type:"undefined",...je(n)})}function Nz(e,n){return new e({type:"null",...je(n)})}function Mz(e){return new e({type:"any"})}function zz(e){return new e({type:"unknown"})}function Iz(e,n){return new e({type:"never",...je(n)})}function u0(e,n){return new _w({check:"less_than",...je(n),value:e,inclusive:!1})}function op(e,n){return new _w({check:"less_than",...je(n),value:e,inclusive:!0})}function d0(e,n){return new Rw({check:"greater_than",...je(n),value:e,inclusive:!1})}function sp(e,n){return new Rw({check:"greater_than",...je(n),value:e,inclusive:!0})}function f0(e,n){return new ZN({check:"multiple_of",...je(n),value:e})}function zw(e,n){return new YN({check:"max_length",...je(n),maximum:e})}function Fc(e,n){return new GN({check:"min_length",...je(n),minimum:e})}function Iw(e,n){return new KN({check:"length_equals",...je(n),length:e})}function Dz(e,n){return new FN({check:"string_format",format:"regex",...je(n),pattern:e})}function Uz(e){return new XN({check:"string_format",format:"lowercase",...je(e)})}function Pz(e){return new QN({check:"string_format",format:"uppercase",...je(e)})}function $z(e,n){return new JN({check:"string_format",format:"includes",...je(n),includes:e})}function Lz(e,n){return new WN({check:"string_format",format:"starts_with",...je(n),prefix:e})}function qz(e,n){return new eM({check:"string_format",format:"ends_with",...je(n),suffix:e})}function Ta(e){return new tM({check:"overwrite",tx:e})}function Hz(e){return Ta(n=>n.normalize(e))}function Bz(){return Ta(e=>e.trim())}function Zz(){return Ta(e=>e.toLowerCase())}function Vz(){return Ta(e=>e.toUpperCase())}function Yz(){return Ta(e=>YO(e))}function Gz(e,n,s){return new e({type:"array",element:n,...je(s)})}function Kz(e,n,s){const r=je(s);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:n,...r})}function Fz(e,n,s){return new e({type:"custom",check:"custom",fn:n,...je(s)})}function Xz(e,n){const s=Qz(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(Bi(i,r.value,s._zod.def));else{const c=i;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=r.value),c.inst??(c.inst=s),c.continue??(c.continue=!s._zod.def.abort),r.issues.push(Bi(c))}},e(r.value,r)),n);return s}function Qz(e,n){const s=new Bn({check:"custom",...je(n)});return s._zod.check=e,s}function Dw(e){let n=e?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ki,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function tn(e,n,s={path:[],schemaPath:[]}){var r;const i=e._zod.def,c=n.seen.get(e);if(c)return c.count++,s.schemaPath.includes(e)&&(c.cycle=s.path),c.schema;const d={schema:{},count:1,cycle:void 0,path:s.path};n.seen.set(e,d);const p=e._zod.toJSONSchema?.();if(p)d.schema=p;else{const y={...s,schemaPath:[...s.schemaPath,e],path:s.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,d.schema,y);else{const x=d.schema,w=n.processors[i.type];if(!w)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);w(e,n,x,y)}const b=e._zod.parent;b&&(d.ref||(d.ref=b),tn(b,n,y),n.seen.get(b).isParent=!0)}const g=n.metadataRegistry.get(e);return g&&Object.assign(d.schema,g),n.io==="input"&&On(e)&&(delete d.schema.examples,delete d.schema.default),n.io==="input"&&"_prefault"in d.schema&&((r=d.schema).default??(r.default=d.schema._prefault)),delete d.schema._prefault,n.seen.get(e).schema}function Uw(e,n){const s=e.seen.get(n);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const d of e.seen.entries()){const p=e.metadataRegistry.get(d[0])?.id;if(p){const g=r.get(p);if(g&&g!==d[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(p,d[0])}}const i=d=>{const p=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const b=e.external.registry.get(d[0])?.id,x=e.external.uri??(E=>E);if(b)return{ref:x(b)};const w=d[1].defId??d[1].schema.id??`schema${e.counter++}`;return d[1].defId=w,{defId:w,ref:`${x("__shared")}#/${p}/${w}`}}if(d[1]===s)return{ref:"#"};const m=`#/${p}/`,y=d[1].schema.id??`__schema${e.counter++}`;return{defId:y,ref:m+y}},c=d=>{if(d[1].schema.$ref)return;const p=d[1],{ref:g,defId:m}=i(d);p.def={...p.schema},m&&(p.defId=m);const y=p.schema;for(const b in y)delete y[b];y.$ref=g};if(e.cycles==="throw")for(const d of e.seen.entries()){const p=d[1];if(p.cycle)throw new Error(`Cycle detected: #/${p.cycle?.join("/")}/<root>
|
|
107
|
+
|
|
108
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const d of e.seen.entries()){const p=d[1];if(n===d[0]){c(d);continue}if(e.external){const m=e.external.registry.get(d[0])?.id;if(n!==d[0]&&m){c(d);continue}}if(e.metadataRegistry.get(d[0])?.id){c(d);continue}if(p.cycle){c(d);continue}if(p.count>1&&e.reused==="ref"){c(d);continue}}}function Pw(e,n){const s=e.seen.get(n);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=p=>{const g=e.seen.get(p);if(g.ref===null)return;const m=g.def??g.schema,y={...m},b=g.ref;if(g.ref=null,b){r(b);const w=e.seen.get(b),E=w.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(E)):Object.assign(m,E),Object.assign(m,y),p._zod.parent===b)for(const A in m)A==="$ref"||A==="allOf"||A in y||delete m[A];if(E.$ref&&w.def)for(const A in m)A==="$ref"||A==="allOf"||A in w.def&&JSON.stringify(m[A])===JSON.stringify(w.def[A])&&delete m[A]}const x=p._zod.parent;if(x&&x!==b){r(x);const w=e.seen.get(x);if(w?.schema.$ref&&(m.$ref=w.schema.$ref,w.def))for(const E in m)E==="$ref"||E==="allOf"||E in w.def&&JSON.stringify(m[E])===JSON.stringify(w.def[E])&&delete m[E]}e.override({zodSchema:p,jsonSchema:m,path:g.path??[]})};for(const p of[...e.seen.entries()].reverse())r(p[0]);const i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const p=e.external.registry.get(n)?.id;if(!p)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(p)}Object.assign(i,s.def??s.schema);const c=e.metadataRegistry.get(n)?.id;c!==void 0&&i.id===c&&delete i.id;const d=e.external?.defs??{};for(const p of e.seen.entries()){const g=p[1];g.def&&g.defId&&(g.def.id===g.defId&&delete g.def.id,d[g.defId]=g.def)}e.external||Object.keys(d).length>0&&(e.target==="draft-2020-12"?i.$defs=d:i.definitions=d);try{const p=JSON.parse(JSON.stringify(i));return Object.defineProperty(p,"~standard",{value:{...n["~standard"],jsonSchema:{input:Xc(n,"input",e.processors),output:Xc(n,"output",e.processors)}},enumerable:!1,writable:!1}),p}catch{throw new Error("Error converting schema to JSON.")}}function On(e,n){const s=n??{seen:new Set};if(s.seen.has(e))return!1;s.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return On(r.element,s);if(r.type==="set")return On(r.valueType,s);if(r.type==="lazy")return On(r.getter(),s);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return On(r.innerType,s);if(r.type==="intersection")return On(r.left,s)||On(r.right,s);if(r.type==="record"||r.type==="map")return On(r.keyType,s)||On(r.valueType,s);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:On(r.in,s)||On(r.out,s);if(r.type==="object"){for(const i in r.shape)if(On(r.shape[i],s))return!0;return!1}if(r.type==="union"){for(const i of r.options)if(On(i,s))return!0;return!1}if(r.type==="tuple"){for(const i of r.items)if(On(i,s))return!0;return!!(r.rest&&On(r.rest,s))}return!1}const Jz=(e,n={})=>s=>{const r=Dw({...s,processors:n});return tn(e,r),Uw(r,e),Pw(r,e)},Xc=(e,n,s={})=>r=>{const{libraryOptions:i,target:c}=r??{},d=Dw({...i??{},target:c,io:n,processors:s});return tn(e,d),Uw(d,e),Pw(d,e)},Wz={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},e2=(e,n,s,r)=>{const i=s;i.type="string";const{minimum:c,maximum:d,format:p,patterns:g,contentEncoding:m}=e._zod.bag;if(typeof c=="number"&&(i.minLength=c),typeof d=="number"&&(i.maxLength=d),p&&(i.format=Wz[p]??p,i.format===""&&delete i.format,p==="time"&&delete i.format),m&&(i.contentEncoding=m),g&&g.size>0){const y=[...g];y.length===1?i.pattern=y[0].source:y.length>1&&(i.allOf=[...y.map(b=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:b.source}))])}},t2=(e,n,s,r)=>{const i=s,{minimum:c,maximum:d,format:p,multipleOf:g,exclusiveMaximum:m,exclusiveMinimum:y}=e._zod.bag;typeof p=="string"&&p.includes("int")?i.type="integer":i.type="number";const b=typeof y=="number"&&y>=(c??Number.NEGATIVE_INFINITY),x=typeof m=="number"&&m<=(d??Number.POSITIVE_INFINITY),w=n.target==="draft-04"||n.target==="openapi-3.0";b?w?(i.minimum=y,i.exclusiveMinimum=!0):i.exclusiveMinimum=y:typeof c=="number"&&(i.minimum=c),x?w?(i.maximum=m,i.exclusiveMaximum=!0):i.exclusiveMaximum=m:typeof d=="number"&&(i.maximum=d),typeof g=="number"&&(i.multipleOf=g)},n2=(e,n,s,r)=>{s.type="boolean"},o2=(e,n,s,r)=>{n.target==="openapi-3.0"?(s.type="string",s.nullable=!0,s.enum=[null]):s.type="null"},s2=(e,n,s,r)=>{if(n.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},r2=(e,n,s,r)=>{s.not={}},a2=(e,n,s,r)=>{},i2=(e,n,s,r)=>{},l2=(e,n,s,r)=>{const i=e._zod.def,c=pw(i.entries);c.every(d=>typeof d=="number")&&(s.type="number"),c.every(d=>typeof d=="string")&&(s.type="string"),s.enum=c},c2=(e,n,s,r)=>{const i=e._zod.def,c=[];for(const d of i.values)if(d===void 0){if(n.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof d=="bigint"){if(n.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");c.push(Number(d))}else c.push(d);if(c.length!==0)if(c.length===1){const d=c[0];s.type=d===null?"null":typeof d,n.target==="draft-04"||n.target==="openapi-3.0"?s.enum=[d]:s.const=d}else c.every(d=>typeof d=="number")&&(s.type="number"),c.every(d=>typeof d=="string")&&(s.type="string"),c.every(d=>typeof d=="boolean")&&(s.type="boolean"),c.every(d=>d===null)&&(s.type="null"),s.enum=c},u2=(e,n,s,r)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},d2=(e,n,s,r)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},f2=(e,n,s,r)=>{const i=s,c=e._zod.def,{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(i.minItems=d),typeof p=="number"&&(i.maxItems=p),i.type="array",i.items=tn(c.element,n,{...r,path:[...r.path,"items"]})},p2=(e,n,s,r)=>{const i=s,c=e._zod.def;i.type="object",i.properties={};const d=c.shape;for(const m in d)i.properties[m]=tn(d[m],n,{...r,path:[...r.path,"properties",m]});const p=new Set(Object.keys(d)),g=new Set([...p].filter(m=>{const y=c.shape[m]._zod;return n.io==="input"?y.optin===void 0:y.optout===void 0}));g.size>0&&(i.required=Array.from(g)),c.catchall?._zod.def.type==="never"?i.additionalProperties=!1:c.catchall?c.catchall&&(i.additionalProperties=tn(c.catchall,n,{...r,path:[...r.path,"additionalProperties"]})):n.io==="output"&&(i.additionalProperties=!1)},h2=(e,n,s,r)=>{const i=e._zod.def,c=i.inclusive===!1,d=i.options.map((p,g)=>tn(p,n,{...r,path:[...r.path,c?"oneOf":"anyOf",g]}));c?s.oneOf=d:s.anyOf=d},m2=(e,n,s,r)=>{const i=e._zod.def,c=tn(i.left,n,{...r,path:[...r.path,"allOf",0]}),d=tn(i.right,n,{...r,path:[...r.path,"allOf",1]}),p=m=>"allOf"in m&&Object.keys(m).length===1,g=[...p(c)?c.allOf:[c],...p(d)?d.allOf:[d]];s.allOf=g},g2=(e,n,s,r)=>{const i=s,c=e._zod.def;i.type="object";const d=c.keyType,g=d._zod.bag?.patterns;if(c.mode==="loose"&&g&&g.size>0){const y=tn(c.valueType,n,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const b of g)i.patternProperties[b.source]=y}else(n.target==="draft-07"||n.target==="draft-2020-12")&&(i.propertyNames=tn(c.keyType,n,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=tn(c.valueType,n,{...r,path:[...r.path,"additionalProperties"]});const m=d._zod.values;if(m){const y=[...m].filter(b=>typeof b=="string"||typeof b=="number");y.length>0&&(i.required=y)}},v2=(e,n,s,r)=>{const i=e._zod.def,c=tn(i.innerType,n,r),d=n.seen.get(e);n.target==="openapi-3.0"?(d.ref=i.innerType,s.nullable=!0):s.anyOf=[c,{type:"null"}]},y2=(e,n,s,r)=>{const i=e._zod.def;tn(i.innerType,n,r);const c=n.seen.get(e);c.ref=i.innerType},b2=(e,n,s,r)=>{const i=e._zod.def;tn(i.innerType,n,r);const c=n.seen.get(e);c.ref=i.innerType,s.default=JSON.parse(JSON.stringify(i.defaultValue))},S2=(e,n,s,r)=>{const i=e._zod.def;tn(i.innerType,n,r);const c=n.seen.get(e);c.ref=i.innerType,n.io==="input"&&(s._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},x2=(e,n,s,r)=>{const i=e._zod.def;tn(i.innerType,n,r);const c=n.seen.get(e);c.ref=i.innerType;let d;try{d=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}s.default=d},w2=(e,n,s,r)=>{const i=e._zod.def,c=i.in._zod.traits.has("$ZodTransform"),d=n.io==="input"?c?i.out:i.in:i.out;tn(d,n,r);const p=n.seen.get(e);p.ref=d},E2=(e,n,s,r)=>{const i=e._zod.def;tn(i.innerType,n,r);const c=n.seen.get(e);c.ref=i.innerType,s.readOnly=!0},$w=(e,n,s,r)=>{const i=e._zod.def;tn(i.innerType,n,r);const c=n.seen.get(e);c.ref=i.innerType},T2=ce("ZodISODateTime",(e,n)=>{mM.init(e,n),Zt.init(e,n)});function Lw(e){return Tz(T2,e)}const _2=ce("ZodISODate",(e,n)=>{gM.init(e,n),Zt.init(e,n)});function R2(e){return _z(_2,e)}const C2=ce("ZodISOTime",(e,n)=>{vM.init(e,n),Zt.init(e,n)});function A2(e){return Rz(C2,e)}const k2=ce("ZodISODuration",(e,n)=>{yM.init(e,n),Zt.init(e,n)});function j2(e){return Cz(k2,e)}const O2=(e,n)=>{vw.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:s=>aN(e,s)},flatten:{value:s=>rN(e,s)},addIssue:{value:s=>{e.issues.push(s),e.message=JSON.stringify(e.issues,Ep,2)}},addIssues:{value:s=>{e.issues.push(...s),e.message=JSON.stringify(e.issues,Ep,2)}},isEmpty:{get(){return e.issues.length===0}}})},ho=ce("ZodError",O2,{Parent:Error}),N2=_h(ho),M2=Rh(ho),z2=gu(ho),I2=vu(ho),D2=lN(ho),U2=cN(ho),P2=uN(ho),$2=dN(ho),L2=fN(ho),q2=pN(ho),H2=hN(ho),B2=mN(ho),p0=new WeakMap;function tl(e,n,s){const r=Object.getPrototypeOf(e);let i=p0.get(r);if(i||(i=new Set,p0.set(r,i)),!i.has(n)){i.add(n);for(const c in s){const d=s[c];Object.defineProperty(r,c,{configurable:!0,enumerable:!1,get(){const p=d.bind(this);return Object.defineProperty(this,c,{configurable:!0,writable:!0,enumerable:!0,value:p}),p},set(p){Object.defineProperty(this,c,{configurable:!0,writable:!0,enumerable:!0,value:p})}})}}}const Mt=ce("ZodType",(e,n)=>(Nt.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:Xc(e,"input"),output:Xc(e,"output")}}),e.toJSONSchema=Jz(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(s,r)=>N2(e,s,r,{callee:e.parse}),e.safeParse=(s,r)=>z2(e,s,r),e.parseAsync=async(s,r)=>M2(e,s,r,{callee:e.parseAsync}),e.safeParseAsync=async(s,r)=>I2(e,s,r),e.spa=e.safeParseAsync,e.encode=(s,r)=>D2(e,s,r),e.decode=(s,r)=>U2(e,s,r),e.encodeAsync=async(s,r)=>P2(e,s,r),e.decodeAsync=async(s,r)=>$2(e,s,r),e.safeEncode=(s,r)=>L2(e,s,r),e.safeDecode=(s,r)=>q2(e,s,r),e.safeEncodeAsync=async(s,r)=>H2(e,s,r),e.safeDecodeAsync=async(s,r)=>B2(e,s,r),tl(e,"ZodType",{check(...s){const r=this.def;return this.clone(Hs(r,{checks:[...r.checks??[],...s.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...s){return this.check(...s)},clone(s,r){return Bs(this,s,r)},brand(){return this},register(s,r){return s.add(this,r),this},refine(s,r){return this.check(II(s,r))},superRefine(s,r){return this.check(DI(s,r))},overwrite(s){return this.check(Ta(s))},optional(){return Bt(this)},exactOptional(){return wI(this)},nullable(){return v0(this)},nullish(){return Bt(v0(this))},nonoptional(s){return AI(this,s)},array(){return Ye(this)},or(s){return ct([this,s])},and(s){return Ah(this,s)},transform(s){return y0(this,Gw(s))},default(s){return _I(this,s)},prefault(s){return CI(this,s)},catch(s){return jI(this,s)},pipe(s){return y0(this,s)},readonly(){return MI(this)},describe(s){const r=this.clone();return ki.add(r,{description:s}),r},meta(...s){if(s.length===0)return ki.get(this);const r=this.clone();return ki.add(r,s[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(s){return s(this)}}),Object.defineProperty(e,"description",{get(){return ki.get(e)?.description},configurable:!0}),e)),qw=ce("_ZodString",(e,n)=>{Ch.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(r,i,c)=>e2(e,r,i);const s=e._zod.bag;e.format=s.format??null,e.minLength=s.minimum??null,e.maxLength=s.maximum??null,tl(e,"_ZodString",{regex(...r){return this.check(Dz(...r))},includes(...r){return this.check($z(...r))},startsWith(...r){return this.check(Lz(...r))},endsWith(...r){return this.check(qz(...r))},min(...r){return this.check(Fc(...r))},max(...r){return this.check(zw(...r))},length(...r){return this.check(Iw(...r))},nonempty(...r){return this.check(Fc(1,...r))},lowercase(r){return this.check(Uz(r))},uppercase(r){return this.check(Pz(r))},trim(){return this.check(Bz())},normalize(...r){return this.check(Hz(...r))},toLowerCase(){return this.check(Zz())},toUpperCase(){return this.check(Vz())},slugify(){return this.check(Yz())}})}),Z2=ce("ZodString",(e,n)=>{Ch.init(e,n),qw.init(e,n),e.email=s=>e.check(oz(V2,s)),e.url=s=>e.check(lz(Y2,s)),e.jwt=s=>e.check(Ez(iI,s)),e.emoji=s=>e.check(cz(G2,s)),e.guid=s=>e.check(c0(h0,s)),e.uuid=s=>e.check(sz(jc,s)),e.uuidv4=s=>e.check(rz(jc,s)),e.uuidv6=s=>e.check(az(jc,s)),e.uuidv7=s=>e.check(iz(jc,s)),e.nanoid=s=>e.check(uz(K2,s)),e.guid=s=>e.check(c0(h0,s)),e.cuid=s=>e.check(dz(F2,s)),e.cuid2=s=>e.check(fz(X2,s)),e.ulid=s=>e.check(pz(Q2,s)),e.base64=s=>e.check(Sz(sI,s)),e.base64url=s=>e.check(xz(rI,s)),e.xid=s=>e.check(hz(J2,s)),e.ksuid=s=>e.check(mz(W2,s)),e.ipv4=s=>e.check(gz(eI,s)),e.ipv6=s=>e.check(vz(tI,s)),e.cidrv4=s=>e.check(yz(nI,s)),e.cidrv6=s=>e.check(bz(oI,s)),e.e164=s=>e.check(wz(aI,s)),e.datetime=s=>e.check(Lw(s)),e.date=s=>e.check(R2(s)),e.time=s=>e.check(A2(s)),e.duration=s=>e.check(j2(s))});function V(e){return nz(Z2,e)}const Zt=ce("ZodStringFormat",(e,n)=>{$t.init(e,n),qw.init(e,n)}),V2=ce("ZodEmail",(e,n)=>{aM.init(e,n),Zt.init(e,n)}),h0=ce("ZodGUID",(e,n)=>{sM.init(e,n),Zt.init(e,n)}),jc=ce("ZodUUID",(e,n)=>{rM.init(e,n),Zt.init(e,n)}),Y2=ce("ZodURL",(e,n)=>{iM.init(e,n),Zt.init(e,n)}),G2=ce("ZodEmoji",(e,n)=>{lM.init(e,n),Zt.init(e,n)}),K2=ce("ZodNanoID",(e,n)=>{cM.init(e,n),Zt.init(e,n)}),F2=ce("ZodCUID",(e,n)=>{uM.init(e,n),Zt.init(e,n)}),X2=ce("ZodCUID2",(e,n)=>{dM.init(e,n),Zt.init(e,n)}),Q2=ce("ZodULID",(e,n)=>{fM.init(e,n),Zt.init(e,n)}),J2=ce("ZodXID",(e,n)=>{pM.init(e,n),Zt.init(e,n)}),W2=ce("ZodKSUID",(e,n)=>{hM.init(e,n),Zt.init(e,n)}),eI=ce("ZodIPv4",(e,n)=>{bM.init(e,n),Zt.init(e,n)}),tI=ce("ZodIPv6",(e,n)=>{SM.init(e,n),Zt.init(e,n)}),nI=ce("ZodCIDRv4",(e,n)=>{xM.init(e,n),Zt.init(e,n)}),oI=ce("ZodCIDRv6",(e,n)=>{wM.init(e,n),Zt.init(e,n)}),sI=ce("ZodBase64",(e,n)=>{EM.init(e,n),Zt.init(e,n)}),rI=ce("ZodBase64URL",(e,n)=>{_M.init(e,n),Zt.init(e,n)}),aI=ce("ZodE164",(e,n)=>{RM.init(e,n),Zt.init(e,n)}),iI=ce("ZodJWT",(e,n)=>{AM.init(e,n),Zt.init(e,n)}),Hw=ce("ZodNumber",(e,n)=>{Aw.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(r,i,c)=>t2(e,r,i),tl(e,"ZodNumber",{gt(r,i){return this.check(d0(r,i))},gte(r,i){return this.check(sp(r,i))},min(r,i){return this.check(sp(r,i))},lt(r,i){return this.check(u0(r,i))},lte(r,i){return this.check(op(r,i))},max(r,i){return this.check(op(r,i))},int(r){return this.check(m0(r))},safe(r){return this.check(m0(r))},positive(r){return this.check(d0(0,r))},nonnegative(r){return this.check(sp(0,r))},negative(r){return this.check(u0(0,r))},nonpositive(r){return this.check(op(0,r))},multipleOf(r,i){return this.check(f0(r,i))},step(r,i){return this.check(f0(r,i))},finite(){return this}});const s=e._zod.bag;e.minValue=Math.max(s.minimum??Number.NEGATIVE_INFINITY,s.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(s.maximum??Number.POSITIVE_INFINITY,s.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(s.format??"").includes("int")||Number.isSafeInteger(s.multipleOf??.5),e.isFinite=!0,e.format=s.format??null});function Qe(e){return Az(Hw,e)}const lI=ce("ZodNumberFormat",(e,n)=>{kM.init(e,n),Hw.init(e,n)});function m0(e){return kz(lI,e)}const cI=ce("ZodBoolean",(e,n)=>{jM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>n2(e,s,r)});function Ot(e){return jz(cI,e)}const uI=ce("ZodUndefined",(e,n)=>{OM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>s2(e,s)});function _p(e){return Oz(uI,e)}const dI=ce("ZodNull",(e,n)=>{NM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>o2(e,s,r)});function fI(e){return Nz(dI,e)}const pI=ce("ZodAny",(e,n)=>{MM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>a2()});function Bw(){return Mz(pI)}const hI=ce("ZodUnknown",(e,n)=>{zM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>i2()});function At(){return zz(hI)}const mI=ce("ZodNever",(e,n)=>{IM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>r2(e,s,r)});function Rp(e){return Iz(mI,e)}const gI=ce("ZodArray",(e,n)=>{DM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>f2(e,s,r,i),e.element=n.element,tl(e,"ZodArray",{min(s,r){return this.check(Fc(s,r))},nonempty(s){return this.check(Fc(1,s))},max(s,r){return this.check(zw(s,r))},length(s,r){return this.check(Iw(s,r))},unwrap(){return this.element}})});function Ye(e,n){return Gz(gI,e,n)}const Zw=ce("ZodObject",(e,n)=>{PM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>p2(e,s,r,i),bt(e,"shape",()=>n.shape),tl(e,"ZodObject",{keyof(){return eo(Object.keys(this._zod.def.shape))},catchall(s){return this.clone({...this._zod.def,catchall:s})},passthrough(){return this.clone({...this._zod.def,catchall:At()})},loose(){return this.clone({...this._zod.def,catchall:At()})},strict(){return this.clone({...this._zod.def,catchall:Rp()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(s){return WO(this,s)},safeExtend(s){return eN(this,s)},merge(s){return tN(this,s)},pick(s){return QO(this,s)},omit(s){return JO(this,s)},partial(...s){return nN(Kw,this,s[0])},required(...s){return oN(Fw,this,s[0])}})});function te(e,n){const s={type:"object",shape:e??{},...je(n)};return new Zw(s)}function qn(e,n){return new Zw({type:"object",shape:e,catchall:At(),...je(n)})}const Vw=ce("ZodUnion",(e,n)=>{Ow.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>h2(e,s,r,i),e.options=n.options});function ct(e,n){return new Vw({type:"union",options:e,...je(n)})}const vI=ce("ZodDiscriminatedUnion",(e,n)=>{Vw.init(e,n),$M.init(e,n)});function Yw(e,n,s){return new vI({type:"union",options:n,discriminator:e,...je(s)})}const yI=ce("ZodIntersection",(e,n)=>{LM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>m2(e,s,r,i)});function Ah(e,n){return new yI({type:"intersection",left:e,right:n})}const g0=ce("ZodRecord",(e,n)=>{qM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>g2(e,s,r,i),e.keyType=n.keyType,e.valueType=n.valueType});function dt(e,n,s){return!n||!n._zod?new g0({type:"record",keyType:V(),valueType:e,...je(n)}):new g0({type:"record",keyType:e,valueType:n,...je(s)})}const Cp=ce("ZodEnum",(e,n)=>{HM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(r,i,c)=>l2(e,r,i),e.enum=n.entries,e.options=Object.values(n.entries);const s=new Set(Object.keys(n.entries));e.extract=(r,i)=>{const c={};for(const d of r)if(s.has(d))c[d]=n.entries[d];else throw new Error(`Key ${d} not found in enum`);return new Cp({...n,checks:[],...je(i),entries:c})},e.exclude=(r,i)=>{const c={...n.entries};for(const d of r)if(s.has(d))delete c[d];else throw new Error(`Key ${d} not found in enum`);return new Cp({...n,checks:[],...je(i),entries:c})}});function eo(e,n){const s=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Cp({type:"enum",entries:s,...je(n)})}const bI=ce("ZodLiteral",(e,n)=>{BM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>c2(e,s,r),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function K(e,n){return new bI({type:"literal",values:Array.isArray(e)?e:[e],...je(n)})}const SI=ce("ZodTransform",(e,n)=>{ZM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>d2(e,s),e._zod.parse=(s,r)=>{if(r.direction==="backward")throw new fw(e.constructor.name);s.addIssue=c=>{if(typeof c=="string")s.issues.push(Bi(c,s.value,n));else{const d=c;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=s.value),d.inst??(d.inst=e),s.issues.push(Bi(d))}};const i=n.transform(s.value,s);return i instanceof Promise?i.then(c=>(s.value=c,s.fallback=!0,s)):(s.value=i,s.fallback=!0,s)}});function Gw(e){return new SI({type:"transform",transform:e})}const Kw=ce("ZodOptional",(e,n)=>{Nw.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>$w(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function Bt(e){return new Kw({type:"optional",innerType:e})}const xI=ce("ZodExactOptional",(e,n)=>{VM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>$w(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function wI(e){return new xI({type:"optional",innerType:e})}const EI=ce("ZodNullable",(e,n)=>{YM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>v2(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function v0(e){return new EI({type:"nullable",innerType:e})}const TI=ce("ZodDefault",(e,n)=>{GM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>b2(e,s,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _I(e,n){return new TI({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():mw(n)}})}const RI=ce("ZodPrefault",(e,n)=>{KM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>S2(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function CI(e,n){return new RI({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():mw(n)}})}const Fw=ce("ZodNonOptional",(e,n)=>{FM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>y2(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function AI(e,n){return new Fw({type:"nonoptional",innerType:e,...je(n)})}const kI=ce("ZodCatch",(e,n)=>{XM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>x2(e,s,r,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function jI(e,n){return new kI({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const Xw=ce("ZodPipe",(e,n)=>{Mw.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>w2(e,s,r,i),e.in=n.in,e.out=n.out});function y0(e,n){return new Xw({type:"pipe",in:e,out:n})}const OI=ce("ZodPreprocess",(e,n)=>{Xw.init(e,n),QM.init(e,n)}),NI=ce("ZodReadonly",(e,n)=>{JM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>E2(e,s,r,i),e.unwrap=()=>e._zod.def.innerType});function MI(e){return new NI({type:"readonly",innerType:e})}const Qw=ce("ZodCustom",(e,n)=>{WM.init(e,n),Mt.init(e,n),e._zod.processJSONSchema=(s,r,i)=>u2(e,s)});function zI(e,n){return Kz(Qw,e??(()=>!0),n)}function II(e,n={}){return Fz(Qw,e,n)}function DI(e,n){return Xz(e,n)}function Jw(e,n){return new OI({type:"pipe",in:Gw(e),out:n})}const dr="io.modelcontextprotocol/related-task",bu="2.0",dn=zI(e=>e!==null&&(typeof e=="object"||typeof e=="function")),Ww=ct([V(),Qe().int()]),eE=V();qn({ttl:Qe().optional(),pollInterval:Qe().optional()});const UI=te({ttl:Qe().optional()}),PI=te({taskId:V()}),kh=qn({progressToken:Ww.optional(),[dr]:PI.optional()}),to=te({_meta:kh.optional()}),nl=to.extend({task:UI.optional()}),$I=e=>nl.safeParse(e).success,wn=te({method:V(),params:to.loose().optional()}),mo=te({_meta:kh.optional()}),go=te({method:V(),params:mo.loose().optional()}),En=qn({_meta:kh.optional()}),ol=ct([V(),Qe().int()]),tE=te({jsonrpc:K(bu),id:ol,...wn.shape}).strict(),b0=e=>tE.safeParse(e).success,nE=te({jsonrpc:K(bu),...go.shape}).strict(),LI=e=>nE.safeParse(e).success,jh=te({jsonrpc:K(bu),id:ol,result:En}).strict(),Oc=e=>jh.safeParse(e).success;var yt;(function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(yt||(yt={}));const Oh=te({jsonrpc:K(bu),id:ol.optional(),error:te({code:Qe().int(),message:V(),data:At().optional()})}).strict(),qI=e=>Oh.safeParse(e).success,HI=ct([tE,nE,jh,Oh]);ct([jh,Oh]);const oE=En.strict(),BI=mo.extend({requestId:ol.optional(),reason:V().optional()}),Nh=go.extend({method:K("notifications/cancelled"),params:BI}),ZI=te({src:V(),mimeType:V().optional(),sizes:Ye(V()).optional(),theme:eo(["light","dark"]).optional()}),sl=te({icons:Ye(ZI).optional()}),ba=te({name:V(),title:V().optional()}),Su=ba.extend({...ba.shape,...sl.shape,version:V(),websiteUrl:V().optional(),description:V().optional()}),VI=Ah(te({applyDefaults:Ot().optional()}),dt(V(),At())),YI=Jw(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Ah(te({form:VI.optional(),url:dn.optional()}),dt(V(),At()).optional())),GI=qn({list:dn.optional(),cancel:dn.optional(),requests:qn({sampling:qn({createMessage:dn.optional()}).optional(),elicitation:qn({create:dn.optional()}).optional()}).optional()}),KI=qn({list:dn.optional(),cancel:dn.optional(),requests:qn({tools:qn({call:dn.optional()}).optional()}).optional()}),FI=te({experimental:dt(V(),dn).optional(),sampling:te({context:dn.optional(),tools:dn.optional()}).optional(),elicitation:YI.optional(),roots:te({listChanged:Ot().optional()}).optional(),tasks:GI.optional(),extensions:dt(V(),dn).optional()}),XI=to.extend({protocolVersion:V(),capabilities:FI,clientInfo:Su}),QI=wn.extend({method:K("initialize"),params:XI}),JI=te({experimental:dt(V(),dn).optional(),logging:dn.optional(),completions:dn.optional(),prompts:te({listChanged:Ot().optional()}).optional(),resources:te({subscribe:Ot().optional(),listChanged:Ot().optional()}).optional(),tools:te({listChanged:Ot().optional()}).optional(),tasks:KI.optional(),extensions:dt(V(),dn).optional()}),WI=En.extend({protocolVersion:V(),capabilities:JI,serverInfo:Su,instructions:V().optional()}),eD=go.extend({method:K("notifications/initialized"),params:mo.optional()}),xu=wn.extend({method:K("ping"),params:to.optional()}),tD=te({progress:Qe(),total:Bt(Qe()),message:Bt(V())}),nD=te({...mo.shape,...tD.shape,progressToken:Ww}),Mh=go.extend({method:K("notifications/progress"),params:nD}),oD=to.extend({cursor:eE.optional()}),rl=wn.extend({params:oD.optional()}),al=En.extend({nextCursor:eE.optional()}),sD=eo(["working","input_required","completed","failed","cancelled"]),il=te({taskId:V(),status:sD,ttl:ct([Qe(),fI()]),createdAt:V(),lastUpdatedAt:V(),pollInterval:Bt(Qe()),statusMessage:Bt(V())}),zh=En.extend({task:il}),rD=mo.merge(il),Qc=go.extend({method:K("notifications/tasks/status"),params:rD}),Ih=wn.extend({method:K("tasks/get"),params:to.extend({taskId:V()})}),Dh=En.merge(il),Uh=wn.extend({method:K("tasks/result"),params:to.extend({taskId:V()})});En.loose();const Ph=rl.extend({method:K("tasks/list")}),$h=al.extend({tasks:Ye(il)}),Lh=wn.extend({method:K("tasks/cancel"),params:to.extend({taskId:V()})}),aD=En.merge(il),sE=te({uri:V(),mimeType:Bt(V()),_meta:dt(V(),At()).optional()}),rE=sE.extend({text:V()}),qh=V().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),aE=sE.extend({blob:qh}),ll=eo(["user","assistant"]),_a=te({audience:Ye(ll).optional(),priority:Qe().min(0).max(1).optional(),lastModified:Lw({offset:!0}).optional()}),iE=te({...ba.shape,...sl.shape,uri:V(),description:Bt(V()),mimeType:Bt(V()),size:Bt(Qe()),annotations:_a.optional(),_meta:Bt(qn({}))}),iD=te({...ba.shape,...sl.shape,uriTemplate:V(),description:Bt(V()),mimeType:Bt(V()),annotations:_a.optional(),_meta:Bt(qn({}))}),lE=rl.extend({method:K("resources/list")}),cE=al.extend({resources:Ye(iE)}),uE=rl.extend({method:K("resources/templates/list")}),dE=al.extend({resourceTemplates:Ye(iD)}),Hh=to.extend({uri:V()}),lD=Hh,fE=wn.extend({method:K("resources/read"),params:lD}),pE=En.extend({contents:Ye(ct([rE,aE]))}),hE=go.extend({method:K("notifications/resources/list_changed"),params:mo.optional()}),cD=Hh,uD=wn.extend({method:K("resources/subscribe"),params:cD}),dD=Hh,fD=wn.extend({method:K("resources/unsubscribe"),params:dD}),pD=mo.extend({uri:V()}),hD=go.extend({method:K("notifications/resources/updated"),params:pD}),mD=te({name:V(),description:Bt(V()),required:Bt(Ot())}),gD=te({...ba.shape,...sl.shape,description:Bt(V()),arguments:Bt(Ye(mD)),_meta:Bt(qn({}))}),mE=rl.extend({method:K("prompts/list")}),gE=al.extend({prompts:Ye(gD)}),vD=to.extend({name:V(),arguments:dt(V(),V()).optional()}),yD=wn.extend({method:K("prompts/get"),params:vD}),Bh=te({type:K("text"),text:V(),annotations:_a.optional(),_meta:dt(V(),At()).optional()}),Zh=te({type:K("image"),data:qh,mimeType:V(),annotations:_a.optional(),_meta:dt(V(),At()).optional()}),Vh=te({type:K("audio"),data:qh,mimeType:V(),annotations:_a.optional(),_meta:dt(V(),At()).optional()}),bD=te({type:K("tool_use"),name:V(),id:V(),input:dt(V(),At()),_meta:dt(V(),At()).optional()}),vE=te({type:K("resource"),resource:ct([rE,aE]),annotations:_a.optional(),_meta:dt(V(),At()).optional()}),yE=iE.extend({type:K("resource_link")}),cl=ct([Bh,Zh,Vh,yE,vE]),SD=te({role:ll,content:cl}),xD=En.extend({description:V().optional(),messages:Ye(SD)}),bE=go.extend({method:K("notifications/prompts/list_changed"),params:mo.optional()}),wD=te({title:V().optional(),readOnlyHint:Ot().optional(),destructiveHint:Ot().optional(),idempotentHint:Ot().optional(),openWorldHint:Ot().optional()}),ED=te({taskSupport:eo(["required","optional","forbidden"]).optional()}),Yh=te({...ba.shape,...sl.shape,description:V().optional(),inputSchema:te({type:K("object"),properties:dt(V(),dn).optional(),required:Ye(V()).optional()}).catchall(At()),outputSchema:te({type:K("object"),properties:dt(V(),dn).optional(),required:Ye(V()).optional()}).catchall(At()).optional(),annotations:wD.optional(),execution:ED.optional(),_meta:dt(V(),At()).optional()}),TD=rl.extend({method:K("tools/list")}),SE=al.extend({tools:Ye(Yh)}),Zi=En.extend({content:Ye(cl).default([]),structuredContent:dt(V(),At()).optional(),isError:Ot().optional()});Zi.or(En.extend({toolResult:At()}));const _D=nl.extend({name:V(),arguments:dt(V(),At()).optional()}),xE=wn.extend({method:K("tools/call"),params:_D}),wE=go.extend({method:K("notifications/tools/list_changed"),params:mo.optional()});te({autoRefresh:Ot().default(!0),debounceMs:Qe().int().nonnegative().default(300)});const EE=eo(["debug","info","notice","warning","error","critical","alert","emergency"]),RD=to.extend({level:EE}),CD=wn.extend({method:K("logging/setLevel"),params:RD}),AD=mo.extend({level:EE,logger:V().optional(),data:At()}),TE=go.extend({method:K("notifications/message"),params:AD}),kD=te({name:V().optional()}),jD=te({hints:Ye(kD).optional(),costPriority:Qe().min(0).max(1).optional(),speedPriority:Qe().min(0).max(1).optional(),intelligencePriority:Qe().min(0).max(1).optional()}),OD=te({mode:eo(["auto","required","none"]).optional()}),ND=te({type:K("tool_result"),toolUseId:V().describe("The unique identifier for the corresponding tool call."),content:Ye(cl).default([]),structuredContent:te({}).loose().optional(),isError:Ot().optional(),_meta:dt(V(),At()).optional()}),MD=Yw("type",[Bh,Zh,Vh]),Jc=Yw("type",[Bh,Zh,Vh,bD,ND]),zD=te({role:ll,content:ct([Jc,Ye(Jc)]),_meta:dt(V(),At()).optional()}),ID=nl.extend({messages:Ye(zD),modelPreferences:jD.optional(),systemPrompt:V().optional(),includeContext:eo(["none","thisServer","allServers"]).optional(),temperature:Qe().optional(),maxTokens:Qe().int(),stopSequences:Ye(V()).optional(),metadata:dn.optional(),tools:Ye(Yh).optional(),toolChoice:OD.optional()}),_E=wn.extend({method:K("sampling/createMessage"),params:ID}),DD=En.extend({model:V(),stopReason:Bt(eo(["endTurn","stopSequence","maxTokens"]).or(V())),role:ll,content:MD}),UD=En.extend({model:V(),stopReason:Bt(eo(["endTurn","stopSequence","maxTokens","toolUse"]).or(V())),role:ll,content:ct([Jc,Ye(Jc)])}),PD=te({type:K("boolean"),title:V().optional(),description:V().optional(),default:Ot().optional()}),$D=te({type:K("string"),title:V().optional(),description:V().optional(),minLength:Qe().optional(),maxLength:Qe().optional(),format:eo(["email","uri","date","date-time"]).optional(),default:V().optional()}),LD=te({type:eo(["number","integer"]),title:V().optional(),description:V().optional(),minimum:Qe().optional(),maximum:Qe().optional(),default:Qe().optional()}),qD=te({type:K("string"),title:V().optional(),description:V().optional(),enum:Ye(V()),default:V().optional()}),HD=te({type:K("string"),title:V().optional(),description:V().optional(),oneOf:Ye(te({const:V(),title:V()})),default:V().optional()}),BD=te({type:K("string"),title:V().optional(),description:V().optional(),enum:Ye(V()),enumNames:Ye(V()).optional(),default:V().optional()}),ZD=ct([qD,HD]),VD=te({type:K("array"),title:V().optional(),description:V().optional(),minItems:Qe().optional(),maxItems:Qe().optional(),items:te({type:K("string"),enum:Ye(V())}),default:Ye(V()).optional()}),YD=te({type:K("array"),title:V().optional(),description:V().optional(),minItems:Qe().optional(),maxItems:Qe().optional(),items:te({anyOf:Ye(te({const:V(),title:V()}))}),default:Ye(V()).optional()}),GD=ct([VD,YD]),KD=ct([BD,ZD,GD]),FD=ct([KD,PD,$D,LD]),XD=nl.extend({mode:K("form").optional(),message:V(),requestedSchema:te({type:K("object"),properties:dt(V(),FD),required:Ye(V()).optional()})}),QD=nl.extend({mode:K("url"),message:V(),elicitationId:V(),url:V().url()}),JD=ct([XD,QD]),WD=wn.extend({method:K("elicitation/create"),params:JD}),e4=mo.extend({elicitationId:V()}),t4=go.extend({method:K("notifications/elicitation/complete"),params:e4}),n4=En.extend({action:eo(["accept","decline","cancel"]),content:Jw(e=>e===null?void 0:e,dt(V(),ct([V(),Qe(),Ot(),Ye(V())])).optional())}),o4=te({type:K("ref/resource"),uri:V()}),s4=te({type:K("ref/prompt"),name:V()}),r4=to.extend({ref:ct([s4,o4]),argument:te({name:V(),value:V()}),context:te({arguments:dt(V(),V()).optional()}).optional()}),a4=wn.extend({method:K("completion/complete"),params:r4}),i4=En.extend({completion:qn({values:Ye(V()).max(100),total:Bt(Qe().int()),hasMore:Bt(Ot())})}),l4=te({uri:V().startsWith("file://"),name:V().optional(),_meta:dt(V(),At()).optional()}),c4=wn.extend({method:K("roots/list"),params:to.optional()}),u4=En.extend({roots:Ye(l4)}),d4=go.extend({method:K("notifications/roots/list_changed"),params:mo.optional()});ct([xu,QI,a4,CD,yD,mE,lE,uE,fE,uD,fD,xE,TD,Ih,Uh,Ph,Lh]);ct([Nh,Mh,eD,d4,Qc]);ct([oE,DD,UD,n4,u4,Dh,$h,zh]);ct([xu,_E,WD,c4,Ih,Uh,Ph,Lh]);ct([Nh,Mh,TE,hD,hE,wE,bE,Qc,t4]);ct([oE,WI,i4,xD,gE,cE,dE,pE,Zi,SE,Dh,$h,zh]);class ft extends Error{constructor(n,s,r){super(`MCP error ${n}: ${s}`),this.code=n,this.data=r,this.name="McpError"}static fromError(n,s,r){if(n===yt.UrlElicitationRequired&&r){const i=r;if(i.elicitations)return new f4(i.elicitations,s)}return new ft(n,s,r)}}class f4 extends ft{constructor(n,s=`URL elicitation${n.length>1?"s":""} required`){super(yt.UrlElicitationRequired,s,{elicitations:n})}get elicitations(){return this.data?.elicitations??[]}}function Gh(e){return!!e._zod}function RE(e,n){return Gh(e)?bw(e,n):e.safeParse(n)}function p4(e){if(!e)return;let n;if(Gh(e)?n=e._zod?.def?.shape:n=e.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function h4(e){if(Gh(e)){const c=e._zod?.def;if(c){if(c.value!==void 0)return c.value;if(Array.isArray(c.values)&&c.values.length>0)return c.values[0]}}const s=e._def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}const r=e.value;if(r!==void 0)return r}function ur(e){return e==="completed"||e==="failed"||e==="cancelled"}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function S0(e){const s=p4(e)?.method;if(!s)throw new Error("Schema is missing a method literal");const r=h4(s);if(typeof r!="string")throw new Error("Schema method literal must be a string");return r}function x0(e,n){const s=RE(e,n);if(!s.success)throw s.error;return s.data}const m4=6e4;class g4{constructor(n){this._options=n,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Nh,s=>{this._oncancel(s)}),this.setNotificationHandler(Mh,s=>{this._onprogress(s)}),this.setRequestHandler(xu,s=>({})),this._taskStore=n?.taskStore,this._taskMessageQueue=n?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(Ih,async(s,r)=>{const i=await this._taskStore.getTask(s.params.taskId,r.sessionId);if(!i)throw new ft(yt.InvalidParams,"Failed to retrieve task: Task not found");return{...i}}),this.setRequestHandler(Uh,async(s,r)=>{const i=async()=>{const c=s.params.taskId;if(this._taskMessageQueue){let p;for(;p=await this._taskMessageQueue.dequeue(c,r.sessionId);){if(p.type==="response"||p.type==="error"){const g=p.message,m=g.id,y=this._requestResolvers.get(m);if(y)if(this._requestResolvers.delete(m),p.type==="response")y(g);else{const b=g,x=new ft(b.error.code,b.error.message,b.error.data);y(x)}else{const b=p.type==="response"?"Response":"Error";this._onerror(new Error(`${b} handler missing for request ${m}`))}continue}await this._transport?.send(p.message,{relatedRequestId:r.requestId})}}const d=await this._taskStore.getTask(c,r.sessionId);if(!d)throw new ft(yt.InvalidParams,`Task not found: ${c}`);if(!ur(d.status))return await this._waitForTaskUpdate(c,r.signal),await i();if(ur(d.status)){const p=await this._taskStore.getTaskResult(c,r.sessionId);return this._clearTaskQueue(c),{...p,_meta:{...p._meta,[dr]:{taskId:c}}}}return await i()};return await i()}),this.setRequestHandler(Ph,async(s,r)=>{try{const{tasks:i,nextCursor:c}=await this._taskStore.listTasks(s.params?.cursor,r.sessionId);return{tasks:i,nextCursor:c,_meta:{}}}catch(i){throw new ft(yt.InvalidParams,`Failed to list tasks: ${i instanceof Error?i.message:String(i)}`)}}),this.setRequestHandler(Lh,async(s,r)=>{try{const i=await this._taskStore.getTask(s.params.taskId,r.sessionId);if(!i)throw new ft(yt.InvalidParams,`Task not found: ${s.params.taskId}`);if(ur(i.status))throw new ft(yt.InvalidParams,`Cannot cancel task in terminal status: ${i.status}`);await this._taskStore.updateTaskStatus(s.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(s.params.taskId);const c=await this._taskStore.getTask(s.params.taskId,r.sessionId);if(!c)throw new ft(yt.InvalidParams,`Task not found after cancellation: ${s.params.taskId}`);return{_meta:{},...c}}catch(i){throw i instanceof ft?i:new ft(yt.InvalidRequest,`Failed to cancel task: ${i instanceof Error?i.message:String(i)}`)}}))}async _oncancel(n){if(!n.params.requestId)return;this._requestHandlerAbortControllers.get(n.params.requestId)?.abort(n.params.reason)}_setupTimeout(n,s,r,i,c=!1){this._timeoutInfo.set(n,{timeoutId:setTimeout(i,s),startTime:Date.now(),timeout:s,maxTotalTimeout:r,resetTimeoutOnProgress:c,onTimeout:i})}_resetTimeout(n){const s=this._timeoutInfo.get(n);if(!s)return!1;const r=Date.now()-s.startTime;if(s.maxTotalTimeout&&r>=s.maxTotalTimeout)throw this._timeoutInfo.delete(n),ft.fromError(yt.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:s.maxTotalTimeout,totalElapsed:r});return clearTimeout(s.timeoutId),s.timeoutId=setTimeout(s.onTimeout,s.timeout),!0}_cleanupTimeout(n){const s=this._timeoutInfo.get(n);s&&(clearTimeout(s.timeoutId),this._timeoutInfo.delete(n))}async connect(n){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=n;const s=this.transport?.onclose;this._transport.onclose=()=>{s?.(),this._onclose()};const r=this.transport?.onerror;this._transport.onerror=c=>{r?.(c),this._onerror(c)};const i=this._transport?.onmessage;this._transport.onmessage=(c,d)=>{i?.(c,d),Oc(c)||qI(c)?this._onresponse(c):b0(c)?this._onrequest(c,d):LI(c)?this._onnotification(c):this._onerror(new Error(`Unknown message type: ${JSON.stringify(c)}`))},await this._transport.start()}_onclose(){const n=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(const r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();const s=ft.fromError(yt.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const r of n.values())r(s)}_onerror(n){this.onerror?.(n)}_onnotification(n){const s=this._notificationHandlers.get(n.method)??this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(n)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(n,s){const r=this._requestHandlers.get(n.method)??this.fallbackRequestHandler,i=this._transport,c=n.params?._meta?.[dr]?.taskId;if(r===void 0){const y={jsonrpc:"2.0",id:n.id,error:{code:yt.MethodNotFound,message:"Method not found"}};c&&this._taskMessageQueue?this._enqueueTaskMessage(c,{type:"error",message:y,timestamp:Date.now()},i?.sessionId).catch(b=>this._onerror(new Error(`Failed to enqueue error response: ${b}`))):i?.send(y).catch(b=>this._onerror(new Error(`Failed to send an error response: ${b}`)));return}const d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);const p=$I(n.params)?n.params.task:void 0,g=this._taskStore?this.requestTaskStore(n,i?.sessionId):void 0,m={signal:d.signal,sessionId:i?.sessionId,_meta:n.params?._meta,sendNotification:async y=>{if(d.signal.aborted)return;const b={relatedRequestId:n.id};c&&(b.relatedTask={taskId:c}),await this.notification(y,b)},sendRequest:async(y,b,x)=>{if(d.signal.aborted)throw new ft(yt.ConnectionClosed,"Request was cancelled");const w={...x,relatedRequestId:n.id};c&&!w.relatedTask&&(w.relatedTask={taskId:c});const E=w.relatedTask?.taskId??c;return E&&g&&await g.updateTaskStatus(E,"input_required"),await this.request(y,b,w)},authInfo:s?.authInfo,requestId:n.id,requestInfo:s?.requestInfo,taskId:c,taskStore:g,taskRequestedTtl:p?.ttl,closeSSEStream:s?.closeSSEStream,closeStandaloneSSEStream:s?.closeStandaloneSSEStream};Promise.resolve().then(()=>{p&&this.assertTaskHandlerCapability(n.method)}).then(()=>r(n,m)).then(async y=>{if(d.signal.aborted)return;const b={result:y,jsonrpc:"2.0",id:n.id};c&&this._taskMessageQueue?await this._enqueueTaskMessage(c,{type:"response",message:b,timestamp:Date.now()},i?.sessionId):await i?.send(b)},async y=>{if(d.signal.aborted)return;const b={jsonrpc:"2.0",id:n.id,error:{code:Number.isSafeInteger(y.code)?y.code:yt.InternalError,message:y.message??"Internal error",...y.data!==void 0&&{data:y.data}}};c&&this._taskMessageQueue?await this._enqueueTaskMessage(c,{type:"error",message:b,timestamp:Date.now()},i?.sessionId):await i?.send(b)}).catch(y=>this._onerror(new Error(`Failed to send response: ${y}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(n){const{progressToken:s,...r}=n.params,i=Number(s),c=this._progressHandlers.get(i);if(!c){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(n)}`));return}const d=this._responseHandlers.get(i),p=this._timeoutInfo.get(i);if(p&&d&&p.resetTimeoutOnProgress)try{this._resetTimeout(i)}catch(g){this._responseHandlers.delete(i),this._progressHandlers.delete(i),this._cleanupTimeout(i),d(g);return}c(r)}_onresponse(n){const s=Number(n.id),r=this._requestResolvers.get(s);if(r){if(this._requestResolvers.delete(s),Oc(n))r(n);else{const d=new ft(n.error.code,n.error.message,n.error.data);r(d)}return}const i=this._responseHandlers.get(s);if(i===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(n)}`));return}this._responseHandlers.delete(s),this._cleanupTimeout(s);let c=!1;if(Oc(n)&&n.result&&typeof n.result=="object"){const d=n.result;if(d.task&&typeof d.task=="object"){const p=d.task;typeof p.taskId=="string"&&(c=!0,this._taskProgressTokens.set(p.taskId,s))}}if(c||this._progressHandlers.delete(s),Oc(n))i(n);else{const d=ft.fromError(n.error.code,n.error.message,n.error.data);i(d)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(n,s,r){const{task:i}=r??{};if(!i){try{yield{type:"result",result:await this.request(n,s,r)}}catch(d){yield{type:"error",error:d instanceof ft?d:new ft(yt.InternalError,String(d))}}return}let c;try{const d=await this.request(n,zh,r);if(d.task)c=d.task.taskId,yield{type:"taskCreated",task:d.task};else throw new ft(yt.InternalError,"Task creation did not return a task");for(;;){const p=await this.getTask({taskId:c},r);if(yield{type:"taskStatus",task:p},ur(p.status)){p.status==="completed"?yield{type:"result",result:await this.getTaskResult({taskId:c},s,r)}:p.status==="failed"?yield{type:"error",error:new ft(yt.InternalError,`Task ${c} failed`)}:p.status==="cancelled"&&(yield{type:"error",error:new ft(yt.InternalError,`Task ${c} was cancelled`)});return}if(p.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:c},s,r)};return}const g=p.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(m=>setTimeout(m,g)),r?.signal?.throwIfAborted()}}catch(d){yield{type:"error",error:d instanceof ft?d:new ft(yt.InternalError,String(d))}}}request(n,s,r){const{relatedRequestId:i,resumptionToken:c,onresumptiontoken:d,task:p,relatedTask:g}=r??{};return new Promise((m,y)=>{const b=_=>{y(_)};if(!this._transport){b(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(n.method),p&&this.assertTaskCapability(n.method)}catch(_){b(_);return}r?.signal?.throwIfAborted();const x=this._requestMessageId++,w={...n,jsonrpc:"2.0",id:x};r?.onprogress&&(this._progressHandlers.set(x,r.onprogress),w.params={...n.params,_meta:{...n.params?._meta||{},progressToken:x}}),p&&(w.params={...w.params,task:p}),g&&(w.params={...w.params,_meta:{...w.params?._meta||{},[dr]:g}});const E=_=>{this._responseHandlers.delete(x),this._progressHandlers.delete(x),this._cleanupTimeout(x),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(_)}},{relatedRequestId:i,resumptionToken:c,onresumptiontoken:d}).catch(R=>this._onerror(new Error(`Failed to send cancellation: ${R}`)));const O=_ instanceof ft?_:new ft(yt.RequestTimeout,String(_));y(O)};this._responseHandlers.set(x,_=>{if(!r?.signal?.aborted){if(_ instanceof Error)return y(_);try{const O=RE(s,_.result);O.success?m(O.data):y(O.error)}catch(O){y(O)}}}),r?.signal?.addEventListener("abort",()=>{E(r?.signal?.reason)});const C=r?.timeout??m4,A=()=>E(ft.fromError(yt.RequestTimeout,"Request timed out",{timeout:C}));this._setupTimeout(x,C,r?.maxTotalTimeout,A,r?.resetTimeoutOnProgress??!1);const j=g?.taskId;if(j){const _=O=>{const R=this._responseHandlers.get(x);R?R(O):this._onerror(new Error(`Response handler missing for side-channeled request ${x}`))};this._requestResolvers.set(x,_),this._enqueueTaskMessage(j,{type:"request",message:w,timestamp:Date.now()}).catch(O=>{this._cleanupTimeout(x),y(O)})}else this._transport.send(w,{relatedRequestId:i,resumptionToken:c,onresumptiontoken:d}).catch(_=>{this._cleanupTimeout(x),y(_)})})}async getTask(n,s){return this.request({method:"tasks/get",params:n},Dh,s)}async getTaskResult(n,s,r){return this.request({method:"tasks/result",params:n},s,r)}async listTasks(n,s){return this.request({method:"tasks/list",params:n},$h,s)}async cancelTask(n,s){return this.request({method:"tasks/cancel",params:n},aD,s)}async notification(n,s){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(n.method);const r=s?.relatedTask?.taskId;if(r){const p={...n,jsonrpc:"2.0",params:{...n.params,_meta:{...n.params?._meta||{},[dr]:s.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:p,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(n.method)&&!n.params&&!s?.relatedRequestId&&!s?.relatedTask){if(this._pendingDebouncedNotifications.has(n.method))return;this._pendingDebouncedNotifications.add(n.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(n.method),!this._transport)return;let p={...n,jsonrpc:"2.0"};s?.relatedTask&&(p={...p,params:{...p.params,_meta:{...p.params?._meta||{},[dr]:s.relatedTask}}}),this._transport?.send(p,s).catch(g=>this._onerror(g))});return}let d={...n,jsonrpc:"2.0"};s?.relatedTask&&(d={...d,params:{...d.params,_meta:{...d.params?._meta||{},[dr]:s.relatedTask}}}),await this._transport.send(d,s)}setRequestHandler(n,s){const r=S0(n);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(i,c)=>{const d=x0(n,i);return Promise.resolve(s(d,c))})}removeRequestHandler(n){this._requestHandlers.delete(n)}assertCanSetRequestHandler(n){if(this._requestHandlers.has(n))throw new Error(`A request handler for ${n} already exists, which would be overridden`)}setNotificationHandler(n,s){const r=S0(n);this._notificationHandlers.set(r,i=>{const c=x0(n,i);return Promise.resolve(s(c))})}removeNotificationHandler(n){this._notificationHandlers.delete(n)}_cleanupTaskProgressHandler(n){const s=this._taskProgressTokens.get(n);s!==void 0&&(this._progressHandlers.delete(s),this._taskProgressTokens.delete(n))}async _enqueueTaskMessage(n,s,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const i=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(n,s,r,i)}async _clearTaskQueue(n,s){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(n,s);for(const i of r)if(i.type==="request"&&b0(i.message)){const c=i.message.id,d=this._requestResolvers.get(c);d?(d(new ft(yt.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(c)):this._onerror(new Error(`Resolver missing for request ${c} during task ${n} cleanup`))}}}async _waitForTaskUpdate(n,s){let r=this._options?.defaultTaskPollInterval??1e3;try{const i=await this._taskStore?.getTask(n);i?.pollInterval&&(r=i.pollInterval)}catch{}return new Promise((i,c)=>{if(s.aborted){c(new ft(yt.InvalidRequest,"Request cancelled"));return}const d=setTimeout(i,r);s.addEventListener("abort",()=>{clearTimeout(d),c(new ft(yt.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(n,s){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async i=>{if(!n)throw new Error("No request provided");return await r.createTask(i,n.id,{method:n.method,params:n.params},s)},getTask:async i=>{const c=await r.getTask(i,s);if(!c)throw new ft(yt.InvalidParams,"Failed to retrieve task: Task not found");return c},storeTaskResult:async(i,c,d)=>{await r.storeTaskResult(i,c,d,s);const p=await r.getTask(i,s);if(p){const g=Qc.parse({method:"notifications/tasks/status",params:p});await this.notification(g),ur(p.status)&&this._cleanupTaskProgressHandler(i)}},getTaskResult:i=>r.getTaskResult(i,s),updateTaskStatus:async(i,c,d)=>{const p=await r.getTask(i,s);if(!p)throw new ft(yt.InvalidParams,`Task "${i}" not found - it may have been cleaned up`);if(ur(p.status))throw new ft(yt.InvalidParams,`Cannot update task "${i}" from terminal status "${p.status}" to "${c}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(i,c,d,s);const g=await r.getTask(i,s);if(g){const m=Qc.parse({method:"notifications/tasks/status",params:g});await this.notification(m),ur(g.status)&&this._cleanupTaskProgressHandler(i)}},listTasks:i=>r.listTasks(i,s)}}}(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(n,s)=>(typeof require<"u"?require:n)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});class v4 extends g4{_registeredMethods=new Set;_eventSlots=new Map;onEventDispatch(n,s){}_ensureEventSlot(n){let s=this._eventSlots.get(n);if(!s){let r=this.eventSchemas[n];if(!r)throw Error(`Unknown event: ${String(n)}`);s={listeners:[]},this._eventSlots.set(n,s);let i=r.shape.method.value;this._registeredMethods.add(i);let c=s;super.setNotificationHandler(r,d=>{let p=d.params;this.onEventDispatch(n,p),c.onHandler?.(p);for(let g of[...c.listeners])g(p)})}return s}setEventHandler(n,s){let r=this._ensureEventSlot(n);r.onHandler&&s&&console.warn(`[MCP Apps] on${String(n)} handler replaced. Use addEventListener("${String(n)}", …) to add multiple listeners without replacing.`),r.onHandler=s}getEventHandler(n){return this._eventSlots.get(n)?.onHandler}addEventListener(n,s){this._ensureEventSlot(n).listeners.push(s)}removeEventListener(n,s){let r=this._eventSlots.get(n);if(!r)return;let i=r.listeners.indexOf(s);i!==-1&&r.listeners.splice(i,1)}setRequestHandler=(n,s)=>{this._assertMethodNotRegistered(n,"setRequestHandler"),super.setRequestHandler(n,s)};setNotificationHandler=(n,s)=>{this._assertMethodNotRegistered(n,"setNotificationHandler"),super.setNotificationHandler(n,s)};warnIfRequestHandlerReplaced(n,s,r){s&&r&&console.warn(`[MCP Apps] ${n} handler replaced. Previous handler will no longer be called.`)}replaceRequestHandler=(n,s)=>{let r=n.shape.method.value;this._registeredMethods.add(r),super.setRequestHandler(n,s)};_assertMethodNotRegistered(n,s){let r=n.shape.method.value;if(this._registeredMethods.has(r))throw Error(`Handler for "${r}" already registered (via ${s}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._registeredMethods.add(r)}}var CE="2026-01-26",y4="ui/notifications/tool-input-partial",b4=ct([K("light"),K("dark")]).describe("Color theme preference for the host environment."),Vi=ct([K("inline"),K("fullscreen"),K("pip")]).describe("Display mode for UI presentation."),S4=ct([K("--color-background-primary"),K("--color-background-secondary"),K("--color-background-tertiary"),K("--color-background-inverse"),K("--color-background-ghost"),K("--color-background-info"),K("--color-background-danger"),K("--color-background-success"),K("--color-background-warning"),K("--color-background-disabled"),K("--color-text-primary"),K("--color-text-secondary"),K("--color-text-tertiary"),K("--color-text-inverse"),K("--color-text-ghost"),K("--color-text-info"),K("--color-text-danger"),K("--color-text-success"),K("--color-text-warning"),K("--color-text-disabled"),K("--color-border-primary"),K("--color-border-secondary"),K("--color-border-tertiary"),K("--color-border-inverse"),K("--color-border-ghost"),K("--color-border-info"),K("--color-border-danger"),K("--color-border-success"),K("--color-border-warning"),K("--color-border-disabled"),K("--color-ring-primary"),K("--color-ring-secondary"),K("--color-ring-inverse"),K("--color-ring-info"),K("--color-ring-danger"),K("--color-ring-success"),K("--color-ring-warning"),K("--font-sans"),K("--font-mono"),K("--font-weight-normal"),K("--font-weight-medium"),K("--font-weight-semibold"),K("--font-weight-bold"),K("--font-text-xs-size"),K("--font-text-sm-size"),K("--font-text-md-size"),K("--font-text-lg-size"),K("--font-heading-xs-size"),K("--font-heading-sm-size"),K("--font-heading-md-size"),K("--font-heading-lg-size"),K("--font-heading-xl-size"),K("--font-heading-2xl-size"),K("--font-heading-3xl-size"),K("--font-text-xs-line-height"),K("--font-text-sm-line-height"),K("--font-text-md-line-height"),K("--font-text-lg-line-height"),K("--font-heading-xs-line-height"),K("--font-heading-sm-line-height"),K("--font-heading-md-line-height"),K("--font-heading-lg-line-height"),K("--font-heading-xl-line-height"),K("--font-heading-2xl-line-height"),K("--font-heading-3xl-line-height"),K("--border-radius-xs"),K("--border-radius-sm"),K("--border-radius-md"),K("--border-radius-lg"),K("--border-radius-xl"),K("--border-radius-full"),K("--border-width-regular"),K("--shadow-hairline"),K("--shadow-sm"),K("--shadow-md"),K("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),x4=dt(S4.describe(`Style variables for theming MCP apps.
|
|
109
|
+
|
|
110
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
111
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
112
|
+
|
|
113
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
114
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),ct([V(),_p()]).describe(`Style variables for theming MCP apps.
|
|
115
|
+
|
|
116
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
117
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
118
|
+
|
|
119
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
120
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`)).describe(`Style variables for theming MCP apps.
|
|
121
|
+
|
|
122
|
+
Individual style keys are optional - hosts may provide any subset of these values.
|
|
123
|
+
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
124
|
+
|
|
125
|
+
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
126
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),w4=te({method:K("ui/open-link"),params:te({url:V().describe("URL to open in the host's browser")})});te({isError:Ot().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough();te({isError:Ot().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough();te({isError:Ot().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough();var E4=te({method:K("ui/notifications/sandbox-proxy-ready"),params:te({})}),Kh=te({connectDomains:Ye(V()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
127
|
+
|
|
128
|
+
- Maps to CSP \`connect-src\` directive
|
|
129
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:Ye(V()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:Ye(V()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:Ye(V()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Fh=te({camera:te({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:te({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:te({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:te({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),T4=te({method:K("ui/notifications/size-changed"),params:te({width:Qe().optional().describe("New width in pixels."),height:Qe().optional().describe("New height in pixels.")})});te({method:K("ui/notifications/tool-input"),params:te({arguments:dt(V(),At().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})});te({method:K("ui/notifications/tool-input-partial"),params:te({arguments:dt(V(),At().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})});te({method:K("ui/notifications/tool-cancelled"),params:te({reason:V().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})});var _4=te({fonts:V().optional()}),R4=te({variables:x4.optional().describe("CSS variables for theming the app."),css:_4.optional().describe("CSS blocks that apps can inject.")});te({method:K("ui/resource-teardown"),params:te({})});var C4=dt(V(),At()),w0=te({text:te({}).optional().describe("Host supports text content blocks."),image:te({}).optional().describe("Host supports image content blocks."),audio:te({}).optional().describe("Host supports audio content blocks."),resource:te({}).optional().describe("Host supports resource content blocks."),resourceLink:te({}).optional().describe("Host supports resource link content blocks."),structuredContent:te({}).optional().describe("Host supports structured content.")}),A4=te({method:K("ui/notifications/request-teardown"),params:te({}).optional()}),k4=te({experimental:dt(V(),dt(V(),Bw()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:te({}).optional().describe("Host supports opening external URLs."),downloadFile:te({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:te({listChanged:Ot().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:te({listChanged:Ot().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:te({}).optional().describe("Host accepts log messages."),sandbox:te({permissions:Fh.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Kh.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:w0.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:w0.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:te({tools:te({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),j4=te({experimental:dt(V(),dt(V(),Bw()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:te({listChanged:Ot().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:Ye(Vi).optional().describe("Display modes the app supports.")}),O4=te({method:K("ui/notifications/initialized"),params:te({}).optional()});te({csp:Kh.optional().describe("Content Security Policy configuration for UI resources."),permissions:Fh.optional().describe("Sandbox permissions requested by the UI resource."),domain:V().optional().describe(`Dedicated origin for view sandbox.
|
|
130
|
+
|
|
131
|
+
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
132
|
+
|
|
133
|
+
**Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
|
|
134
|
+
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
|
|
135
|
+
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
|
|
136
|
+
|
|
137
|
+
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:Ot().optional().describe(`Visual boundary preference - true if view prefers a visible border.
|
|
138
|
+
|
|
139
|
+
Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
|
|
140
|
+
|
|
141
|
+
- \`true\`: request visible border + background
|
|
142
|
+
- \`false\`: request no visible border + background
|
|
143
|
+
- omitted: host decides border`)});var E0=te({method:K("ui/request-display-mode"),params:te({mode:Vi.describe("The display mode being requested.")})});te({mode:Vi.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough();var N4=ct([K("model"),K("app")]).describe("Tool visibility scope - who can access the tool.");te({resourceUri:V().optional(),visibility:Ye(N4).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
144
|
+
- "model": Tool visible to and callable by the agent
|
|
145
|
+
- "app": Tool callable by the app from this server only`),csp:Rp().optional(),permissions:Rp().optional()});te({mimeTypes:Ye(V()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')});var M4=te({method:K("ui/download-file"),params:te({contents:Ye(ct([vE,yE])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),z4=te({method:K("ui/message"),params:te({role:K("user").describe('Message role, currently only "user" is supported.'),content:Ye(cl).describe("Message content blocks (text, image, etc.).")})});te({method:K("ui/notifications/sandbox-resource-ready"),params:te({html:V().describe("HTML content to load into the inner iframe."),sandbox:V().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Kh.optional().describe("CSP configuration from resource metadata."),permissions:Fh.optional().describe("Sandbox permissions from resource metadata.")})});te({method:K("ui/notifications/tool-result"),params:Zi.describe("Standard MCP tool execution result.")});var AE=te({toolInfo:te({id:ol.optional().describe("JSON-RPC id of the tools/call request."),tool:Yh.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:b4.optional().describe("Current color theme preference."),styles:R4.optional().describe("Style configuration for theming the app."),displayMode:Vi.optional().describe("How the UI is currently displayed."),availableDisplayModes:Ye(Vi).optional().describe("Display modes the host supports."),containerDimensions:ct([te({height:Qe().describe("Fixed container height in pixels.")}),te({maxHeight:ct([Qe(),_p()]).optional().describe("Maximum container height in pixels.")})]).and(ct([te({width:Qe().describe("Fixed container width in pixels.")}),te({maxWidth:ct([Qe(),_p()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
146
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:V().optional().describe("User's language and region preference in BCP 47 format."),timeZone:V().optional().describe("User's timezone in IANA format."),userAgent:V().optional().describe("Host application identifier."),platform:ct([K("web"),K("desktop"),K("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:te({touch:Ot().optional().describe("Whether the device supports touch input."),hover:Ot().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:te({top:Qe().describe("Top safe area inset in pixels."),right:Qe().describe("Right safe area inset in pixels."),bottom:Qe().describe("Bottom safe area inset in pixels."),left:Qe().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough();te({method:K("ui/notifications/host-context-changed"),params:AE.describe("Partial context update containing only changed fields.")});var I4=te({method:K("ui/update-model-context"),params:te({content:Ye(cl).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:dt(V(),At().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),D4=te({method:K("ui/initialize"),params:te({appInfo:Su.describe("App identification (name and version)."),appCapabilities:j4.describe("Features and capabilities this app provides."),protocolVersion:V().describe("Protocol version this app supports.")})});te({protocolVersion:V().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Su.describe("Host application identification and version."),hostCapabilities:k4.describe("Features and capabilities provided by the host."),hostContext:AE.describe("Rich context about the host environment.")}).passthrough();class U4{eventTarget;eventSource;messageListener;constructor(n=window.parent,s){this.eventTarget=n,this.eventSource=s,this.messageListener=r=>{if(s&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let i=HI.safeParse(r.data);i.success?(console.debug("Parsed message",i.data),this.onmessage?.(i.data)):r.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",i.error.message,r):(console.error("Failed to parse message",i.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+i.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(n,s){n.method!==y4&&console.debug("Sending message",n),this.eventTarget.postMessage(n,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var kE=[CE];class P4 extends v4{_client;_hostInfo;_capabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_baseReplaceRequestHandler=this.replaceRequestHandler;replaceRequestHandler=(n,s)=>{this._baseReplaceRequestHandler(n,(r,i)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${r.method}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),s(r,i)))};eventSchemas={sizechange:T4,sandboxready:E4,initialized:O4,requestteardown:A4,loggingmessage:TE};constructor(n,s,r,i){super(i),this._client=n,this._hostInfo=s,this._capabilities=r,this.addEventListener("initialized",()=>{this._initializedReceived=!0}),this._hostContext=i?.hostContext||{},this.setRequestHandler(D4,c=>this._oninitialize(c)),this.setRequestHandler(xu,(c,d)=>(this.onping?.(c.params,d),{})),this.replaceRequestHandler(E0,c=>({mode:this._hostContext.displayMode??"inline"}))}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(n){this.setEventHandler("sizechange",n)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(n){this.setEventHandler("sandboxready",n)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(n){this.setEventHandler("initialized",n)}_onmessage;get onmessage(){return this._onmessage}set onmessage(n){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,n),this._onmessage=n,this.replaceRequestHandler(z4,async(s,r)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(s.params,r)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(n){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,n),this._onopenlink=n,this.replaceRequestHandler(w4,async(s,r)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(s.params,r)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(n){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,n),this._ondownloadfile=n,this.replaceRequestHandler(M4,async(s,r)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(s.params,r)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(n){this.setEventHandler("requestteardown",n)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(n){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,n),this._onrequestdisplaymode=n,this.replaceRequestHandler(E0,async(s,r)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(s.params,r)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(n){this.setEventHandler("loggingmessage",n)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(n){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,n),this._onupdatemodelcontext=n,this.replaceRequestHandler(I4,async(s,r)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(s.params,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(n){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,n),this._oncalltool=n,this.replaceRequestHandler(xE,async(s,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(s.params,r)})}set oncreatesamplingmessage(n){this.setRequestHandler(_E,async(s,r)=>n(s.params,r))}sendToolListChanged(n={}){return this.notification({method:"notifications/tools/list_changed",params:n})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(n){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,n),this._onlistresources=n,this.replaceRequestHandler(lE,async(s,r)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(s.params,r)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(n){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,n),this._onlistresourcetemplates=n,this.replaceRequestHandler(uE,async(s,r)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(s.params,r)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(n){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,n),this._onreadresource=n,this.replaceRequestHandler(fE,async(s,r)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(s.params,r)})}sendResourceListChanged(n={}){return this.notification({method:"notifications/resources/list_changed",params:n})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(n){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,n),this._onlistprompts=n,this.replaceRequestHandler(mE,async(s,r)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(s.params,r)})}sendPromptListChanged(n={}){return this.notification({method:"notifications/prompts/list_changed",params:n})}assertCapabilityForMethod(n){}assertRequestHandlerCapability(n){}assertNotificationCapability(n){}assertTaskCapability(n){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(n){throw Error("Task handlers are not supported in MCP Apps")}getCapabilities(){return this._capabilities}async _oninitialize(n){let s=n.params.protocolVersion;return this._appInfo!==void 0&&console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values."),this._appCapabilities=n.params.appCapabilities,this._appInfo=n.params.appInfo,{protocolVersion:kE.includes(s)?s:CE,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(n){let s={},r=!1;for(let i of Object.keys(n)){let c=this._hostContext[i],d=n[i];$4(c,d)||(s[i]=d,r=!0)}r&&(this._hostContext=n,this.sendHostContextChange(s))}sendHostContextChange(n){return this.notification({method:"ui/notifications/host-context-changed",params:n})}sendToolInput(n){return this.notification({method:"ui/notifications/tool-input",params:n})}sendToolInputPartial(n){return this.notification({method:"ui/notifications/tool-input-partial",params:n})}sendToolResult(n){return this.notification({method:"ui/notifications/tool-result",params:n})}sendToolCancelled(n){return this.notification({method:"ui/notifications/tool-cancelled",params:n})}sendSandboxResourceReady(n){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:n})}teardownResource(n,s){return this.request({method:"ui/resource-teardown",params:n},C4,s)}sendResourceTeardown=this.teardownResource;callTool(n,s){return this.request({method:"tools/call",params:n},Zi,s)}listTools(n,s){return this.request({method:"tools/list",params:n},SE,s)}async connect(n){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let s=this._client.getServerCapabilities();if(!s)throw Error("Client server capabilities not available");s.tools&&(this.oncalltool=async(r,i)=>this._client.request({method:"tools/call",params:r},Zi,{signal:i.signal}),s.tools.listChanged&&this._client.setNotificationHandler(wE,r=>this.sendToolListChanged(r.params))),s.resources&&(this.onlistresources=async(r,i)=>this._client.request({method:"resources/list",params:r},cE,{signal:i.signal}),this.onlistresourcetemplates=async(r,i)=>this._client.request({method:"resources/templates/list",params:r},dE,{signal:i.signal}),this.onreadresource=async(r,i)=>this._client.request({method:"resources/read",params:r},pE,{signal:i.signal}),s.resources.listChanged&&this._client.setNotificationHandler(hE,r=>this.sendResourceListChanged(r.params))),s.prompts&&(this.onlistprompts=async(r,i)=>this._client.request({method:"prompts/list",params:r},gE,{signal:i.signal}),s.prompts.listChanged&&this._client.setNotificationHandler(bE,r=>this.sendPromptListChanged(r.params)))}return super.connect(n)}}function $4(e,n){return JSON.stringify(e)===JSON.stringify(n)}const T0=["2026-01-26","2025-11-21"];function L4(e=kE){for(const n of T0)e.includes(n)||e.push(n);return T0.filter(n=>e.includes(n))}const q4=L4();function H4(e){return typeof e=="string"&&q4.includes(e)}const B4=2*1024*1024,Z4=e=>new TextEncoder().encode(e).byteLength,V4=e=>{const n=e.csp?.resourceDomains??[],s=e.csp?.connectDomains??[],r=e.csp?.frameDomains??[],i=e.csp?.baseUriDomains??[],c=(d,p=[])=>[...p,...d].join(" ")||"'none'";return["default-src 'none'","script-src 'unsafe-inline'",`style-src 'unsafe-inline'${n.length>0?` ${n.join(" ")}`:""}`,`img-src ${c(n,["data:","blob:"])}`,`font-src ${c(n,["data:"])}`,`media-src ${c(n,["blob:"])}`,`connect-src ${c(s)}`,`frame-src ${c(r)}`,`base-uri ${c(i)}`,"form-action 'none'","object-src 'none'","child-src 'none'","worker-src 'none'","manifest-src 'none'","navigate-to 'none'"].join("; ")},Y4=e=>e.replaceAll("&","&").replaceAll('"',""").replaceAll("<","<"),G4=(e,n)=>{const r=`<!doctype html><head><meta http-equiv="Content-Security-Policy" content="${Y4(V4(n))}"><meta name="referrer" content="no-referrer"></head>${e}`;if(Z4(r)>B4)throw new Error("The MCP App resource is too large.");return r},K4="text/html;profile=mcp-app",Wc=160,eu=1600,Ap=1400,F4=320,X4="/api/v1/mcp-app-proxy",un=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,_0=e=>new TextEncoder().encode(e).byteLength,rp=(e,n)=>typeof e=="string"&&e.trim().length>0?e.replace(/[\u0000-\u001f\u007f]/gu," ").trim().slice(0,n):void 0,Q4=/(?:authorization|auth|token|api[_-]?key|password|passwd|secret|cookie|credential|session)/iu,ap=2048,kp=(e,n,s)=>{if(e===null||typeof e=="boolean"||typeof e=="number")return e;if(typeof e=="string")return e.slice(0,240);if(typeof e=="bigint")return String(e);if(typeof e!="object")return`[${typeof e}]`;if(n>=4)return"[depth limit]";if(s.has(e))return"[circular]";if(s.add(e),Array.isArray(e)){const c=e.slice(0,12).map(d=>kp(d,n+1,s));return e.length>12&&c.push(`[${String(e.length-12)} more items]`),c}const r={},i=Object.entries(e).slice(0,16);for(const[c,d]of i)r[c.slice(0,120)]=Q4.test(c)?"[redacted]":kp(d,n+1,s);return Object.keys(e).length>i.length&&(r["…"]="[more fields]"),r},J4=e=>{if(e===void 0)return;let n;try{n=JSON.stringify(kp(e,0,new WeakSet),null,2)}catch{n="[unavailable]"}if(_0(n)<=ap)return n;let s=Math.min(n.length,ap);for(;s>0&&_0(`${n.slice(0,s)}…`)>ap;)s-=1;return`${n.slice(0,s)}…`},W4=(e,n=(s,r,i)=>window.open(s,r,i))=>{try{const s=n(e,"_blank","noopener,noreferrer");if(s!==null)try{s.opener=null}catch{}return!0}catch{return!1}},jE=e=>{if(!(typeof e!="string"||e.length>2048))try{const n=new URL(e),s=n.protocol==="http:"&&(n.hostname==="localhost"||n.hostname==="127.0.0.1"||n.hostname==="[::1]");return n.protocol!=="https:"&&!s||n.username||n.password||n.pathname!=="/"&&n.pathname!==""||n.search||n.hash?void 0:n.origin}catch{return}},eU=e=>{if(!Array.isArray(e))return;const n=[...new Set(e.map(jE).filter(s=>s!==void 0))];return n.length>0?n.slice(0,64):void 0},Nc=(e,n)=>{const s=new Set((n??[]).map(jE).filter(i=>i!==void 0));if(s.size===0)return;const r=eU(e)?.filter(i=>s.has(i));return r===void 0||r.length===0?void 0:r},tU=e=>{const n=un(e),s=un(n?.ui)??n,r=un(s?.preferredSize)?.height;if(!(typeof r!="number"||!Number.isFinite(r)||r<=0))return Math.round(Math.min(eu,Math.max(Wc,r)))},nU=(e,n={})=>{const s=un(e),r=un(s?.ui)??s,i=un(r?.csp),c=un(r?.permissions),d=Nc(i?.connectDomains,n.connectOrigins),p=Nc(i?.resourceDomains,n.resourceOrigins),g=Nc(i?.frameDomains,n.frameOrigins),m=Nc(i?.baseUriDomains,n.baseUriOrigins),y=i===void 0?void 0:{...d===void 0?{}:{connectDomains:d},...p===void 0?{}:{resourceDomains:p},...g===void 0?{}:{frameDomains:g},...m===void 0?{}:{baseUriDomains:m}},b=un(c?.clipboardWrite)===void 0?void 0:{clipboardWrite:{}};return{...y===void 0?{}:{csp:y},...b===void 0?{}:{permissions:b}}},oU=()=>{if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(24));return Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")},sU=e=>e<1024?`${e} B`:e<1024*1024?`${Math.round(e/1024)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`,rU=e=>{const n=un(e);return n?.type==="attachment"&&typeof n.id=="string"&&typeof n.name=="string"&&typeof n.mediaType=="string"&&Number.isSafeInteger(n.sizeBytes)&&typeof n.integrityId=="string"?n:void 0},aU=e=>{const n=un(e);return n?.type==="failure"&&typeof n.code=="string"&&typeof n.message=="string"?n:void 0},iU=e=>{const n=un(e);return n?.type==="mcp_app"&&typeof n.id=="string"&&typeof n.invocationId=="string"&&typeof n.connectionId=="string"&&typeof n.serverName=="string"&&typeof n.toolName=="string"&&typeof n.resourceUri=="string"&&n.mediaType===K4&&H4(n.protocolVersion)?n:void 0},lU=e=>JSON.stringify(e===void 0?["invalid"]:[e.id,e.artifactId,e.name,e.mediaType,e.sizeBytes,e.integrityId,e.expiresAt]),cU=(e,n)=>e.id===n.id&&e.artifactId===n.artifactId&&e.name===n.name&&e.mediaType===n.mediaType&&e.sizeBytes===n.sizeBytes&&e.integrityId===n.integrityId&&e.expiresAt===n.expiresAt;class jp extends Error{}class OE extends Error{}const uU=new Map([["reply_attachment_unavailable","The attachment source is offline or incompatible."],["reply_part_expired","The reply part has expired."],["reply_part_not_found","The reply part is unavailable."]]),dU=new Map([["reply_attachment_unavailable",new Set(["The attachment source is offline or incompatible.","Attachment stream is unavailable."])],["reply_part_expired",new Set(["The reply part has expired."])],["reply_part_not_found",new Set(["The reply part is unavailable."])]]),fU=e=>{if(Di(e))return{state:"expired",status:"Download access expired. Refresh and try again."};if(e instanceof jp)return{state:"unavailable",status:"The downloaded file failed integrity validation."};if(e instanceof OE)return{state:"error",status:"The download was interrupted. Check your connection and try again."};if(e instanceof Sa){const n=e.code===void 0?void 0:uU.get(e.code);if(n!==void 0&&e.code!==void 0)return{state:"unavailable",status:`${dU.get(e.code)?.has(e.message)===!0?e.message:n} (${e.code})`}}return{state:"error",status:"The download was interrupted. Check your connection and try again."}},pU=(e,n)=>{const s=URL.createObjectURL(e),r=URL.revokeObjectURL.bind(URL),i=document.createElement("a");i.href=s,i.download=n,i.rel="noopener noreferrer",i.hidden=!0,document.body.append(i);try{i.click()}finally{i.remove(),window.setTimeout(()=>r(s),0)}},hU=/^\/api\/v1\/uploads\/[^/?#]+\/content$/u,mU=e=>e!==void 0&&gh(e.mediaType)&&e.storedUrl!==void 0&&hU.test(e.storedUrl)?e.storedUrl:void 0;function gU(e,n,s,r){const[i,c]=v.useState(void 0);return v.useEffect(()=>{if(!e||n===void 0||s===void 0||r===void 0)return;const d=new AbortController;let p;return(async()=>{try{const g=await Ze.replyAttachmentContent(n,d.signal);if(d.signal.aborted)return;const m=g.headers.get("content-length");if(m!==null&&Number(m)!==s||g.headers.get("x-mono-agent-integrity-id")!==r)return;const y=await g.blob();if(d.signal.aborted||y.size!==s)return;p=URL.createObjectURL(y),c(p)}catch{}})(),()=>{d.abort(),p!==void 0&&URL.revokeObjectURL(p),c(void 0)}},[e,n,s,r]),i}function NE({data:e}){const n=rU(e),s=lU(n),r=v.useRef(s);r.current=s;const i=v.useRef(!1),c=v.useRef(null),d=v.useRef(void 0),[p,g]=v.useState(null);v.useEffect(()=>(i.current=!0,()=>{i.current=!1;const _=c.current;_?.identity===s&&(c.current=null,_.controller.abort())}),[s]);let m;try{m=n?.contentUrl===void 0?void 0:vr(n.contentUrl)}catch{m=void 0}const y=d.current;y===void 0||y.identity!==s?d.current={identity:s,declaredUrl:m,currentUrl:m,generation:(y?.generation??0)+1}:y.declaredUrl!==m&&(d.current={identity:s,declaredUrl:m,currentUrl:m,generation:y.generation+1});const b=mU(n),x=gU(b===void 0&&gh(n?.mediaType),m,n?.sizeBytes,n?.integrityId),w=b??x;if(n===void 0)return f.jsx("div",{className:"reply-part-error",role:"alert",children:"An attachment reference was invalid."});if(w!==void 0)return f.jsx(ew,{image:{key:n.id,src:w,name:n.name}});const E=d.current?.identity===s?d.current.currentUrl:void 0,C=p?.identity===s?p.state:"idle",A=E===void 0||C==="unavailable",j=A?p?.identity===s&&p.state==="unavailable"?p.status:"This file is no longer available.":p?.identity===s?p.status:"";return f.jsxs("section",{className:"reply-attachment","aria-label":`File attachment: ${n.name}`,children:[f.jsx("span",{className:"reply-part-icon",children:f.jsx(Ae,{name:"file",size:16})}),f.jsxs("span",{className:"reply-part-copy",children:[f.jsx("strong",{children:n.name}),f.jsxs("span",{children:[n.mediaType," · ",sU(n.sizeBytes)]})]}),!A&&f.jsxs("button",{type:"button",className:"reply-part-action",disabled:C==="refreshing",onClick:()=>{if(c.current?.identity===s)return;const _=d.current;if(_?.identity!==s||_.currentUrl===void 0)return;const O=_.currentUrl,R=_.generation,M=new AbortController;c.current={identity:s,controller:M},g({identity:s,state:"refreshing",status:"Refreshing download access…"});const U=()=>i.current&&!M.signal.aborted&&r.current===s&&c.current?.controller===M;(async()=>{try{const k=await Ze.replyAttachmentContent(O,M.signal,$=>{if(!(!U()||!cU(n,$)||$.contentUrl===void 0))try{const B=vr($.contentUrl),P=d.current;P?.identity===s&&P.generation===R&&(d.current={...P,currentUrl:B})}catch{}});if(!U())return;const Y=k.headers.get("content-length");if(Y!==null&&Number(Y)!==n.sizeBytes||k.headers.get("x-mono-agent-integrity-id")!==n.integrityId)throw new jp;const H=await k.blob();if(!U())return;if(H.size!==n.sizeBytes)throw Y===null&&H.size<n.sizeBytes?new OE:new jp;if(pU(H,n.name),!U())return;g({identity:s,state:"started",status:"Download started with refreshed access."})}catch(k){if(!U())return;const Y=fU(k);g({identity:s,...Y})}finally{c.current?.controller===M&&(c.current=null)}})()},children:[C==="expired"?"Refresh access":C==="error"?"Try again":"Download",f.jsxs("span",{className:"sr-only",children:[" ",n.name]})]}),f.jsx("span",{className:`reply-part-status${A?" is-unavailable":""}`,role:"status","aria-live":"polite","aria-atomic":"true",children:j})]})}function ME({data:e}){const n=aU(e);return f.jsxs("div",{className:"reply-part-error",role:"alert",children:[f.jsx("strong",{children:n?.code??"Reply part unavailable"}),f.jsx("span",{children:n?.message??"A rich reply part could not be displayed."})]})}const vU=(e,n)=>n.app.invocationId===e.invocationId&&n.app.connectionId===e.connectionId&&n.app.resourceUri===e.resourceUri&&n.app.protocolVersion===e.protocolVersion&&n.app.mediaType===e.mediaType,yU=e=>un(e),bU=e=>{const n=un(e);return Array.isArray(n?.content)?e:{content:[{type:"text",text:"The MCP tool returned an invalid app result."}],isError:!0}},R0=(e,n=Ap)=>({theme:window.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light",displayMode:"inline",availableDisplayModes:["inline"],containerDimensions:{maxWidth:Math.max(240,Math.min(Ap,n)),maxHeight:Math.min(eu,Math.max(Wc,e))},locale:navigator.language||"en",timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,userAgent:navigator.userAgent,platform:window.matchMedia?.("(max-width: 600px)").matches?"mobile":"web",deviceCapabilities:{touch:navigator.maxTouchPoints>0,hover:window.matchMedia?.("(hover: hover)").matches??!1}}),SU=e=>JSON.stringify(e===void 0?["invalid"]:[e.id,e.invocationId,e.connectionId,e.serverName,e.toolName,e.resourceUri,e.mediaType,e.protocolVersion,e.title,e.description,e.expiresAt]),xU=(e,n)=>e.id===n.id&&e.invocationId===n.invocationId&&e.connectionId===n.connectionId&&e.serverName===n.serverName&&e.toolName===n.toolName&&e.resourceUri===n.resourceUri&&e.mediaType===n.mediaType&&e.protocolVersion===n.protocolVersion&&e.title===n.title&&e.description===n.description&&e.expiresAt===n.expiresAt,C0=e=>{if(!(e?.resourceUrl===void 0||e.bridgeUrl===void 0))try{return{resourceUrl:vr(e.resourceUrl),bridgeUrl:vr(e.bridgeUrl)}}catch{return}},wU=e=>e===void 0?"invalid":JSON.stringify([e.resourceUrl,e.bridgeUrl]),EU=new Map([["mcp_app_unavailable","The MCP App source is offline or incompatible."],["mcp_app_identity_mismatch","The MCP App identity changed after publication."]]),TU=e=>Di(e)?"Interactive app access expired. Refresh access to reconnect.":e instanceof Sa&&e.code!==void 0?EU.get(e.code)??"The MCP App could not be loaded.":"The MCP App could not be loaded.";function zE({data:e}){const n=iU(e),s=SU(n),r=v.useRef(s);r.current=s;const i=v.useRef(!1),c=C0(n),d=wU(c),p=v.useRef(void 0),g=p.current;(g===void 0||g.identity!==s||g.declaredKey!==d)&&(p.current={identity:s,declaredKey:d,current:c,generation:(g?.generation??0)+1});const m=p.current?.current!==void 0,[y,b]=v.useState(null),[x,w]=v.useState("loading"),[E,C]=v.useState("Loading interactive app…"),[A,j]=v.useState(F4),[_,O]=v.useState(!1),[R,M]=v.useState(null),[U,k]=v.useState(!1),[Y,H]=v.useState(0),$=v.useRef(null),B=v.useRef(0),P=v.useRef(null),oe=v.useRef(null),le=v.useRef(null),ee=v.useRef(null),z=v.useRef(null),G=v.useMemo(oU,[n?.connectionId,n?.invocationId]),Q=v.useCallback((_e,Be,ge,Oe)=>{if(!i.current||r.current!==_e||!xU(Be,Oe))return;const Re=C0(Oe);if(Re===void 0)return;const Ge=p.current;Ge?.identity!==_e||Ge.generation!==ge||(p.current={...Ge,current:Re})},[]);v.useEffect(()=>(i.current=!0,()=>{i.current=!1}),[]);const q=v.useCallback(_e=>{const Be=$.current;if(Be===null)return;const ge=oe.current;$.current=null,oe.current=null,M(null),Be.resolve(_e),window.setTimeout(()=>{i.current&&ge?.isConnected===!0&&ge.focus()},0)},[]),re=v.useCallback((_e,Be,ge)=>$.current!==null?Promise.resolve(!1):new Promise(Oe=>{oe.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const Re={id:++B.current,title:_e,detail:Be,...ge===void 0?{}:{preview:ge},resolve:Oe};$.current=Re,M(Re)}),[]),Se=v.useCallback(()=>{const _e=$.current;if(_e===null)return;const Be=le.current;$.current=null,oe.current=null,M(null),_e.resolve(!1),window.setTimeout(()=>{i.current&&Be?.isConnected===!0&&Be.focus()},0)},[]);v.useEffect(()=>{R!==null&&P.current?.focus()},[R]),v.useEffect(()=>(Se(),Se),[Se,s]),v.useEffect(()=>{const _e=p.current,Be=_e?.current;if(b(null),k(!1),n===void 0||_e?.identity!==s||Be===void 0){w("error"),C("This MCP App does not have a valid private host endpoint.");return}const ge=n,Oe=s,Re=_e.generation,Ge=new AbortController;w("loading"),C("Loading interactive app…");const tt=()=>i.current&&!Ge.signal.aborted&&r.current===Oe;return Promise.resolve().then(async()=>(Ge.signal.throwIfAborted(),await Ze.mcpAppResource(Be.resourceUrl,Ge.signal,ye=>{tt()&&Q(Oe,ge,Re,ye)}))).then(ye=>{if(tt()){if(!vU(ge,ye))throw new Error("The MCP App identity changed during loading.");if(!ye.connected)throw new Error("The originating MCP connection is no longer available.");b(ye),w("connecting"),C("Starting the isolated app…")}}).catch(ye=>{if(!tt())return;const Je=Di(ye);k(Je),w("error"),C(TU(ye))}),()=>Ge.abort()},[m,Q,s,Y]);const D=v.useMemo(()=>nU(y?.resourceMetadata),[y?.resourceMetadata]),ne=v.useMemo(()=>{if(y===null)return{};try{return{html:G4(y.html,D)}}catch(_e){return{error:_e instanceof Error?_e.message:"The MCP App resource is invalid."}}},[D,y]);v.useEffect(()=>{ne.error!==void 0&&(w("error"),C(ne.error))},[ne.error]);const de=ne.html,ae=D.permissions?.clipboardWrite!==void 0,me=v.useMemo(()=>tU(y?.resourceMetadata),[y?.resourceMetadata]);v.useEffect(()=>{me!==void 0&&j(me)},[me]);const Ce=`${s}:${ae?"clipboard":"none"}`,be=n?.invocationId,xe=n?.connectionId,qe=v.useCallback(()=>{const _e=ee.current?.contentWindow;_e==null||be===void 0||xe===void 0||_e.postMessage({type:"mono-agent:mcp-app-proxy-config",nonce:G,invocationId:be,connectionId:xe,clipboardWrite:ae},"*")},[ae,xe,be,G]);if(v.useEffect(()=>{if(n===void 0||p.current?.current===void 0||y===null||de===void 0||U||x==="closed"||_)return;const _e=ee.current?.contentWindow;if(_e==null)return;let Be=!1,ge,Oe;const Re=new AbortController,Ge=n,tt=s,ye=()=>!Be&&i.current&&!Re.signal.aborted&&r.current===tt,Je=()=>{if(!ye())throw new DOMException("The MCP App instance is no longer active.","AbortError")},we=async(Ne,Fe,nt)=>{try{Je();const ht=p.current,zt=ht?.identity===tt?ht.current?.bridgeUrl:void 0;if(zt===void 0||ht===void 0)throw new Error("The MCP App host endpoint is unavailable.");const fn=await Ze.mcpAppRequest(zt,Ne,Fe,nt,Re.signal,kt=>{ye()&&Q(tt,Ge,ht.generation,kt)});return Je(),fn}catch(ht){throw ye()&&Di(ht)&&(k(!0),w("error"),C("Interactive app access expired. Refresh access to reconnect.")),ht}},Ee=async Ne=>{if(!(Ne.source!==_e||Ne.origin!=="null"||un(Ne.data)?.type!=="mono-agent:mcp-app-proxy-ready"||un(Ne.data)?.nonce!==G||un(Ne.data)?.invocationId!==n.invocationId||un(Ne.data)?.connectionId!==n.connectionId)){window.removeEventListener("message",rt);try{if(Je(),ge=new P4(null,{name:"mono-agent web console",version:"0.4.0"},{openLinks:{},serverTools:{},serverResources:{},sandbox:{...ae?{permissions:{clipboardWrite:{}}}:{},csp:{}},updateModelContext:{text:{},resource:{},resourceLink:{},structuredContent:{}}},{hostContext:R0(A,le.current?.clientWidth)}),Oe=new U4(_e,_e),ge.onsandboxready=()=>{ye()&&ge?.sendSandboxResourceReady({html:de,sandbox:"allow-scripts",...D.csp===void 0?{}:{csp:D.csp},...D.permissions===void 0?{}:{permissions:D.permissions}}).catch(()=>{ye()&&(w("error"),C("The app sandbox rejected its resource."))})},ge.oninitialized=()=>{(async()=>{Je(),await ge?.sendToolInput({arguments:yU(y.toolInput)}),Je(),await ge?.sendToolResult(bU(y.toolResult)),ye()&&(w("ready"),C("Interactive app ready."))})().catch(()=>{ye()&&(w("error"),C("The app could not be initialized."))})},ge.onsizechange=({height:Fe})=>{ye()&&typeof Fe=="number"&&Number.isFinite(Fe)&&j(Math.round(Math.min(eu,Math.max(Wc,Fe))))},ge.oncalltool=async Fe=>{Je();const nt=rp(Fe.name,256)??"requested tool";if(!await re("Allow app tool call?",`Run ${nt} on ${n.serverName}.`,J4(Fe.arguments)))throw new Error("The user declined the MCP App tool call.");return await we("tools/call",Fe,!0)},ge.onreadresource=async Fe=>await we("resources/read",Fe,!1),ge.onopenlink=async Fe=>{Je();const nt=rp(Fe.url,8192)??"the requested link";if(!await re("Open external link?",nt))return{isError:!0};const zt=un(await we("ui/open-link",Fe,!0)),fn=zt?.allowed===!0&&typeof zt.url=="string"?zt.url:void 0;return fn===void 0?{isError:!0}:W4(fn)?{}:(C("The browser blocked the app's external link."),{isError:!0})},ge.onupdatemodelcontext=async Fe=>{if(Je(),!await re("Allow app context update?","The app wants to prepare context for a future model turn."))throw new Error("The user declined the MCP App context update.");const ht=un(await we("ui/update-model-context",Fe,!0));if(ht?.accepted!==!0)throw new Error(rp(ht?.reason,500)??"The host did not apply the context update.");return{}},ge.onrequestteardown=()=>{ye()&&(w("closed"),C("The interactive app closed."))},ge.onerror=()=>{ye()&&(w("error"),C("The app bridge reported an error."))},await ge.connect(Oe),!ye())return;z.current=ge,_e.postMessage({type:"mono-agent:mcp-app-host-ready",nonce:G,invocationId:n.invocationId,connectionId:n.connectionId},"*")}catch{if(!ye())return;w("error"),C("The app bridge could not start.")}}},rt=Ne=>{Ee(Ne)};return window.addEventListener("message",rt),qe(),()=>{Be=!0,Re.abort(),Se(),z.current===ge&&(z.current=null),window.removeEventListener("message",rt),ge?.teardownResource({},{timeout:500}).catch(()=>{}).finally(()=>{Oe?.close().catch(()=>{})})}},[m,U,Q,Se,qe,s,D,G,n?.connectionId,n?.invocationId,Y,re,y,de,x==="closed",_]),v.useEffect(()=>{const _e=()=>{const Oe=le.current?.clientWidth??880;z.current?.setHostContext({...R0(A),containerDimensions:{maxWidth:Math.max(240,Math.min(Ap,Oe)),maxHeight:Math.min(eu,Math.max(Wc,A))}})},Be=typeof ResizeObserver=="function"&&le.current!==null?new ResizeObserver(_e):void 0;le.current!==null&&Be?.observe(le.current);const ge=window.matchMedia?.("(prefers-color-scheme: dark)");return window.addEventListener("resize",_e),ge?.addEventListener?.("change",_e),_e(),()=>{Be?.disconnect(),window.removeEventListener("resize",_e),ge?.removeEventListener?.("change",_e)}},[A]),n===void 0)return f.jsx("div",{className:"reply-part-error",role:"alert",children:"An MCP App reference was invalid."});const it=x==="closed"||x==="error"||U,Me=y!==null&&de!==void 0&&!it&&!_,Te=n.title??n.toolName,$e=()=>{O(!1),w("loading"),C("Loading interactive app…"),H(_e=>_e+1)};return f.jsxs("section",{ref:le,className:"mcp-app","aria-label":`Interactive app: ${n.title??n.toolName}`,tabIndex:-1,children:[f.jsxs("header",{inert:R!==null,"aria-hidden":R!==null,children:[f.jsx("span",{className:"reply-part-icon",children:f.jsx(Ae,{name:"spark",size:16})}),f.jsxs("span",{className:"reply-part-copy",children:[f.jsx("strong",{children:n.title??n.toolName}),f.jsx("span",{children:n.description??`${n.serverName} · ${n.toolName}`})]}),it?f.jsxs("button",{type:"button",className:"reply-part-action",disabled:R!==null,onClick:$e,children:["Reopen",f.jsxs("span",{className:"sr-only",children:[" ",Te]})]}):f.jsxs("button",{type:"button",className:"reply-part-action","aria-expanded":!_,disabled:R!==null,onClick:()=>O(_e=>!_e),children:[_?"Show":"Hide",f.jsxs("span",{className:"sr-only",children:[" ",Te]})]})]}),f.jsx("p",{className:`mcp-app-status is-${x}`,role:"status",children:_?"Hidden. Choose Show to bring the app back.":E}),Me&&f.jsx("iframe",{ref:ee,className:"mcp-app-frame",title:`${n.title??n.toolName} interactive app`,sandbox:"allow-scripts",allow:ae?"clipboard-write":void 0,referrerPolicy:"no-referrer",inert:R!==null,"aria-hidden":R!==null,tabIndex:R===null?0:-1,src:X4,onLoad:qe,style:{height:A}},Ce),R!==null&&f.jsxs("div",{className:"mcp-app-confirmation",role:"dialog","aria-modal":"true","aria-labelledby":`mcp-app-confirm-title-${R.id}`,"aria-describedby":[`mcp-app-confirm-detail-${R.id}`,...R.preview===void 0?[]:[`mcp-app-confirm-preview-${R.id}`]].join(" "),onKeyDown:_e=>{if(_e.key==="Escape"){_e.preventDefault(),q(!1);return}if(_e.key==="Tab"){const Be=Array.from(_e.currentTarget.querySelectorAll("button:not(:disabled)")),ge=Be.at(0),Oe=Be.at(-1);_e.shiftKey&&document.activeElement===ge?(_e.preventDefault(),Oe?.focus()):!_e.shiftKey&&document.activeElement===Oe&&(_e.preventDefault(),ge?.focus())}},children:[f.jsx("strong",{id:`mcp-app-confirm-title-${R.id}`,children:R.title}),f.jsx("span",{id:`mcp-app-confirm-detail-${R.id}`,children:R.detail}),R.preview!==void 0&&f.jsx("pre",{id:`mcp-app-confirm-preview-${R.id}`,className:"mcp-app-confirm-preview",children:R.preview}),f.jsxs("span",{className:"mcp-app-confirm-actions",children:[f.jsx("button",{type:"button",onClick:()=>q(!1),children:"Cancel"}),f.jsx("button",{ref:P,type:"button",className:"is-primary",onClick:()=>q(!0),children:"Allow once"})]})]})]})}const IE=async e=>{if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}const n=document.createElement("textarea");n.value=e,n.readOnly=!0,n.setAttribute("aria-hidden","true"),n.style.cssText="position:fixed;left:-9999px;top:0;opacity:0";const s=document.activeElement instanceof HTMLElement?document.activeElement:null;document.body.append(n),n.select(),n.setSelectionRange(0,e.length);let r=!1;try{r=typeof document.execCommand=="function"&&document.execCommand("copy")}finally{n.remove(),s?.focus()}if(!r)throw new Error("This browser did not allow clipboard access.")},_U=e=>e.flatMap(n=>n.type==="text"&&n.text?[n.text]:[]).join(`
|
|
147
|
+
|
|
148
|
+
`);function RU({label:e}){const n=zn(i=>_U(i.message.content)),[s,r]=v.useState("idle");return v.useEffect(()=>{if(s==="idle")return;const i=window.setTimeout(()=>r("idle"),2500);return()=>window.clearTimeout(i)},[s]),f.jsxs("button",{type:"button",className:`message-action${s==="copied"?" is-success":s==="error"?" is-error":""}`,"aria-label":s==="copied"?"Copied":e,disabled:!n,onClick:()=>{IE(n).then(()=>r("copied"),i=>{r("error"),window.dispatchEvent(new CustomEvent("mono-agent:notice",{detail:{message:i instanceof Error?i.message:"Copy failed."}}))})},children:[f.jsx(Ae,{name:s==="copied"?"check":"copy",size:14}),f.jsx("span",{children:s==="copied"?"Copied":s==="error"?"Copy failed":"Copy"})]})}function DE({label:e,persistentWhenLast:n=!1}){const s=zn(r=>r.message.isLast);return f.jsx(jR.Root,{className:`message-actions${n&&s?" is-persistent":""}`,autohide:"never",children:f.jsx(RU,{label:e})})}function CU({node:e,...n}){return f.jsx("div",{className:"markdown-table",tabIndex:0,children:f.jsx("table",{...n})})}function AU({node:e,href:n,...s}){const r=n!==void 0&&/^https?:/i.test(n);return f.jsx("a",{...s,href:n,...r?{target:"_blank",rel:"noreferrer noopener"}:{}})}const kU=[UR],jU={a:AU,table:CU};function UE(){return f.jsx(DR,{className:"markdown","data-aui-quote-selectable":!0,components:jU,remarkPlugins:kU,defer:!0,smooth:!0})}function OU(){const e=zn(s=>s.message.metadata.custom?.liveInputStatus);if(e!=="pending"&&e!=="applied"&&e!=="queued"&&e!=="cancelled")return null;const n=e==="pending"?"Steering current run…":e==="applied"?"Applied to current run":e==="queued"?"Queued as next turn":"Cancelled";return f.jsx("span",{className:`live-input-status is-${e}`,role:"status",children:n})}function Op({status:e}){return zn(s=>s.message.role)!=="assistant"||e.type!=="running"?null:f.jsxs("span",{className:"thinking-indicator","aria-label":"Agent is thinking",children:[f.jsx("i",{}),f.jsx("i",{}),f.jsx("i",{})]})}function A0(e,n){const s=e.questions.find(i=>i.id===n.questionId);if(s===void 0)return;const r=n.customReply?.trim();return{header:s.header,labels:n.selectedOptionIds.flatMap(i=>{const c=s.options.find(d=>d.id===i);return c===void 0?[]:[c.label]}),...r===void 0||r.length===0?{}:{customReply:r}}}function NU(e){if(e.answers.length===1){const s=A0(e,e.answers[0]);return s===void 0?void 0:s.labels.length>0?{kind:"single",text:s.labels.join(", ")}:s.customReply===void 0?void 0:{kind:"single",text:`Answer: ${s.customReply}`}}const n=e.answers.flatMap(s=>{const r=A0(e,s);return r===void 0||r.header.trim().length===0?[]:r.labels.length>0?[`${r.header}: ${r.labels.join(", ")}`]:r.customReply===void 0?[]:[`${r.header}: ${r.customReply}`]});return n.length===0?void 0:{kind:"multiple",lines:n}}const PE=v.createContext(null),MU=250,zU=2e3,IU=async(e,n)=>{n.aborted||await new Promise(s=>{let r=!1,i=0;const c=()=>{r||(r=!0,window.clearTimeout(i),n.removeEventListener("abort",d),s())},d=()=>c();i=window.setTimeout(c,e),n.addEventListener("abort",d,{once:!0}),n.aborted&&c()})},ip=e=>e.status==="pending"&&Date.parse(e.expiresAt)<=Date.now()?{...e,status:"expired"}:e,Np=(e,n=0)=>{if(n>6||e===null||typeof e!="object"||Array.isArray(e))return;const s=e;if(typeof s.interactionId=="string"&&s.interactionId.trim().length>0)return s.interactionId;for(const r of["structuredContent","data","result","value"]){const i=Np(s[r],n+1);if(i!==void 0)return i}},Mp=(e,n=0)=>{if(n>6||e===null||typeof e!="object"||Array.isArray(e))return;const s=e;if(typeof s.interactionId=="string"&&s.interactionId.trim().length>0){if(s.answered===!0)return"answered";if(s.answered===!1&&s.reason==="timeout")return"expired";if(s.answered===!1&&s.reason==="cancelled")return"cancelled"}for(const r of["structuredContent","data","result","value"]){const i=Mp(s[r],n+1);if(i!==void 0)return i}};function DU({children:e}){const{selectedThread:n,selectedAgent:s,connection:r}=nn(),i=n?.id,c=v.useRef(new Map),d=v.useRef(0),[p,g]=v.useState(0),[m,y]=v.useState({}),b=v.useRef(m);v.useEffect(()=>{b.current=m},[m]);const x=v.useCallback(A=>(d.current+=1,{...A,version:d.current}),[]),w=v.useCallback(A=>{const j=c.current.get(A.toolCallId);return(j===void 0||j.expectedInteractionId!==A.expectedInteractionId||j.running!==A.running)&&(c.current.set(A.toolCallId,x(A)),g(_=>_+1)),()=>{c.current.delete(A.toolCallId),g(_=>_+1)}},[x]),E=v.useCallback((A,j)=>{const _=ip(j),O={snapshot:_,unavailable:!1},R=c.current.get(A);R!==void 0&&c.current.set(A,x({...R,expectedInteractionId:_.interactionId})),b.current={...b.current,[A]:O},y(M=>({...M,[A]:O}))},[x]);v.useEffect(()=>{y({})},[i]),v.useEffect(()=>{if(i===void 0)return;const A=new AbortController,j=M=>c.current.get(M.toolCallId)?.version===M.version,_=(M,U)=>A.signal.aborted||!j(M)?!1:(y(k=>j(M)?{...k,[M.toolCallId]:U}:k),!0),O=M=>{let U=!1;for(const k of M)_(k,{unavailable:!0})||(U=!0);return U};return(async()=>{let M=MU;for(;!A.signal.aborted;){const U=[...c.current.values()];if(U.length===0)return;if(r!=="live"||s?.status==="offline"){O(U);return}let k=!1;const Y=U.filter(P=>P.expectedInteractionId!==void 0);for(const P of Y){if(!j(P)){k=!0;continue}const oe=P.expectedInteractionId,le=b.current[P.toolCallId]?.snapshot;if(!(le?.interactionId===oe&&le.status!=="pending"))try{const ee=await Ze.ask(i,oe,A.signal);if(A.signal.aborted)return;if(ee===void 0||ee.interactionId!==oe){_(P,{unavailable:!0})||(k=!0);continue}const z=ip(ee);(!_(P,{snapshot:z,unavailable:!1})||z.status==="pending")&&(k=!0)}catch{if(A.signal.aborted)return;_(P,{unavailable:!0}),k=!0}}const H=U.filter(P=>P.expectedInteractionId===void 0),$=H.filter(P=>!P.running);O($)&&(k=!0);const B=H.filter(P=>P.running);if(B.length>0){const P=B.at(-1);if(!j(P)){k=!0;continue}try{const oe=await Ze.pendingAsk(i,A.signal);if(A.signal.aborted)return;if(!j(P))k=!0;else if(oe!==void 0)if([...c.current.values()].find(ee=>ee.toolCallId!==P.toolCallId&&ee.expectedInteractionId===oe.interactionId)===void 0){const ee=x({...P,expectedInteractionId:oe.interactionId});c.current.set(P.toolCallId,ee);const z=ip(oe);(!_(ee,{snapshot:z,unavailable:!1})||z.status==="pending")&&(k=!0)}else _(P,{unavailable:!0})||(k=!0);else _(P,{unavailable:!1}),k=!0}catch{if(A.signal.aborted)return;_(P,{unavailable:!0}),k=!0}}if(!k||A.signal.aborted)return;await IU(M,A.signal),M=Math.min(zU,M*2)}})(),()=>A.abort()},[r,p,s?.status,i,x]);const C=v.useMemo(()=>({states:m,register:w,replace:E}),[w,E,m]);return f.jsx(PE.Provider,{value:C,children:e})}function UU({args:e,result:n,structuredResult:s,status:r,toolCallId:i}){const c=nn().selectedThread?.id,d=v.useContext(PE),p=d?.register,g=d?.replace,m=v.useMemo(()=>Np(s)??Np(n),[n,s]),y=v.useMemo(()=>Mp(s)??Mp(n),[n,s]),b=d?.states[i],x=b?.snapshot,[w,E]=v.useState({}),[C,A]=v.useState({}),[j,_]=v.useState(!1),[O,R]=v.useState(),M=typeof e=="object"&&e!==null?e:{};v.useEffect(()=>p?.({toolCallId:i,...m===void 0?{}:{expectedInteractionId:m},running:r.type==="running"}),[m,p,r.type,i]);const U=x?.questions.slice(x.activeQuestionIndex)??[],k=U.length>0&&U.every(B=>{const P=(w[B.id]?.length??0)+((C[B.id]?.trim().length??0)>0?1:0);return B.multiSelect?P>0:P===1}),Y=async()=>{if(!c||!x||!k)return;_(!0),R(void 0);const B=U.map(P=>({questionId:P.id,selectedOptionIds:w[P.id]??[],...C[P.id]?.trim()?{customReply:C[P.id].trim()}:{}}));try{const P=await Ze.submitAsk(c,x.interactionId,B);if(!P.accepted)throw new Error(P.code==="invalid_answer"?"Please complete every question.":"This question is no longer active.");P.snapshot!==void 0&&g?.(i,P.snapshot)}catch(P){R(P instanceof Error?P.message:"Could not submit the answer.")}finally{_(!1)}},H=x?.status!==void 0&&x.status!=="pending"?x.status:x===void 0?y:void 0,$=x?.status==="answered"?NU(x):void 0;return f.jsxs("section",{className:"ask-user-card","aria-label":"Question from the agent",children:[f.jsxs("div",{className:"ask-user-heading",children:[f.jsx("span",{className:`tool-status${r.type==="running"?" is-running":""}`}),f.jsx("strong",{children:"Input needed"})]}),(x?.message??(typeof M.message=="string"?M.message:void 0))&&f.jsx("div",{className:"ask-user-context",children:x?.message??String(M.message)}),x===void 0?H!==void 0?f.jsx("p",{className:"ask-user-complete",role:"status",children:H==="answered"?"Answers submitted.":`Question ${H}.`}):b?.unavailable===!0?f.jsx("p",{className:"ask-user-complete",children:"Question unavailable. It may have expired, been evicted, or the agent may be offline."}):f.jsx("p",{className:"ask-user-loading",children:"Preparing the questions…"}):H!==void 0?f.jsxs("div",{className:"ask-user-complete",role:"status",children:[f.jsx("p",{children:H==="answered"?"Answers submitted.":`Question ${H}.`}),$?.kind==="single"?f.jsx("p",{className:"ask-user-summary-line",children:$.text}):$?.kind==="multiple"?f.jsx("ul",{className:"ask-user-summary",children:$.lines.map((B,P)=>f.jsx("li",{className:"ask-user-summary-line",children:B},`${String(P)}:${B}`))}):null]}):f.jsxs("form",{onSubmit:B=>{B.preventDefault(),Y()},children:[x.questions.map((B,P)=>{const oe=x.answers.find(G=>G.questionId===B.id),le=P<x.activeQuestionIndex&&oe!==void 0,ee=le?oe.selectedOptionIds:w[B.id]??[],z=le?oe.customReply??"":C[B.id]??"";return f.jsxs("fieldset",{disabled:le||j,children:[f.jsxs("legend",{children:[f.jsx("span",{children:B.header}),B.question]}),f.jsx("div",{className:"ask-user-options",children:B.options.map(G=>{const Q=ee.includes(G.id);return f.jsxs("label",{className:`ask-user-option${Q?" is-selected":""}`,children:[f.jsx("input",{type:B.multiSelect?"checkbox":"radio",name:B.id,checked:Q,onChange:()=>{E(q=>({...q,[B.id]:B.multiSelect?Q?(q[B.id]??[]).filter(re=>re!==G.id):[...q[B.id]??[],G.id]:[G.id]})),B.multiSelect||A(q=>({...q,[B.id]:""}))}}),f.jsxs("span",{children:[f.jsx("strong",{children:G.label}),f.jsx("small",{children:G.description})]})]},G.id)})}),f.jsxs("label",{className:"ask-user-other",children:[f.jsx("span",{children:"Custom reply"}),f.jsx("textarea",{rows:2,value:z,placeholder:"Type another answer…",onChange:G=>{const Q=G.target.value;A(q=>({...q,[B.id]:Q})),!B.multiSelect&&Q.trim()&&E(q=>({...q,[B.id]:[]}))}})]})]},B.id)}),O&&f.jsx("p",{className:"ask-user-error",role:"alert",children:O}),f.jsx("button",{type:"submit",className:"ask-user-submit",disabled:!k||j,children:j?"Submitting…":x.questions.length===1?"Submit answer":"Submit answers"})]})]})}function PU({toolName:e,args:n,result:s,isError:r,status:i,toolCallId:c,artifact:d}){const p=Xh(d);if(e==="AskUser")return f.jsx(UU,{args:n,result:s,structuredResult:p?.structuredResult,status:i,toolCallId:c});const g=i.type==="running",m=$E(p?.history),y=el(m),b=r?typeof m?.terminalState=="string"?m.terminalState:"failed":void 0,x=xr(p?.executionMs);return f.jsx(fu,{status:g?"running":r?"failed":"complete",label:rw(e),summary:qi(n),failed:b,duration:x===void 0?void 0:Sr(x),children:f.jsx(pu,{args:n,result:s,resultIsError:r,error:y,indented:!0})})}function Xh(e){return e===null||typeof e!="object"||Array.isArray(e)?void 0:e}function $E(e){if(e===null||typeof e!="object"||Array.isArray(e))return;const n=e;return(n.persistence==="persisted"||n.persistence==="failed")&&n.untrusted===!0?n:void 0}const k0=e=>typeof e=="number"&&Number.isFinite(e)&&e>=0?e:void 0,$U=e=>e>=1e6?`${(e/1e6).toFixed(1).replace(/\.0$/u,"")}M`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/u,"")}k`:String(Math.round(e)),LU=e=>{let n=e,s={};const r=new Set;for(let i=0;i<8&&!(n===null||typeof n!="object"||Array.isArray(n)||r.has(n));i+=1){r.add(n);const c=n;typeof c.status=="string"&&(s=c),n=c.data}return s};function LE({data:e,status:n}){const s=LU(e),r=["running","succeeded","skipped","failed"].includes(String(s.status))?s.status:"failed",i=r==="running"&&n.type!=="running"?"interrupted":r,c={running:"Compacting context…",succeeded:"Context compacted",skipped:"Context compaction skipped",failed:"Context compaction failed",interrupted:"Context compaction interrupted"}[i],d=typeof s.trigger=="string"?s.trigger:void 0,p=d==="overflow"?"after overflow":d==="proactive"?"proactive":d==="manual"?"manual":void 0,g=k0(s.tokensBefore),m=k0(s.tokensAfter),y=s.tokenCountsExact!==!0,b=w=>`${y?"~":""}${$U(w)}`,x=g!==void 0&&m!==void 0?`${b(g)} → ${b(m)} tokens`:g!==void 0?`${b(g)} tokens before`:m!==void 0?`${b(m)} tokens after`:void 0;return f.jsxs("div",{className:`context-compaction-row is-${i}`,role:"status","aria-label":[c.replace("…",""),p,x].filter(Boolean).join(", "),children:[f.jsx("span",{className:"context-compaction-status","aria-hidden":"true"}),f.jsx("span",{className:"context-compaction-label",children:c}),p!==void 0&&f.jsx("span",{className:"context-compaction-trigger",children:p}),x!==void 0&&f.jsx("span",{className:"context-compaction-counts",children:x})]})}function qE({data:e}){const n=e,s=typeof n.runId=="string"?n.runId:void 0,[r,i]=v.useState(!1),[c,d]=v.useState(!1),{loadCronRunActivity:p}=nn();if(s===void 0)return null;const g=typeof n.sequence=="number"?n.sequence:void 0,m=typeof n.status=="string"?n.status:"unknown",y=m==="succeeded"?n.silent===!0?"completed silently":"completed":m.replaceAll("_"," "),b=n.trigger==="manual"?"manual":"scheduled",x=typeof n.artifactRunId=="string"?n.artifactRunId:void 0,w=typeof n.conversationId=="string"?n.conversationId:void 0,E=typeof n.orderedAt=="string"?n.orderedAt:void 0,C=Number.isSafeInteger(n.eventCount)?Number(n.eventCount):0,A=n.activityLoaded===!0,j=n.activityStale===!0,_=n.eventsTruncated===!0,O=Array.isArray(n.fieldsTruncated)?n.fieldsTruncated.filter(R=>typeof R=="string"):[];return f.jsxs("div",{id:wp(s),className:`cron-run-row is-${m}`,role:"group","aria-label":`Cron run ${s}, ${b}, ${y}`,children:[f.jsxs("a",{className:"cron-run-link",href:`#${wp(s)}`,title:s,children:["Run",g===void 0?"":` ${String(g)}`]}),f.jsxs("span",{className:"cron-run-state",children:[b," · ",y]}),E!==void 0&&f.jsx("time",{dateTime:E,children:new Date(E).toLocaleString()}),x!==void 0&&f.jsxs("span",{className:"cron-artifact-link",title:x,children:["Artifact ",f.jsx("code",{children:x})]}),w!==void 0&&f.jsxs("button",{type:"button",className:"cron-session-button",title:w,"aria-label":r?"Originating session copied":`Copy originating session ${w}`,onClick:()=>{IE(w).then(()=>{i(!0),window.setTimeout(()=>i(!1),2e3)})},children:[f.jsx(Ae,{name:r?"check":"copy",size:12}),r?"Session copied":"Originating session"]}),C>0&&(!A||j)&&f.jsx("button",{type:"button",className:"cron-activity-button",disabled:c,onClick:()=>{d(!0),p(s).finally(()=>d(!1))},children:c?"Loading activity…":j?"Refresh activity":"Load activity"}),_&&f.jsx("span",{className:"cron-activity-truncated",role:"status",children:"Activity is truncated; retained and wire-bounded events are shown."}),O.length>0&&f.jsxs("span",{className:"cron-activity-truncated",role:"status",children:["Run ",O.join(", ")," ",O.length===1?"is":"are"," truncated in this view."]})]})}function HE({data:e}){const n=e?.text;return typeof n!="string"||n.trim().length===0?null:f.jsx("p",{className:"activity-note",children:n.trim()})}const Ic=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)?e:{};function BE({data:e}){const n=Ic(e),s=Array.isArray(n.calls)?n.calls:[],r=typeof n.failedCount=="number"?n.failedCount:0,i=xr(n.totalMs),c=n.status==="running"?"running":n.status==="failed"?"failed":"complete",d=s.flatMap(p=>{const g=qi(Ic(p).args);return g===void 0?[]:[g]});return f.jsx(fu,{status:c,label:`${rw(typeof n.toolName=="string"?n.toolName:"Tool")} ×${String(s.length)}`,summary:aw(d),failed:Li(r,!0),duration:i===void 0?void 0:Sr(i),children:f.jsx("div",{className:"activity-steps",children:s.map((p,g)=>{const m=Ic(p),y=Xh(m.artifact),b=el($E(y?.history)),x=xr(y?.executionMs),w=m.isError===!0;return f.jsx(hu,{toolName:String(m.toolName??n.toolName??"Tool"),summary:qi(m.args),failed:Li(w?1:0,!1),duration:x===void 0?void 0:Sr(x),children:f.jsx(pu,{args:m.args,result:m.result,resultIsError:w,error:b})},typeof m.toolCallId=="string"?m.toolCallId:g)})})})}function ZE({data:e}){const n=e;return f.jsxs("div",{className:"message-error",role:"alert",children:[f.jsx("strong",{children:n.code?String(n.code):"Agent error"}),f.jsx("span",{children:String(n.message??"The agent run failed.")})]})}const j0=new Set(["succeeded","failed","timed_out","cancelled","spawn_failed","queue_expired","interrupted"]),qU=1e3,HU=1e4;function BU(e){const n=e.origin.conversationId.split("#",1)[0];if(!(n===void 0||!n.startsWith("web:")||n==="web:new"))return n.slice(4)||void 0}function ZU(e,n){const s=Date.parse(e.timestamps.startedAt??e.timestamps.admittedAt),r=e.timestamps.completedAt===null?n:Date.parse(e.timestamps.completedAt),i=Number.isFinite(e.durationMs)&&e.durationMs!==null?e.durationMs:Math.max(0,r-s);if(i<1e3)return`${String(Math.round(i))} ms`;const c=Math.floor(i/1e3);if(c<60)return`${String(c)} s`;const d=Math.floor(c/60),p=c%60;return d<60?`${String(d)}m ${String(p)}s`:`${String(Math.floor(d/60))}h ${String(d%60)}m`}function VE({data:e}){const n=e,s=n.job,[r,i]=v.useState(s),[c,d]=v.useState(()=>Date.now()),p=s===void 0?void 0:BU(s),g=s?.jobId,m=r===void 0||j0.has(r.state);v.useEffect(()=>{i(s)},[s]),v.useEffect(()=>{if(m||p===void 0||g===void 0)return;const w=new AbortController;let E,C=qU;const A=async()=>{d(Date.now());try{const j=await Ze.threadJob(p,g,w.signal);if(w.signal.aborted||(i(j),j0.has(j.state)))return}catch{}w.signal.aborted||(E=window.setTimeout(()=>void A(),C),C=Math.min(HU,C*2))};return A(),()=>{w.abort(),E!==void 0&&window.clearTimeout(E)}},[g,m,p]);const y=v.useMemo(()=>r===void 0?[]:[r.output.stdoutRef,r.output.stderrRef].filter(w=>w!==null),[r]);if(r===void 0)return null;const b=typeof n.responseText=="string"?n.responseText:void 0,x=r.state.replaceAll("_"," ");return f.jsxs("section",{className:`process-job-card is-${r.state}`,"aria-label":`${r.tool} background job ${x}`,"aria-live":"polite",children:[f.jsxs("header",{className:"process-job-header",children:[f.jsx("span",{className:"process-job-state-dot","aria-hidden":"true"}),f.jsxs("strong",{children:[r.tool," background job"]}),f.jsx("span",{className:"process-job-state",children:x})]}),f.jsx("p",{className:"process-job-summary",children:r.summary}),f.jsxs("dl",{className:"process-job-facts",children:[f.jsxs("div",{children:[f.jsx("dt",{children:"Elapsed"}),f.jsx("dd",{children:ZU(r,c)})]}),r.exitCode!==null&&f.jsxs("div",{children:[f.jsx("dt",{children:"Exit"}),f.jsx("dd",{children:r.exitCode})]}),r.signal!==null&&f.jsxs("div",{children:[f.jsx("dt",{children:"Signal"}),f.jsx("dd",{children:r.signal})]}),f.jsxs("div",{children:[f.jsx("dt",{children:"Wake"}),f.jsx("dd",{children:r.wake.state})]})]}),(r.output.preview.length>0||y.length>0)&&f.jsxs("details",{className:"process-job-output",children:[f.jsxs("summary",{children:["Output",r.output.truncated?" (truncated)":""]}),r.output.preview.length>0&&f.jsx("pre",{children:r.output.preview}),y.length>0&&f.jsx("ul",{children:y.map(w=>f.jsx("li",{children:f.jsx("code",{children:w})},w))})]}),r.lastError!==null&&f.jsxs("p",{className:"process-job-error",children:[f.jsx("strong",{children:r.lastError.code})," ",r.lastError.message]}),b!==void 0&&b.trim().length>0&&f.jsx("p",{className:"process-job-response",children:b})]})}const YE={Text:UE,Quote:Hj,Empty:Op,data:{by_name:{"context-compaction":LE,"cron-run":qE,subagent:dw,note:HE,"tool-cluster":BE,error:ZE,"reply-attachment":NE,"mcp-app":zE,"reply-failure":ME,"process-job":VE}}},VU=e=>e.type==="data"&&typeof e.name=="string"?e.name:typeof e.type=="string"&&e.type.startsWith("data-")?e.type.slice(5):void 0,YU=e=>{let n=0,s=0,r=!1;const i=c=>{c!==void 0&&(s+=c,r=!0)};for(const c of e){if(c===null||typeof c!="object"||Array.isArray(c))continue;const d=c;if(d.type==="reasoning"){n+=1;continue}if(d.type==="tool-call"){n+=1,i(xr(Xh(d.artifact)?.executionMs));continue}const p=VU(d);if(p===void 0||!lw.has(p))continue;const g=Ic(d.data);n+=p==="tool-cluster"&&Array.isArray(g.calls)?g.calls.length:1,i(xr(p==="tool-cluster"?g.totalMs:g.executionMs))}return{stepCount:n,...r?{elapsedMs:s}:{}}};function GU(){const e=zn(s=>s.message.status?.type==="running"),n=zn(s=>s.message.content);return f.jsx(Is.GroupedParts,{groupBy:OO,indicator:"no-text",children:({part:s,children:r})=>{switch(s.type){case"group-activity":{const i=YU(s.indices.map(c=>n[c]));return f.jsx(uw,{streaming:e,stepCount:i.stepCount,elapsedMs:i.elapsedMs,children:r})}case"group-reply-images":return f.jsx("div",{className:"image-row",children:r});case"text":return s.text.length>0?f.jsx(UE,{}):s.status.type==="running"?f.jsx(Op,{status:s.status}):null;case"reasoning":return f.jsx(cw,{...s});case"tool-call":return s.toolUI??f.jsx(PU,{...s});case"data":return s.name==="telemetry"?null:s.name==="context-compaction"?f.jsx(LE,{...s}):s.name==="cron-run"?f.jsx(qE,{...s}):s.name==="subagent"?f.jsx(dw,{...s}):s.name==="note"?f.jsx(HE,{...s}):s.name==="tool-cluster"?f.jsx(BE,{...s}):s.name==="error"?f.jsx(ZE,{...s}):s.name==="reply-attachment"?f.jsx(NE,{...s}):s.name==="mcp-app"?f.jsx(zE,{...s}):s.name==="reply-failure"?f.jsx(ME,{...s}):s.name==="process-job"?f.jsx(VE,{...s}):s.dataRendererUI;case"indicator":return f.jsx(Op,{status:{type:"running"}});default:return null}}})}function KU(){return f.jsxs(Is.Root,{className:"message message-user",children:[f.jsx(Wx,{children:f.jsxs("div",{className:"message-user-content",children:[f.jsx(uO,{}),f.jsx(Is.Parts,{components:YE})]})}),f.jsx(OU,{}),f.jsx(DE,{label:"Copy message"})]})}function FU(){return f.jsx(Is.Root,{className:"message message-assistant",children:f.jsx(Wx,{children:f.jsxs("div",{className:"assistant-content",children:[f.jsx(GU,{}),f.jsx(Is.Error,{children:f.jsx("div",{className:"message-error",role:"alert",children:"The response ended with an error."})}),f.jsx(DE,{label:"Copy response",persistentWhenLast:!0})]})})})}function XU(){return f.jsx(Is.Root,{className:"message message-system",children:f.jsx(Is.Parts,{components:YE})})}const QU=(e,n,s)=>e==="live"&&n!==null&&n.status!=="offline"&&!s?.archivedAt&&(s?.canSend??!0),GE=(e,n,s)=>e==="live"&&n!==null&&n.status!=="offline"&&n.supportsAttachments&&(s?.canUpload??!0),JU=8,WU=/^[A-Za-z0-9_-]*$/u,KE=/^\$[A-Za-z0-9][A-Za-z0-9_-]*$/u,eP=/[\p{L}\p{N}_$-]$/u,tP=/^[\p{L}\p{N}_$-]/u;function O0(e,n,s=n){if(n!==s)return null;const r=Math.max(0,Math.min(n,e.length)),i=e.slice(0,r);for(let c=i.length-1;c>=0;c-=1){const d=i[c]??"";if(/\s/u.test(d))return null;if(d!=="$"||c>0&&!/\s/u.test(i[c-1]??""))continue;const p=i.slice(c+1);return WU.test(p)?{offset:c,query:p,cursor:r}:null}return null}function Qh(e){return e.availability!=="unavailable"&&typeof e.reference=="string"&&e.reference===`$${e.name}`&&KE.test(e.reference)}function Yi(e,n,s={}){const r=zp(n.trim()),i=e.flatMap((c,d)=>{if(c.availability==="unavailable"&&s.includeUnavailable!==!0)return[];if(c.availability!=="unavailable"&&!Qh(c))return[];const p=oP(c,r);return p===void 0?[]:[{skill:c,originalIndex:d,tier:p.tier,quality:p.quality}]});return i.sort(rP),i.slice(0,s.limit??JU).map(({skill:c})=>c)}function nP(e,n,s,r){if(!KE.test(r))return{text:e,selectionStart:n,selectionEnd:s};const i=Math.max(0,Math.min(n,e.length)),c=Math.max(i,Math.min(s,e.length)),d=e.slice(0,i),p=e.slice(c),g=eP.test(d)?" ":"",m=p.length===0||tP.test(p)?" ":"",y=`${d}${g}${r}${m}${p}`,x=d.length+g.length+r.length+(m.length>0?m.length:/^\s/u.test(p)?1:0);return{text:y,selectionStart:x,selectionEnd:x}}function oP(e,n){if(n.length===0)return{tier:7,quality:0};const s=zp(e.name);if(s===n)return{tier:0,quality:0};if(s.startsWith(n))return{tier:1,quality:s.length-n.length};const i=s.split(/[-_]+/u).filter(Boolean).findIndex(b=>b.startsWith(n));if(i>=0)return{tier:2,quality:i};const c=s.indexOf(n);if(c>=0)return{tier:3,quality:c};const d=sP(s,n);if(d!==void 0)return{tier:4,quality:d};const p=zp(e.description),g=p.indexOf(n);if(g>=0)return{tier:5,quality:g};const m=n.split(/[^a-z0-9]+/u).filter(Boolean),y=p.split(/[^a-z0-9]+/u).filter(Boolean);if(m.length>0&&m.every(b=>y.some(x=>x.startsWith(b))))return{tier:6,quality:m.length}}function sP(e,n){let s=0,r=-1,i=-1;for(const c of n){const d=e.indexOf(c,s);if(d<0)return;r<0&&(r=d),i=d,s=d+1}return r<0?void 0:i-r+1-n.length+r}function rP(e,n){if(e.tier!==n.tier)return e.tier-n.tier;if(e.quality!==n.quality)return e.quality-n.quality;const s=N0(e.skill)-N0(n.skill);if(s!==0)return s;if(e.tier!==7&&e.skill.name.length!==n.skill.name.length)return e.skill.name.length-n.skill.name.length;const r=e.skill.name.toLowerCase(),i=n.skill.name.toLowerCase();return r<i?-1:r>i?1:e.originalIndex-n.originalIndex}function N0(e){return e.availability==="inlined"?0:e.availability==="on-demand"?1:2}function zp(e){return e.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase()}const aP=new Set(["agent","archive","arrow-down","attach","check","chevron","close","command","copy","file","menu","more","new","restore","search","send","settings","spark","star","stop","threads"]),iP=e=>typeof e=="string"&&aP.has(e)?e:"command";function lP({commands:e,className:n}){const s=OR({commands:e,removeOnExecute:!0});return f.jsxs(cn.Unstable_TriggerPopover,{char:"/",adapter:s.adapter,"aria-label":"Commands","data-slot":"composer-trigger-popover",className:["composer-trigger-popover",n].filter(Boolean).join(" "),children:[f.jsx(cn.Unstable_TriggerPopover.Action,{onExecute:s.action.onExecute,removeOnExecute:s.action.removeOnExecute}),f.jsx(cn.Unstable_TriggerPopoverItems,{"aria-label":"Available commands",children:r=>f.jsxs("div",{className:"composer-trigger-list","data-slot":"composer-trigger-list",children:[r.map((i,c)=>{const d=iP(i.metadata?.icon);return f.jsxs(cn.Unstable_TriggerPopoverItem,{item:i,index:c,className:"composer-trigger-item","data-slot":"composer-trigger-item",children:[f.jsx("span",{className:"composer-trigger-item-icon","data-command-icon":d,children:f.jsx(Ae,{name:d,size:16})}),f.jsxs("span",{className:"composer-trigger-item-copy",children:[f.jsx("strong",{children:i.label}),i.description&&f.jsx("small",{children:i.description})]})]},i.id)}),r.length===0&&f.jsx("div",{className:"composer-trigger-empty","data-slot":"composer-trigger-empty",role:"status",children:"No matching commands"})]})})]})}const Ip=e=>e.availability==="inlined"?"In prompt":e.availability==="on-demand"?"On demand":e.unavailableReason==="read-skill-disabled"?"ReadSkill disabled":e.unavailableReason==="unsupported-name"?"Unsupported name":"Not selected",cP={...NR,serialize:e=>`$${e.id}`};function uP({resultCount:e,onSelect:n}){const s=Z0(),r=v.useRef(n);return r.current=n,v.useEffect(()=>s.registerSelectItemOverride(i=>(r.current(i.id),!0)),[s.registerSelectItemOverride]),s.open?f.jsxs("span",{className:"sr-only",role:"status","aria-live":"polite",children:[e," skill suggestion",e===1?"":"s"," available."]}):null}function dP({cursor:e,onSynchronized:n}){const s=Z0();return v.useLayoutEffect(()=>s.setCursorPosition(e),[e,s.setCursorPosition]),v.useLayoutEffect(()=>n(e),[e,n]),null}function fP({skills:e,query:n,cursor:s,onSelect:r}){const[i,c]=v.useState(!1),[d,p]=v.useState();v.useEffect(()=>{c(!0)},[]);const g=v.useMemo(()=>({categories:()=>[],categoryItems:()=>[],search:y=>Yi(e,y).map(b=>({id:b.name,type:"skill",label:b.reference??`$${b.name}`,description:b.description,metadata:{availability:b.availability}}))}),[e]),m=Yi(e,n).length;return f.jsxs(cn.Unstable_TriggerPopover,{char:"$",adapter:g,"aria-label":"Skills","data-slot":"skill-autocomplete",className:"composer-trigger-popover skill-autocomplete",children:[f.jsx(cn.Unstable_TriggerPopover.Action,{formatter:cP,onExecute:()=>{}}),i&&d!==s?f.jsx(dP,{cursor:s,onSynchronized:p}):null,i?f.jsx(uP,{resultCount:m,onSelect:r}):null,f.jsx(cn.Unstable_TriggerPopoverItems,{"aria-label":"Available skills",children:y=>f.jsx("div",{className:"composer-trigger-list","data-slot":"skill-autocomplete-list",children:y.map((b,x)=>{const w=e.find(E=>E.name===b.id);return w===void 0?null:f.jsxs(cn.Unstable_TriggerPopoverItem,{item:b,index:x,className:"composer-trigger-item skill-result","data-slot":"skill-autocomplete-item",children:[f.jsx("span",{className:"composer-trigger-item-icon",children:f.jsx(Ae,{name:"spark",size:16})}),f.jsxs("span",{className:"composer-trigger-item-copy",children:[f.jsx("strong",{children:w.reference}),f.jsx("small",{children:w.description})]}),f.jsx("span",{className:"skill-status","data-availability":w.availability,children:Ip(w)})]},b.id)})})})]})}function pP({agentLabel:e,registry:n,onBeforeOpen:s,onSelect:r}){const[i,c]=v.useState(!1),[d,p]=v.useState(""),g=v.useRef(null),m=v.useMemo(()=>Yi(n.items,d,{includeUnavailable:!0,limit:256}),[d,n.items]),y=n.status==="ready";return v.useEffect(()=>{if(!i){p("");return}window.requestAnimationFrame(()=>g.current?.focus())},[i]),f.jsxs(Xx,{open:i,onOpenChange:c,children:[f.jsx(nO,{type:"button",className:"icon-button composer-tool","aria-label":"Browse skills",title:"Browse skills",disabled:e===void 0,onClick:s,children:f.jsx(Ae,{name:"spark",size:17})}),f.jsxs(Fx,{children:[f.jsx(Vx,{className:"skill-browser-backdrop"}),f.jsxs(Kx,{className:"skill-browser-popup",children:[f.jsxs("header",{className:"skill-browser-header",children:[f.jsxs("span",{children:[f.jsx(Qx,{children:"Skills"}),f.jsxs(Yj,{children:["Browse skills for ",e??"the active agent",". Selecting one only inserts its reference."]})]}),f.jsx(Yx,{className:"icon-button","aria-label":"Close skills",children:f.jsx(Ae,{name:"close",size:16})})]}),f.jsxs(No,{className:"skill-browser-command",label:"Search skills",loop:!0,shouldFilter:!1,children:[f.jsxs("div",{className:"skill-browser-search",children:[f.jsx(Ae,{name:"search",size:16}),f.jsx(No.Input,{ref:g,value:d,onValueChange:p,placeholder:"Search names and descriptions…","aria-label":"Search skills"})]}),f.jsx(hP,{registry:n}),f.jsxs(No.List,{className:"skill-browser-list","aria-label":"Skills",children:[m.map(b=>{const x=y&&Qh(b);return f.jsxs(No.Item,{value:b.name,className:"skill-browser-item",disabled:!x,"aria-label":`${b.reference??b.name}, ${Ip(b)}. ${b.description}`,onSelect:()=>{x&&(c(!1),r(b.name))},children:[f.jsx("span",{className:"skill-browser-item-icon",children:f.jsx(Ae,{name:"spark",size:16})}),f.jsxs("span",{className:"skill-browser-item-copy",children:[f.jsx("strong",{children:b.reference??b.name}),f.jsx("small",{children:b.description})]}),f.jsx("span",{className:"skill-status","data-availability":b.availability,children:Ip(b)})]},b.name)}),n.status==="ready"&&m.length===0&&f.jsx("div",{className:"skill-browser-empty",role:"status",children:n.items.length===0?"No skills are installed for this agent.":"No matching skills."})]})]})]})]})]})}function hP({registry:e}){let n;switch(e.status){case"loading":n="Loading skills…";break;case"stale":n="Showing a stale snapshot. Reconnect before inserting a skill.";break;case"error":n="The agent could not load its skill registry.";break;case"unsupported":n="This agent version does not expose skill discovery.";break;case"offline":n="This agent is offline.";break;case"ready":n=e.truncated===!0?`Showing ${e.items.length} of ${e.total} skills.`:void 0;break}return n===void 0?null:f.jsx("p",{className:"skill-browser-notice",role:"status",children:n})}const mP=({attachmentCount:e,hasAgent:n,hasRunSettings:s,isRunning:r,createConversation:i,openRunSettings:c,stopResponse:d})=>[...!r&&s?[{id:"settings",label:"Run settings",description:"Choose the model and reasoning effort",icon:"settings",execute:c}]:[],...r?[{id:"stop",label:"Stop response",description:"Cancel the current agent run",icon:"stop",execute:d}]:[],...!r&&n&&e===0?[{id:"new",label:"New conversation",description:"Start a clean conversation with this agent",icon:"new",execute:i}]:[]];function gP(){const e=nn(),{connection:n,selectedAgent:s,selectedThread:r}=e,i=MR(),c=v.useRef(null),[d,p]=v.useState({start:i.value.length,end:i.value.length}),g=v.useRef(d),m=zn(R=>R.thread.isRunning),y=!m&&GE(n,s,r),b=zn(R=>R.composer.canSend),x=zn(R=>R.composer.attachments.length),w=v.useMemo(()=>mP({attachmentCount:x,hasAgent:s!==null,hasRunSettings:e.modelOptions.length>0||e.effortOptions.length>0,isRunning:m,createConversation:()=>void e.createThread().catch(()=>{}),openRunSettings:()=>window.dispatchEvent(new Event("mono-agent:run-settings")),stopResponse:()=>void e.cancelTurn().catch(()=>{})}),[x,m,s,e]),E=s?.status==="offline"?`${s.label} is offline`:r?.archivedAt?"Conversation archived":void 0,C=v.useMemo(()=>O0(i.value,d.start,d.end),[i.value,d.end,d.start]),A=v.useMemo(()=>e.skillRegistry.status==="ready"&&C!==null?Yi(e.skillRegistry.items,C.query):[],[C,e.skillRegistry]),j=v.useCallback((R=c.current)=>{if(R===null)return;const M={start:R.selectionStart??R.value.length,end:R.selectionEnd??R.value.length};p(M),g.current=M},[]),_=v.useCallback((R,M)=>{window.requestAnimationFrame(()=>{const U=c.current;U!==null&&(U.focus({preventScroll:!0}),U.setSelectionRange(R,M),p({start:R,end:M}),g.current={start:R,end:M})})},[]),O=v.useCallback((R,M)=>{if(e.skillRegistry.status!=="ready")return;const U=e.skillRegistry.items.find($=>$.name===R);if(U===void 0||!Qh(U))return;const k=i.value;let Y=M==="browse"?g.current:{start:c.current?.selectionStart??d.start,end:c.current?.selectionEnd??d.end};if(M==="autocomplete"){const $=O0(k,Y.start,Y.end);if($===null||!Yi(e.skillRegistry.items,$.query).some(B=>B.name===R))return;Y={start:$.offset,end:$.cursor}}const H=nP(k,Y.start,Y.end,U.reference);i.setText(H.text),_(H.selectionStart,H.selectionEnd)},[i,_,d.end,d.start,e.skillRegistry]);return f.jsx(cn.Unstable_TriggerPopoverRoot,{children:f.jsxs(cn.Root,{className:"composer-root",children:[f.jsx(lP,{commands:w}),C!==null&&A.length>0&&f.jsx(fP,{skills:e.skillRegistry.items,query:C.query,cursor:C.cursor,onSelect:R=>O(R,"autocomplete")}),f.jsx(Zj,{}),f.jsxs(cn.AttachmentDropzone,{className:"composer-dropzone",disabled:!y,children:[f.jsx(iO,{}),f.jsx(lO,{}),f.jsx("div",{className:"composer-input-row",children:f.jsx(cn.Input,{ref:c,id:"composer-input",className:"composer-input",placeholder:E??(m?`Steer ${s?.label??"the agent"} while it works…`:`Message ${s?.label??"an agent"}…`),"aria-label":"Message",role:"combobox","aria-autocomplete":"list","aria-expanded":!1,rows:1,addAttachmentOnPaste:y,submitMode:"enter",unstable_insertNewlineOnTouchEnter:!0,unstable_focusOnRunStart:!1,unstable_focusOnScrollToBottom:!1,unstable_focusOnThreadSwitched:!1,onChange:R=>j(R.currentTarget),onSelect:R=>j(R.currentTarget),onKeyUp:R=>j(R.currentTarget),onClick:R=>j(R.currentTarget)})}),f.jsxs("div",{className:"composer-toolbar",children:[f.jsxs("div",{className:"composer-tools",children:[y&&f.jsx(cn.AddAttachment,{className:"icon-button composer-tool","aria-label":"Attach files",title:"Attach files",multiple:!0,children:f.jsx(Ae,{name:"attach",size:17})}),f.jsx(pP,{agentLabel:s?.label,registry:e.skillRegistry,onBeforeOpen:()=>j(),onSelect:R=>O(R,"browse")}),f.jsx("span",{className:"composer-hint",children:E??(m?"Enter to steer this run":"Enter to send · / commands · $ skills")})]}),f.jsxs("div",{className:"composer-actions",children:[f.jsx(cn.Send,{className:"composer-send","aria-label":m?"Send live follow-up":"Send message",disabled:!b,children:f.jsx(Ae,{name:"send",size:16})}),m&&f.jsxs(cn.Cancel,{className:"composer-stop","aria-label":"Stop response",children:[f.jsx(Ae,{name:"stop",size:14}),f.jsx("span",{children:"Stop"})]})]})]})]})]})})}const FE=e=>({none:"Off",minimal:"Minimal",low:"Low",medium:"Medium",high:"High",xhigh:"Extra high",max:"Max",ultra:"Ultra"})[e]??e,vP=(e,n)=>e===void 0?"Provider":n?e==="none"?"Off":"On":FE(e);function yP(){const{model:e,effort:n,modelOptions:s,effortOptions:r,setModel:i,setEffort:c,selectedThread:d,selectedAgent:p,detail:g,effectiveModel:m,effectiveEffort:y,hasRunOverride:b,resetRunOverride:x}=nn(),w=p?.defaultModel??"",E=p?.defaultEffort??"",C=v.useMemo(()=>{const j=Ak(g,{selectedModel:m});return j!==null?j:d===null?null:{context:d.runState.status==="running"?{status:"updating",reason:"The conversation is loading while the current turn updates context."}:{status:"unavailable",reason:"Context measurements are loading for this conversation."}}},[g,m,d]),A=v.useMemo(()=>{if(!p)return[];const j=_=>{const O=_||w||p.defaultModel||s[0]||"",R=p.modelOptions?.[O]?.reasoningMode==="toggle",M=Uc(p,O);return M.length===0?[]:[{id:"",name:`Default · ${vP(E||p.defaultEffort,R)}`},...M.map(U=>({id:U,name:R?U==="none"?"Off":"On":FE(U)}))]};return[{id:"",name:`Default · ${(p.modelOptions?.[w]?.label??w)||"agent"}`,description:w?`Agent default · ${w}`:"Use the agent default",efforts:j("")},...s.map(_=>({id:_,name:p.modelOptions?.[_]?.label??_,description:_,efforts:j(_)}))]},[E,w,s,p]);return{usage:C,selectorModels:A,model:e,effort:n,effectiveModel:m,effectiveEffort:y,setModel:i,setEffort:c,agentDefaultModel:w,hasRunOverride:b,resetRunOverride:x,disabled:d?.runState.status==="running",hasSettings:s.length>0||r.length>0}}const M0={idle:"Ready",running:"Working",complete:"Ready",failed:"Failed",cancelled:"Stopped",interrupted:"Interrupted"},bP=5e3;function SP({connection:e}){const[n,s]=v.useState(e==="offline");return v.useEffect(()=>{if(e==="live"){s(!1);return}if(e==="offline"){s(!0);return}s(!1);const r=window.setTimeout(()=>s(!0),bP);return()=>window.clearTimeout(r)},[e]),!n||e==="live"?null:f.jsxs("div",{className:"connection-banner",role:"status",children:[f.jsx("span",{className:"connection-pulse"}),e==="offline"?"You’re offline. Existing conversations remain readable; you can send again after reconnecting.":"Live updates are reconnecting. The agent keeps working on the server."]})}function xP(){const{selectedThread:e,renameThread:n}=nn(),[s,r]=v.useState(!1),[i,c]=v.useState(e?.title??"New conversation"),d=v.useRef(null);v.useEffect(()=>{c(e?.title??"New conversation"),r(!1)},[e?.id,e?.title]),v.useEffect(()=>{s&&d.current?.select()},[s]);const p=()=>{if(r(!1),!e)return;const m=i.trim();if(!m){c(e.title);return}m!==e.title&&n(e.id,m).catch(()=>{})},g=e?.trigger?f.jsx("span",{className:"trigger-badge trigger-badge-header","aria-label":`${e.trigger.kind} notification`,children:e.trigger.kind}):null;return s&&e?f.jsxs("div",{className:"conversation-title-group",children:[f.jsx("input",{ref:d,className:"title-input",value:i,onChange:m=>c(m.target.value),onBlur:p,onKeyDown:m=>{m.key==="Enter"&&m.currentTarget.blur(),m.key==="Escape"&&(c(e.title),r(!1))},maxLength:120,"aria-label":"Conversation title"}),g]}):f.jsxs("div",{className:"conversation-title-group",children:[f.jsx("button",{type:"button",className:"conversation-title",onClick:()=>e&&r(!0),disabled:!e,title:e?"Rename conversation":void 0,children:e?.title??"New conversation"}),g]})}function wP(){const{usage:e,selectorModels:n,model:s,effort:r,setModel:i,setEffort:c,agentDefaultModel:d,hasRunOverride:p,resetRunOverride:g,disabled:m,hasSettings:y}=yP(),[b,x]=v.useState(!1);return v.useEffect(()=>{const w=()=>{x(!0)};return window.addEventListener("mono-agent:run-settings",w),()=>{window.removeEventListener("mono-agent:run-settings",w)}},[]),f.jsxs("div",{className:"model-controls","aria-label":"Run settings",children:[e&&f.jsx(zk,{context:e.context,processed:e.processed,conversationCost:e.cost}),y&&f.jsx(qj,{models:n,value:s,effort:r,onValueChange:i,onEffortChange:c,open:b,onOpenChange:x,disabled:m,badge:p?"custom":"default",agentDefaultId:d,...p?{onReset:g}:{}})]})}function EP(){const{selectedAgent:e,createThread:n,selectedThread:s}=nn(),r=s?.trigger?.kind==="cron";return f.jsx(aa.Empty,{children:f.jsxs("div",{className:"chat-empty",children:[f.jsxs("div",{className:"empty-orbit","aria-hidden":"true",children:[f.jsx("span",{}),f.jsx(Ae,{name:"spark",size:22})]}),f.jsx("span",{className:"eyebrow",children:e?.label??"mono-agent"}),f.jsx("h2",{children:r?"No cron runs recorded yet":s?"What should we work on?":"Start a new conversation"}),f.jsx("p",{children:r?"Runs will appear here chronologically after the agent admits them.":e?"Messages, reasoning, tool calls, and files stay together in this conversation.":"No agents have been discovered yet. Start an agent and it will appear here automatically."}),e&&!s&&!r&&f.jsxs("button",{type:"button",className:"primary-button",onClick:()=>void n().catch(()=>{}),children:[f.jsx(Ae,{name:"new",size:16}),"New conversation"]})]})})}function TP({onOpenAgents:e,onOpenThreads:n}){const{selectedAgent:s,selectedThread:r,connection:i,detailLoading:c,archiveThread:d,unarchiveThread:p,deleteThread:g,hasOlderMessages:m,loadOlderMessages:y}=nn(),b=r?.runState.status,x=b==="running"||b==="failed"||b==="cancelled"||b==="interrupted",w=s?.status==="offline"?"Offline":i==="offline"?"Browser offline":i==="reconnecting"?"Reconnecting":x&&b?M0[b]:s?.status==="degraded"?"Degraded":r?M0[r.runState.status]:"Ready",E=w==="Ready"?"ready":w==="Working"?"working":w.toLowerCase();return f.jsxs("main",{className:"chat-panel",children:[f.jsxs("header",{className:"chat-header",children:[f.jsxs("div",{className:"mobile-navigation",children:[f.jsx("button",{type:"button",className:"icon-button",onClick:e,"aria-label":"Choose agent",children:f.jsx(Ae,{name:"agent",size:19})}),f.jsx("button",{type:"button",className:"icon-button",onClick:n,"aria-label":"Open conversations",children:f.jsx(Ae,{name:"menu",size:19})})]}),f.jsxs("div",{className:"chat-title-block",children:[f.jsx(xP,{}),f.jsxs("span",{className:`chat-status is-${E}`,children:[f.jsx("i",{}),w]})]}),f.jsxs("div",{className:"chat-header-actions",children:[r?.trigger?.kind!=="cron"&&f.jsx(wP,{}),f.jsx(S1,{}),r&&f.jsx("button",{type:"button",className:"icon-button header-archive","aria-label":r.archivedAt?"Restore conversation":"Archive conversation",title:r.archivedAt?"Restore conversation":"Archive conversation",onClick:()=>{(r.archivedAt?p(r.id):d(r.id)).catch(()=>{})},children:f.jsx(Ae,{name:r.archivedAt?"restore":"archive",size:17})}),r?.archivedAt&&(r.trigger?.kind!=="cron"||r.trigger.configured===!1)&&f.jsx("button",{type:"button",className:"icon-button header-delete","aria-label":"Permanently delete conversation",title:"Permanently delete conversation",onClick:()=>{window.confirm("Permanently delete this conversation and its attachments? This cannot be undone.")&&g(r.id).catch(()=>{})},children:f.jsx(Ae,{name:"trash",size:17})})]})]}),f.jsx(SP,{connection:i}),f.jsx(ZO,{}),f.jsx(DU,{children:f.jsxs(aa.Root,{className:"thread-root",children:[f.jsx(Bj,{}),f.jsxs(aa.Viewport,{className:"thread-viewport",autoScroll:!0,children:[f.jsxs("div",{className:"message-column",children:[f.jsx(EP,{}),m&&f.jsx("button",{type:"button",className:"message-history-more",onClick:()=>void y().catch(()=>{}),children:"Load earlier messages"}),f.jsx(aa.Messages,{components:{UserMessage:KU,AssistantMessage:FU,SystemMessage:XU}})]}),f.jsx(aa.ScrollToBottom,{className:"scroll-bottom","aria-label":"Scroll to latest message",children:f.jsx(Ae,{name:"arrow-down",size:16})}),f.jsx(aa.ViewportFooter,{className:"thread-footer",children:r?.archivedAt?f.jsxs("div",{className:"archived-footer",children:[f.jsx("span",{children:"This conversation is archived."}),f.jsx("button",{type:"button",onClick:()=>void p(r.id).catch(()=>{}),children:"Restore to continue"})]}):r?.trigger?.kind==="cron"?f.jsx("div",{className:"cron-readonly-footer",role:"status",children:"Cron channels are read-only. Open the originating session to continue the conversation."}):f.jsx(gP,{})})]}),c&&r&&f.jsx("div",{className:"detail-loading",role:"status","aria-label":"Loading conversation",children:f.jsx("span",{})})]})})]})}const XE="",QE="",JE=2,_P=200,WE=e=>e.split(XE).join("").split(QE).join(""),z0=e=>e.length===0?[]:[{text:WE(e),match:!1}];function RP(e){const n=[];let s=0;for(;;){const r=e.indexOf(XE,s);if(r<0)break;const i=e.indexOf(QE,r+1);if(i<0)break;n.push(...z0(e.slice(s,r))),n.push({text:WE(e.slice(r+1,i)),match:!0}),s=i+1}return n.push(...z0(e.slice(s))),n}function CP(e,n){const s=n.trim();if(s.length===0)return[{text:e,match:!1}];const r=e.toLocaleLowerCase().indexOf(s.toLocaleLowerCase());return r<0?[{text:e,match:!1}]:[...r>0?[{text:e.slice(0,r),match:!1}]:[],{text:e.slice(r,r+s.length),match:!0},...r+s.length<e.length?[{text:e.slice(r+s.length),match:!1}]:[]]}const I0={hits:[],status:"idle",truncated:!1};function AP(e,n){const[s,r]=v.useState(I0),i=v.useRef(s);return i.current=s,v.useEffect(()=>{const c=n.trim();if(e===null||c.length<JE){r(I0);return}r({...i.current,status:"loading"});const d=new AbortController,p=setTimeout(()=>{Ze.searchThreads(e,c,d.signal).then(g=>{r({hits:g.hits,status:"ready",truncated:g.truncated})}).catch(g=>{d.signal.aborted||g instanceof DOMException&&g.name==="AbortError"||r({hits:[],status:"error",truncated:!1})})},_P);return()=>{clearTimeout(p),d.abort()}},[n,e]),s}const eT=e=>{const n=Math.max(0,Date.now()-Date.parse(e)),s=Math.floor(n/6e4);if(s<1)return"now";if(s<60)return`${String(s)}m`;const r=Math.floor(s/60);if(r<24)return`${String(r)}h`;const i=Math.floor(r/24);return i<7?`${String(i)}d`:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(e))};function D0({segments:e}){return f.jsx(f.Fragment,{children:e.map((n,s)=>f.jsx(v.Fragment,{children:n.match?f.jsx("mark",{children:n.text}):n.text},s))})}function U0({hit:e,query:n,onSelect:s}){const{selectThread:r,selectedThreadId:i}=nn(),{thread:c}=e;return f.jsxs("button",{type:"button",className:`thread-search-hit${c.id===i?" is-active":""}`,"aria-label":`Open ${c.title}`,onClick:()=>{r(c.id),s?.()},children:[f.jsxs("span",{className:"thread-title-line",children:[f.jsx("span",{className:"thread-title",children:f.jsx(D0,{segments:CP(c.title,n)})}),c.trigger&&f.jsx("span",{className:"trigger-badge",children:c.trigger.kind}),f.jsx("time",{dateTime:c.updatedAt,children:eT(c.updatedAt)})]}),f.jsxs("span",{className:"thread-preview",children:[f.jsx("span",{className:"thread-preview-text",children:e.snippet===void 0?e.titleMatch?"Matched the title":c.lastMessagePreview||"No matching message text":f.jsx(D0,{segments:RP(e.snippet)})}),e.messageMatches>1&&f.jsx("span",{className:"thread-search-count",children:`${String(e.messageMatches)} matches`})]})]})}function kP({query:e,search:n,onSelect:s}){const r=n.hits.filter(c=>c.thread.archivedAt===null),i=n.hits.filter(c=>c.thread.archivedAt!==null);return n.status==="error"?f.jsxs("div",{className:"thread-list-empty",role:"alert",children:[f.jsx(Ae,{name:"search",size:19}),f.jsx("span",{children:"Search is unavailable right now"})]}):n.hits.length===0?f.jsxs("div",{className:"thread-list-empty",children:[f.jsx(Ae,{name:"search",size:19}),f.jsx("span",{children:n.status==="loading"?"Searching…":"No matching conversations"})]}):f.jsxs("div",{className:"thread-search-results","aria-busy":n.status==="loading",children:[r.length>0&&f.jsxs("section",{children:[f.jsx("h2",{className:"thread-search-group",children:"Conversations"}),r.map(c=>f.jsx(U0,{hit:c,query:e,onSelect:s},c.thread.id))]}),i.length>0&&f.jsxs("section",{children:[f.jsx("h2",{className:"thread-search-group",children:"Archived"}),i.map(c=>f.jsx(U0,{hit:c,query:e,onSelect:s},c.thread.id))]}),n.truncated&&f.jsx("p",{className:"thread-search-truncated",children:"Showing the closest matches. Add a word to narrow the search."})]})}function jP({thread:e,archived:n}){const s=zn(i=>i.threads.mainThreadId===i.threadListItem.id),r=e.runState.status==="running";return f.jsxs(bi.Root,{className:`thread-item${s?" is-active":""}`,children:[f.jsxs(bi.Trigger,{className:"thread-trigger","aria-label":`Open ${e.title}`,children:[f.jsxs("span",{className:"thread-title-line",children:[f.jsx("span",{className:"thread-title",children:f.jsx(bi.Title,{fallback:"Untitled conversation"})}),e.trigger&&f.jsx("span",{className:"trigger-badge","aria-label":`${e.trigger.kind} notification`,children:e.trigger.kind}),f.jsx("time",{dateTime:e.updatedAt,children:eT(e.updatedAt)})]}),f.jsxs("span",{className:"thread-preview",children:[r&&f.jsx("i",{className:"thread-running","aria-label":"Agent is responding"}),f.jsx("span",{className:"thread-preview-text",children:e.lastMessagePreview||(e.messageCount?`${e.messageCount} messages`:"New conversation")})]})]}),n?f.jsx(bi.Unarchive,{className:"thread-action","aria-label":`Restore ${e.title}`,title:"Restore conversation",children:f.jsx(Ae,{name:"restore",size:15})}):f.jsx(bi.Archive,{className:"thread-action","aria-label":`Archive ${e.title}`,title:"Archive conversation",children:f.jsx(Ae,{name:"archive",size:15})})]})}function P0({onSelect:e}){const{selectedAgent:n,threads:s,selectedAgentId:r,showArchived:i,setShowArchived:c,hasMoreThreads:d,loadMoreThreads:p}=nn(),[g,m]=v.useState(""),y=g.trim().length>=JE,b=AP(r,g),x=v.useMemo(()=>new Map(s.map(E=>[E.id,E])),[s]),w=s.filter(E=>E.sourceId===r&&!!E.archivedAt===i).length;return f.jsxs("aside",{className:"thread-sidebar","aria-label":"Conversations",children:[f.jsxs("div",{className:"sidebar-header",children:[f.jsxs("div",{children:[f.jsx("span",{className:"eyebrow",children:"Conversations"}),f.jsx("h1",{children:n?.label??"No agent"})]}),f.jsx(jf.New,{className:"new-thread-button","aria-label":"New conversation",title:"New conversation (⌘⇧O)",onClick:e,disabled:!n,children:f.jsx(Ae,{name:"new",size:18})})]}),f.jsxs("label",{className:"thread-search",children:[f.jsx(Ae,{name:"search",size:16}),f.jsx("span",{className:"sr-only",children:"Search conversations"}),f.jsx("input",{value:g,onChange:E=>m(E.target.value),placeholder:"Search conversations",type:"search"}),g&&f.jsx("button",{type:"button",onClick:()=>m(""),"aria-label":"Clear search",children:f.jsx(Ae,{name:"close",size:13})})]}),f.jsx(jf.Root,{className:"thread-list",children:f.jsx("div",{className:"thread-list-scroll",onClick:y?void 0:e,children:y?f.jsx(kP,{query:g,search:b,onSelect:e}):f.jsxs(f.Fragment,{children:[f.jsx(jf.Items,{archived:i,children:({threadListItem:E})=>{const C=x.get(E.id);return C?f.jsx(jP,{thread:C,archived:i}):null}}),w===0&&f.jsxs("div",{className:"thread-list-empty",children:[f.jsx(Ae,{name:i?"archive":"threads",size:19}),f.jsx("span",{children:i?"No archived conversations":"Start a conversation"})]}),d&&f.jsx("button",{type:"button",className:"thread-load-more",onClick:E=>{E.stopPropagation(),p().catch(()=>{})},children:"Load older conversations"})]})})}),f.jsxs("button",{type:"button",className:`archive-toggle${i?" is-active":""}`,onClick:()=>c(!i),children:[f.jsx(Ae,{name:i?"threads":"archive",size:16}),f.jsx("span",{children:i?"Back to conversations":"Archived"}),f.jsx("span",{className:"archive-count",children:s.filter(E=>E.sourceId===r&&!!E.archivedAt).length||""})]})]})}const OP={evergreen:{light:"#eeefeb",dark:"#0f1110"},ocean:{light:"#edf1f4",dark:"#0d1115"},plum:{light:"#f2eef3",dark:"#120f14"},terracotta:{light:"#f4efec",dark:"#130f0d"}},NP=["(prefers-color-scheme: light)","(prefers-color-scheme: dark)"];function MP(e){const n=document.documentElement,s=n.dataset.consoleTheme,r=document.title,i=OP[e.theme],c=NP.map(p=>document.head.querySelector(`meta[name="theme-color"][media="${p}"]`)),d=c.map(p=>p?.getAttribute("content"));return n.dataset.consoleTheme=e.theme,document.title=`${e.hostName} · mono-agent`,c[0]?.setAttribute("content",i.light),c[1]?.setAttribute("content",i.dark),()=>{s===void 0?delete n.dataset.consoleTheme:n.dataset.consoleTheme=s,document.title=r,c.forEach((p,g)=>{const m=d[g];m==null?p?.removeAttribute("content"):p?.setAttribute("content",m)})}}const $0=["button:not([disabled])","a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])"].join(",");function Dp(e,n,s,r){const i=v.useRef(null);v.useEffect(()=>{if(!e)return;i.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const c=window.setTimeout(()=>{r?.current?.focus(),r?.current||n.current?.querySelector($0)?.focus()},0),d=p=>{if(p.key==="Escape"){p.preventDefault(),p.stopPropagation(),s();return}if(p.key!=="Tab"||!n.current)return;const g=[...n.current.querySelectorAll($0)].filter(x=>!x.hidden&&x.getAttribute("aria-hidden")!=="true");if(g.length===0){p.preventDefault(),n.current.focus();return}const m=g[0],y=g.at(-1),b=document.activeElement;p.shiftKey&&(b===m||!n.current.contains(b))?(p.preventDefault(),y?.focus()):!p.shiftKey&&(b===y||!n.current.contains(b))&&(p.preventDefault(),m?.focus())};return document.addEventListener("keydown",d),()=>{window.clearTimeout(c),document.removeEventListener("keydown",d);const p=i.current;p?.isConnected&&p.focus(),i.current=null}},[r,s,e,n])}function zP({open:e,onClose:n}){const s=nn(),[r,i]=v.useState(""),c=v.useRef(null),d=v.useRef(null);Dp(e,d,n,c),v.useEffect(()=>{e&&i("")},[e]);const p=v.useMemo(()=>[{id:"new",label:"New conversation",hint:"⌘⇧O",icon:"new",disabled:!s.selectedAgent,run:()=>void s.createThread().catch(()=>{})},{id:"rename",label:"Rename conversation",icon:"threads",disabled:!s.selectedThread,run:()=>{if(!s.selectedThread)return;const y=window.prompt("Conversation title",s.selectedThread.title)?.trim();y&&s.renameThread(s.selectedThread.id,y).catch(()=>{})}},{id:"focus",label:"Focus message composer",hint:"/",icon:"threads",run:()=>document.querySelector("#composer-input")?.focus()},{id:"archive-view",label:s.showArchived?"Show active conversations":"Show archived conversations",icon:s.showArchived?"threads":"archive",run:()=>s.setShowArchived(!s.showArchived)},{id:"pin-agent",label:s.selectedAgent?.pinned?`Unpin ${s.selectedAgent.label}`:`Pin ${s.selectedAgent?.label??"agent"}`,icon:"star",disabled:!s.selectedAgent,run:()=>{const y=s.selectedAgent;y&&s.setAgentPinned(y.sourceId,!y.pinned).catch(()=>{})}},...s.hiddenOfflineAgentCount>0?[{id:"offline-agents",label:s.showOfflineAgents?"Hide offline agents":`Show ${s.hiddenOfflineAgentCount} offline agent${s.hiddenOfflineAgentCount===1?"":"s"}`,icon:s.showOfflineAgents?"eye-off":"eye",run:()=>s.setShowOfflineAgents(!s.showOfflineAgents)}]:[],...s.visibleAgents.map(y=>({id:`agent:${y.sourceId}`,label:`Switch to ${y.label}`,hint:y.status,icon:"agent",run:()=>s.selectAgent(y.sourceId)}))],[s]),g=r.trim().toLowerCase(),m=p.filter(y=>y.label.toLowerCase().includes(g));return e?f.jsx("div",{className:"dialog-layer",role:"presentation",onMouseDown:n,children:f.jsxs("section",{ref:d,className:"command-palette",role:"dialog","aria-modal":"true","aria-label":"Command palette",tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[f.jsxs("div",{className:"palette-search",children:[f.jsx(Ae,{name:"search",size:17}),f.jsx("input",{ref:c,value:r,onChange:y=>i(y.target.value),onKeyDown:y=>{y.key==="Escape"&&n();const b=m.find(x=>!x.disabled);y.key==="Enter"&&b&&(n(),window.requestAnimationFrame(b.run))},placeholder:"Type a command…","aria-label":"Search commands"}),f.jsx("kbd",{children:"esc"})]}),f.jsxs("div",{className:"palette-results",role:"listbox",children:[m.map((y,b)=>f.jsxs("button",{type:"button",role:"option","aria-selected":b===0,disabled:y.disabled,onClick:()=>{n(),window.requestAnimationFrame(y.run)},children:[f.jsx("span",{className:"palette-icon",children:f.jsx(Ae,{name:y.icon,size:16})}),f.jsx("span",{children:y.label}),y.hint&&f.jsx("kbd",{children:y.hint})]},y.id)),m.length===0&&f.jsx("p",{children:"No matching commands"})]}),f.jsxs("footer",{children:[f.jsxs("span",{children:[f.jsx("kbd",{children:"↵"})," run"]}),f.jsxs("span",{children:[f.jsx("kbd",{children:"⌘K"})," toggle"]})]})]})}):null}function IP(){return f.jsxs("div",{className:"initial-state",role:"status",children:[f.jsx(nu,{}),f.jsxs("div",{className:"initial-loader",children:[f.jsx("span",{}),f.jsx("span",{}),f.jsx("span",{})]}),f.jsx("span",{children:"Discovering agents"})]})}function DP(){const{error:e,retry:n}=nn();return f.jsxs("div",{className:"fatal-state",children:[f.jsx(nu,{}),f.jsx("span",{className:"eyebrow",children:"Console unavailable"}),f.jsx("h1",{children:"Couldn’t reach the mono-agent service."}),f.jsx("p",{children:e??"The local web service did not respond."}),f.jsx("button",{type:"button",className:"primary-button",onClick:n,children:"Try again"}),f.jsxs("small",{children:["No sign-in is required. Check that ",f.jsx("code",{children:"mono-agent web start"})," or ",f.jsx("code",{children:"mono-agent web run"})," is running on this machine."]})]})}function UP(){const{loading:e,bootstrap:n,error:s,actionError:r,clearActionError:i}=nn(),[c,d]=v.useState(!1),[p,g]=v.useState(!1),[m,y]=v.useState(!1),[b,x]=v.useState(null),[w,E]=v.useState(KR),C=v.useRef(null),A=v.useRef(null),j={"--agent-rail-width":`${XR(w)}px`},_=v.useCallback(()=>{E(H=>{const $=!H;return FR($),$})},[]),O=v.useCallback(()=>{d(!1),g(!1)},[]),R=v.useCallback(()=>y(!1),[]),M=v.useCallback(()=>{O(),y(H=>!H)},[O]),U=v.useCallback(()=>{y(!1),g(!1),d(!0)},[]),k=v.useCallback(()=>{y(!1),d(!1),g(!0)},[]);Dp(c,C,O),Dp(p,A,O),v.useEffect(()=>{const H=()=>M(),$=B=>{const P=B.detail;P?.message&&x(P.message)};return window.addEventListener("mono-agent:command",H),window.addEventListener("mono-agent:notice",$),()=>{window.removeEventListener("mono-agent:command",H),window.removeEventListener("mono-agent:notice",$)}},[M]),v.useEffect(()=>{if(!b&&!r)return;const H=window.setTimeout(()=>{x(null),i()},6e3);return()=>window.clearTimeout(H)},[r,i,b]),v.useEffect(()=>{if(n)return MP(n.console)},[n]),v.useEffect(()=>{const H=$=>{const B=$.target,P=B?.tagName==="INPUT"||B?.tagName==="SELECT"||B?.tagName==="TEXTAREA"||B?.isContentEditable,oe=!!document.querySelector('[role="dialog"][aria-modal="true"]:not([aria-hidden="true"]), [data-slot="model-selector-content"]');if(($.metaKey||$.ctrlKey)&&$.key.toLowerCase()==="k"){if($.preventDefault(),m){y(!1);return}if(oe)return;M();return}if(!oe){if(($.metaKey||$.ctrlKey)&&$.shiftKey&&$.key.toLowerCase()==="o"){$.preventDefault(),window.dispatchEvent(new CustomEvent("mono-agent:new-thread"));return}!P&&$.key==="/"&&($.preventDefault(),document.querySelector("#composer-input")?.focus()),$.key==="Escape"&&(y(!1),O())}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[O,m,M]);const Y=nn();return v.useEffect(()=>{const H=()=>{Y.selectedAgent&&Y.createThread().catch(()=>{})};return window.addEventListener("mono-agent:new-thread",H),()=>window.removeEventListener("mono-agent:new-thread",H)},[Y]),e&&!n?f.jsx(IP,{}):s&&!n?f.jsx(DP,{}):f.jsxs("div",{className:"app-shell",style:j,children:[f.jsx("div",{className:"desktop-agent-rail",children:f.jsx(c1,{expanded:w,onToggleExpanded:_})}),f.jsx("div",{className:"desktop-thread-sidebar",children:f.jsx(P0,{})}),f.jsx(TP,{onOpenAgents:U,onOpenThreads:k}),(c||p)&&f.jsx("button",{className:"drawer-scrim",type:"button",onClick:O,"aria-label":"Close navigation"}),f.jsx("div",{ref:C,className:`mobile-agent-drawer${c?" is-open":""}`,role:"dialog","aria-modal":"true","aria-label":"Choose agent","aria-hidden":!c,inert:!c,tabIndex:-1,children:f.jsx(u1,{onSelect:O})}),f.jsx("div",{ref:A,className:`mobile-thread-drawer${p?" is-open":""}`,role:"dialog","aria-modal":"true","aria-label":"Conversations","aria-hidden":!p,inert:!p,tabIndex:-1,children:f.jsx(P0,{onSelect:O})}),f.jsx(zP,{open:m,onClose:R}),(b||r)&&f.jsxs("div",{className:"toast",role:"alert",children:[f.jsx("span",{children:b??r}),f.jsx("button",{type:"button","aria-label":"Dismiss",onClick:()=>{x(null),i()},children:f.jsx(Ae,{name:"close",size:14})})]})]})}const Up={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".pdf":"application/pdf",".json":"application/json",".zip":"application/zip",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xls":"application/vnd.ms-excel",".txt":"text/plain",".md":"text/markdown",".markdown":"text/markdown",".csv":"text/csv",".html":"text/html",".htm":"text/html",".ogg":"audio/ogg",".oga":"audio/ogg",".mp3":"audio/mpeg",".m4a":"audio/mp4",".aac":"audio/aac",".wav":"audio/wav",".flac":"audio/flac",".mp4":"video/mp4",".mpeg":"video/mpeg",".mpg":"video/mpeg",".mov":"video/quicktime",".webm":"video/webm"},PP=e=>{if(e.type.trim())return e.type.trim().toLowerCase();const n=e.name.toLowerCase(),s=Object.keys(Up).find(r=>n.endsWith(r));return s&&Up[s]||"application/octet-stream"},lp=e=>e.startsWith("image/")?"image":"document";class $P{accept;limits;uploads=new Map;activeSizes=new Map;transfers=new Map;removing=new Set;sending=new Set;recovering=new Set;files=new Map;recoveryFiles=new WeakMap;reservationTail=Promise.resolve();generation=0;constructor(n){this.limits=n;const s=new Set(n.accept.map(i=>i.toLowerCase())),r=Object.entries(Up).filter(([,i])=>s.has(i)).map(([i])=>i);this.accept=[...n.accept,...r].join(",")||"*"}async*add({file:n}){const s=this.recoveryFiles.get(n);if(s){this.recoveryFiles.delete(n);const C=this.uploads.get(s);if(C?.uploaded){yield{id:s,type:lp(C.contentType),name:C.name,contentType:C.contentType,file:n,status:{type:"requires-action",reason:"composer-send"}};return}}const r=this.generation,i=PP(n),c=n.type===i?n:new File([n],n.name,{type:i,lastModified:n.lastModified}),d=await this.reserveUpload(c,r);this.files.set(d.id,c);let p=0,g=!1,m,y,b;const x=()=>{b?.(),b=void 0},w=new AbortController,E=JR(d,c,C=>{p=C,x()},w.signal);for(this.transfers.set(d.id,{controller:w,done:E}),E.then(C=>{m=C,g=!0,x()},C=>{y=C,g=!0,x()});!g;)yield{id:d.id,type:lp(i),name:n.name,contentType:i,file:c,status:{type:"running",reason:"uploading",progress:p}},g||await new Promise(C=>{b=C});if(y)throw this.transfers.delete(d.id),this.activeSizes.delete(d.id),this.uploads.delete(d.id),this.files.delete(d.id),this.removing.has(d.id)||Ze.deleteUpload(d.id).catch(()=>{}),y;this.transfers.delete(d.id),!(this.removing.has(d.id)||!this.uploads.has(d.id))&&(this.uploads.set(d.id,m??d),yield{id:d.id,type:lp(i),name:n.name,contentType:i,file:c,status:{type:"requires-action",reason:"composer-send"}})}async send(n){const s=this.uploads.get(n.id);if(!s?.uploaded)throw new Error(`${n.name} has not finished uploading.`);const r=s.contentUrl??`/api/v1/uploads/${encodeURIComponent(s.id)}/content`;return{id:n.id,type:n.type,name:n.name,contentType:n.contentType,status:{type:"complete"},content:n.type==="image"?[{type:"image",image:r,filename:n.name}]:[{type:"file",data:r,mimeType:n.contentType??"application/octet-stream",filename:n.name}]}}async remove(n){this.removing.add(n.id),this.sending.delete(n.id),this.recovering.delete(n.id),this.activeSizes.delete(n.id);const s=this.uploads.delete(n.id);this.files.delete(n.id);const r=this.transfers.get(n.id);if(r?.controller.abort(),await r?.done.catch(()=>{}),this.transfers.delete(n.id),!s){this.removing.delete(n.id);return}await Ze.deleteUpload(n.id).catch(()=>{}),this.removing.delete(n.id)}beginSend(n){return n.map(({id:r})=>(this.recovering.delete(r),this.sending.add(r),this.uploads.get(r)?.id??r))}completeSend(n){for(const{id:s}of n)this.sending.delete(s),this.recovering.delete(s),this.activeSizes.delete(s),this.uploads.delete(s),this.files.delete(s)}retainForRecovery(n){for(const{id:s}of n)this.recovering.add(s)}recoverSend(n){for(const{id:s}of n)this.sending.delete(s),this.recovering.add(s)}releaseRecovery(n){for(const{id:s}of n)this.recovering.delete(s)}prepareRecoveryAttachment(n){const s=this.files.get(n.id);return s?(this.recoveryFiles.set(s,n.id),s):{id:n.id,type:n.type,name:n.name,contentType:n.contentType,content:n.content}}async failSend(n){const s=n.map(({id:r})=>this.uploads.get(r)?.id??r);for(const{id:r}of n)this.sending.delete(r),this.recovering.delete(r),this.activeSizes.delete(r),this.uploads.delete(r),this.files.delete(r);await Promise.all(s.map(r=>Ze.deleteUpload(r).catch(()=>{})))}disposeUnsent({includeRecovering:n=!1}={}){this.generation+=1;const s=[...this.uploads.keys()].filter(i=>!this.sending.has(i)&&(n||!this.recovering.has(i)));for(const i of s)this.removing.add(i),this.activeSizes.delete(i),this.uploads.delete(i),this.files.delete(i);const r=s.flatMap(i=>{const c=this.transfers.get(i);return this.transfers.delete(i),c?[c]:[]});for(const i of r)i?.controller.abort();Promise.all(r.map(i=>i?.done.catch(()=>{}))).then(async()=>{await Promise.all(s.map(i=>Ze.deleteUpload(i).catch(()=>{})));for(const i of s)this.removing.delete(i)})}async reserveUpload(n,s){const r=this.reservationTail;let i;this.reservationTail=new Promise(c=>{i=c}),await r;try{if(s!==this.generation)throw new DOMException("The attachment context changed.","AbortError");if(n.size>this.limits.maxFileBytes)throw new Error(`${n.name} is larger than the ${L0(this.limits.maxFileBytes)} per-file limit.`);if(this.activeSizes.size>=this.limits.maxFilesPerTurn)throw new Error(`You can attach up to ${this.limits.maxFilesPerTurn} files per message.`);if([...this.activeSizes.values()].reduce((p,g)=>p+g,0)+n.size>this.limits.maxTurnBytes)throw new Error(`Attachments exceed the ${L0(this.limits.maxTurnBytes)} per-message limit.`);const d=await Ze.createUpload(n);if(s!==this.generation)throw Ze.deleteUpload(d.id).catch(()=>{}),new DOMException("The attachment context changed.","AbortError");return this.uploads.set(d.id,d),this.activeSizes.set(d.id,n.size),d}finally{i()}}}const L0=e=>e<1024?`${e} B`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.round(e/(1024*1024)*10)/10} MB`,LP=new Set(["AskUser"]),qP=e=>{const n=e.artifact;if(n===null||typeof n!="object"||Array.isArray(n))return;const s=n.executionMs;return typeof s=="number"&&Number.isFinite(s)&&s>=0?s:void 0},q0=e=>e.type==="tool-call"&&e.toolName!==void 0&&!LP.has(e.toolName);function HP(e){const n=[];for(let s=0;s<e.length;){const r=e[s];if(!q0(r)){n.push(r),s+=1;continue}const i=[r];let c=s+1;for(;c<e.length;){const d=e[c];if(!q0(d)||d.toolName!==r.toolName)break;i.push(d),c+=1}if(i.length<2)n.push(r);else{const d=i.filter(g=>g.isError===!0).length,p=i.flatMap(g=>{const m=qP(g);return m===void 0?[]:[m]});n.push({type:"data-tool-cluster",data:{toolName:r.toolName,status:i.some(g=>g.status?.type==="running")?"running":d>0?"failed":"complete",failedCount:d,...p.length===0?{}:{totalMs:p.reduce((g,m)=>g+m,0)},calls:i}})}s=c}return n}const BP=(e,n)=>e?!n||n===e?e:`${e}
|
|
149
|
+
|
|
150
|
+
${n}`:n,ZP=(e,n)=>e.agentId===n.agentId&&e.threadId===n.threadId,VP=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return;const n=e;return typeof n.text=="string"&&n.text.trim().length>0&&typeof n.messageId=="string"&&n.messageId.trim().length>0?{text:n.text,messageId:n.messageId}:void 0},YP=(e,n)=>n===void 0?e:`Quoted context:
|
|
151
|
+
${n.text.trim().split(/\r?\n/u).map(r=>`> ${r}`).join(`
|
|
152
|
+
`)}
|
|
153
|
+
|
|
154
|
+
${e}`,Pp=e=>e===null||typeof e=="string"||typeof e=="boolean"?e:typeof e=="number"?Number.isFinite(e)?e:null:Array.isArray(e)?e.map(Pp):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).map(([n,s])=>[n,Pp(s)])):e===void 0?null:String(e),Ns=e=>{const n=Pp(e);return n&&typeof n=="object"&&!Array.isArray(n)?n:e===void 0?{}:{value:n}},GP=e=>{try{return JSON.stringify(e??{},null,2)}catch{return"{}"}},KP=e=>{if(e.event==="context_compaction")return!0;let n=e.data;const s=new Set;for(let r=0;r<8;r+=1){if(n===null||typeof n!="object"||Array.isArray(n)||s.has(n))return!1;s.add(n);const i=n;if(i.kind==="context_compaction"||i.type==="context_compaction")return!0;n=i.data}return!1},H0=e=>e.history===void 0&&e.structuredResult===void 0&&e.executionMs===void 0?void 0:{...e.history===void 0?{}:{history:e.history},...e.structuredResult===void 0?{}:{structuredResult:e.structuredResult},...e.executionMs===void 0?{}:{executionMs:e.executionMs}},FP=e=>{switch(e.type){case"text":return{type:"text",text:e.text};case"reasoning":return{type:"reasoning",text:e.text};case"tool-call":return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,args:Ns(e.args),argsText:GP(e.args),result:e.result,isError:e.status==="failed",...H0(e)===void 0?{}:{artifact:H0(e)}};case"subagent":return{type:"data-subagent",data:Ns(e)};case"process-job":return{type:"data-process-job",data:Ns(e)};case"telemetry":return KP(e)?{type:"data-context-compaction",data:Ns(e.data)}:e.event==="cron_run"?{type:"data-cron-run",data:Ns(e.data)}:null;case"error":return{type:"data-error",data:{code:e.code,message:e.message}};case"attachment":return{type:"data-reply-attachment",data:Ns(e)};case"mcp_app":return{type:"data-mcp-app",data:Ns(e)};case"failure":return{type:"data-reply-failure",data:Ns(e)}}},XP=e=>{const n=e.contentUrl??`/api/v1/uploads/${encodeURIComponent(e.id)}/content`;return{id:e.id,type:e.kind,name:e.name,contentType:e.contentType,status:{type:"complete"},content:e.kind==="image"?[{type:"image",image:n,filename:e.name}]:[{type:"file",data:n,mimeType:e.contentType,filename:e.name}]}},QP=e=>e.reduce((n,s)=>{const r=n.at(-1);return s.type==="text"&&r?.type==="text"?(n[n.length-1]={...r,text:`${r.text}${s.text}`},n):(n.push(s),n)},[]),JP=new Set(["reasoning","tool-call","data-subagent","data-context-compaction","data-process-job"]),WP=e=>e.type==="text"&&e.text.trim().length===0,e6=e=>{const n=e.filter(c=>!WP(c));let s=-1;if(n.forEach((c,d)=>{c.type==="text"&&(s=d)}),s<0)return n;const r=[],i=[];return n.forEach((c,d)=>{if(d!==s){if(c.type==="text"){r.push({type:"data-note",data:{text:c.text}});return}(JP.has(c.type)?r:i).push(c)}}),[...r,n[s],...i]},t6=e=>{const n=QP(e.parts.flatMap(c=>{const d=FP(c);return d==null?[]:[d]})),s=e.role==="assistant"&&e.status==="complete"?e6(n):n,r=HP(s),i=e.status==="running"?{type:"running"}:e.status==="complete"?{type:"complete",reason:"stop"}:e.status==="cancelled"?{type:"incomplete",reason:"cancelled"}:e.status==="failed"?{type:"incomplete",reason:"error",error:"Agent run failed"}:{type:"incomplete",reason:"other",error:"Agent run was interrupted"};return{id:e.id,role:e.role,content:r,createdAt:new Date(e.createdAt),...e.role==="assistant"?{status:i}:{},attachments:e.role==="user"?e.attachments.map(XP):void 0,metadata:{custom:{turnId:e.turnId,updatedAt:e.updatedAt,...e.liveInputStatus===void 0?{}:{liveInputStatus:e.liveInputStatus},...e.quote===void 0?{}:{quote:e.quote}}}}};function n6({children:e}){const n=nn(),s=i1(),[r,i]=v.useState(!1),[c,d]=v.useState([]),p=v.useRef(!1),g=v.useRef(0),m=v.useRef({agentId:n.selectedAgentId,threadId:n.selectedThreadId});m.current={agentId:n.selectedAgentId,threadId:n.selectedThreadId};const y=`${s.maxFileBytes}:${s.maxFilesPerTurn}:${s.maxTurnBytes}:${s.accept.join("|")}`,b=v.useMemo(()=>new $P(s),[y]),x=`${n.selectedAgentId??"none"}:${n.selectedThreadId??"new"}`,w=v.useRef(null);v.useEffect(()=>{w.current!==null&&w.current!==x&&b.disposeUnsent(),w.current=x},[b,x]),v.useEffect(()=>()=>{b.disposeUnsent({includeRecovering:!0})},[b]);const E=v.useCallback((k,Y,H,$)=>{b.retainForRecovery(Y),d(B=>[...B,{id:++g.current,text:k,attachments:Y,...H===void 0?{}:{quote:H},...$}])},[b]),C=v.useCallback(async k=>{const Y=k.content.filter(oe=>oe.type==="text").map(oe=>oe.text).join(`
|
|
155
|
+
`).trim(),H=k.attachments??[],$=VP(k.metadata?.custom?.quote);if(!Y&&H.length===0)return;const B={agentId:n.selectedAgentId,threadId:n.selectedThreadId};if(n.selectedThread?.runState.status==="running"&&H.length===0){n.sendLiveInput(YP(Y,$)).catch(()=>{E(Y,[],$,B)});return}if(p.current){E(Y,H,$,B);return}p.current=!0,i(!0);const P=b.beginSend(H);(async()=>{let oe=B.threadId;try{await n.sendTurn({text:Y||void 0,quote:$,attachmentIds:P.length>0?P:void 0,model:n.model||void 0,effort:n.effort||void 0},le=>{oe=le,B.threadId===null&&d(ee=>ee.map(z=>z.agentId===B.agentId&&z.threadId===null?{...z,threadId:le}:z))}),b.completeSend(H)}catch{const le={agentId:B.agentId,threadId:oe};b.recoverSend(H),E(Y,H,$,le)}finally{p.current=!1,i(!1)}})()},[b,E,n]),A=v.useMemo(()=>({threadId:n.selectedThreadId??void 0,isLoading:n.loading,threads:n.threads.filter(k=>k.sourceId===n.selectedAgentId&&!k.archivedAt).map(k=>({id:k.id,remoteId:k.id,status:"regular",title:k.title,custom:{runStatus:k.runState.status,updatedAt:k.updatedAt}})),archivedThreads:n.threads.filter(k=>k.sourceId===n.selectedAgentId&&!!k.archivedAt).map(k=>({id:k.id,remoteId:k.id,status:"archived",title:k.title,custom:{runStatus:k.runState.status,updatedAt:k.updatedAt}})),onSwitchToNewThread:async()=>{n.selectedAgent&&await n.createThread().catch(()=>{})},onSwitchToThread:k=>n.selectThread(k),onRename:async(k,Y)=>{await n.renameThread(k,Y).catch(()=>{})},onArchive:async k=>{await n.archiveThread(k).catch(()=>{})},onUnarchive:async k=>{await n.unarchiveThread(k).catch(()=>{})}}),[n]),j=QU(n.connection,n.selectedAgent,n.selectedThread),_=GE(n.connection,n.selectedAgent,n.selectedThread),O=n.selectedThread?.runState.status==="running",R=v.useMemo(()=>O?{items:[],enqueue:k=>{C(k)},steer:()=>{},remove:()=>{},clear:()=>{}}:void 0,[O,C]),M=zR({messages:n.detail?.messages??[],convertMessage:t6,isLoading:n.detailLoading,isRunning:O,isSendDisabled:!j||r,onNew:C,onCancel:n.cancelTurn,queue:R,unstable_capabilities:{copy:!0},adapters:{threadList:A,attachments:_?b:void 0}}),U=v.useRef(null);return v.useEffect(()=>{U.current!==null&&U.current!==x&&M.thread.composer.setQuote(void 0),U.current=x},[x,M]),v.useEffect(()=>{if(r)return;const k=c[0];if(!k)return;if(!ZP(k,m.current)){d(B=>B.filter(({id:P})=>P!==k.id)),b.failSend(k.attachments);return}const Y=M.thread.composer,H=Y.getState();if(k.text&&Y.setText(BP(k.text,H.text)),k.quote&&!H.quote&&Y.setQuote(k.quote),k.attachments.length>0&&!_){k.text&&d(B=>B.map(P=>P.id===k.id?{...P,text:""}:P));return}d(B=>B.filter(({id:P})=>P!==k.id));const $=new Set(H.attachments.map(({id:B})=>B));(async()=>{try{await Promise.all(k.attachments.filter(({id:B})=>!$.has(B)).map(B=>Y.addAttachment(b.prepareRecoveryAttachment(B)))),b.releaseRecovery(k.attachments)}catch{await b.failSend(k.attachments)}})()},[b,c,M,_,r]),f.jsx(IR,{runtime:M,children:e})}YR({immediate:!0});HR.createRoot(document.getElementById("root")).render(f.jsx(v.StrictMode,{children:f.jsx(a1,{children:f.jsx(b1,{children:f.jsx(n6,{children:f.jsx(UP,{})})})})}));
|