@gbasin/agentboard-linux-arm64 0.23.2 → 0.24.0
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/bin/agentboard +1 -1
- package/dist/client/assets/{index-B8IKAXvp.js → index-14pWIjZe.js} +17 -17
- package/dist/client/assets/index-Df-L8u4N.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/client/sw.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-BYcxg5qQ.css +0 -1
|
@@ -5,7 +5,7 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
5
5
|
`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{te=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?B(e):``}function H(e){switch(e.tag){case 5:return B(e.type);case 16:return B(`Lazy`);case 13:return B(`Suspense`);case 19:return B(`SuspenseList`);case 0:case 2:case 15:return e=V(e.type,!1),e;case 11:return e=V(e.type.render,!1),e;case 1:return e=V(e.type,!0),e;default:return``}}function ne(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?ne(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}function re(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ne(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ie(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function U(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ae(e){var t=U(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function oe(e){e._valueTracker||=ae(e)}function se(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=U(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function ce(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function le(e,t){var n=t.checked;return R({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ue(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ie(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function de(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function fe(e,t){de(e,t);var n=ie(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?me(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&me(e,t.type,ie(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pe(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function me(e,t,n){(t!==`number`||ce(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var he=Array.isArray;function ge(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+ie(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function _e(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return R({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function ve(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(he(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:ie(n)}}function ye(e,t){var n=ie(t.value),r=ie(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function be(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function xe(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Se(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?xe(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Ce,we=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Ce||=document.createElement(`div`),Ce.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Ce.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Te(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ee={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},De=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ee).forEach(function(e){De.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ee[t]=Ee[e]})});function Oe(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ee.hasOwnProperty(e)&&Ee[e]?(``+t).trim():t+`px`}function ke(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Oe(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Ae=R({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function je(e,t){if(t){if(Ae[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Me(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Ne=null;function Pe(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fe=null,Ie=null,Le=null;function Re(e){if(e=Ii(e)){if(typeof Fe!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ri(t),Fe(e.stateNode,e.type,t))}}function ze(e){Ie?Le?Le.push(e):Le=[e]:Ie=e}function Be(){if(Ie){var e=Ie,t=Le;if(Le=Ie=null,Re(e),t)for(e=0;e<t.length;e++)Re(t[e])}}function Ve(e,t){return e(t)}function He(){}var Ue=!1;function We(e,t,n){if(Ue)return e(t,n);Ue=!0;try{return Ve(e,t,n)}finally{Ue=!1,(Ie!==null||Le!==null)&&(He(),Be())}}function Ge(e,t){var n=e.stateNode;if(n===null)return null;var i=Ri(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var Ke=!1;if(c)try{var qe={};Object.defineProperty(qe,`passive`,{get:function(){Ke=!0}}),window.addEventListener(`test`,qe,qe),window.removeEventListener(`test`,qe,qe)}catch{Ke=!1}function Je(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var Ye=!1,Xe=null,Ze=!1,Qe=null,$e={onError:function(e){Ye=!0,Xe=e}};function et(e,t,n,r,i,a,o,s,c){Ye=!1,Xe=null,Je.apply($e,arguments)}function tt(e,t,n,i,a,o,s,c,l){if(et.apply(this,arguments),Ye){if(Ye){var u=Xe;Ye=!1,Xe=null}else throw Error(r(198));Ze||(Ze=!0,Qe=u)}}function nt(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function rt(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function it(e){if(nt(e)!==e)throw Error(r(188))}function at(e){var t=e.alternate;if(!t){if(t=nt(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return it(a),e;if(o===i)return it(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function ot(e){return e=at(e),e===null?null:W(e)}function W(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=W(e);if(t!==null)return t;e=e.sibling}return null}var st=n.unstable_scheduleCallback,ct=n.unstable_cancelCallback,lt=n.unstable_shouldYield,ut=n.unstable_requestPaint,dt=n.unstable_now,ft=n.unstable_getCurrentPriorityLevel,pt=n.unstable_ImmediatePriority,mt=n.unstable_UserBlockingPriority,G=n.unstable_NormalPriority,ht=n.unstable_LowPriority,gt=n.unstable_IdlePriority,_t=null,vt=null;function yt(e){if(vt&&typeof vt.onCommitFiberRoot==`function`)try{vt.onCommitFiberRoot(_t,e,void 0,(e.current.flags&128)==128)}catch{}}var bt=Math.clz32?Math.clz32:Ct,xt=Math.log,St=Math.LN2;function Ct(e){return e>>>=0,e===0?32:31-(xt(e)/St|0)|0}var wt=64,Tt=4194304;function Et(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Dt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Et(a))):r=Et(s)}else o=n&~i,o===0?a!==0&&(r=Et(a)):r=Et(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-bt(t),i=1<<n,r|=e[n],t&=~i;return r}function Ot(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-bt(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ot(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function At(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function jt(){var e=wt;return wt<<=1,!(wt&4194240)&&(wt=64),e}function Mt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Nt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-bt(t),e[t]=n}function Pt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-bt(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Ft(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-bt(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var It=0;function Lt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Rt,zt,Bt,Vt,Ht,Ut=!1,Wt=[],Gt=null,Kt=null,qt=null,Jt=new Map,Yt=new Map,Xt=[],Zt=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit`.split(` `);function Qt(e,t){switch(e){case`focusin`:case`focusout`:Gt=null;break;case`dragenter`:case`dragleave`:Kt=null;break;case`mouseover`:case`mouseout`:qt=null;break;case`pointerover`:case`pointerout`:Jt.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Yt.delete(t.pointerId)}}function $t(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Ii(t),t!==null&&zt(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function en(e,t,n,r,i){switch(t){case`focusin`:return Gt=$t(Gt,e,t,n,r,i),!0;case`dragenter`:return Kt=$t(Kt,e,t,n,r,i),!0;case`mouseover`:return qt=$t(qt,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Jt.set(a,$t(Jt.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Yt.set(a,$t(Yt.get(a)||null,e,t,n,r,i)),!0}return!1}function tn(e){var t=Fi(e.target);if(t!==null){var n=nt(t);if(n!==null){if(t=n.tag,t===13){if(t=rt(n),t!==null){e.blockedOn=t,Ht(e.priority,function(){Bt(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function nn(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=mn(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ne=r,n.target.dispatchEvent(r),Ne=null}else return t=Ii(n),t!==null&&zt(t),e.blockedOn=n,!1;t.shift()}return!0}function rn(e,t,n){nn(e)&&n.delete(t)}function an(){Ut=!1,Gt!==null&&nn(Gt)&&(Gt=null),Kt!==null&&nn(Kt)&&(Kt=null),qt!==null&&nn(qt)&&(qt=null),Jt.forEach(rn),Yt.forEach(rn)}function on(e,t){e.blockedOn===t&&(e.blockedOn=null,Ut||(Ut=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,an)))}function sn(e){function t(t){return on(t,e)}if(0<Wt.length){on(Wt[0],e);for(var n=1;n<Wt.length;n++){var r=Wt[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Gt!==null&&on(Gt,e),Kt!==null&&on(Kt,e),qt!==null&&on(qt,e),Jt.forEach(t),Yt.forEach(t),n=0;n<Xt.length;n++)r=Xt[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Xt.length&&(n=Xt[0],n.blockedOn===null);)tn(n),n.blockedOn===null&&Xt.shift()}var cn=C.ReactCurrentBatchConfig,ln=!0;function un(e,t,n,r){var i=It,a=cn.transition;cn.transition=null;try{It=1,fn(e,t,n,r)}finally{It=i,cn.transition=a}}function dn(e,t,n,r){var i=It,a=cn.transition;cn.transition=null;try{It=4,fn(e,t,n,r)}finally{It=i,cn.transition=a}}function fn(e,t,n,r){if(ln){var i=mn(e,t,n,r);if(i===null)si(e,t,r,pn,n),Qt(e,r);else if(en(i,e,t,n,r))r.stopPropagation();else if(Qt(e,r),t&4&&-1<Zt.indexOf(e)){for(;i!==null;){var a=Ii(i);if(a!==null&&Rt(a),a=mn(e,t,n,r),a===null&&si(e,t,r,pn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else si(e,t,r,null,n)}}var pn=null;function mn(e,t,n,r){if(pn=null,e=Pe(r),e=Fi(e),e!==null)if(t=nt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=rt(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return pn=e,null}function hn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(ft()){case pt:return 1;case mt:return 4;case G:case ht:return 16;case gt:return 536870912;default:return 16}default:return 16}}var gn=null,_n=null,vn=null;function yn(){if(vn)return vn;var e,t=_n,n=t.length,r,i=`value`in gn?gn.value:gn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return vn=i.slice(e,1<r?1-r:void 0)}function bn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function xn(){return!0}function Sn(){return!1}function Cn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?xn:Sn,this.isPropagationStopped=Sn,this}return R(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=xn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=xn)},persist:function(){},isPersistent:xn}),t}var wn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tn=Cn(wn),En=R({},wn,{view:0,detail:0}),Dn=Cn(En),On,kn,An,jn=R({},En,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Hn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==An&&(An&&e.type===`mousemove`?(On=e.screenX-An.screenX,kn=e.screenY-An.screenY):kn=On=0,An=e),On)},movementY:function(e){return`movementY`in e?e.movementY:kn}}),Mn=Cn(jn),Nn=Cn(R({},jn,{dataTransfer:0})),Pn=Cn(R({},En,{relatedTarget:0})),Fn=Cn(R({},wn,{animationName:0,elapsedTime:0,pseudoElement:0})),In=Cn(R({},wn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Ln=Cn(R({},wn,{data:0})),Rn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},zn={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`},Bn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Vn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Bn[e])?!!t[e]:!1}function Hn(){return Vn}var Un=Cn(R({},En,{key:function(e){if(e.key){var t=Rn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=bn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?zn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Hn,charCode:function(e){return e.type===`keypress`?bn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?bn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Wn=Cn(R({},jn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Gn=Cn(R({},En,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Hn})),Kn=Cn(R({},wn,{propertyName:0,elapsedTime:0,pseudoElement:0})),qn=Cn(R({},jn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Jn=[9,13,27,32],Yn=c&&`CompositionEvent`in window,Xn=null;c&&`documentMode`in document&&(Xn=document.documentMode);var Zn=c&&`TextEvent`in window&&!Xn,Qn=c&&(!Yn||Xn&&8<Xn&&11>=Xn),K=` `,$n=!1;function er(e,t){switch(e){case`keyup`:return Jn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function tr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var nr=!1;function rr(e,t){switch(e){case`compositionend`:return tr(t);case`keypress`:return t.which===32?($n=!0,K):null;case`textInput`:return e=t.data,e===K&&$n?null:e;default:return null}}function ir(e,t){if(nr)return e===`compositionend`||!Yn&&er(e,t)?(e=yn(),vn=_n=gn=null,nr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Qn&&t.locale!==`ko`?null:t.data;default:return null}}var ar={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 or(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ar[e.type]:t===`textarea`}function sr(e,t,n,r){ze(r),t=li(t,`onChange`),0<t.length&&(n=new Tn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var cr=null,lr=null;function ur(e){ti(e,0)}function dr(e){if(se(Li(e)))return e}function fr(e,t){if(e===`change`)return t}var pr=!1;if(c){var mr;if(c){var hr=`oninput`in document;if(!hr){var gr=document.createElement(`div`);gr.setAttribute(`oninput`,`return;`),hr=typeof gr.oninput==`function`}mr=hr}else mr=!1;pr=mr&&(!document.documentMode||9<document.documentMode)}function _r(){cr&&(cr.detachEvent(`onpropertychange`,vr),lr=cr=null)}function vr(e){if(e.propertyName===`value`&&dr(lr)){var t=[];sr(t,lr,e,Pe(e)),We(ur,t)}}function yr(e,t,n){e===`focusin`?(_r(),cr=t,lr=n,cr.attachEvent(`onpropertychange`,vr)):e===`focusout`&&_r()}function br(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return dr(lr)}function xr(e,t){if(e===`click`)return dr(t)}function Sr(e,t){if(e===`input`||e===`change`)return dr(t)}function Cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var wr=typeof Object.is==`function`?Object.is:Cr;function Tr(e,t){if(wr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!wr(e[i],t[i]))return!1}return!0}function Er(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Dr(e,t){var n=Er(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Er(n)}}function Or(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Or(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function kr(){for(var e=window,t=ce();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=ce(e.document)}return t}function Ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function jr(e){var t=kr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Or(n.ownerDocument.documentElement,n)){if(r!==null&&Ar(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Dr(n,a);var o=Dr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Mr=c&&`documentMode`in document&&11>=document.documentMode,Nr=null,Pr=null,Fr=null,Ir=!1;function Lr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ir||Nr==null||Nr!==ce(r)||(r=Nr,`selectionStart`in r&&Ar(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Fr&&Tr(Fr,r)||(Fr=r,r=li(Pr,`onSelect`),0<r.length&&(t=new Tn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Nr)))}function Rr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var zr={animationend:Rr(`Animation`,`AnimationEnd`),animationiteration:Rr(`Animation`,`AnimationIteration`),animationstart:Rr(`Animation`,`AnimationStart`),transitionend:Rr(`Transition`,`TransitionEnd`)},Br={},Vr={};c&&(Vr=document.createElement(`div`).style,`AnimationEvent`in window||(delete zr.animationend.animation,delete zr.animationiteration.animation,delete zr.animationstart.animation),`TransitionEvent`in window||delete zr.transitionend.transition);function Hr(e){if(Br[e])return Br[e];if(!zr[e])return e;var t=zr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vr)return Br[e]=t[n];return e}var Ur=Hr(`animationend`),Wr=Hr(`animationiteration`),Gr=Hr(`animationstart`),Kr=Hr(`transitionend`),qr=new Map,Jr=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function Yr(e,t){qr.set(e,t),o(t,[e])}for(var Xr=0;Xr<Jr.length;Xr++){var Zr=Jr[Xr];Yr(Zr.toLowerCase(),`on`+(Zr[0].toUpperCase()+Zr.slice(1)))}Yr(Ur,`onAnimationEnd`),Yr(Wr,`onAnimationIteration`),Yr(Gr,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Kr,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Qr=`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(` `),$r=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(Qr));function ei(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,tt(r,t,void 0,e),e.currentTarget=null}function ti(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;ei(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;ei(i,s,l),a=c}}}if(Ze)throw e=Qe,Ze=!1,Qe=null,e}function ni(e,t){var n=t[Mi];n===void 0&&(n=t[Mi]=new Set);var r=e+`__bubble`;n.has(r)||(oi(t,e,2,!1),n.add(r))}function ri(e,t,n){var r=0;t&&(r|=4),oi(n,e,r,t)}var ii=`_reactListening`+Math.random().toString(36).slice(2);function ai(e){if(!e[ii]){e[ii]=!0,i.forEach(function(t){t!==`selectionchange`&&($r.has(t)||ri(t,!1,e),ri(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ii]||(t[ii]=!0,ri(`selectionchange`,!1,t))}}function oi(e,t,n,r){switch(hn(t)){case 1:var i=un;break;case 4:i=dn;break;default:i=fn}n=i.bind(null,t,n,e),i=void 0,!Ke||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function si(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Fi(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}We(function(){var r=a,i=Pe(n),o=[];a:{var s=qr.get(e);if(s!==void 0){var c=Tn,l=e;switch(e){case`keypress`:if(bn(n)===0)break a;case`keydown`:case`keyup`:c=Un;break;case`focusin`:l=`focus`,c=Pn;break;case`focusout`:l=`blur`,c=Pn;break;case`beforeblur`:case`afterblur`:c=Pn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Mn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Nn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=Gn;break;case Ur:case Wr:case Gr:c=Fn;break;case Kr:c=Kn;break;case`scroll`:c=Dn;break;case`wheel`:c=qn;break;case`copy`:case`cut`:case`paste`:c=In;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=Wn}var u=(t&4)!=0,d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=Ge(p,f),h!=null&&u.push(ci(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==Ne&&(l=n.relatedTarget||n.fromElement)&&(Fi(l)||l[ji]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Fi(l):null,l!==null&&(d=nt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Mn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=Wn,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Li(c),m=l==null?s:Li(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Fi(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=ui(m))p++;for(m=0,h=f;h;h=ui(h))m++;for(;0<p-m;)u=ui(u),p--;for(;0<m-p;)f=ui(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=ui(u),f=ui(f)}u=null}else u=null;c!==null&&di(o,s,c,u,!1),l!==null&&d!==null&&di(o,d,l,u,!0)}}a:{if(s=r?Li(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=fr;else if(or(s))if(pr)g=Sr;else{g=br;var _=yr}else (c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=xr);if(g&&=g(e,r)){sr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&me(s,`number`,s.value)}switch(_=r?Li(r):window,e){case`focusin`:(or(_)||_.contentEditable===`true`)&&(Nr=_,Pr=r,Fr=null);break;case`focusout`:Fr=Pr=Nr=null;break;case`mousedown`:Ir=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Ir=!1,Lr(o,n,i);break;case`selectionchange`:if(Mr)break;case`keydown`:case`keyup`:Lr(o,n,i)}var v;if(Yn)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else nr?er(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(Qn&&n.locale!==`ko`&&(nr||y!==`onCompositionStart`?y===`onCompositionEnd`&&nr&&(v=yn()):(gn=i,_n=`value`in gn?gn.value:gn.textContent,nr=!0)),_=li(r,y),0<_.length&&(y=new Ln(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=tr(n),v!==null&&(y.data=v)))),(v=Zn?rr(e,n):ir(e,n))&&(r=li(r,`onBeforeInput`),0<r.length&&(i=new Ln(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ti(o,t)})}function ci(e,t,n){return{instance:e,listener:t,currentTarget:n}}function li(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=Ge(e,n),a!=null&&r.unshift(ci(e,a,i)),a=Ge(e,t),a!=null&&r.push(ci(e,a,i))),e=e.return}return r}function ui(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function di(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=Ge(n,a),c!=null&&o.unshift(ci(n,c,s))):i||(c=Ge(n,a),c!=null&&o.push(ci(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var fi=/\r\n?/g,pi=/\u0000|\uFFFD/g;function mi(e){return(typeof e==`string`?e:``+e).replace(fi,`
|
|
6
6
|
`).replace(pi,``)}function hi(e,t,n){if(t=mi(t),mi(e)!==t&&n)throw Error(r(425))}function gi(){}var _i=null,vi=null;function yi(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var bi=typeof setTimeout==`function`?setTimeout:void 0,xi=typeof clearTimeout==`function`?clearTimeout:void 0,Si=typeof Promise==`function`?Promise:void 0,Ci=typeof queueMicrotask==`function`?queueMicrotask:Si===void 0?bi:function(e){return Si.resolve(null).then(e).catch(wi)};function wi(e){setTimeout(function(){throw e})}function Ti(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),sn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++;n=i}while(n);sn(t)}function Ei(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function Di(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Oi=Math.random().toString(36).slice(2),ki=`__reactFiber$`+Oi,Ai=`__reactProps$`+Oi,ji=`__reactContainer$`+Oi,Mi=`__reactEvents$`+Oi,Ni=`__reactListeners$`+Oi,Pi=`__reactHandles$`+Oi;function Fi(e){var t=e[ki];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ji]||n[ki]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Di(e);e!==null;){if(n=e[ki])return n;e=Di(e)}return t}e=n,n=e.parentNode}return null}function Ii(e){return e=e[ki]||e[ji],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Li(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ri(e){return e[Ai]||null}var zi=[],Bi=-1;function Vi(e){return{current:e}}function Hi(e){0>Bi||(e.current=zi[Bi],zi[Bi]=null,Bi--)}function Ui(e,t){Bi++,zi[Bi]=e.current,e.current=t}var Wi={},Gi=Vi(Wi),Ki=Vi(!1),qi=Wi;function Ji(e,t){var n=e.type.contextTypes;if(!n)return Wi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Yi(e){return e=e.childContextTypes,e!=null}function Xi(){Hi(Ki),Hi(Gi)}function Zi(e,t,n){if(Gi.current!==Wi)throw Error(r(168));Ui(Gi,t),Ui(Ki,n)}function Qi(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,re(e)||`Unknown`,a));return R({},n,i)}function $i(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wi,qi=Gi.current,Ui(Gi,e),Ui(Ki,Ki.current),!0}function ea(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=Qi(e,t,qi),i.__reactInternalMemoizedMergedChildContext=e,Hi(Ki),Hi(Gi),Ui(Gi,e)):Hi(Ki),Ui(Ki,n)}var ta=null,na=!1,ra=!1;function ia(e){ta===null?ta=[e]:ta.push(e)}function aa(e){na=!0,ia(e)}function oa(){if(!ra&&ta!==null){ra=!0;var e=0,t=It;try{var n=ta;for(It=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}ta=null,na=!1}catch(t){throw ta!==null&&(ta=ta.slice(e+1)),st(pt,oa),t}finally{It=t,ra=!1}}return null}var sa=[],ca=0,la=null,ua=0,da=[],fa=0,pa=null,ma=1,ha=``;function ga(e,t){sa[ca++]=ua,sa[ca++]=la,la=e,ua=t}function _a(e,t,n){da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,pa=e;var r=ma;e=ha;var i=32-bt(r)-1;r&=~(1<<i),n+=1;var a=32-bt(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ma=1<<32-bt(t)+i|n<<i|r,ha=a+e}else ma=1<<a|n<<i|r,ha=e}function va(e){e.return!==null&&(ga(e,1),_a(e,1,0))}function ya(e){for(;e===la;)la=sa[--ca],sa[ca]=null,ua=sa[--ca],sa[ca]=null;for(;e===pa;)pa=da[--fa],da[fa]=null,ha=da[--fa],da[fa]=null,ma=da[--fa],da[fa]=null}var ba=null,xa=null,Sa=!1,Ca=null;function wa(e,t){var n=Ql(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Ta(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t===null?!1:(e.stateNode=t,ba=e,xa=Ei(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t===null?!1:(e.stateNode=t,ba=e,xa=null,!0);case 13:return t=t.nodeType===8?t:null,t===null?!1:(n=pa===null?null:{id:ma,overflow:ha},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ql(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ba=e,xa=null,!0);default:return!1}}function Ea(e){return(e.mode&1)!=0&&(e.flags&128)==0}function Da(e){if(Sa){var t=xa;if(t){var n=t;if(!Ta(e,t)){if(Ea(e))throw Error(r(418));t=Ei(n.nextSibling);var i=ba;t&&Ta(e,t)?wa(i,n):(e.flags=e.flags&-4097|2,Sa=!1,ba=e)}}else{if(Ea(e))throw Error(r(418));e.flags=e.flags&-4097|2,Sa=!1,ba=e}}}function Oa(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ba=e}function ka(e){if(e!==ba)return!1;if(!Sa)return Oa(e),Sa=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!yi(e.type,e.memoizedProps)),t&&=xa){if(Ea(e))throw Aa(),Error(r(418));for(;t;)wa(e,t),t=Ei(t.nextSibling)}if(Oa(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){xa=Ei(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}xa=null}}else xa=ba?Ei(e.stateNode.nextSibling):null;return!0}function Aa(){for(var e=xa;e;)e=Ei(e.nextSibling)}function ja(){xa=ba=null,Sa=!1}function Ma(e){Ca===null?Ca=[e]:Ca.push(e)}var Na=C.ReactCurrentBatchConfig;function Pa(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Fa(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Ia(e){var t=e._init;return t(e._payload)}function La(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=tu(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=au(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===E?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===F&&Ia(i)===t.type)?(r=a(t,n.props),r.ref=Pa(e,t,n),r.return=e,r):(r=nu(n.type,n.key,n.props,null,e.mode,r),r.ref=Pa(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ou(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ru(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=au(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=nu(t.type,t.key,t.props,null,e.mode,n),n.ref=Pa(e,null,t),n.return=e,n;case T:return t=ou(t,e.mode,n),t.return=e,t;case F:var r=t._init;return f(e,r(t._payload),n)}if(he(t)||ee(t))return t=ru(t,e.mode,n,null),t.return=e,t;Fa(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case F:return i=n._init,p(e,t,i(n._payload),r)}if(he(n)||ee(n))return i===null?d(e,t,n,r,null):null;Fa(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case F:var a=r._init;return m(e,t,n,a(r._payload),i)}if(he(r)||ee(r))return e=e.get(n)||null,d(t,e,r,i,null);Fa(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Sa&&ga(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Sa&&ga(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),Sa&&ga(r,h),l}function g(a,s,c,l){var u=ee(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Sa&&ga(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Sa&&ga(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Sa&&ga(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&Ia(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=Pa(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=ru(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=nu(i.type,i.key,i.props,null,e.mode,o),o.ref=Pa(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=ou(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(he(i))return h(e,r,i,o);if(ee(i))return g(e,r,i,o);Fa(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=au(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ra=La(!0),za=La(!1),Ba=Vi(null),Va=null,Ha=null,Ua=null;function Wa(){Ua=Ha=Va=null}function Ga(e){var t=Ba.current;Hi(Ba),e._currentValue=t}function Ka(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function qa(e,t){Va=e,Ua=Ha=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Ls=!0),e.firstContext=null)}function Ja(e){var t=e._currentValue;if(Ua!==e)if(e={context:e,memoizedValue:t,next:null},Ha===null){if(Va===null)throw Error(r(308));Ha=e,Va.dependencies={lanes:0,firstContext:e}}else Ha=Ha.next=e;return t}var Ya=null;function Xa(e){Ya===null?Ya=[e]:Ya.push(e)}function Za(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Xa(t)):(n.next=i.next,i.next=n),t.interleaved=n,Qa(e,r)}function Qa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var $a=!1;function eo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function to(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function no(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ro(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Kc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Qa(e,n)}return i=r.interleaved,i===null?(t.next=t,Xa(r)):(t.next=i.next,i.next=t),r.interleaved=t,Qa(e,n)}function io(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ft(e,n)}}function ao(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function oo(e,t,n,r){var i=e.updateQueue;$a=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=R({},d,f);break a;case 2:$a=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);el|=o,e.lanes=o,e.memoizedState=d}}function so(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var co={},lo=Vi(co),uo=Vi(co),fo=Vi(co);function po(e){if(e===co)throw Error(r(174));return e}function mo(e,t){switch(Ui(fo,t),Ui(uo,e),Ui(lo,co),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Se(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Se(t,e)}Hi(lo),Ui(lo,t)}function ho(){Hi(lo),Hi(uo),Hi(fo)}function go(e){po(fo.current);var t=po(lo.current),n=Se(t,e.type);t!==n&&(Ui(uo,e),Ui(lo,n))}function _o(e){uo.current===e&&(Hi(lo),Hi(uo))}var vo=Vi(0);function yo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var bo=[];function xo(){for(var e=0;e<bo.length;e++)bo[e]._workInProgressVersionPrimary=null;bo.length=0}var So=C.ReactCurrentDispatcher,Co=C.ReactCurrentBatchConfig,wo=0,To=null,Eo=null,Do=null,Oo=!1,ko=!1,Ao=0,jo=0;function Mo(){throw Error(r(321))}function No(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!wr(e[n],t[n]))return!1;return!0}function Po(e,t,n,i,a,o){if(wo=o,To=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,So.current=e===null||e.memoizedState===null?_s:vs,e=n(i,a),ko){o=0;do{if(ko=!1,Ao=0,25<=o)throw Error(r(301));o+=1,Do=Eo=null,t.updateQueue=null,So.current=ys,e=n(i,a)}while(ko)}if(So.current=gs,t=Eo!==null&&Eo.next!==null,wo=0,Do=Eo=To=null,Oo=!1,t)throw Error(r(300));return e}function Fo(){var e=Ao!==0;return Ao=0,e}function Io(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Do===null?To.memoizedState=Do=e:Do=Do.next=e,Do}function Lo(){if(Eo===null){var e=To.alternate;e=e===null?null:e.memoizedState}else e=Eo.next;var t=Do===null?To.memoizedState:Do.next;if(t!==null)Do=t,Eo=e;else{if(e===null)throw Error(r(310));Eo=e,e={memoizedState:Eo.memoizedState,baseState:Eo.baseState,baseQueue:Eo.baseQueue,queue:Eo.queue,next:null},Do===null?To.memoizedState=Do=e:Do=Do.next=e}return Do}function Ro(e,t){return typeof t==`function`?t(e):t}function zo(e){var t=Lo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=Eo,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((wo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,To.lanes|=d,el|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,wr(i,t.memoizedState)||(Ls=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,To.lanes|=o,el|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Bo(e){var t=Lo(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);wr(o,t.memoizedState)||(Ls=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Vo(){}function Ho(e,t){var n=To,i=Lo(),a=t(),o=!wr(i.memoizedState,a);if(o&&(i.memoizedState=a,Ls=!0),i=i.queue,es(Go.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||Do!==null&&Do.memoizedState.tag&1){if(n.flags|=2048,Yo(9,Wo.bind(null,n,i,a,t),void 0,null),qc===null)throw Error(r(349));wo&30||Uo(n,t,a)}return a}function Uo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=To.updateQueue,t===null?(t={lastEffect:null,stores:null},To.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Wo(e,t,n,r){t.value=n,t.getSnapshot=r,Ko(t)&&qo(e)}function Go(e,t,n){return n(function(){Ko(t)&&qo(e)})}function Ko(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!wr(e,n)}catch{return!0}}function qo(e){var t=Qa(e,1);t!==null&&bl(t,e,1,-1)}function Jo(e){var t=Io();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:e},t.queue=e,e=e.dispatch=fs.bind(null,To,e),[t.memoizedState,e]}function Yo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=To.updateQueue,t===null?(t={lastEffect:null,stores:null},To.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Xo(){return Lo().memoizedState}function Zo(e,t,n,r){var i=Io();To.flags|=e,i.memoizedState=Yo(1|t,n,void 0,r===void 0?null:r)}function Qo(e,t,n,r){var i=Lo();r=r===void 0?null:r;var a=void 0;if(Eo!==null){var o=Eo.memoizedState;if(a=o.destroy,r!==null&&No(r,o.deps)){i.memoizedState=Yo(t,n,a,r);return}}To.flags|=e,i.memoizedState=Yo(1|t,n,a,r)}function $o(e,t){return Zo(8390656,8,e,t)}function es(e,t){return Qo(2048,8,e,t)}function ts(e,t){return Qo(4,2,e,t)}function ns(e,t){return Qo(4,4,e,t)}function rs(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function is(e,t,n){return n=n==null?null:n.concat([e]),Qo(4,4,rs.bind(null,t,e),n)}function as(){}function os(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&No(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ss(e,t){var n=Lo();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&No(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function cs(e,t,n){return wo&21?(wr(n,t)||(n=jt(),To.lanes|=n,el|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Ls=!0),e.memoizedState=n)}function ls(e,t){var n=It;It=n!==0&&4>n?n:4,e(!0);var r=Co.transition;Co.transition={};try{e(!1),t()}finally{It=n,Co.transition=r}}function us(){return Lo().memoizedState}function ds(e,t,n){var r=yl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ps(e))ms(t,n);else if(n=Za(e,t,n,r),n!==null){var i=vl();bl(n,e,r,i),hs(n,t,r)}}function fs(e,t,n){var r=yl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ps(e))ms(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,wr(s,o)){var c=t.interleaved;c===null?(i.next=i,Xa(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=Za(e,t,i,r),n!==null&&(i=vl(),bl(n,e,r,i),hs(n,t,r))}}function ps(e){var t=e.alternate;return e===To||t!==null&&t===To}function ms(e,t){ko=Oo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ft(e,n)}}var gs={readContext:Ja,useCallback:Mo,useContext:Mo,useEffect:Mo,useImperativeHandle:Mo,useInsertionEffect:Mo,useLayoutEffect:Mo,useMemo:Mo,useReducer:Mo,useRef:Mo,useState:Mo,useDebugValue:Mo,useDeferredValue:Mo,useTransition:Mo,useMutableSource:Mo,useSyncExternalStore:Mo,useId:Mo,unstable_isNewReconciler:!1},_s={readContext:Ja,useCallback:function(e,t){return Io().memoizedState=[e,t===void 0?null:t],e},useContext:Ja,useEffect:$o,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Zo(4194308,4,rs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zo(4,2,e,t)},useMemo:function(e,t){var n=Io();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Io();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ds.bind(null,To,e),[r.memoizedState,e]},useRef:function(e){var t=Io();return e={current:e},t.memoizedState=e},useState:Jo,useDebugValue:as,useDeferredValue:function(e){return Io().memoizedState=e},useTransition:function(){var e=Jo(!1),t=e[0];return e=ls.bind(null,e[1]),Io().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=To,a=Io();if(Sa){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),qc===null)throw Error(r(349));wo&30||Uo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,$o(Go.bind(null,i,o,e),[e]),i.flags|=2048,Yo(9,Wo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Io(),t=qc.identifierPrefix;if(Sa){var n=ha,r=ma;n=(r&~(1<<32-bt(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=Ao++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=jo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},vs={readContext:Ja,useCallback:os,useContext:Ja,useEffect:es,useImperativeHandle:is,useInsertionEffect:ts,useLayoutEffect:ns,useMemo:ss,useReducer:zo,useRef:Xo,useState:function(){return zo(Ro)},useDebugValue:as,useDeferredValue:function(e){return cs(Lo(),Eo.memoizedState,e)},useTransition:function(){return[zo(Ro)[0],Lo().memoizedState]},useMutableSource:Vo,useSyncExternalStore:Ho,useId:us,unstable_isNewReconciler:!1},ys={readContext:Ja,useCallback:os,useContext:Ja,useEffect:es,useImperativeHandle:is,useInsertionEffect:ts,useLayoutEffect:ns,useMemo:ss,useReducer:Bo,useRef:Xo,useState:function(){return Bo(Ro)},useDebugValue:as,useDeferredValue:function(e){var t=Lo();return Eo===null?t.memoizedState=e:cs(t,Eo.memoizedState,e)},useTransition:function(){return[Bo(Ro)[0],Lo().memoizedState]},useMutableSource:Vo,useSyncExternalStore:Ho,useId:us,unstable_isNewReconciler:!1};function bs(e,t){if(e&&e.defaultProps){for(var n in t=R({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function xs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:R({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ss={isMounted:function(e){return(e=e._reactInternals)?nt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=no(r,i);a.payload=t,n!=null&&(a.callback=n),t=ro(e,a,i),t!==null&&(bl(t,e,i,r),io(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vl(),i=yl(e),a=no(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=ro(e,a,i),t!==null&&(bl(t,e,i,r),io(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vl(),r=yl(e),i=no(n,r);i.tag=2,t!=null&&(i.callback=t),t=ro(e,i,r),t!==null&&(bl(t,e,r,n),io(t,e,r))}};function Cs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Tr(n,r)||!Tr(i,a):!0}function ws(e,t,n){var r=!1,i=Wi,a=t.contextType;return typeof a==`object`&&a?a=Ja(a):(i=Yi(t)?qi:Gi.current,r=t.contextTypes,a=(r=r!=null)?Ji(e,i):Wi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Ss,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Ts(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ss.enqueueReplaceState(t,t.state,null)}function Es(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},eo(e);var a=t.contextType;typeof a==`object`&&a?i.context=Ja(a):(a=Yi(t)?qi:Gi.current,i.context=Ji(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(xs(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Ss.enqueueReplaceState(i,i.state,null),oo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Ds(e,t){try{var n=``,r=t;do n+=H(r),r=r.return;while(r);var i=n}catch(e){i=`
|
|
7
7
|
Error generating stack: `+e.message+`
|
|
8
|
-
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Os(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ks(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var As=typeof WeakMap==`function`?WeakMap:Map;function js(e,t,n){n=no(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,ll=r),ks(e,t)},n}function Ms(e,t,n){n=no(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ks(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ks(e,t),typeof r!=`function`&&(ul===null?ul=new Set([this]):ul.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ns(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new As;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Gl.bind(null,e,t,n),t.then(e,e))}function Ps(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Fs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=no(-1,1),t.tag=2,ro(n,t,1))),n.lanes|=1),e)}var Is=C.ReactCurrentOwner,Ls=!1;function Rs(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function zs(e,t,n,r,i){n=n.render;var a=t.ref;return qa(t,i),r=Po(e,t,n,r,a,i),n=Fo(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(Sa&&n&&va(t),t.flags|=1,Rs(e,t,r,i),t.child)}function Bs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$l(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Vs(e,t,a,r,i)):(e=nu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Tr:n,n(o,r)&&e.ref===t.ref)return ac(e,t,i)}return t.flags|=1,e=tu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Vs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref)if(Ls=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ls=!0);else return t.lanes=e.lanes,ac(e,t,i)}return Ws(e,t,n,r,i)}function Hs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ui(Zc,Xc),Xc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ui(Zc,Xc),Xc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Ui(Zc,Xc),Xc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Ui(Zc,Xc),Xc|=r;return Rs(e,t,i,n),t.child}function Us(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ws(e,t,n,r,i){var a=Yi(n)?qi:Gi.current;return a=Ji(t,a),qa(t,i),n=Po(e,t,n,r,a,i),r=Fo(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(Sa&&r&&va(t),t.flags|=1,Rs(e,t,n,i),t.child)}function Gs(e,t,n,r,i){if(Yi(n)){var a=!0;$i(t)}else a=!1;if(qa(t,i),t.stateNode===null)ic(e,t),ws(t,n,r),Es(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ja(l):(l=Yi(n)?qi:Gi.current,l=Ji(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Ts(t,o,r,l),$a=!1;var f=t.memoizedState;o.state=f,oo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ki.current||$a?(typeof u==`function`&&(xs(t,n,u,r),c=t.memoizedState),(s=$a||Cs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,to(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:bs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ja(c):(c=Yi(n)?qi:Gi.current,c=Ji(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Ts(t,o,r,c),$a=!1,f=t.memoizedState,o.state=f,oo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ki.current||$a?(typeof p==`function`&&(xs(t,n,p,r),m=t.memoizedState),(l=$a||Cs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ks(e,t,n,r,a,i)}function Ks(e,t,n,r,i,a){Us(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ea(t,n,!1),ac(e,t,a);r=t.stateNode,Is.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ra(t,e.child,null,a),t.child=Ra(t,null,s,a)):Rs(e,t,s,a),t.memoizedState=r.state,i&&ea(t,n,!0),t.child}function qs(e){var t=e.stateNode;t.pendingContext?Zi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zi(e,t.context,!1),mo(e,t.containerInfo)}function Js(e,t,n,r,i){return ja(),Ma(i),t.flags|=256,Rs(e,t,n,r),t.child}var Ys={dehydrated:null,treeContext:null,retryLane:0};function Xs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zs(e,t,n){var r=t.pendingProps,i=vo.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ui(vo,i&1),e===null)return Da(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=iu(o,r,0,null),e=ru(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Xs(n),t.memoizedState=Ys,e):Qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ec(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=tu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ru(a,o,n,null),a.flags|=2):a=tu(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Xs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ys,r}return a=e.child,e=a.sibling,r=tu(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Qs(e,t){return t=iu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function $s(e,t,n,r){return r!==null&&Ma(r),Ra(t,e.child,null,n),e=Qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ec(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Os(Error(r(422))),$s(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=iu({mode:`visible`,children:i.children},a,0,null),o=ru(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ra(t,e.child,null,s),t.child.memoizedState=Xs(s),t.memoizedState=Ys,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return $s(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Os(o,i,void 0),$s(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ls||c){if(i=qc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,Qa(e,a),bl(i,e,a,-1))}return Pl(),i=Os(Error(r(421))),$s(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,xa=Ei(a.nextSibling),ba=t,Sa=!0,Ca=null,e!==null&&(da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,ma=e.id,ha=e.overflow,pa=t),t=Qs(t,i.children),t.flags|=4096,t)}function tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ka(e.return,t,n)}function nc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function rc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Rs(e,t,r.children,n),r=vo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tc(e,n,t);else if(e.tag===19)tc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ui(vo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&yo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),nc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&yo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}nc(t,!0,n,null,a);break;case`together`:nc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ic(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),el|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=tu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=tu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function oc(e,t,n){switch(t.tag){case 3:qs(t),ja();break;case 5:go(t);break;case 1:Yi(t.type)&&$i(t);break;case 4:mo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ui(Ba,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ui(vo,vo.current&1),e=ac(e,t,n),e===null?null:e.sibling):Zs(e,t,n):(Ui(vo,vo.current&1),t.flags|=128,null);Ui(vo,vo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return rc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ui(vo,vo.current),r)break;return null;case 22:case 23:return t.lanes=0,Hs(e,t,n)}return ac(e,t,n)}var sc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},cc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,po(lo.current);var o=null;switch(n){case`input`:i=le(e,i),r=le(e,r),o=[];break;case`select`:i=R({},i,{value:void 0}),r=R({},r,{value:void 0}),o=[];break;case`textarea`:i=_e(e,i),r=_e(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=gi)}je(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ni(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},lc=function(e,t,n,r){n!==r&&(t.flags|=4)};function uc(e,t){if(!Sa)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function dc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function fc(e,t,n){var i=t.pendingProps;switch(ya(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dc(t),null;case 1:return Yi(t.type)&&Xi(),dc(t),null;case 3:return i=t.stateNode,ho(),Hi(Ki),Hi(Gi),xo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ka(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ca!==null&&(wl(Ca),Ca=null))),dc(t),null;case 5:_o(t);var o=po(fo.current);if(n=t.type,e!==null&&t.stateNode!=null)cc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return dc(t),null}if(e=po(lo.current),ka(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[ki]=t,i[Ai]=s,e=(t.mode&1)!=0,n){case`dialog`:ni(`cancel`,i),ni(`close`,i);break;case`iframe`:case`object`:case`embed`:ni(`load`,i);break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],i);break;case`source`:ni(`error`,i);break;case`img`:case`image`:case`link`:ni(`error`,i),ni(`load`,i);break;case`details`:ni(`toggle`,i);break;case`input`:ue(i,s),ni(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ni(`invalid`,i);break;case`textarea`:ve(i,s),ni(`invalid`,i)}for(var c in je(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ni(`scroll`,i)}switch(n){case`input`:oe(i),pe(i,s,!0);break;case`textarea`:oe(i),be(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=gi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=xe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ki]=t,e[Ai]=i,sc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Me(n,i),n){case`dialog`:ni(`cancel`,e),ni(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ni(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],e);o=i;break;case`source`:ni(`error`,e),o=i;break;case`img`:case`image`:case`link`:ni(`error`,e),ni(`load`,e),o=i;break;case`details`:ni(`toggle`,e),o=i;break;case`input`:ue(e,i),o=le(e,i),ni(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),ni(`invalid`,e);break;case`textarea`:ve(e,i),o=_e(e,i),ni(`invalid`,e);break;default:o=i}for(s in je(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?ke(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&we(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Te(e,u):typeof u==`number`&&Te(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ni(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:oe(e),pe(e,i,!1);break;case`textarea`:oe(e),be(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+ie(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&ge(e,!!i.multiple,i.defaultValue,!0):ge(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=gi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return dc(t),null;case 6:if(e&&t.stateNode!=null)lc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=po(fo.current),po(lo.current),ka(t)){if(i=t.stateNode,n=t.memoizedProps,i[ki]=t,(s=i.nodeValue!==n)&&(e=ba,e!==null))switch(e.tag){case 3:hi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&hi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ki]=t,t.stateNode=i}return dc(t),null;case 13:if(Hi(vo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Sa&&xa!==null&&t.mode&1&&!(t.flags&128))Aa(),ja(),t.flags|=98560,s=!1;else if(s=ka(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[ki]=t}else ja(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dc(t),s=!1}else Ca!==null&&(wl(Ca),Ca=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||vo.current&1?Qc===0&&(Qc=3):Pl())),t.updateQueue!==null&&(t.flags|=4),dc(t),null);case 4:return ho(),e===null&&ai(t.stateNode.containerInfo),dc(t),null;case 10:return Ga(t.type._context),dc(t),null;case 17:return Yi(t.type)&&Xi(),dc(t),null;case 19:if(Hi(vo),s=t.memoizedState,s===null)return dc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)uc(s,!1);else{if(Qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=yo(e),c!==null){for(t.flags|=128,uc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ui(vo,vo.current&1|2),t.child}e=e.sibling}s.tail!==null&&dt()>ol&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304)}else{if(!i)if(e=yo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),uc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Sa)return dc(t),null}else 2*dt()-s.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(dc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=dt(),t.sibling=null,n=vo.current,Ui(vo,i?n&1|2:n&1),t);case 22:case 23:return Al(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Xc&1073741824&&(dc(t),t.subtreeFlags&6&&(t.flags|=8192)):dc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function pc(e,t){switch(ya(t),t.tag){case 1:return Yi(t.type)&&Xi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ho(),Hi(Ki),Hi(Gi),xo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _o(t),null;case 13:if(Hi(vo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ja()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Hi(vo),null;case 4:return ho(),null;case 10:return Ga(t.type._context),null;case 22:case 23:return Al(),null;case 24:return null;default:return null}}var mc=!1,hc=!1,gc=typeof WeakSet==`function`?WeakSet:Set,q=null;function _c(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Wl(e,t,n)}else n.current=null}function vc(e,t,n){try{n()}catch(n){Wl(e,t,n)}}var yc=!1;function bc(e,t){if(_i=ln,e=kr(),Ar(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(vi={focusedElem:e,selectionRange:n},ln=!1,q=t;q!==null;)if(t=q,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:bs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Wl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return h=yc,yc=!1,h}function xc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&vc(t,n,a)}i=i.next}while(i!==r)}}function Sc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function wc(e){var t=e.alternate;t!==null&&(e.alternate=null,wc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ki],delete t[Ai],delete t[Mi],delete t[Ni],delete t[Pi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tc(e){return e.tag===5||e.tag===3||e.tag===4}function Ec(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Tc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Dc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gi));else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}var kc=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(vt&&typeof vt.onCommitFiberUnmount==`function`)try{vt.onCommitFiberUnmount(_t,n)}catch{}switch(n.tag){case 5:hc||_c(n,t);case 6:var r=kc,i=Ac;kc=null,jc(e,t,n),kc=r,Ac=i,kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kc.removeChild(n.stateNode));break;case 18:kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?Ti(e.parentNode,n):e.nodeType===1&&Ti(e,n),sn(e)):Ti(kc,n.stateNode));break;case 4:r=kc,i=Ac,kc=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),kc=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!hc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&vc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!hc&&(_c(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Wl(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(hc=(r=hc)||n.memoizedState!==null,jc(e,t,n),hc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gc),t.forEach(function(t){var r=Jl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:kc=c.stateNode,Ac=!1;break a;case 3:kc=c.stateNode.containerInfo,Ac=!0;break a;case 4:kc=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(kc===null)throw Error(r(160));Mc(o,s,a),kc=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Wl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{xc(3,e,e.return),Sc(3,e)}catch(t){Wl(e,e.return,t)}try{xc(5,e,e.return)}catch(t){Wl(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return),e.flags&32){var a=e.stateNode;try{Te(a,``)}catch(t){Wl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&de(a,o),Me(c,s);var u=Me(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?ke(a,f):d===`dangerouslySetInnerHTML`?we(a,f):d===`children`?Te(a,f):S(a,d,f,u)}switch(c){case`input`:fe(a,o);break;case`textarea`:ye(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?ge(a,!!o.multiple,o.multiple?[]:``,!1):ge(a,!!o.multiple,o.defaultValue,!0)):ge(a,!!o.multiple,m,!1)}a[Ai]=o}catch(t){Wl(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Wl(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{sn(t.containerInfo)}catch(t){Wl(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(al=dt())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(hc=(u=hc)||d,Pc(t,e),hc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(q=e,d=e.child;d!==null;){for(f=q=d;q!==null;){switch(p=q,m=p.child,p.tag){case 0:case 11:case 14:case 15:xc(4,p,p.return);break;case 1:_c(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Wl(i,n,e)}}break;case 5:_c(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,q=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Oe(`display`,s))}catch(t){Wl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Wl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Tc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Te(a,``),i.flags&=-33),Oc(e,Ec(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Dc(e,Ec(e),o);break;default:throw Error(r(161))}}catch(t){Wl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){q=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=(e.mode&1)!=0;q!==null;){var i=q,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||mc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||hc;s=mc;var l=hc;if(mc=o,(hc=c)&&!l)for(q=i;q!==null;)o=q,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,q=c);for(;a!==null;)q=a,Rc(a,t,n),a=a.sibling;q=i,mc=s,hc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,q=a):zc(e,t,n)}}function zc(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:hc||Sc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!hc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:bs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&so(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}so(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&sn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}hc||t.flags&512&&Cc(t)}catch(e){Wl(t,t.return,e)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function Bc(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function Vc(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sc(4,t)}catch(e){Wl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Wl(t,i,e)}}var a=t.return;try{Cc(t)}catch(e){Wl(t,a,e)}break;case 5:var o=t.return;try{Cc(t)}catch(e){Wl(t,o,e)}}}catch(e){Wl(t,t.return,e)}if(t===e){q=null;break}var s=t.sibling;if(s!==null){s.return=t.return,q=s;break}q=t.return}}var Hc=Math.ceil,Uc=C.ReactCurrentDispatcher,Wc=C.ReactCurrentOwner,Gc=C.ReactCurrentBatchConfig,Kc=0,qc=null,Jc=null,Yc=0,Xc=0,Zc=Vi(0),Qc=0,$c=null,el=0,tl=0,nl=0,rl=null,il=null,al=0,ol=1/0,sl=null,cl=!1,ll=null,ul=null,dl=!1,fl=null,pl=0,ml=0,hl=null,gl=-1,_l=0;function vl(){return Kc&6?dt():gl===-1?gl=dt():gl}function yl(e){return e.mode&1?Kc&2&&Yc!==0?Yc&-Yc:Na.transition===null?(e=It,e===0?(e=window.event,e=e===void 0?16:hn(e.type),e):e):(_l===0&&(_l=jt()),_l):1}function bl(e,t,n,i){if(50<ml)throw ml=0,hl=null,Error(r(185));Nt(e,n,i),(!(Kc&2)||e!==qc)&&(e===qc&&(!(Kc&2)&&(tl|=n),Qc===4&&El(e,Yc)),xl(e,i),n===1&&Kc===0&&!(t.mode&1)&&(ol=dt()+500,na&&oa()))}function xl(e,t){var n=e.callbackNode;kt(e,t);var r=Dt(e,e===qc?Yc:0);if(r===0)n!==null&&ct(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ct(n),t===1)e.tag===0?aa(Dl.bind(null,e)):ia(Dl.bind(null,e)),Ci(function(){!(Kc&6)&&oa()}),n=null;else{switch(Lt(r)){case 1:n=pt;break;case 4:n=mt;break;case 16:n=G;break;case 536870912:n=gt;break;default:n=G}n=Xl(n,Sl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sl(e,t){if(gl=-1,_l=0,Kc&6)throw Error(r(327));var n=e.callbackNode;if(Hl()&&e.callbackNode!==n)return null;var i=Dt(e,e===qc?Yc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Fl(e,i);else{t=i;var a=Kc;Kc|=2;var o=Nl();(qc!==e||Yc!==t)&&(sl=null,ol=dt()+500,jl(e,t));do try{Ll();break}catch(t){Ml(e,t)}while(1);Wa(),Uc.current=o,Kc=a,Jc===null?(qc=null,Yc=0,t=Qc):t=0}if(t!==0){if(t===2&&(a=At(e),a!==0&&(i=a,t=Cl(e,a))),t===1)throw n=$c,jl(e,0),El(e,i),xl(e,dt()),n;if(t===6)El(e,i);else{if(a=e.current.alternate,!(i&30)&&!Tl(a)&&(t=Fl(e,i),t===2&&(o=At(e),o!==0&&(i=o,t=Cl(e,o))),t===1))throw n=$c,jl(e,0),El(e,i),xl(e,dt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Bl(e,il,sl);break;case 3:if(El(e,i),(i&130023424)===i&&(t=al+500-dt(),10<t)){if(Dt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){vl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=bi(Bl.bind(null,e,il,sl),t);break}Bl(e,il,sl);break;case 4:if(El(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-bt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=dt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=bi(Bl.bind(null,e,il,sl),i);break}Bl(e,il,sl);break;case 5:Bl(e,il,sl);break;default:throw Error(r(329))}}}return xl(e,dt()),e.callbackNode===n?Sl.bind(null,e):null}function Cl(e,t){var n=rl;return e.current.memoizedState.isDehydrated&&(jl(e,t).flags|=256),e=Fl(e,t),e!==2&&(t=il,il=n,t!==null&&wl(t)),e}function wl(e){il===null?il=e:il.push.apply(il,e)}function Tl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!wr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function El(e,t){for(t&=~nl,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-bt(t),r=1<<n;e[n]=-1,t&=~r}}function Dl(e){if(Kc&6)throw Error(r(327));Hl();var t=Dt(e,0);if(!(t&1))return xl(e,dt()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var i=At(e);i!==0&&(t=i,n=Cl(e,i))}if(n===1)throw n=$c,jl(e,0),El(e,t),xl(e,dt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Bl(e,il,sl),xl(e,dt()),null}function Ol(e,t){var n=Kc;Kc|=1;try{return e(t)}finally{Kc=n,Kc===0&&(ol=dt()+500,na&&oa())}}function kl(e){fl!==null&&fl.tag===0&&!(Kc&6)&&Hl();var t=Kc;Kc|=1;var n=Gc.transition,r=It;try{if(Gc.transition=null,It=1,e)return e()}finally{It=r,Gc.transition=n,Kc=t,!(Kc&6)&&oa()}}function Al(){Xc=Zc.current,Hi(Zc)}function jl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xi(n)),Jc!==null)for(n=Jc.return;n!==null;){var r=n;switch(ya(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xi();break;case 3:ho(),Hi(Ki),Hi(Gi),xo();break;case 5:_o(r);break;case 4:ho();break;case 13:Hi(vo);break;case 19:Hi(vo);break;case 10:Ga(r.type._context);break;case 22:case 23:Al()}n=n.return}if(qc=e,Jc=e=tu(e.current,null),Yc=Xc=t,Qc=0,$c=null,nl=tl=el=0,il=rl=null,Ya!==null){for(t=0;t<Ya.length;t++)if(n=Ya[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Ya=null}return e}function Ml(e,t){do{var n=Jc;try{if(Wa(),So.current=gs,Oo){for(var i=To.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Oo=!1}if(wo=0,Do=Eo=To=null,ko=!1,Ao=0,Wc.current=null,n===null||n.return===null){Qc=1,$c=t,Jc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Yc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Ps(s);if(m!==null){m.flags&=-257,Fs(m,s,c,o,t),m.mode&1&&Ns(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Ns(o,u,t),Pl();break a}l=Error(r(426))}}else if(Sa&&c.mode&1){var _=Ps(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Fs(_,s,c,o,t),Ma(Ds(l,c));break a}}o=l=Ds(l,c),Qc!==4&&(Qc=2),rl===null?rl=[o]:rl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=js(o,l,t);ao(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ul===null||!ul.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ms(o,c,t);ao(o,x);break a}}o=o.return}while(o!==null)}zl(n)}catch(e){t=e,Jc===n&&n!==null&&(Jc=n=n.return);continue}break}while(1)}function Nl(){var e=Uc.current;return Uc.current=gs,e===null?gs:e}function Pl(){(Qc===0||Qc===3||Qc===2)&&(Qc=4),qc===null||!(el&268435455)&&!(tl&268435455)||El(qc,Yc)}function Fl(e,t){var n=Kc;Kc|=2;var i=Nl();(qc!==e||Yc!==t)&&(sl=null,jl(e,t));do try{Il();break}catch(t){Ml(e,t)}while(1);if(Wa(),Kc=n,Uc.current=i,Jc!==null)throw Error(r(261));return qc=null,Yc=0,Qc}function Il(){for(;Jc!==null;)Rl(Jc)}function Ll(){for(;Jc!==null&&!lt();)Rl(Jc)}function Rl(e){var t=Yl(e.alternate,e,Xc);e.memoizedProps=e.pendingProps,t===null?zl(e):Jc=t,Wc.current=null}function zl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=pc(n,t),n!==null){n.flags&=32767,Jc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Qc=6,Jc=null;return}}else if(n=fc(n,t,Xc),n!==null){Jc=n;return}if(t=t.sibling,t!==null){Jc=t;return}Jc=t=e}while(t!==null);Qc===0&&(Qc=5)}function Bl(e,t,n){var r=It,i=Gc.transition;try{Gc.transition=null,It=1,Vl(e,t,n,r)}finally{Gc.transition=i,It=r}return null}function Vl(e,t,n,i){do Hl();while(fl!==null);if(Kc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Pt(e,o),e===qc&&(Jc=qc=null,Yc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,Xl(G,function(){return Hl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=It;It=1;var c=Kc;Kc|=4,Wc.current=null,bc(e,n),Fc(n,e),jr(vi),ln=!!_i,vi=_i=null,e.current=n,Lc(n,e,a),ut(),Kc=c,It=s,Gc.transition=o}else e.current=n;if(dl&&(dl=!1,fl=e,pl=a),o=e.pendingLanes,o===0&&(ul=null),yt(n.stateNode,i),xl(e,dt()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(cl)throw cl=!1,e=ll,ll=null,e;return pl&1&&e.tag!==0&&Hl(),o=e.pendingLanes,o&1?e===hl?ml++:(ml=0,hl=e):ml=0,oa(),null}function Hl(){if(fl!==null){var e=Lt(pl),t=Gc.transition,n=It;try{if(Gc.transition=null,It=16>e?16:e,fl===null)var i=!1;else{if(e=fl,fl=null,pl=0,Kc&6)throw Error(r(331));var a=Kc;for(Kc|=4,q=e.current;q!==null;){var o=q,s=o.child;if(q.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(q=u;q!==null;){var d=q;switch(d.tag){case 0:case 11:case 15:xc(8,d,o)}var f=d.child;if(f!==null)f.return=d,q=f;else for(;q!==null;){d=q;var p=d.sibling,m=d.return;if(wc(d),d===u){q=null;break}if(p!==null){p.return=m,q=p;break}q=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}q=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,q=s;else b:for(;q!==null;){if(o=q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:xc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,q=v;break b}q=o.return}}var y=e.current;for(q=y;q!==null;){s=q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,q=b;else b:for(s=y;q!==null;){if(c=q,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Sc(9,c)}}catch(e){Wl(c,c.return,e)}if(c===s){q=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,q=x;break b}q=c.return}}if(Kc=a,oa(),vt&&typeof vt.onPostCommitFiberRoot==`function`)try{vt.onPostCommitFiberRoot(_t,e)}catch{}i=!0}return i}finally{It=n,Gc.transition=t}}return!1}function Ul(e,t,n){t=Ds(n,t),t=js(e,t,1),e=ro(e,t,1),t=vl(),e!==null&&(Nt(e,1,t),xl(e,t))}function Wl(e,t,n){if(e.tag===3)Ul(e,e,n);else for(;t!==null;){if(t.tag===3){Ul(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ul===null||!ul.has(r))){e=Ds(n,e),e=Ms(t,e,1),t=ro(t,e,1),e=vl(),t!==null&&(Nt(t,1,e),xl(t,e));break}}t=t.return}}function Gl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vl(),e.pingedLanes|=e.suspendedLanes&n,qc===e&&(Yc&n)===n&&(Qc===4||Qc===3&&(Yc&130023424)===Yc&&500>dt()-al?jl(e,0):nl|=n),xl(e,t)}function Kl(e,t){t===0&&(e.mode&1?(t=Tt,Tt<<=1,!(Tt&130023424)&&(Tt=4194304)):t=1);var n=vl();e=Qa(e,t),e!==null&&(Nt(e,t,n),xl(e,n))}function ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Kl(e,n)}function Jl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Kl(e,n)}var Yl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ki.current)Ls=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ls=!1,oc(e,t,n);Ls=!!(e.flags&131072)}else Ls=!1,Sa&&t.flags&1048576&&_a(t,ua,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ic(e,t),e=t.pendingProps;var a=Ji(t,Gi.current);qa(t,n),a=Po(null,t,i,e,a,n);var o=Fo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yi(i)?(o=!0,$i(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,eo(t),a.updater=Ss,t.stateNode=a,a._reactInternals=t,Es(t,i,e,n),t=Ks(null,t,i,!0,o,n)):(t.tag=0,Sa&&o&&va(t),Rs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ic(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=eu(i),e=bs(i,e),a){case 0:t=Ws(null,t,i,e,n);break a;case 1:t=Gs(null,t,i,e,n);break a;case 11:t=zs(null,t,i,e,n);break a;case 14:t=Bs(null,t,i,bs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Ws(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Gs(e,t,i,a,n);case 3:a:{if(qs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,to(e,t),oo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ds(Error(r(423)),t),t=Js(e,t,i,n,a);break a}else if(i!==a){a=Ds(Error(r(424)),t),t=Js(e,t,i,n,a);break a}else for(xa=Ei(t.stateNode.containerInfo.firstChild),ba=t,Sa=!0,Ca=null,n=za(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ja(),i===a){t=ac(e,t,n);break a}Rs(e,t,i,n)}t=t.child}return t;case 5:return go(t),e===null&&Da(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,yi(i,a)?s=null:o!==null&&yi(i,o)&&(t.flags|=32),Us(e,t),Rs(e,t,s,n),t.child;case 6:return e===null&&Da(t),null;case 13:return Zs(e,t,n);case 4:return mo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ra(t,null,i,n):Rs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),zs(e,t,i,a,n);case 7:return Rs(e,t,t.pendingProps,n),t.child;case 8:return Rs(e,t,t.pendingProps.children,n),t.child;case 12:return Rs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ui(Ba,i._currentValue),i._currentValue=s,o!==null)if(wr(o.value,s)){if(o.children===a.children&&!Ki.current){t=ac(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=no(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ka(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ka(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Rs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,qa(t,n),a=Ja(a),i=i(a),t.flags|=1,Rs(e,t,i,n),t.child;case 14:return i=t.type,a=bs(i,t.pendingProps),a=bs(i.type,a),Bs(e,t,i,a,n);case 15:return Vs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),ic(e,t),t.tag=1,Yi(i)?(e=!0,$i(t)):e=!1,qa(t,n),ws(t,i,a),Es(t,i,a,n),Ks(null,t,i,!0,e,n);case 19:return rc(e,t,n);case 22:return Hs(e,t,n)}throw Error(r(156,t.tag))};function Xl(e,t){return st(e,t)}function Zl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ql(e,t,n,r){return new Zl(e,t,n,r)}function $l(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eu(e){if(typeof e==`function`)return+!!$l(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function tu(e,t){var n=e.alternate;return n===null?(n=Ql(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function nu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)$l(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return ru(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Ql(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Ql(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Ql(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return iu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Ql(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ru(e,t,n,r){return e=Ql(7,e,r,t),e.lanes=n,e}function iu(e,t,n,r){return e=Ql(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function au(e,t,n){return e=Ql(6,e,null,t),e.lanes=n,e}function ou(e,t,n){return t=Ql(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function su(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mt(0),this.expirationTimes=Mt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function cu(e,t,n,r,i,a,o,s,c){return e=new su(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Ql(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},eo(a),e}function lu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function uu(e){if(!e)return Wi;e=e._reactInternals;a:{if(nt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Yi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Yi(n))return Qi(e,n,t)}return t}function du(e,t,n,r,i,a,o,s,c){return e=cu(n,r,!0,e,i,a,o,s,c),e.context=uu(null),n=e.current,r=vl(),i=yl(n),a=no(r,i),a.callback=t??null,ro(n,a,i),e.current.lanes=i,Nt(e,i,r),xl(e,r),e}function fu(e,t,n,r){var i=t.current,a=vl(),o=yl(i);return n=uu(n),t.context===null?t.context=n:t.pendingContext=n,t=no(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ro(i,t,o),e!==null&&(bl(e,i,o,a),io(e,i,o)),o}function pu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function mu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hu(e,t){mu(e,t),(e=e.alternate)&&mu(e,t)}function gu(){return null}var _u=typeof reportError==`function`?reportError:function(e){console.error(e)};function vu(e){this._internalRoot=e}yu.prototype.render=vu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));fu(e,t,null,null)},yu.prototype.unmount=vu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kl(function(){fu(null,e,null,null)}),t[ji]=null}};function yu(e){this._internalRoot=e}yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Xt.length&&t!==0&&t<Xt[n].priority;n++);Xt.splice(n,0,e),n===0&&tn(e)}};function bu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Su(){}function Cu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=pu(o);a.call(e)}}var o=du(t,r,e,0,null,!1,!1,``,Su);return e._reactRootContainer=o,e[ji]=o.current,ai(e.nodeType===8?e.parentNode:e),kl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=pu(c);s.call(e)}}var c=cu(e,0,!1,null,null,!1,!1,``,Su);return e._reactRootContainer=c,e[ji]=c.current,ai(e.nodeType===8?e.parentNode:e),kl(function(){fu(t,c,n,r)}),c}function wu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=pu(o);s.call(e)}}fu(t,o,e,i)}else o=Cu(n,t,e,i,r);return pu(o)}Rt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Et(t.pendingLanes);n!==0&&(Ft(t,n|1),xl(t,dt()),!(Kc&6)&&(ol=dt()+500,oa()))}break;case 13:kl(function(){var t=Qa(e,1);t!==null&&bl(t,e,1,vl())}),hu(e,1)}},zt=function(e){if(e.tag===13){var t=Qa(e,134217728);t!==null&&bl(t,e,134217728,vl()),hu(e,134217728)}},Bt=function(e){if(e.tag===13){var t=yl(e),n=Qa(e,t);n!==null&&bl(n,e,t,vl()),hu(e,t)}},Vt=function(){return It},Ht=function(e,t){var n=It;try{return It=e,t()}finally{It=n}},Fe=function(e,t,n){switch(t){case`input`:if(fe(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ri(i);if(!a)throw Error(r(90));se(i),fe(i,a)}}}break;case`textarea`:ye(e,n);break;case`select`:t=n.value,t!=null&&ge(e,!!n.multiple,t,!1)}},Ve=Ol,He=kl;var Tu={usingClientEntryPoint:!1,Events:[Ii,Li,Ri,ze,Be,Ol]},Eu={findFiberByHostInstance:Fi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Du={bundleType:Eu.bundleType,version:Eu.version,rendererPackageName:Eu.rendererPackageName,rendererConfig:Eu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ot(e),e===null?null:e.stateNode},findFiberByHostInstance:Eu.findFiberByHostInstance||gu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{_t=Ou.inject(Du),vt=Ou}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bu(t))throw Error(r(200));return lu(e,t,null,n)},e.createRoot=function(e,t){if(!bu(e))throw Error(r(299));var n=!1,i=``,a=_u;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=cu(e,1,!1,null,null,n,!1,i,a),e[ji]=t.current,ai(e.nodeType===8?e.parentNode:e),new vu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=ot(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return kl(e)},e.hydrate=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!bu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=_u;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=du(t,null,e,1,n??null,a,!1,o,s),e[ji]=t.current,ai(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new yu(t)},e.render=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!xu(e))throw Error(r(40));return e._reactRootContainer?(kl(function(){wu(null,null,e,!1,function(){e._reactRootContainer=null,e[ji]=null})}),!0):!1},e.unstable_batchedUpdates=Ol,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!xu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return wu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),_=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=s((e=>{var t=_();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),y=s((e=>{var t=p(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),b=s(((e,t)=>{t.exports=y()})),x=v(),S=b(),C=u(p());function w({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v4m0 4h.01M10.615 3.892L2.39 18.098c-.456.788-.684 1.182-.65 1.506a1 1 0 00.406.705c.263.191.718.191 1.629.191h16.45c.91 0 1.365 0 1.628-.191a1 1 0 00.407-.705c.034-.324-.195-.718-.65-1.506L13.383 3.892c-.454-.785-.681-1.178-.978-1.31a1 1 0 00-.813 0c-.296.132-.523.525-.978 1.31z`}))}var T=C.forwardRef(w);function E({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 5v14m0 0l7-7m-7 7l-7-7`}))}var D=C.forwardRef(E);function O({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 9l6 6 6-6`}))}var k=C.forwardRef(O);function A({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 18l6-6-6-6`}))}var j=C.forwardRef(A);function M({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16 4c.93 0 1.395 0 1.776.102a3 3 0 012.122 2.122C20 6.605 20 7.07 20 8v9.2c0 1.68 0 2.52-.327 3.162a3 3 0 01-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 01-1.311-1.311C4 19.72 4 18.88 4 17.2V8c0-.93 0-1.395.102-1.776a3 3 0 012.122-2.122C6.605 4 7.07 4 8 4m1.6 2h4.8c.56 0 .84 0 1.054-.109a1 1 0 00.437-.437C16 5.24 16 4.96 16 4.4v-.8c0-.56 0-.84-.109-1.054a1 1 0 00-.437-.437C15.24 2 14.96 2 14.4 2H9.6c-.56 0-.84 0-1.054.109a1 1 0 00-.437.437C8 2.76 8 3.04 8 3.6v.8c0 .56 0 .84.109 1.054a1 1 0 00.437.437C8.76 6 9.04 6 9.6 6z`}))}var N=C.forwardRef(M);function P({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 15c-.932 0-1.398 0-1.765-.152a2 2 0 01-1.083-1.083C2 13.398 2 12.932 2 12V5.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C3.52 2 4.08 2 5.2 2H12c.932 0 1.398 0 1.765.152a2 2 0 011.083 1.083C15 3.602 15 4.068 15 5m-2.8 17h6.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 20.48 22 19.92 22 18.8v-6.6c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 9 19.92 9 18.8 9h-6.6c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C9 10.52 9 11.08 9 12.2v6.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C10.52 22 11.08 22 12.2 22z`}))}var F=C.forwardRef(P);function I({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M20 4v1.4c0 3.36 0 5.04-.654 6.324a6 6 0 01-2.622 2.622C15.44 15 13.76 15 10.4 15H4m0 0l5-5m-5 5l5 5`}))}var L=C.forwardRef(I);function ee({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M17 9l-6 6m0-6l6 6M2.72 12.96l4.32 5.76c.352.47.528.704.751.873.198.15.421.262.66.33C8.72 20 9.013 20 9.6 20h7.6c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C22 17.72 22 16.88 22 15.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 00-1.311-1.311C19.72 4 18.88 4 17.2 4H9.6c-.587 0-.88 0-1.15.077a2 2 0 00-.659.33c-.223.169-.399.404-.751.873l-4.32 5.76c-.258.344-.387.516-.437.705a1 1 0 000 .51c.05.189.179.36.437.705z`}))}var R=C.forwardRef(ee);function z({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 13a1 1 0 100-2 1 1 0 000 2zM12 6a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z`}))}var B=C.forwardRef(z);function te({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M11 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 00-1.311 1.311C2 6.28 2 7.12 2 8.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 001.311 1.311C4.28 22 5.12 22 6.8 22h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C20 19.72 20 18.88 20 17.2V13M8 16h1.675c.489 0 .733 0 .963-.055.204-.05.4-.13.579-.24.201-.123.374-.296.72-.642L21.5 5.5a2.121 2.121 0 00-3-3l-9.563 9.563c-.346.346-.519.519-.642.72a2 2 0 00-.24.579c-.055.23-.055.474-.055.963V16z`}))}var V=C.forwardRef(te);function H({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 00.437.437c.214.11.494.11 1.054.11h4.13M16 13H8m8 4H8m2-8H8m6-7H8.8c-1.68 0-2.52 0-3.162.327a3 3 0 00-1.311 1.311C4 4.28 4 5.12 4 6.8v10.4c0 1.68 0 2.52.327 3.162a3 3 0 001.311 1.311C6.28 22 7.12 22 8.8 22h6.4c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C20 19.72 20 18.88 20 17.2V8l-6-6z`}))}var ne=C.forwardRef(H);function re({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3.386 5.667C2.63 4.822 2.25 4.399 2.237 4.04a1 1 0 01.363-.811C2.877 3 3.444 3 4.578 3h14.843c1.134 0 1.702 0 1.979.229a1 1 0 01.362.81c-.014.36-.392.783-1.148 1.628l-5.707 6.377c-.15.169-.226.253-.28.35a1 1 0 00-.103.27c-.024.108-.024.221-.024.447v5.347c0 .196 0 .294-.032.378a.5.5 0 01-.132.196c-.067.06-.158.096-.34.17l-3.4 1.36c-.367.146-.55.22-.698.189a.5.5 0 01-.315-.213c-.083-.126-.083-.324-.083-.72v-6.707c0-.226 0-.339-.024-.446a1 1 0 00-.104-.272c-.054-.096-.13-.18-.28-.349L3.386 5.667z`}))}var ie=C.forwardRef(re);function U({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 7l-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 00-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 011.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 01-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 01-1.311-1.311C2 18.72 2 17.88 2 16.2V7z`}))}var ae=C.forwardRef(U);function oe({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 18a3 3 0 106 0 3 3 0 00-6 0zm0 0a9 9 0 01-9-9m0 0a3 3 0 100-6 3 3 0 000 6zm0 0v12`}))}var se=C.forwardRef(oe);function ce({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18 15a3 3 0 100 6 3 3 0 000-6zm0 0V8a2 2 0 00-2-2h-3M6 9a3 3 0 100-6 3 3 0 000 6zm0 0v12`}))}var le=C.forwardRef(ce);function ue({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.9 11.444v2.778m0-2.778V4.778c0-.92.761-1.667 1.7-1.667s1.7.746 1.7 1.667m-3.4 6.666c0-.92-.761-1.666-1.7-1.666s-1.7.746-1.7 1.666v2.223C3.5 18.269 7.306 22 12 22s8.5-3.731 8.5-8.333V8.11c0-.92-.761-1.667-1.7-1.667s-1.7.747-1.7 1.667m-6.8-3.333v6.11m0-6.11V3.667C10.3 2.747 11.061 2 12 2s1.7.746 1.7 1.667v1.11m0 0v6.112m0-6.111c0-.92.761-1.667 1.7-1.667s1.7.746 1.7 1.667V8.11m0 0v2.778`}))}var de=C.forwardRef(ue);function fe({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 8h16M4 16h16M8 3v18m8-18v18`}))}var pe=C.forwardRef(fe);function me({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 10h.01M8 14h.01M10 10h.01M12 14h.01M14 10h.01M16 14h.01M18 10h.01M5.2 18h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 16.48 22 15.92 22 14.8V9.2c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 6 19.92 6 18.8 6H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 7.52 2 8.08 2 9.2v5.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C3.52 18 4.08 18 5.2 18z`}))}var he=C.forwardRef(me);function ge({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 12h18M3 6h18M3 18h18`}))}var _e=C.forwardRef(ge);function ve({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 12h14`}))}var ye=C.forwardRef(ve);function be({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M22 15.844a10.424 10.424 0 01-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 002 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156z`}))}var xe=C.forwardRef(be);function Se({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 9l-3 3m0 0l3 3m-3-3h20M9 5l3-3m0 0l3 3m-3-3v20m3-3l-3 3m0 0l-3-3M19 9l3 3m0 0l-3 3`}))}var Ce=C.forwardRef(Se);function we({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18 2l4 4M2 22l1.276-4.68c.084-.305.125-.458.19-.6.056-.127.126-.247.207-.36.092-.125.204-.237.428-.46L14.434 5.565c.198-.198.297-.297.412-.334a.5.5 0 01.309 0c.114.037.213.136.41.334l2.87 2.868c.197.198.296.297.333.411.033.1.033.21 0 .31-.037.114-.136.213-.334.41L8.101 19.9c-.224.224-.336.336-.462.428a2.003 2.003 0 01-.358.208c-.143.064-.296.105-.6.189L2 22z`}))}var Te=C.forwardRef(we);function Ee({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 4.99c0-.972 0-1.457.202-1.725a1 1 0 01.738-.395c.335-.02.74.25 1.548.788l10.515 7.01c.668.446 1.002.668 1.118.949a1 1 0 010 .766c-.116.28-.45.503-1.118.948l-10.515 7.01c-.809.54-1.213.809-1.548.789a1 1 0 01-.738-.395C5 20.467 5 19.98 5 19.01V4.99z`}))}var De=C.forwardRef(Ee);function Oe({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 5v14m-7-7h14`}))}var ke=C.forwardRef(Oe);function Ae({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 15a3 3 0 100-6 3 3 0 000 6z`}),C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.29 19.371l.584 1.315a2.213 2.213 0 004.044 0l.585-1.315a2.426 2.426 0 012.47-1.423l1.43.152a2.212 2.212 0 002.022-3.502l-.847-1.164a2.428 2.428 0 01-.46-1.434c0-.513.163-1.014.465-1.429l.847-1.163a2.212 2.212 0 00-2.023-3.502l-1.43.152a2.433 2.433 0 01-1.47-.312 2.425 2.425 0 01-1-1.117l-.588-1.315a2.212 2.212 0 00-4.045 0L9.29 4.63c-.207.468-.558.86-1 1.117-.445.256-.96.365-1.47.312l-1.435-.152a2.212 2.212 0 00-2.022 3.502l.847 1.163a2.43 2.43 0 010 2.858l-.847 1.163a2.21 2.21 0 00.786 3.273c.381.195.81.274 1.236.23l1.43-.153a2.434 2.434 0 012.475 1.43z`}))}var je=C.forwardRef(Ae);function Me({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 17l6-6-6-6m8 14h8`}))}var Ne=C.forwardRef(Me);function Pe({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18 6L6 18M6 6l12 12`}))}var Fe=C.forwardRef(Pe);function Ie(e){return(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,...e,children:[(0,S.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,S.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]})}var Le=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Re=(e=>e?Le(e):Le),ze=e=>e;function Be(e,t=ze){let n=C.useSyncExternalStore(e.subscribe,C.useCallback(()=>t(e.getState()),[e,t]),C.useCallback(()=>t(e.getInitialState()),[e,t]));return C.useDebugValue(n),n}var Ve=e=>{let t=Re(e),n=e=>Be(t,e);return Object.assign(n,t),n},He=(e=>e?Ve(e):Ve);function Ue(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var We=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return We(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return We(t)(e)}}}},Ge=(e,t)=>(n,r,i)=>{let a={storage:Ue(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=new Set,c=new Set,l=a.storage;if(!l)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let u=()=>{let e=a.partialize({...r()});return l.setItem(a.name,{state:e,version:a.version})},d=i.setState;i.setState=(e,t)=>(d(e,t),u());let f=e((...e)=>(n(...e),u()),r,i);i.getInitialState=()=>f;let p,m=()=>{if(!l)return;o=!1,s.forEach(e=>e(r()??f));let e=a.onRehydrateStorage?.call(a,r()??f)||void 0;return We(l.getItem.bind(l))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(e=>{let[t,i]=e;if(p=a.merge(i,r()??f),n(p,!0),t)return u()}).then(()=>{e?.(p,void 0),p=r(),o=!0,c.forEach(e=>e(p))}).catch(t=>{e?.(void 0,t)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(l=e.storage)},clearStorage:()=>{l?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:e=>(s.add(e),()=>{s.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},a.skipHydration||m(),p||f};function Ke(){let e=new Map;return{getItem:t=>e.get(t)??null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}var qe=Ke(),Je={getItem:e=>{if(typeof localStorage>`u`)return qe.getItem(e);try{return localStorage.getItem(e)}catch{return qe.getItem(e)}},setItem:(e,t)=>{if(typeof localStorage>`u`){qe.setItem(e,t);return}try{localStorage.setItem(e,t)}catch{qe.setItem(e,t)}},removeItem:e=>{if(typeof localStorage>`u`){qe.removeItem(e);return}try{localStorage.removeItem(e)}catch{qe.removeItem(e)}}};function Ye(e){let t=new Map,n=!1,r=t=>{let n={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1},r=globalThis.Bun?.main??``,i=/\.test\.[cm]?[jt]sx?$/.test(r);if((typeof n?.DEV==`boolean`?n.DEV:i)&&t!==e)throw Error(`createTabStorage("${e}") received unexpected key "${t}". Create a dedicated tab storage instance per persist key.`)};return{getItem(e){if(r(e),n)return t.get(e)??null;n=!0;let i=Je.getItem(e);return i!==null&&t.set(e,i),i},setItem(e,n){r(e),t.set(e,n),Je.setItem(e,n)},removeItem(e){r(e),t.delete(e),Je.removeItem(e)}}}var Xe=`~/Documents/GitHub`,Ze=`claude`,Qe=!(typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!/iPhone|iPad|iPod/.test(navigator.userAgent)&&(typeof devicePixelRatio<`u`?devicePixelRatio:1)>1),$e=[{id:`jetbrains-mono`,label:`JetBrains Mono`,family:`"JetBrains Mono Variable", "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace`},{id:`system`,label:`System Default`,family:`ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", "Consolas", monospace`},{id:`custom`,label:`Custom`,family:``}];function et(e,t){return e===`custom`&&t.trim()?t.trim():$e.find(t=>t.id===e)?.family||$e[0].family}var tt=[{id:`claude`,label:`Claude`,command:`claude`,isBuiltIn:!0,agentType:`claude`},{id:`codex`,label:`Codex`,command:`codex`,isBuiltIn:!0,agentType:`codex`},{id:`pi`,label:`Pi`,command:`pi`,isBuiltIn:!0,agentType:`pi`},{id:`grok`,label:`Grok`,command:`grok`,isBuiltIn:!0,agentType:`grok`},{id:`devin`,label:`Devin`,command:`devin`,isBuiltIn:!0,agentType:`devin`},{id:`omp`,label:`OMP`,command:`omp`,isBuiltIn:!0,agentType:`omp`}];function nt(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||t.agentType===`claude`||t.agentType===`codex`||t.agentType===`pi`||t.agentType===`devin`||t.agentType===`grok`||t.agentType===`omp`||t.agentType===`claude-rp`)}function rt(e){return{...e,label:e.label.trim().slice(0,64),command:e.command.trim().slice(0,1024)}}function it(e){return e.command.trim()}function at(e){for(let t=0;t<100;t++){let t=`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;if(!e.has(t))return t}return`custom-${Date.now()}-${Math.random().toString(36).slice(2)}`}function ot(e,t){return e.some(e=>e.id===t)?t:e[0]?.id||`claude`}var W=He()(Ge((e,t)=>({defaultProjectDir:Xe,setDefaultProjectDir:t=>e({defaultProjectDir:t}),defaultCommand:Ze,setDefaultCommand:t=>e({defaultCommand:t}),lastProjectPath:null,setLastProjectPath:t=>e({lastProjectPath:t}),recentPaths:[],addRecentPath:t=>e(e=>({recentPaths:[t,...e.recentPaths.filter(e=>e!==t)].slice(0,5)})),sessionSortMode:`created`,setSessionSortMode:t=>e({sessionSortMode:t}),sessionSortDirection:`desc`,setSessionSortDirection:t=>e({sessionSortDirection:t}),manualSessionOrder:[],setManualSessionOrder:t=>e({manualSessionOrder:t}),sidebarAnchor:`top`,setSidebarAnchor:t=>e({sidebarAnchor:t}),useWebGL:Qe,setUseWebGL:t=>e({useWebGL:t}),fontSize:13,setFontSize:t=>e({fontSize:Math.max(6,Math.min(24,t))}),lineHeight:1,setLineHeight:t=>e({lineHeight:Math.max(1,Math.min(2,t))}),letterSpacing:0,setLetterSpacing:t=>e({letterSpacing:Math.max(-3,Math.min(3,t))}),fontOption:`jetbrains-mono`,setFontOption:t=>e({fontOption:t}),customFontFamily:``,setCustomFontFamily:t=>e({customFontFamily:t.slice(0,256)}),shortcutModifier:`auto`,setShortcutModifier:t=>e({shortcutModifier:t}),showProjectName:!0,setShowProjectName:t=>e({showProjectName:t}),showLastUserMessage:!0,setShowLastUserMessage:t=>e({showLastUserMessage:t}),showSessionIdPrefix:!1,setShowSessionIdPrefix:t=>e({showSessionIdPrefix:t}),historySessionsExpanded:!1,setHistorySessionsExpanded:t=>e({historySessionsExpanded:t}),hibernatingSessionsExpanded:!0,setHibernatingSessionsExpanded:t=>e({hibernatingSessionsExpanded:t}),sidebarWidth:240,setSidebarWidth:t=>e({sidebarWidth:Math.max(180,Math.min(400,t))}),projectFilters:[],setProjectFilters:t=>e({projectFilters:t}),hostFilters:[],setHostFilters:t=>e({hostFilters:t}),soundOnPermission:!1,setSoundOnPermission:t=>e({soundOnPermission:t}),soundOnIdle:!1,setSoundOnIdle:t=>e({soundOnIdle:t}),yoloMode:!1,setYoloMode:t=>e({yoloMode:t}),commandPresets:tt,setCommandPresets:t=>e({commandPresets:t}),defaultPresetId:`claude`,setDefaultPresetId:t=>e({defaultPresetId:t}),updatePresetCommand:(n,r)=>{let{commandPresets:i}=t();e({commandPresets:i.map(e=>e.id===n?{...e,command:r.trim().slice(0,1024)}:e)})},addPreset:n=>{let{commandPresets:r}=t();if(r.length>=50){console.warn(`[agentboard:settings] Max presets reached`);return}let i=new Set(r.map(e=>e.id)),a={...rt({...n,id:``,isBuiltIn:!1}),id:at(i),isBuiltIn:!1};e({commandPresets:[...r,a]})},removePreset:n=>{let{commandPresets:r,defaultPresetId:i}=t(),a=r.find(e=>e.id===n);if(!a||a.isBuiltIn)return;let o=r.filter(e=>e.id!==n);e({commandPresets:o,defaultPresetId:n===i?ot(o,i):i})}}),{name:`agentboard-settings`,storage:Ue(()=>Je),version:8,migrate:(e,t)=>{let n=e;typeof n.historySessionsExpanded!=`boolean`&&typeof n.inactiveSessionsExpanded==`boolean`&&(n.historySessionsExpanded=n.inactiveSessionsExpanded),typeof n.hibernatingSessionsExpanded!=`boolean`&&typeof n.snoozedSessionsExpanded==`boolean`&&(n.hibernatingSessionsExpanded=n.snoozedSessionsExpanded);let r=e=>{if(typeof e.command==`string`)return e;let t=typeof e.baseCommand==`string`?e.baseCommand.trim():``,n=typeof e.modifiers==`string`?e.modifiers.trim():``,r=n?`${t} ${n}`:t;return{id:e.id,label:e.label,command:r||`claude`,isBuiltIn:e.isBuiltIn,agentType:e.agentType}};if(t===0||!Array.isArray(n.commandPresets)){let e=typeof n.defaultCommand==`string`?n.defaultCommand:`claude`,t=[...tt],r=`claude`;if(e===`codex`)r=`codex`;else if(e!==`claude`){let n={id:at(new Set(t.map(e=>e.id))),label:`Migrated`,command:e,isBuiltIn:!1};t.push(n),r=n.id}return console.info(`[agentboard:settings] Migrated from v0 to v2`),{...n,commandPresets:t,defaultPresetId:r,defaultCommand:e,recentPaths:[]}}let i=n.commandPresets.map(r).filter(nt);if(!(i.some(e=>e.id===`claude`)&&i.some(e=>e.id===`codex`))||i.length===0)return console.warn(`[agentboard:settings] Invalid presets, resetting to defaults`),{...n,commandPresets:tt,defaultPresetId:`claude`};let a=new Set(i.map(e=>e.id)),o=tt.filter(e=>e.isBuiltIn&&!a.has(e.id)),s=[...i,...o];return t<8&&console.info(`[agentboard:settings] Migrated from v${t} to v8`),{...n,commandPresets:s.map(rt),defaultPresetId:ot(s,n.defaultPresetId)}}}));function st(){let[e,t]=(0,C.useState)(W.persist.hasHydrated());return(0,C.useEffect)(()=>{let e=W.persist.onFinishHydration(()=>t(!0));return W.persist.hasHydrated()&&t(!0),e},[]),e}function ct(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent,t=/iPad|iPhone|iPod/.test(e),n=navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;return t||n}function lt(){return typeof navigator>`u`?!1:ct()&&navigator.standalone===!0}function ut(){return typeof navigator>`u`?!1:navigator.platform.toUpperCase().indexOf(`MAC`)>=0}function dt(e){return e===`auto`?ut()?`ctrl-option`:`ctrl-shift`:e}var ft={"ctrl-option":`⌃⌥`,"ctrl-shift":`⌃⇧`,"cmd-option":`⌘⌥`,"cmd-shift":`⌘⇧`};function pt(e){return ft[e]}function mt(e,t){switch(t){case`ctrl-option`:return e.ctrlKey&&e.altKey&&!e.metaKey&&!e.shiftKey;case`ctrl-shift`:return e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey;case`cmd-option`:return e.metaKey&&e.altKey&&!e.ctrlKey&&!e.shiftKey;case`cmd-shift`:return e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey}}var G={pill:12,default:14,primary:16,key:18},ht=`relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md border transition-all active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-40`,gt={neutral:`border-border text-secondary hover:bg-hover hover:text-primary`,active:`border-accent/40 bg-accent/20 text-accent hover:bg-accent/30`,danger:`border-danger/30 bg-danger/10 text-danger hover:bg-danger/20`,primary:`border-transparent bg-accent text-white hover:bg-accent/90`};function _t(e=`neutral`){return`${ht} ${gt[e]}`}var vt=_t(`neutral`);function yt(e=`neutral`,t=`flex`){return`${t} size-[44px] shrink-0 items-center justify-center rounded-md border transition-all active:scale-95 disabled:cursor-not-allowed disabled:opacity-40 ${e===`neutral`?`bg-surface `:``}${gt[e]}`}var bt=`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted hover:text-primary`,xt=`max-md:flex max-md:min-h-[44px] max-md:flex-col max-md:justify-center`,St=`[@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,Ct={connected:`bg-working`,connecting:`bg-approval`,reconnecting:`bg-approval`,disconnected:`bg-danger`},wt={connected:`Connected`,connecting:`Connecting`,reconnecting:`Reconnecting`,disconnected:`Disconnected`};function Tt({connectionStatus:e,tailscaleIp:t,placement:n=`down`}){let[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=(0,C.useId)(),c=(0,C.useRef)(null),l=(0,C.useRef)(null),u=`Connection: ${wt[e]}`,d=(0,S.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${Ct[e]}`});return(0,C.useEffect)(()=>{if(!r||typeof document>`u`||!document.addEventListener||!document.removeEventListener)return;let e=e=>{let t=e.target;t&&c.current?.contains(t)||i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e,{passive:!0}),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,C.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]),t?(0,S.jsxs)(`div`,{ref:c,className:`flex shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,"aria-label":`${u}. Tailscale remote access`,"aria-haspopup":`dialog`,"aria-expanded":r,"aria-controls":r?s:void 0,title:`${wt[e]} - Tailscale ${t}`,onClick:()=>i(e=>!e),className:vt,children:d}),r&&(0,S.jsxs)(`div`,{id:s,role:`dialog`,"aria-label":`Remote access`,className:`absolute left-2 right-2 z-20 ${n===`up`?`bottom-full mb-1`:`top-full mt-1`} rounded border border-border bg-surface p-2 text-xs shadow-lg`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 pb-1.5 text-muted`,children:[d,(0,S.jsx)(`span`,{children:wt[e]}),(0,S.jsx)(`span`,{className:`ml-auto`,children:`Tailscale`})]}),(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{let e=`http://${t}:${window.location.port||`4040`}`;navigator.clipboard.writeText(e),o(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>o(!1),1500)},className:`flex w-full items-center justify-between gap-2 rounded px-1 py-1 text-left text-secondary hover:bg-hover hover:text-primary`,title:`Tailscale IP - click to copy remote access URL`,children:[(0,S.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:a?`Copied!`:t}),!a&&(0,S.jsx)(F,{width:G.default,height:G.default,className:`shrink-0`})]})]})]}):(0,S.jsx)(`span`,{role:`img`,"aria-label":u,title:u,className:`flex h-7 w-5 shrink-0 items-center justify-center`,children:d})}function Et({connectionStatus:e,onNewSession:t,onOpenSettings:n,tailscaleIp:r,placement:i=`down`}){let a=pt(dt(W(e=>e.shortcutModifier)));return(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,S.jsx)(Tt,{connectionStatus:e,tailscaleIp:r,placement:i}),(0,S.jsx)(`button`,{type:`button`,onClick:t,className:_t(`primary`),title:`New session (${a}N)`,"aria-label":`New session`,children:(0,S.jsx)(ke,{width:G.primary,height:G.primary})}),(0,S.jsx)(`button`,{type:`button`,onClick:n,className:vt,title:`Settings`,"aria-label":`Settings`,children:(0,S.jsx)(je,{width:G.default,height:G.default})})]})}var Dt=(0,C.createContext)({});function Ot(e){let t=(0,C.useRef)(null);return t.current===null&&(t.current=e()),t.current}var kt=typeof window<`u`,At=kt?C.useLayoutEffect:C.useEffect,jt=(0,C.createContext)(null);function Mt(e,t){e.indexOf(t)===-1&&e.push(t)}function Nt(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Pt=(e,t,n)=>n>t?t:n<e?e:n,Ft={},It=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Lt(e){return typeof e==`object`&&!!e}var Rt=e=>/^0[^.\s]+$/u.test(e);function zt(e){let t;return()=>(t===void 0&&(t=e()),t)}var Bt=e=>e,Vt=(e,t)=>n=>t(e(n)),Ht=(...e)=>e.reduce(Vt),Ut=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Wt=class{constructor(){this.subscriptions=[]}add(e){return Mt(this.subscriptions,e),()=>Nt(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Gt=e=>e*1e3,Kt=e=>e/1e3;function qt(e,t){return t?1e3/t*e:0}var Jt=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Yt=1e-7,Xt=12;function Zt(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Jt(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Yt&&++s<Xt);return o}function Qt(e,t,n,r){if(e===t&&n===r)return Bt;let i=t=>Zt(t,0,1,e,n);return e=>e===0||e===1?e:Jt(i(e),t,r)}var $t=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,en=e=>t=>1-e(1-t),tn=Qt(.33,1.53,.69,.99),nn=en(tn),rn=$t(nn),an=e=>(e*=2)<1?.5*nn(e):.5*(2-2**(-10*(e-1))),on=e=>1-Math.sin(Math.acos(e)),sn=en(on),cn=$t(on),ln=Qt(.42,0,1,1),un=Qt(0,0,.58,1),dn=Qt(.42,0,.58,1),fn=e=>Array.isArray(e)&&typeof e[0]!=`number`,pn=e=>Array.isArray(e)&&typeof e[0]==`number`,mn={linear:Bt,easeIn:ln,easeInOut:dn,easeOut:un,circIn:on,circInOut:cn,circOut:sn,backIn:nn,backInOut:rn,backOut:tn,anticipate:an},hn=e=>typeof e==`string`,gn=e=>{if(pn(e)){e.length;let[t,n,r,i]=e;return Qt(t,n,r,i)}else if(hn(e))return mn[e],`${e}`,mn[e];return e},_n=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],vn={value:null,addProjectionMetrics:null};function yn(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&&vn.value&&vn.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var bn=40;function xn(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=_n.reduce((e,n)=>(e[n]=yn(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Ft.useManualTiming?i.timestamp:performance.now();n=!1,Ft.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,bn),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:_n.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<_n.length;t++)o[_n[t]].cancel(e)},state:i,steps:o}}var{schedule:Sn,cancel:Cn,state:wn,steps:Tn}=xn(typeof requestAnimationFrame<`u`?requestAnimationFrame:Bt,!0),En;function Dn(){En=void 0}var On={now:()=>(En===void 0&&On.set(wn.isProcessing||Ft.useManualTiming?wn.timestamp:performance.now()),En),set:e=>{En=e,queueMicrotask(Dn)}},kn={layout:0,mainThread:0,waapi:0},An=e=>t=>typeof t==`string`&&t.startsWith(e),jn=An(`--`),Mn=An(`var(--`),Nn=e=>Mn(e)?Pn.test(e.split(`/*`)[0].trim()):!1,Pn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Fn(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var In={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Ln={...In,transform:e=>Pt(0,1,e)},Rn={...In,default:1},zn=e=>Math.round(e*1e5)/1e5,Bn=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Vn(e){return e==null}var Hn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Un=(e,t)=>n=>!!(typeof n==`string`&&Hn.test(n)&&n.startsWith(e)||t&&!Vn(n)&&Object.prototype.hasOwnProperty.call(n,t)),Wn=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Bn);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Gn=e=>Pt(0,255,e),Kn={...In,transform:e=>Math.round(Gn(e))},qn={test:Un(`rgb`,`red`),parse:Wn(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Kn.transform(e)+`, `+Kn.transform(t)+`, `+Kn.transform(n)+`, `+zn(Ln.transform(r))+`)`};function Jn(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Yn={test:Un(`#`),parse:Jn,transform:qn.transform},Xn=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Zn=Xn(`deg`),Qn=Xn(`%`),K=Xn(`px`),$n=Xn(`vh`),er=Xn(`vw`),tr={...Qn,parse:e=>Qn.parse(e)/100,transform:e=>Qn.transform(e*100)},nr={test:Un(`hsl`,`hue`),parse:Wn(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Qn.transform(zn(t))+`, `+Qn.transform(zn(n))+`, `+zn(Ln.transform(r))+`)`},rr={test:e=>qn.test(e)||Yn.test(e)||nr.test(e),parse:e=>qn.test(e)?qn.parse(e):nr.test(e)?nr.parse(e):Yn.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?qn.transform(e):nr.transform(e),getAnimatableNone:e=>{let t=rr.parse(e);return t.alpha=0,rr.transform(t)}},ir=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ar(e){return isNaN(e)&&typeof e==`string`&&(e.match(Bn)?.length||0)+(e.match(ir)?.length||0)>0}var or=`number`,sr=`color`,cr=`var`,lr=`var(`,ur="${}",dr=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function fr(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(dr,e=>(rr.test(e)?(r.color.push(a),i.push(sr),n.push(rr.parse(e))):e.startsWith(lr)?(r.var.push(a),i.push(cr),n.push(e)):(r.number.push(a),i.push(or),n.push(parseFloat(e))),++a,ur)).split(ur),indexes:r,types:i}}function pr(e){return fr(e).values}function mr(e){let{split:t,types:n}=fr(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===or?i+=zn(e[a]):t===sr?i+=rr.transform(e[a]):i+=e[a]}return i}}var hr=e=>typeof e==`number`?0:rr.test(e)?rr.getAnimatableNone(e):e;function gr(e){let t=pr(e);return mr(e)(t.map(hr))}var _r={test:ar,parse:pr,createTransformer:mr,getAnimatableNone:gr};function vr(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yr({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=vr(s,r,e+1/3),a=vr(s,r,e),o=vr(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function br(e,t){return n=>n>0?t:e}var xr=(e,t,n)=>e+(t-e)*n,Sr=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Cr=[Yn,qn,nr],wr=e=>Cr.find(t=>t.test(e));function Tr(e){let t=wr(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===nr&&(n=yr(n)),n}var Er=(e,t)=>{let n=Tr(e),r=Tr(t);if(!n||!r)return br(e,t);let i={...n};return e=>(i.red=Sr(n.red,r.red,e),i.green=Sr(n.green,r.green,e),i.blue=Sr(n.blue,r.blue,e),i.alpha=xr(n.alpha,r.alpha,e),qn.transform(i))},Dr=new Set([`none`,`hidden`]);function Or(e,t){return Dr.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function kr(e,t){return n=>xr(e,t,n)}function Ar(e){return typeof e==`number`?kr:typeof e==`string`?Nn(e)?br:rr.test(e)?Er:Pr:Array.isArray(e)?jr:typeof e==`object`?rr.test(e)?Er:Mr:br}function jr(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Ar(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Mr(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Ar(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Nr(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Pr=(e,t)=>{let n=_r.createTransformer(t),r=fr(e),i=fr(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Dr.has(e)&&!i.values.length||Dr.has(t)&&!r.values.length?Or(e,t):Ht(jr(Nr(r,i),i.values),n):(`${e}${t}`,br(e,t))};function Fr(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?xr(e,t,n):Ar(e)(e,t)}var Ir=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Sn.update(t,e),stop:()=>Cn(t),now:()=>wn.isProcessing?wn.timestamp:On.now()}},Lr=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Rr=2e4;function zr(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function Br(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(zr(r),Rr);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Kt(i)}}var Vr=5;function Hr(e,t,n){let r=Math.max(t-Vr,0);return qt(n-e(r),t-r)}var Ur={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Wr=.001;function Gr({duration:e=Ur.duration,bounce:t=Ur.bounce,velocity:n=Ur.velocity,mass:r=Ur.mass}){let i,a;Ur.maxDuration;let o=1-t;o=Pt(Ur.minDamping,Ur.maxDamping,o),e=Pt(Ur.minDuration,Ur.maxDuration,Kt(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Jr(t,o),c=Math.exp(-i);return Wr-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Jr(t**2,o);return(-i(t)+Wr>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Wr+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=qr(i,a,s);if(e=Gt(e),isNaN(c))return{stiffness:Ur.stiffness,damping:Ur.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Kr=12;function qr(e,t,n){let r=n;for(let n=1;n<Kr;n++)r-=e(r)/t(r);return r}function Jr(e,t){return e*Math.sqrt(1-t*t)}var Yr=[`duration`,`bounce`],Xr=[`stiffness`,`damping`,`mass`];function Zr(e,t){return t.some(t=>e[t]!==void 0)}function Qr(e){let t={velocity:Ur.velocity,stiffness:Ur.stiffness,damping:Ur.damping,mass:Ur.mass,isResolvedFromDuration:!1,...e};if(!Zr(e,Xr)&&Zr(e,Yr))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Pt(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Ur.mass,stiffness:i,damping:a}}else{let n=Gr(e);t={...t,...n,mass:Ur.mass},t.isResolvedFromDuration=!0}return t}function $r(e=Ur.visualDuration,t=Ur.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Qr({...n,velocity:-Kt(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Kt(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Ur.restSpeed.granular:Ur.restSpeed.default,i||=v?Ur.restDelta.granular:Ur.restDelta.default;let y;if(h<1){let e=Jr(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?Gt(m):Hr(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(zr(b),Rr),t=Lr(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}$r.applyToOptions=e=>{let t=Br(e,100,$r);return e.ease=t.ease,e.duration=Gt(t.duration),e.type=`keyframes`,e};function ei({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=$r({keyframes:[f.value,m(f.value)],velocity:Hr(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function ti(e,t,n){let r=[],i=n||Ft.mix||Fr,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Ht(Array.isArray(t)?t[n]||Bt:t,a)),r.push(a)}return r}function ni(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=ti(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Ut(e[r],e[r+1],n);return s[r](i)};return n?t=>l(Pt(e[0],e[a-1],t)):l}function ri(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Ut(0,t,r);e.push(xr(n,1,i))}}function ii(e){let t=[0];return ri(t,e.length-1),t}function ai(e,t){return e.map(e=>e*t)}function oi(e,t){return e.map(()=>t||dn).splice(0,e.length-1)}function si({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=fn(r)?r.map(gn):gn(r),a={done:!1,value:t[0]},o=ni(ai(n&&n.length===t.length?n:ii(t),e),t,{ease:Array.isArray(i)?i:oi(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var ci=e=>e!==null;function li(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(ci),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ui={decay:ei,inertia:ei,tween:si,keyframes:si,spring:$r};function di(e){typeof e.type==`string`&&(e.type=ui[e.type])}var fi=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},pi=e=>e/100,mi=class extends fi{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==On.now()&&this.tick(On.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},kn.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;di(e);let{type:t=si,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||si;s!==si&&typeof o[0]!=`number`&&(this.mixKeyframes=Ht(pi,Fr(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=zr(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Pt(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==ei&&(b.value=li(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Kt(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Kt(e)}get time(){return Kt(this.currentTime)}set time(e){e=Gt(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(On.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Kt(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Ir,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(On.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,kn.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function hi(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var gi=e=>e*180/Math.PI,_i=e=>yi(gi(Math.atan2(e[1],e[0]))),vi={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:_i,rotateZ:_i,skewX:e=>gi(Math.atan(e[1])),skewY:e=>gi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},yi=e=>(e%=360,e<0&&(e+=360),e),bi=_i,xi=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Si=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Ci={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:xi,scaleY:Si,scale:e=>(xi(e)+Si(e))/2,rotateX:e=>yi(gi(Math.atan2(e[6],e[5]))),rotateY:e=>yi(gi(Math.atan2(-e[2],e[0]))),rotateZ:bi,rotate:bi,skewX:e=>gi(Math.atan(e[4])),skewY:e=>gi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function wi(e){return+!!e.includes(`scale`)}function Ti(e,t){if(!e||e===`none`)return wi(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Ci,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=vi,i=t}if(!i)return wi(t);let a=r[t],o=i[1].split(`,`).map(Di);return typeof a==`function`?a(o):o[a]}var Ei=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Ti(n,t)};function Di(e){return parseFloat(e.trim())}var Oi=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],ki=new Set(Oi),Ai=e=>e===In||e===K,ji=new Set([`x`,`y`,`z`]),Mi=Oi.filter(e=>!ji.has(e));function Ni(e){let t=[];return Mi.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var Pi={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Ti(t,`x`),y:(e,{transform:t})=>Ti(t,`y`)};Pi.translateX=Pi.x,Pi.translateY=Pi.y;var Fi=new Set,Ii=!1,Li=!1,Ri=!1;function zi(){if(Li){let e=Array.from(Fi).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Ni(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Li=!1,Ii=!1,Fi.forEach(e=>e.complete(Ri)),Fi.clear()}function Bi(){Fi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Li=!0)})}function Vi(){Ri=!0,Bi(),zi(),Ri=!1}var Hi=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Fi.add(this),Ii||(Ii=!0,Sn.read(Bi),Sn.resolveKeyframes(zi))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}hi(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Fi.delete(this)}cancel(){this.state===`scheduled`&&(Fi.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ui=e=>e.startsWith(`--`);function Wi(e,t,n){Ui(t)?e.style.setProperty(t,n):e.style[t]=n}var Gi=zt(()=>window.ScrollTimeline!==void 0),Ki={};function qi(e,t){let n=zt(e);return()=>Ki[t]??n()}var Ji=qi(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Yi=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Xi={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Yi([0,.65,.55,1]),circOut:Yi([.55,0,1,.45]),backIn:Yi([.31,.01,.66,-.59]),backOut:Yi([.33,1.53,.69,.99])};function Zi(e,t){if(e)return typeof e==`function`?Ji()?Lr(e,t):`ease-out`:pn(e)?Yi(e):Array.isArray(e)?e.map(e=>Zi(e,t)||Xi.easeOut):Xi[e]}function Qi(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Zi(s,i);Array.isArray(d)&&(u.easing=d),vn.value&&kn.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return vn.value&&p.finished.finally(()=>{kn.waapi--}),p}function $i(e){return typeof e==`function`&&`applyToOptions`in e}function ea({type:e,...t}){return $i(e)&&Ji()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var ta=class extends fi{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=ea(e);this.animation=Qi(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=li(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):Wi(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Kt(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Kt(e)}get time(){return Kt(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Gt(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Gi()?(this.animation.timeline=e,Bt):t(this)}},na={anticipate:an,backInOut:rn,circInOut:cn};function ra(e){return e in na}function ia(e){typeof e.ease==`string`&&ra(e.ease)&&(e.ease=na[e.ease])}var aa=10,oa=class extends ta{constructor(e){ia(e),di(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new mi({...a,autoplay:!1}),s=Math.max(aa,On.now()-this.startTime),c=Pt(0,aa,s-aa);t.setWithVelocity(o.sample(Math.max(0,s-c)).value,o.sample(s).value,c),o.stop()}},sa=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(_r.test(e)||e===`0`)&&!e.startsWith(`url(`));function ca(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function la(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=sa(i,t),s=sa(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:ca(e)||(n===`spring`||$i(n))&&r}function ua(e){e.duration=0,e.type=`keyframes`}var da=new Set([`opacity`,`clipPath`,`filter`,`transform`]),fa=zt(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function pa(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return fa()&&n&&da.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var ma=40,ha=class extends fi{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=On.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Hi)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=On.now(),la(e,i,a,o)||((Ft.instantAnimations||!s)&&l?.(li(e,n,t)),e[0]=e[e.length-1],ua(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>ma?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&pa(u)?new oa({...u,element:u.motionValue.owner.current}):new mi(u);d.finished.then(()=>this.notifyFinished()).catch(Bt),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Vi()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},ga=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _a(e){let t=ga.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function va(e,t,n=1){`${e}`;let[r,i]=_a(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return It(e)?parseFloat(e):e}return Nn(i)?va(i,t,n+1):i}function ya(e,t){return e?.[t]??e?.default??e}var ba=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Oi]),xa={test:e=>e===`auto`,parse:e=>e},Sa=e=>t=>t.test(e),Ca=[In,K,Qn,Zn,er,$n,xa],wa=e=>Ca.find(Sa(e));function Ta(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Rt(e)}var Ea=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Da(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Bn)||[];if(!r)return e;let i=n.replace(r,``),a=+!!Ea.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Oa=/\b([a-z-]*)\(.*?\)/gu,ka={..._r,getAnimatableNone:e=>{let t=e.match(Oa);return t?t.map(Da).join(` `):e}},Aa={...In,transform:Math.round},ja={borderWidth:K,borderTopWidth:K,borderRightWidth:K,borderBottomWidth:K,borderLeftWidth:K,borderRadius:K,radius:K,borderTopLeftRadius:K,borderTopRightRadius:K,borderBottomRightRadius:K,borderBottomLeftRadius:K,width:K,maxWidth:K,height:K,maxHeight:K,top:K,right:K,bottom:K,left:K,inset:K,insetBlock:K,insetBlockStart:K,insetBlockEnd:K,insetInline:K,insetInlineStart:K,insetInlineEnd:K,padding:K,paddingTop:K,paddingRight:K,paddingBottom:K,paddingLeft:K,paddingBlock:K,paddingBlockStart:K,paddingBlockEnd:K,paddingInline:K,paddingInlineStart:K,paddingInlineEnd:K,margin:K,marginTop:K,marginRight:K,marginBottom:K,marginLeft:K,marginBlock:K,marginBlockStart:K,marginBlockEnd:K,marginInline:K,marginInlineStart:K,marginInlineEnd:K,backgroundPositionX:K,backgroundPositionY:K,rotate:Zn,rotateX:Zn,rotateY:Zn,rotateZ:Zn,scale:Rn,scaleX:Rn,scaleY:Rn,scaleZ:Rn,skew:Zn,skewX:Zn,skewY:Zn,distance:K,translateX:K,translateY:K,translateZ:K,x:K,y:K,z:K,perspective:K,transformPerspective:K,opacity:Ln,originX:tr,originY:tr,originZ:K,zIndex:Aa,fillOpacity:Ln,strokeOpacity:Ln,numOctaves:Aa},Ma={...ja,color:rr,backgroundColor:rr,outlineColor:rr,fill:rr,stroke:rr,borderColor:rr,borderTopColor:rr,borderRightColor:rr,borderBottomColor:rr,borderLeftColor:rr,filter:ka,WebkitFilter:ka},Na=e=>Ma[e];function Pa(e,t){let n=Na(e);return n!==ka&&(n=_r),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Fa=new Set([`auto`,`none`,`0`]);function Ia(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Fa.has(t)&&fr(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Pa(n,i)}var La=class extends Hi{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Nn(r))){let i=va(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!ba.has(n)||e.length!==2)return;let[r,i]=e,a=wa(r),o=wa(i);if(Fn(r)!==Fn(i)&&Pi[n]){this.needsMeasurement=!0;return}if(a!==o)if(Ai(a)&&Ai(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else Pi[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Ta(e[t]))&&n.push(t);n.length&&Ia(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pi[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=Pi[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function Ra(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var za=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ba(e){return Lt(e)&&`offsetHeight`in e}var Va=30,Ha=e=>!isNaN(parseFloat(e)),Ua={current:void 0},Wa=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=On.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=On.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Ha(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Wt);let n=this.events[e].add(t);return e===`change`?()=>{n(),Sn.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ua.current&&Ua.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=On.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Va)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Va);return qt(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Ga(e,t){return new Wa(e,t)}var{schedule:Ka,cancel:qa}=xn(queueMicrotask,!1),Ja={x:!1,y:!1};function Ya(){return Ja.x||Ja.y}function Xa(e){return e===`x`||e===`y`?Ja[e]?null:(Ja[e]=!0,()=>{Ja[e]=!1}):Ja.x||Ja.y?null:(Ja.x=Ja.y=!0,()=>{Ja.x=Ja.y=!1})}function Za(e,t){let n=Ra(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Qa(e){return!(e.pointerType===`touch`||Ya())}function $a(e,t,n={}){let[r,i,a]=Za(e,n),o=e=>{if(!Qa(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Qa(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var eo=(e,t)=>t?e===t?!0:eo(e,t.parentElement):!1,to=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,no=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function ro(e){return no.has(e.tagName)||e.isContentEditable===!0}var io=new WeakSet;function ao(e){return t=>{t.key===`Enter`&&e(t)}}function oo(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var so=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=ao(()=>{if(io.has(n))return;oo(n,`down`);let e=ao(()=>{oo(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>oo(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function co(e){return to(e)&&!Ya()}function lo(e,t,n={}){let[r,i,a]=Za(e,n),o=e=>{let r=e.currentTarget;if(!co(e))return;io.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),io.has(r)&&io.delete(r),co(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||eo(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ba(e)&&(e.addEventListener(`focus`,e=>so(e,i)),!ro(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function uo(e){return Lt(e)&&`ownerSVGElement`in e}function fo(e){return uo(e)&&e.tagName===`svg`}var po=e=>!!(e&&e.getVelocity),mo=[...Ca,rr,_r],ho=e=>mo.find(Sa(e)),go=(0,C.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function _o(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function vo(...e){return t=>{let n=!1,r=e.map(e=>{let r=_o(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():_o(e[t],null)}}}}function yo(...e){return C.useCallback(vo(...e),e)}var bo=class extends C.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,n=Ba(e)&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=n-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}};function xo({children:e,isPresent:t,anchorX:n,root:r}){let i=(0,C.useId)(),a=(0,C.useRef)(null),o=(0,C.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:s}=(0,C.useContext)(go),c=yo(a,e.props?.ref??e?.ref);return(0,C.useInsertionEffect)(()=>{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(`
|
|
8
|
+
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Os(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function ks(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var As=typeof WeakMap==`function`?WeakMap:Map;function js(e,t,n){n=no(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){cl||(cl=!0,ll=r),ks(e,t)},n}function Ms(e,t,n){n=no(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){ks(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){ks(e,t),typeof r!=`function`&&(ul===null?ul=new Set([this]):ul.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ns(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new As;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=Gl.bind(null,e,t,n),t.then(e,e))}function Ps(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Fs(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=no(-1,1),t.tag=2,ro(n,t,1))),n.lanes|=1),e)}var Is=C.ReactCurrentOwner,Ls=!1;function Rs(e,t,n,r){t.child=e===null?za(t,null,n,r):Ra(t,e.child,n,r)}function zs(e,t,n,r,i){n=n.render;var a=t.ref;return qa(t,i),r=Po(e,t,n,r,a,i),n=Fo(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(Sa&&n&&va(t),t.flags|=1,Rs(e,t,r,i),t.child)}function Bs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$l(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Vs(e,t,a,r,i)):(e=nu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Tr:n,n(o,r)&&e.ref===t.ref)return ac(e,t,i)}return t.flags|=1,e=tu(a,r),e.ref=t.ref,e.return=t,t.child=e}function Vs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Tr(a,r)&&e.ref===t.ref)if(Ls=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ls=!0);else return t.lanes=e.lanes,ac(e,t,i)}return Ws(e,t,n,r,i)}function Hs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ui(Zc,Xc),Xc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ui(Zc,Xc),Xc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,Ui(Zc,Xc),Xc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),Ui(Zc,Xc),Xc|=r;return Rs(e,t,i,n),t.child}function Us(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ws(e,t,n,r,i){var a=Yi(n)?qi:Gi.current;return a=Ji(t,a),qa(t,i),n=Po(e,t,n,r,a,i),r=Fo(),e!==null&&!Ls?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,ac(e,t,i)):(Sa&&r&&va(t),t.flags|=1,Rs(e,t,n,i),t.child)}function Gs(e,t,n,r,i){if(Yi(n)){var a=!0;$i(t)}else a=!1;if(qa(t,i),t.stateNode===null)ic(e,t),ws(t,n,r),Es(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=Ja(l):(l=Yi(n)?qi:Gi.current,l=Ji(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Ts(t,o,r,l),$a=!1;var f=t.memoizedState;o.state=f,oo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ki.current||$a?(typeof u==`function`&&(xs(t,n,u,r),c=t.memoizedState),(s=$a||Cs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,to(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:bs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=Ja(c):(c=Yi(n)?qi:Gi.current,c=Ji(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Ts(t,o,r,c),$a=!1,f=t.memoizedState,o.state=f,oo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ki.current||$a?(typeof p==`function`&&(xs(t,n,p,r),m=t.memoizedState),(l=$a||Cs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Ks(e,t,n,r,a,i)}function Ks(e,t,n,r,i,a){Us(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ea(t,n,!1),ac(e,t,a);r=t.stateNode,Is.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ra(t,e.child,null,a),t.child=Ra(t,null,s,a)):Rs(e,t,s,a),t.memoizedState=r.state,i&&ea(t,n,!0),t.child}function qs(e){var t=e.stateNode;t.pendingContext?Zi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zi(e,t.context,!1),mo(e,t.containerInfo)}function Js(e,t,n,r,i){return ja(),Ma(i),t.flags|=256,Rs(e,t,n,r),t.child}var Ys={dehydrated:null,treeContext:null,retryLane:0};function Xs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Zs(e,t,n){var r=t.pendingProps,i=vo.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Ui(vo,i&1),e===null)return Da(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=iu(o,r,0,null),e=ru(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Xs(n),t.memoizedState=Ys,e):Qs(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return ec(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=tu(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=ru(a,o,n,null),a.flags|=2):a=tu(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Xs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ys,r}return a=e.child,e=a.sibling,r=tu(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Qs(e,t){return t=iu({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function $s(e,t,n,r){return r!==null&&Ma(r),Ra(t,e.child,null,n),e=Qs(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function ec(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Os(Error(r(422))),$s(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=iu({mode:`visible`,children:i.children},a,0,null),o=ru(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ra(t,e.child,null,s),t.child.memoizedState=Xs(s),t.memoizedState=Ys,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return $s(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Os(o,i,void 0),$s(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ls||c){if(i=qc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,Qa(e,a),bl(i,e,a,-1))}return Pl(),i=Os(Error(r(421))),$s(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=ql.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,xa=Ei(a.nextSibling),ba=t,Sa=!0,Ca=null,e!==null&&(da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,ma=e.id,ha=e.overflow,pa=t),t=Qs(t,i.children),t.flags|=4096,t)}function tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ka(e.return,t,n)}function nc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function rc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Rs(e,t,r.children,n),r=vo.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&tc(e,n,t);else if(e.tag===19)tc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ui(vo,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&yo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),nc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&yo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}nc(t,!0,n,null,a);break;case`together`:nc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ic(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function ac(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),el|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=tu(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=tu(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function oc(e,t,n){switch(t.tag){case 3:qs(t),ja();break;case 5:go(t);break;case 1:Yi(t.type)&&$i(t);break;case 4:mo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Ui(Ba,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ui(vo,vo.current&1),e=ac(e,t,n),e===null?null:e.sibling):Zs(e,t,n):(Ui(vo,vo.current&1),t.flags|=128,null);Ui(vo,vo.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return rc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ui(vo,vo.current),r)break;return null;case 22:case 23:return t.lanes=0,Hs(e,t,n)}return ac(e,t,n)}var sc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},cc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,po(lo.current);var o=null;switch(n){case`input`:i=le(e,i),r=le(e,r),o=[];break;case`select`:i=R({},i,{value:void 0}),r=R({},r,{value:void 0}),o=[];break;case`textarea`:i=_e(e,i),r=_e(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=gi)}je(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&ni(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},lc=function(e,t,n,r){n!==r&&(t.flags|=4)};function uc(e,t){if(!Sa)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function dc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function fc(e,t,n){var i=t.pendingProps;switch(ya(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dc(t),null;case 1:return Yi(t.type)&&Xi(),dc(t),null;case 3:return i=t.stateNode,ho(),Hi(Ki),Hi(Gi),xo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(ka(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ca!==null&&(wl(Ca),Ca=null))),dc(t),null;case 5:_o(t);var o=po(fo.current);if(n=t.type,e!==null&&t.stateNode!=null)cc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return dc(t),null}if(e=po(lo.current),ka(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[ki]=t,i[Ai]=s,e=(t.mode&1)!=0,n){case`dialog`:ni(`cancel`,i),ni(`close`,i);break;case`iframe`:case`object`:case`embed`:ni(`load`,i);break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],i);break;case`source`:ni(`error`,i);break;case`img`:case`image`:case`link`:ni(`error`,i),ni(`load`,i);break;case`details`:ni(`toggle`,i);break;case`input`:ue(i,s),ni(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},ni(`invalid`,i);break;case`textarea`:ve(i,s),ni(`invalid`,i)}for(var c in je(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&hi(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&ni(`scroll`,i)}switch(n){case`input`:oe(i),pe(i,s,!0);break;case`textarea`:oe(i),be(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=gi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=xe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ki]=t,e[Ai]=i,sc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Me(n,i),n){case`dialog`:ni(`cancel`,e),ni(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ni(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<Qr.length;o++)ni(Qr[o],e);o=i;break;case`source`:ni(`error`,e),o=i;break;case`img`:case`image`:case`link`:ni(`error`,e),ni(`load`,e),o=i;break;case`details`:ni(`toggle`,e),o=i;break;case`input`:ue(e,i),o=le(e,i),ni(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=R({},i,{value:void 0}),ni(`invalid`,e);break;case`textarea`:ve(e,i),o=_e(e,i),ni(`invalid`,e);break;default:o=i}for(s in je(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?ke(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&we(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Te(e,u):typeof u==`number`&&Te(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&ni(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:oe(e),pe(e,i,!1);break;case`textarea`:oe(e),be(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+ie(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&ge(e,!!i.multiple,i.defaultValue,!0):ge(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=gi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return dc(t),null;case 6:if(e&&t.stateNode!=null)lc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=po(fo.current),po(lo.current),ka(t)){if(i=t.stateNode,n=t.memoizedProps,i[ki]=t,(s=i.nodeValue!==n)&&(e=ba,e!==null))switch(e.tag){case 3:hi(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&hi(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ki]=t,t.stateNode=i}return dc(t),null;case 13:if(Hi(vo),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Sa&&xa!==null&&t.mode&1&&!(t.flags&128))Aa(),ja(),t.flags|=98560,s=!1;else if(s=ka(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[ki]=t}else ja(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;dc(t),s=!1}else Ca!==null&&(wl(Ca),Ca=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||vo.current&1?Qc===0&&(Qc=3):Pl())),t.updateQueue!==null&&(t.flags|=4),dc(t),null);case 4:return ho(),e===null&&ai(t.stateNode.containerInfo),dc(t),null;case 10:return Ga(t.type._context),dc(t),null;case 17:return Yi(t.type)&&Xi(),dc(t),null;case 19:if(Hi(vo),s=t.memoizedState,s===null)return dc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)uc(s,!1);else{if(Qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=yo(e),c!==null){for(t.flags|=128,uc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ui(vo,vo.current&1|2),t.child}e=e.sibling}s.tail!==null&&dt()>ol&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304)}else{if(!i)if(e=yo(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),uc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Sa)return dc(t),null}else 2*dt()-s.renderingStartTime>ol&&n!==1073741824&&(t.flags|=128,i=!0,uc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(dc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=dt(),t.sibling=null,n=vo.current,Ui(vo,i?n&1|2:n&1),t);case 22:case 23:return Al(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Xc&1073741824&&(dc(t),t.subtreeFlags&6&&(t.flags|=8192)):dc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function pc(e,t){switch(ya(t),t.tag){case 1:return Yi(t.type)&&Xi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ho(),Hi(Ki),Hi(Gi),xo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return _o(t),null;case 13:if(Hi(vo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));ja()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Hi(vo),null;case 4:return ho(),null;case 10:return Ga(t.type._context),null;case 22:case 23:return Al(),null;case 24:return null;default:return null}}var mc=!1,hc=!1,gc=typeof WeakSet==`function`?WeakSet:Set,q=null;function _c(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Wl(e,t,n)}else n.current=null}function vc(e,t,n){try{n()}catch(n){Wl(e,t,n)}}var yc=!1;function bc(e,t){if(_i=ln,e=kr(),Ar(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(vi={focusedElem:e,selectionRange:n},ln=!1,q=t;q!==null;)if(t=q,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,q=e;else for(;q!==null;){t=q;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:bs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Wl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,q=e;break}q=t.return}return h=yc,yc=!1,h}function xc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&vc(t,n,a)}i=i.next}while(i!==r)}}function Sc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function wc(e){var t=e.alternate;t!==null&&(e.alternate=null,wc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ki],delete t[Ai],delete t[Mi],delete t[Ni],delete t[Pi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Tc(e){return e.tag===5||e.tag===3||e.tag===4}function Ec(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Tc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Dc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=gi));else if(r!==4&&(e=e.child,e!==null))for(Dc(e,t,n),e=e.sibling;e!==null;)Dc(e,t,n),e=e.sibling}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}var kc=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(vt&&typeof vt.onCommitFiberUnmount==`function`)try{vt.onCommitFiberUnmount(_t,n)}catch{}switch(n.tag){case 5:hc||_c(n,t);case 6:var r=kc,i=Ac;kc=null,jc(e,t,n),kc=r,Ac=i,kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kc.removeChild(n.stateNode));break;case 18:kc!==null&&(Ac?(e=kc,n=n.stateNode,e.nodeType===8?Ti(e.parentNode,n):e.nodeType===1&&Ti(e,n),sn(e)):Ti(kc,n.stateNode));break;case 4:r=kc,i=Ac,kc=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),kc=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!hc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&vc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!hc&&(_c(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Wl(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(hc=(r=hc)||n.memoizedState!==null,jc(e,t,n),hc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new gc),t.forEach(function(t){var r=Jl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:kc=c.stateNode,Ac=!1;break a;case 3:kc=c.stateNode.containerInfo,Ac=!0;break a;case 4:kc=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(kc===null)throw Error(r(160));Mc(o,s,a),kc=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){Wl(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{xc(3,e,e.return),Sc(3,e)}catch(t){Wl(e,e.return,t)}try{xc(5,e,e.return)}catch(t){Wl(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&_c(n,n.return),e.flags&32){var a=e.stateNode;try{Te(a,``)}catch(t){Wl(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&de(a,o),Me(c,s);var u=Me(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?ke(a,f):d===`dangerouslySetInnerHTML`?we(a,f):d===`children`?Te(a,f):S(a,d,f,u)}switch(c){case`input`:fe(a,o);break;case`textarea`:ye(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?ge(a,!!o.multiple,o.multiple?[]:``,!1):ge(a,!!o.multiple,o.defaultValue,!0)):ge(a,!!o.multiple,m,!1)}a[Ai]=o}catch(t){Wl(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){Wl(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{sn(t.containerInfo)}catch(t){Wl(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(al=dt())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(hc=(u=hc)||d,Pc(t,e),hc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(q=e,d=e.child;d!==null;){for(f=q=d;q!==null;){switch(p=q,m=p.child,p.tag){case 0:case 11:case 14:case 15:xc(4,p,p.return);break;case 1:_c(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){Wl(i,n,e)}}break;case 5:_c(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,q=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Oe(`display`,s))}catch(t){Wl(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){Wl(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Tc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Te(a,``),i.flags&=-33),Oc(e,Ec(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Dc(e,Ec(e),o);break;default:throw Error(r(161))}}catch(t){Wl(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){q=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=(e.mode&1)!=0;q!==null;){var i=q,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||mc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||hc;s=mc;var l=hc;if(mc=o,(hc=c)&&!l)for(q=i;q!==null;)o=q,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,q=c);for(;a!==null;)q=a,Rc(a,t,n),a=a.sibling;q=i,mc=s,hc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,q=a):zc(e,t,n)}}function zc(e){for(;q!==null;){var t=q;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:hc||Sc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!hc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:bs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&so(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}so(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&sn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}hc||t.flags&512&&Cc(t)}catch(e){Wl(t,t.return,e)}}if(t===e){q=null;break}if(n=t.sibling,n!==null){n.return=t.return,q=n;break}q=t.return}}function Bc(e){for(;q!==null;){var t=q;if(t===e){q=null;break}var n=t.sibling;if(n!==null){n.return=t.return,q=n;break}q=t.return}}function Vc(e){for(;q!==null;){var t=q;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sc(4,t)}catch(e){Wl(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){Wl(t,i,e)}}var a=t.return;try{Cc(t)}catch(e){Wl(t,a,e)}break;case 5:var o=t.return;try{Cc(t)}catch(e){Wl(t,o,e)}}}catch(e){Wl(t,t.return,e)}if(t===e){q=null;break}var s=t.sibling;if(s!==null){s.return=t.return,q=s;break}q=t.return}}var Hc=Math.ceil,Uc=C.ReactCurrentDispatcher,Wc=C.ReactCurrentOwner,Gc=C.ReactCurrentBatchConfig,Kc=0,qc=null,Jc=null,Yc=0,Xc=0,Zc=Vi(0),Qc=0,$c=null,el=0,tl=0,nl=0,rl=null,il=null,al=0,ol=1/0,sl=null,cl=!1,ll=null,ul=null,dl=!1,fl=null,pl=0,ml=0,hl=null,gl=-1,_l=0;function vl(){return Kc&6?dt():gl===-1?gl=dt():gl}function yl(e){return e.mode&1?Kc&2&&Yc!==0?Yc&-Yc:Na.transition===null?(e=It,e===0?(e=window.event,e=e===void 0?16:hn(e.type),e):e):(_l===0&&(_l=jt()),_l):1}function bl(e,t,n,i){if(50<ml)throw ml=0,hl=null,Error(r(185));Nt(e,n,i),(!(Kc&2)||e!==qc)&&(e===qc&&(!(Kc&2)&&(tl|=n),Qc===4&&El(e,Yc)),xl(e,i),n===1&&Kc===0&&!(t.mode&1)&&(ol=dt()+500,na&&oa()))}function xl(e,t){var n=e.callbackNode;kt(e,t);var r=Dt(e,e===qc?Yc:0);if(r===0)n!==null&&ct(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ct(n),t===1)e.tag===0?aa(Dl.bind(null,e)):ia(Dl.bind(null,e)),Ci(function(){!(Kc&6)&&oa()}),n=null;else{switch(Lt(r)){case 1:n=pt;break;case 4:n=mt;break;case 16:n=G;break;case 536870912:n=gt;break;default:n=G}n=Xl(n,Sl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function Sl(e,t){if(gl=-1,_l=0,Kc&6)throw Error(r(327));var n=e.callbackNode;if(Hl()&&e.callbackNode!==n)return null;var i=Dt(e,e===qc?Yc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Fl(e,i);else{t=i;var a=Kc;Kc|=2;var o=Nl();(qc!==e||Yc!==t)&&(sl=null,ol=dt()+500,jl(e,t));do try{Ll();break}catch(t){Ml(e,t)}while(1);Wa(),Uc.current=o,Kc=a,Jc===null?(qc=null,Yc=0,t=Qc):t=0}if(t!==0){if(t===2&&(a=At(e),a!==0&&(i=a,t=Cl(e,a))),t===1)throw n=$c,jl(e,0),El(e,i),xl(e,dt()),n;if(t===6)El(e,i);else{if(a=e.current.alternate,!(i&30)&&!Tl(a)&&(t=Fl(e,i),t===2&&(o=At(e),o!==0&&(i=o,t=Cl(e,o))),t===1))throw n=$c,jl(e,0),El(e,i),xl(e,dt()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Bl(e,il,sl);break;case 3:if(El(e,i),(i&130023424)===i&&(t=al+500-dt(),10<t)){if(Dt(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){vl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=bi(Bl.bind(null,e,il,sl),t);break}Bl(e,il,sl);break;case 4:if(El(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-bt(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=dt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=bi(Bl.bind(null,e,il,sl),i);break}Bl(e,il,sl);break;case 5:Bl(e,il,sl);break;default:throw Error(r(329))}}}return xl(e,dt()),e.callbackNode===n?Sl.bind(null,e):null}function Cl(e,t){var n=rl;return e.current.memoizedState.isDehydrated&&(jl(e,t).flags|=256),e=Fl(e,t),e!==2&&(t=il,il=n,t!==null&&wl(t)),e}function wl(e){il===null?il=e:il.push.apply(il,e)}function Tl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!wr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function El(e,t){for(t&=~nl,t&=~tl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-bt(t),r=1<<n;e[n]=-1,t&=~r}}function Dl(e){if(Kc&6)throw Error(r(327));Hl();var t=Dt(e,0);if(!(t&1))return xl(e,dt()),null;var n=Fl(e,t);if(e.tag!==0&&n===2){var i=At(e);i!==0&&(t=i,n=Cl(e,i))}if(n===1)throw n=$c,jl(e,0),El(e,t),xl(e,dt()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Bl(e,il,sl),xl(e,dt()),null}function Ol(e,t){var n=Kc;Kc|=1;try{return e(t)}finally{Kc=n,Kc===0&&(ol=dt()+500,na&&oa())}}function kl(e){fl!==null&&fl.tag===0&&!(Kc&6)&&Hl();var t=Kc;Kc|=1;var n=Gc.transition,r=It;try{if(Gc.transition=null,It=1,e)return e()}finally{It=r,Gc.transition=n,Kc=t,!(Kc&6)&&oa()}}function Al(){Xc=Zc.current,Hi(Zc)}function jl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xi(n)),Jc!==null)for(n=Jc.return;n!==null;){var r=n;switch(ya(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xi();break;case 3:ho(),Hi(Ki),Hi(Gi),xo();break;case 5:_o(r);break;case 4:ho();break;case 13:Hi(vo);break;case 19:Hi(vo);break;case 10:Ga(r.type._context);break;case 22:case 23:Al()}n=n.return}if(qc=e,Jc=e=tu(e.current,null),Yc=Xc=t,Qc=0,$c=null,nl=tl=el=0,il=rl=null,Ya!==null){for(t=0;t<Ya.length;t++)if(n=Ya[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Ya=null}return e}function Ml(e,t){do{var n=Jc;try{if(Wa(),So.current=gs,Oo){for(var i=To.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}Oo=!1}if(wo=0,Do=Eo=To=null,ko=!1,Ao=0,Wc.current=null,n===null||n.return===null){Qc=1,$c=t,Jc=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Yc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Ps(s);if(m!==null){m.flags&=-257,Fs(m,s,c,o,t),m.mode&1&&Ns(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){Ns(o,u,t),Pl();break a}l=Error(r(426))}}else if(Sa&&c.mode&1){var _=Ps(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Fs(_,s,c,o,t),Ma(Ds(l,c));break a}}o=l=Ds(l,c),Qc!==4&&(Qc=2),rl===null?rl=[o]:rl.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=js(o,l,t);ao(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(ul===null||!ul.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ms(o,c,t);ao(o,x);break a}}o=o.return}while(o!==null)}zl(n)}catch(e){t=e,Jc===n&&n!==null&&(Jc=n=n.return);continue}break}while(1)}function Nl(){var e=Uc.current;return Uc.current=gs,e===null?gs:e}function Pl(){(Qc===0||Qc===3||Qc===2)&&(Qc=4),qc===null||!(el&268435455)&&!(tl&268435455)||El(qc,Yc)}function Fl(e,t){var n=Kc;Kc|=2;var i=Nl();(qc!==e||Yc!==t)&&(sl=null,jl(e,t));do try{Il();break}catch(t){Ml(e,t)}while(1);if(Wa(),Kc=n,Uc.current=i,Jc!==null)throw Error(r(261));return qc=null,Yc=0,Qc}function Il(){for(;Jc!==null;)Rl(Jc)}function Ll(){for(;Jc!==null&&!lt();)Rl(Jc)}function Rl(e){var t=Yl(e.alternate,e,Xc);e.memoizedProps=e.pendingProps,t===null?zl(e):Jc=t,Wc.current=null}function zl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=pc(n,t),n!==null){n.flags&=32767,Jc=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Qc=6,Jc=null;return}}else if(n=fc(n,t,Xc),n!==null){Jc=n;return}if(t=t.sibling,t!==null){Jc=t;return}Jc=t=e}while(t!==null);Qc===0&&(Qc=5)}function Bl(e,t,n){var r=It,i=Gc.transition;try{Gc.transition=null,It=1,Vl(e,t,n,r)}finally{Gc.transition=i,It=r}return null}function Vl(e,t,n,i){do Hl();while(fl!==null);if(Kc&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Pt(e,o),e===qc&&(Jc=qc=null,Yc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||dl||(dl=!0,Xl(G,function(){return Hl(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=It;It=1;var c=Kc;Kc|=4,Wc.current=null,bc(e,n),Fc(n,e),jr(vi),ln=!!_i,vi=_i=null,e.current=n,Lc(n,e,a),ut(),Kc=c,It=s,Gc.transition=o}else e.current=n;if(dl&&(dl=!1,fl=e,pl=a),o=e.pendingLanes,o===0&&(ul=null),yt(n.stateNode,i),xl(e,dt()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(cl)throw cl=!1,e=ll,ll=null,e;return pl&1&&e.tag!==0&&Hl(),o=e.pendingLanes,o&1?e===hl?ml++:(ml=0,hl=e):ml=0,oa(),null}function Hl(){if(fl!==null){var e=Lt(pl),t=Gc.transition,n=It;try{if(Gc.transition=null,It=16>e?16:e,fl===null)var i=!1;else{if(e=fl,fl=null,pl=0,Kc&6)throw Error(r(331));var a=Kc;for(Kc|=4,q=e.current;q!==null;){var o=q,s=o.child;if(q.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(q=u;q!==null;){var d=q;switch(d.tag){case 0:case 11:case 15:xc(8,d,o)}var f=d.child;if(f!==null)f.return=d,q=f;else for(;q!==null;){d=q;var p=d.sibling,m=d.return;if(wc(d),d===u){q=null;break}if(p!==null){p.return=m,q=p;break}q=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}q=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,q=s;else b:for(;q!==null;){if(o=q,o.flags&2048)switch(o.tag){case 0:case 11:case 15:xc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,q=v;break b}q=o.return}}var y=e.current;for(q=y;q!==null;){s=q;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,q=b;else b:for(s=y;q!==null;){if(c=q,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Sc(9,c)}}catch(e){Wl(c,c.return,e)}if(c===s){q=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,q=x;break b}q=c.return}}if(Kc=a,oa(),vt&&typeof vt.onPostCommitFiberRoot==`function`)try{vt.onPostCommitFiberRoot(_t,e)}catch{}i=!0}return i}finally{It=n,Gc.transition=t}}return!1}function Ul(e,t,n){t=Ds(n,t),t=js(e,t,1),e=ro(e,t,1),t=vl(),e!==null&&(Nt(e,1,t),xl(e,t))}function Wl(e,t,n){if(e.tag===3)Ul(e,e,n);else for(;t!==null;){if(t.tag===3){Ul(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(ul===null||!ul.has(r))){e=Ds(n,e),e=Ms(t,e,1),t=ro(t,e,1),e=vl(),t!==null&&(Nt(t,1,e),xl(t,e));break}}t=t.return}}function Gl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=vl(),e.pingedLanes|=e.suspendedLanes&n,qc===e&&(Yc&n)===n&&(Qc===4||Qc===3&&(Yc&130023424)===Yc&&500>dt()-al?jl(e,0):nl|=n),xl(e,t)}function Kl(e,t){t===0&&(e.mode&1?(t=Tt,Tt<<=1,!(Tt&130023424)&&(Tt=4194304)):t=1);var n=vl();e=Qa(e,t),e!==null&&(Nt(e,t,n),xl(e,n))}function ql(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Kl(e,n)}function Jl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Kl(e,n)}var Yl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ki.current)Ls=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ls=!1,oc(e,t,n);Ls=!!(e.flags&131072)}else Ls=!1,Sa&&t.flags&1048576&&_a(t,ua,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ic(e,t),e=t.pendingProps;var a=Ji(t,Gi.current);qa(t,n),a=Po(null,t,i,e,a,n);var o=Fo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yi(i)?(o=!0,$i(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,eo(t),a.updater=Ss,t.stateNode=a,a._reactInternals=t,Es(t,i,e,n),t=Ks(null,t,i,!0,o,n)):(t.tag=0,Sa&&o&&va(t),Rs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ic(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=eu(i),e=bs(i,e),a){case 0:t=Ws(null,t,i,e,n);break a;case 1:t=Gs(null,t,i,e,n);break a;case 11:t=zs(null,t,i,e,n);break a;case 14:t=Bs(null,t,i,bs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Ws(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),Gs(e,t,i,a,n);case 3:a:{if(qs(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,to(e,t),oo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Ds(Error(r(423)),t),t=Js(e,t,i,n,a);break a}else if(i!==a){a=Ds(Error(r(424)),t),t=Js(e,t,i,n,a);break a}else for(xa=Ei(t.stateNode.containerInfo.firstChild),ba=t,Sa=!0,Ca=null,n=za(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ja(),i===a){t=ac(e,t,n);break a}Rs(e,t,i,n)}t=t.child}return t;case 5:return go(t),e===null&&Da(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,yi(i,a)?s=null:o!==null&&yi(i,o)&&(t.flags|=32),Us(e,t),Rs(e,t,s,n),t.child;case 6:return e===null&&Da(t),null;case 13:return Zs(e,t,n);case 4:return mo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ra(t,null,i,n):Rs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),zs(e,t,i,a,n);case 7:return Rs(e,t,t.pendingProps,n),t.child;case 8:return Rs(e,t,t.pendingProps.children,n),t.child;case 12:return Rs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ui(Ba,i._currentValue),i._currentValue=s,o!==null)if(wr(o.value,s)){if(o.children===a.children&&!Ki.current){t=ac(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=no(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ka(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ka(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Rs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,qa(t,n),a=Ja(a),i=i(a),t.flags|=1,Rs(e,t,i,n),t.child;case 14:return i=t.type,a=bs(i,t.pendingProps),a=bs(i.type,a),Bs(e,t,i,a,n);case 15:return Vs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:bs(i,a),ic(e,t),t.tag=1,Yi(i)?(e=!0,$i(t)):e=!1,qa(t,n),ws(t,i,a),Es(t,i,a,n),Ks(null,t,i,!0,e,n);case 19:return rc(e,t,n);case 22:return Hs(e,t,n)}throw Error(r(156,t.tag))};function Xl(e,t){return st(e,t)}function Zl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ql(e,t,n,r){return new Zl(e,t,n,r)}function $l(e){return e=e.prototype,!(!e||!e.isReactComponent)}function eu(e){if(typeof e==`function`)return+!!$l(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function tu(e,t){var n=e.alternate;return n===null?(n=Ql(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function nu(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)$l(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return ru(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=Ql(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=Ql(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=Ql(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return iu(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Ql(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function ru(e,t,n,r){return e=Ql(7,e,r,t),e.lanes=n,e}function iu(e,t,n,r){return e=Ql(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function au(e,t,n){return e=Ql(6,e,null,t),e.lanes=n,e}function ou(e,t,n){return t=Ql(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function su(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Mt(0),this.expirationTimes=Mt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function cu(e,t,n,r,i,a,o,s,c){return e=new su(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Ql(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},eo(a),e}function lu(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function uu(e){if(!e)return Wi;e=e._reactInternals;a:{if(nt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Yi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Yi(n))return Qi(e,n,t)}return t}function du(e,t,n,r,i,a,o,s,c){return e=cu(n,r,!0,e,i,a,o,s,c),e.context=uu(null),n=e.current,r=vl(),i=yl(n),a=no(r,i),a.callback=t??null,ro(n,a,i),e.current.lanes=i,Nt(e,i,r),xl(e,r),e}function fu(e,t,n,r){var i=t.current,a=vl(),o=yl(i);return n=uu(n),t.context===null?t.context=n:t.pendingContext=n,t=no(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=ro(i,t,o),e!==null&&(bl(e,i,o,a),io(e,i,o)),o}function pu(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function mu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function hu(e,t){mu(e,t),(e=e.alternate)&&mu(e,t)}function gu(){return null}var _u=typeof reportError==`function`?reportError:function(e){console.error(e)};function vu(e){this._internalRoot=e}yu.prototype.render=vu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));fu(e,t,null,null)},yu.prototype.unmount=vu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;kl(function(){fu(null,e,null,null)}),t[ji]=null}};function yu(e){this._internalRoot=e}yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Xt.length&&t!==0&&t<Xt[n].priority;n++);Xt.splice(n,0,e),n===0&&tn(e)}};function bu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function Su(){}function Cu(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=pu(o);a.call(e)}}var o=du(t,r,e,0,null,!1,!1,``,Su);return e._reactRootContainer=o,e[ji]=o.current,ai(e.nodeType===8?e.parentNode:e),kl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=pu(c);s.call(e)}}var c=cu(e,0,!1,null,null,!1,!1,``,Su);return e._reactRootContainer=c,e[ji]=c.current,ai(e.nodeType===8?e.parentNode:e),kl(function(){fu(t,c,n,r)}),c}function wu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=pu(o);s.call(e)}}fu(t,o,e,i)}else o=Cu(n,t,e,i,r);return pu(o)}Rt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Et(t.pendingLanes);n!==0&&(Ft(t,n|1),xl(t,dt()),!(Kc&6)&&(ol=dt()+500,oa()))}break;case 13:kl(function(){var t=Qa(e,1);t!==null&&bl(t,e,1,vl())}),hu(e,1)}},zt=function(e){if(e.tag===13){var t=Qa(e,134217728);t!==null&&bl(t,e,134217728,vl()),hu(e,134217728)}},Bt=function(e){if(e.tag===13){var t=yl(e),n=Qa(e,t);n!==null&&bl(n,e,t,vl()),hu(e,t)}},Vt=function(){return It},Ht=function(e,t){var n=It;try{return It=e,t()}finally{It=n}},Fe=function(e,t,n){switch(t){case`input`:if(fe(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ri(i);if(!a)throw Error(r(90));se(i),fe(i,a)}}}break;case`textarea`:ye(e,n);break;case`select`:t=n.value,t!=null&&ge(e,!!n.multiple,t,!1)}},Ve=Ol,He=kl;var Tu={usingClientEntryPoint:!1,Events:[Ii,Li,Ri,ze,Be,Ol]},Eu={findFiberByHostInstance:Fi,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},Du={bundleType:Eu.bundleType,version:Eu.version,rendererPackageName:Eu.rendererPackageName,rendererConfig:Eu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ot(e),e===null?null:e.stateNode},findFiberByHostInstance:Eu.findFiberByHostInstance||gu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Ou=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ou.isDisabled&&Ou.supportsFiber)try{_t=Ou.inject(Du),vt=Ou}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Tu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bu(t))throw Error(r(200));return lu(e,t,null,n)},e.createRoot=function(e,t){if(!bu(e))throw Error(r(299));var n=!1,i=``,a=_u;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=cu(e,1,!1,null,null,n,!1,i,a),e[ji]=t.current,ai(e.nodeType===8?e.parentNode:e),new vu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=ot(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return kl(e)},e.hydrate=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!bu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=_u;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=du(t,null,e,1,n??null,a,!1,o,s),e[ji]=t.current,ai(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new yu(t)},e.render=function(e,t,n){if(!xu(t))throw Error(r(200));return wu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!xu(e))throw Error(r(40));return e._reactRootContainer?(kl(function(){wu(null,null,e,!1,function(){e._reactRootContainer=null,e[ji]=null})}),!0):!1},e.unstable_batchedUpdates=Ol,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!xu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return wu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),_=s(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=g()})),v=s((e=>{var t=_();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),y=s((e=>{var t=p(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),b=s(((e,t)=>{t.exports=y()})),x=v(),S=b(),C=u(p());function w({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 9v4m0 4h.01M10.615 3.892L2.39 18.098c-.456.788-.684 1.182-.65 1.506a1 1 0 00.406.705c.263.191.718.191 1.629.191h16.45c.91 0 1.365 0 1.628-.191a1 1 0 00.407-.705c.034-.324-.195-.718-.65-1.506L13.383 3.892c-.454-.785-.681-1.178-.978-1.31a1 1 0 00-.813 0c-.296.132-.523.525-.978 1.31z`}))}var T=C.forwardRef(w);function E({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 5v14m0 0l7-7m-7 7l-7-7`}))}var D=C.forwardRef(E);function O({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 9l6 6 6-6`}))}var k=C.forwardRef(O);function A({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 18l6-6-6-6`}))}var j=C.forwardRef(A);function M({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M16 4c.93 0 1.395 0 1.776.102a3 3 0 012.122 2.122C20 6.605 20 7.07 20 8v9.2c0 1.68 0 2.52-.327 3.162a3 3 0 01-1.311 1.311C17.72 22 16.88 22 15.2 22H8.8c-1.68 0-2.52 0-3.162-.327a3 3 0 01-1.311-1.311C4 19.72 4 18.88 4 17.2V8c0-.93 0-1.395.102-1.776a3 3 0 012.122-2.122C6.605 4 7.07 4 8 4m1.6 2h4.8c.56 0 .84 0 1.054-.109a1 1 0 00.437-.437C16 5.24 16 4.96 16 4.4v-.8c0-.56 0-.84-.109-1.054a1 1 0 00-.437-.437C15.24 2 14.96 2 14.4 2H9.6c-.56 0-.84 0-1.054.109a1 1 0 00-.437.437C8 2.76 8 3.04 8 3.6v.8c0 .56 0 .84.109 1.054a1 1 0 00.437.437C8.76 6 9.04 6 9.6 6z`}))}var N=C.forwardRef(M);function P({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 15c-.932 0-1.398 0-1.765-.152a2 2 0 01-1.083-1.083C2 13.398 2 12.932 2 12V5.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C3.52 2 4.08 2 5.2 2H12c.932 0 1.398 0 1.765.152a2 2 0 011.083 1.083C15 3.602 15 4.068 15 5m-2.8 17h6.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 20.48 22 19.92 22 18.8v-6.6c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 9 19.92 9 18.8 9h-6.6c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C9 10.52 9 11.08 9 12.2v6.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C10.52 22 11.08 22 12.2 22z`}))}var F=C.forwardRef(P);function I({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M20 4v1.4c0 3.36 0 5.04-.654 6.324a6 6 0 01-2.622 2.622C15.44 15 13.76 15 10.4 15H4m0 0l5-5m-5 5l5 5`}))}var L=C.forwardRef(I);function ee({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M17 9l-6 6m0-6l6 6M2.72 12.96l4.32 5.76c.352.47.528.704.751.873.198.15.421.262.66.33C8.72 20 9.013 20 9.6 20h7.6c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C22 17.72 22 16.88 22 15.2V8.8c0-1.68 0-2.52-.327-3.162a3 3 0 00-1.311-1.311C19.72 4 18.88 4 17.2 4H9.6c-.587 0-.88 0-1.15.077a2 2 0 00-.659.33c-.223.169-.399.404-.751.873l-4.32 5.76c-.258.344-.387.516-.437.705a1 1 0 000 .51c.05.189.179.36.437.705z`}))}var R=C.forwardRef(ee);function z({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 13a1 1 0 100-2 1 1 0 000 2zM12 6a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z`}))}var B=C.forwardRef(z);function te({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M11 4H6.8c-1.68 0-2.52 0-3.162.327a3 3 0 00-1.311 1.311C2 6.28 2 7.12 2 8.8v8.4c0 1.68 0 2.52.327 3.162a3 3 0 001.311 1.311C4.28 22 5.12 22 6.8 22h8.4c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C20 19.72 20 18.88 20 17.2V13M8 16h1.675c.489 0 .733 0 .963-.055.204-.05.4-.13.579-.24.201-.123.374-.296.72-.642L21.5 5.5a2.121 2.121 0 00-3-3l-9.563 9.563c-.346.346-.519.519-.642.72a2 2 0 00-.24.579c-.055.23-.055.474-.055.963V16z`}))}var V=C.forwardRef(te);function H({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M14 2.27V6.4c0 .56 0 .84.109 1.054a1 1 0 00.437.437c.214.11.494.11 1.054.11h4.13M16 13H8m8 4H8m2-8H8m6-7H8.8c-1.68 0-2.52 0-3.162.327a3 3 0 00-1.311 1.311C4 4.28 4 5.12 4 6.8v10.4c0 1.68 0 2.52.327 3.162a3 3 0 001.311 1.311C6.28 22 7.12 22 8.8 22h6.4c1.68 0 2.52 0 3.162-.327a3 3 0 001.311-1.311C20 19.72 20 18.88 20 17.2V8l-6-6z`}))}var ne=C.forwardRef(H);function re({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3.386 5.667C2.63 4.822 2.25 4.399 2.237 4.04a1 1 0 01.363-.811C2.877 3 3.444 3 4.578 3h14.843c1.134 0 1.702 0 1.979.229a1 1 0 01.362.81c-.014.36-.392.783-1.148 1.628l-5.707 6.377c-.15.169-.226.253-.28.35a1 1 0 00-.103.27c-.024.108-.024.221-.024.447v5.347c0 .196 0 .294-.032.378a.5.5 0 01-.132.196c-.067.06-.158.096-.34.17l-3.4 1.36c-.367.146-.55.22-.698.189a.5.5 0 01-.315-.213c-.083-.126-.083-.324-.083-.72v-6.707c0-.226 0-.339-.024-.446a1 1 0 00-.104-.272c-.054-.096-.13-.18-.28-.349L3.386 5.667z`}))}var ie=C.forwardRef(re);function U({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 7l-1.116-2.231c-.32-.642-.481-.963-.72-1.198a2 2 0 00-.748-.462C10.1 3 9.74 3 9.022 3H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 4.52 2 5.08 2 6.2V7m0 0h15.2c1.68 0 2.52 0 3.162.327a3 3 0 011.311 1.311C22 9.28 22 10.12 22 11.8v4.4c0 1.68 0 2.52-.327 3.162a3 3 0 01-1.311 1.311C19.72 21 18.88 21 17.2 21H6.8c-1.68 0-2.52 0-3.162-.327a3 3 0 01-1.311-1.311C2 18.72 2 17.88 2 16.2V7z`}))}var ae=C.forwardRef(U);function oe({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 18a3 3 0 106 0 3 3 0 00-6 0zm0 0a9 9 0 01-9-9m0 0a3 3 0 100-6 3 3 0 000 6zm0 0v12`}))}var se=C.forwardRef(oe);function ce({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18 15a3 3 0 100 6 3 3 0 000-6zm0 0V8a2 2 0 00-2-2h-3M6 9a3 3 0 100-6 3 3 0 000 6zm0 0v12`}))}var le=C.forwardRef(ce);function ue({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6.9 11.444v2.778m0-2.778V4.778c0-.92.761-1.667 1.7-1.667s1.7.746 1.7 1.667m-3.4 6.666c0-.92-.761-1.666-1.7-1.666s-1.7.746-1.7 1.666v2.223C3.5 18.269 7.306 22 12 22s8.5-3.731 8.5-8.333V8.11c0-.92-.761-1.667-1.7-1.667s-1.7.747-1.7 1.667m-6.8-3.333v6.11m0-6.11V3.667C10.3 2.747 11.061 2 12 2s1.7.746 1.7 1.667v1.11m0 0v6.112m0-6.111c0-.92.761-1.667 1.7-1.667s1.7.746 1.7 1.667V8.11m0 0v2.778`}))}var de=C.forwardRef(ue);function fe({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 8h16M4 16h16M8 3v18m8-18v18`}))}var pe=C.forwardRef(fe);function me({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 10h.01M8 14h.01M10 10h.01M12 14h.01M14 10h.01M16 14h.01M18 10h.01M5.2 18h13.6c1.12 0 1.68 0 2.108-.218a2 2 0 00.874-.874C22 16.48 22 15.92 22 14.8V9.2c0-1.12 0-1.68-.218-2.108a2 2 0 00-.874-.874C20.48 6 19.92 6 18.8 6H5.2c-1.12 0-1.68 0-2.108.218a2 2 0 00-.874.874C2 7.52 2 8.08 2 9.2v5.6c0 1.12 0 1.68.218 2.108a2 2 0 00.874.874C3.52 18 4.08 18 5.2 18z`}))}var he=C.forwardRef(me);function ge({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 12h18M3 6h18M3 18h18`}))}var _e=C.forwardRef(ge);function ve({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 12h14`}))}var ye=C.forwardRef(ve);function be({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M22 15.844a10.424 10.424 0 01-4.306.925c-5.779 0-10.463-4.684-10.463-10.462 0-1.536.33-2.994.925-4.307A10.464 10.464 0 002 11.538C2 17.316 6.684 22 12.462 22c4.243 0 7.896-2.526 9.538-6.156z`}))}var xe=C.forwardRef(be);function Se({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 9l-3 3m0 0l3 3m-3-3h20M9 5l3-3m0 0l3 3m-3-3v20m3-3l-3 3m0 0l-3-3M19 9l3 3m0 0l-3 3`}))}var Ce=C.forwardRef(Se);function we({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18 2l4 4M2 22l1.276-4.68c.084-.305.125-.458.19-.6.056-.127.126-.247.207-.36.092-.125.204-.237.428-.46L14.434 5.565c.198-.198.297-.297.412-.334a.5.5 0 01.309 0c.114.037.213.136.41.334l2.87 2.868c.197.198.296.297.333.411.033.1.033.21 0 .31-.037.114-.136.213-.334.41L8.101 19.9c-.224.224-.336.336-.462.428a2.003 2.003 0 01-.358.208c-.143.064-.296.105-.6.189L2 22z`}))}var Te=C.forwardRef(we);function Ee({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 4.99c0-.972 0-1.457.202-1.725a1 1 0 01.738-.395c.335-.02.74.25 1.548.788l10.515 7.01c.668.446 1.002.668 1.118.949a1 1 0 010 .766c-.116.28-.45.503-1.118.948l-10.515 7.01c-.809.54-1.213.809-1.548.789a1 1 0 01-.738-.395C5 20.467 5 19.98 5 19.01V4.99z`}))}var De=C.forwardRef(Ee);function Oe({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 5v14m-7-7h14`}))}var ke=C.forwardRef(Oe);function Ae({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 15a3 3 0 100-6 3 3 0 000 6z`}),C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9.29 19.371l.584 1.315a2.213 2.213 0 004.044 0l.585-1.315a2.426 2.426 0 012.47-1.423l1.43.152a2.212 2.212 0 002.022-3.502l-.847-1.164a2.428 2.428 0 01-.46-1.434c0-.513.163-1.014.465-1.429l.847-1.163a2.212 2.212 0 00-2.023-3.502l-1.43.152a2.433 2.433 0 01-1.47-.312 2.425 2.425 0 01-1-1.117l-.588-1.315a2.212 2.212 0 00-4.045 0L9.29 4.63c-.207.468-.558.86-1 1.117-.445.256-.96.365-1.47.312l-1.435-.152a2.212 2.212 0 00-2.022 3.502l.847 1.163a2.43 2.43 0 010 2.858l-.847 1.163a2.21 2.21 0 00.786 3.273c.381.195.81.274 1.236.23l1.43-.153a2.434 2.434 0 012.475 1.43z`}))}var je=C.forwardRef(Ae);function Me({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 17l6-6-6-6m8 14h8`}))}var Ne=C.forwardRef(Me);function Pe({title:e,titleId:t,...n},r){return C.createElement(`svg`,Object.assign({xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,strokeWidth:1.5,stroke:`currentColor`,"aria-hidden":`true`,ref:r,"aria-labelledby":t},n),e?C.createElement(`title`,{id:t},e):null,C.createElement(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18 6L6 18M6 6l12 12`}))}var Fe=C.forwardRef(Pe);function Ie(e){return(0,S.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,...e,children:[(0,S.jsx)(`circle`,{className:`opacity-25`,cx:`12`,cy:`12`,r:`10`,stroke:`currentColor`,strokeWidth:`4`}),(0,S.jsx)(`path`,{className:`opacity-75`,fill:`currentColor`,d:`M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z`})]})}var Le=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Re=(e=>e?Le(e):Le),ze=e=>e;function Be(e,t=ze){let n=C.useSyncExternalStore(e.subscribe,C.useCallback(()=>t(e.getState()),[e,t]),C.useCallback(()=>t(e.getInitialState()),[e,t]));return C.useDebugValue(n),n}var Ve=e=>{let t=Re(e),n=e=>Be(t,e);return Object.assign(n,t),n},He=(e=>e?Ve(e):Ve);function Ue(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var We=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return We(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return We(t)(e)}}}},Ge=(e,t)=>(n,r,i)=>{let a={storage:Ue(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=new Set,c=new Set,l=a.storage;if(!l)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let u=()=>{let e=a.partialize({...r()});return l.setItem(a.name,{state:e,version:a.version})},d=i.setState;i.setState=(e,t)=>(d(e,t),u());let f=e((...e)=>(n(...e),u()),r,i);i.getInitialState=()=>f;let p,m=()=>{if(!l)return;o=!1,s.forEach(e=>e(r()??f));let e=a.onRehydrateStorage?.call(a,r()??f)||void 0;return We(l.getItem.bind(l))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(e=>{let[t,i]=e;if(p=a.merge(i,r()??f),n(p,!0),t)return u()}).then(()=>{e?.(p,void 0),p=r(),o=!0,c.forEach(e=>e(p))}).catch(t=>{e?.(void 0,t)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(l=e.storage)},clearStorage:()=>{l?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>m(),hasHydrated:()=>o,onHydrate:e=>(s.add(e),()=>{s.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},a.skipHydration||m(),p||f};function Ke(){let e=new Map;return{getItem:t=>e.get(t)??null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}var qe=Ke(),Je={getItem:e=>{if(typeof localStorage>`u`)return qe.getItem(e);try{return localStorage.getItem(e)}catch{return qe.getItem(e)}},setItem:(e,t)=>{if(typeof localStorage>`u`){qe.setItem(e,t);return}try{localStorage.setItem(e,t)}catch{qe.setItem(e,t)}},removeItem:e=>{if(typeof localStorage>`u`){qe.removeItem(e);return}try{localStorage.removeItem(e)}catch{qe.removeItem(e)}}};function Ye(e){let t=new Map,n=!1,r=t=>{let n={BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1},r=globalThis.Bun?.main??``,i=/\.test\.[cm]?[jt]sx?$/.test(r);if((typeof n?.DEV==`boolean`?n.DEV:i)&&t!==e)throw Error(`createTabStorage("${e}") received unexpected key "${t}". Create a dedicated tab storage instance per persist key.`)};return{getItem(e){if(r(e),n)return t.get(e)??null;n=!0;let i=Je.getItem(e);return i!==null&&t.set(e,i),i},setItem(e,n){r(e),t.set(e,n),Je.setItem(e,n)},removeItem(e){r(e),t.delete(e),Je.removeItem(e)}}}var Xe=`~/Documents/GitHub`,Ze=`claude`,Qe=!(typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!/iPhone|iPad|iPod/.test(navigator.userAgent)&&(typeof devicePixelRatio<`u`?devicePixelRatio:1)>1),$e=[{id:`jetbrains-mono`,label:`JetBrains Mono`,family:`"JetBrains Mono Variable", "JetBrains Mono", "SF Mono", "Fira Code", ui-monospace, monospace`},{id:`system`,label:`System Default`,family:`ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", "Consolas", monospace`},{id:`custom`,label:`Custom`,family:``}];function et(e,t){return e===`custom`&&t.trim()?t.trim():$e.find(t=>t.id===e)?.family||$e[0].family}var tt=[{id:`claude`,label:`Claude`,command:`claude`,isBuiltIn:!0,agentType:`claude`},{id:`codex`,label:`Codex`,command:`codex`,isBuiltIn:!0,agentType:`codex`},{id:`pi`,label:`Pi`,command:`pi`,isBuiltIn:!0,agentType:`pi`},{id:`grok`,label:`Grok`,command:`grok`,isBuiltIn:!0,agentType:`grok`},{id:`devin`,label:`Devin`,command:`devin`,isBuiltIn:!0,agentType:`devin`},{id:`omp`,label:`OMP`,command:`omp`,isBuiltIn:!0,agentType:`omp`}];function nt(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||t.agentType===`claude`||t.agentType===`codex`||t.agentType===`pi`||t.agentType===`devin`||t.agentType===`grok`||t.agentType===`omp`||t.agentType===`claude-rp`)}function rt(e){return{...e,label:e.label.trim().slice(0,64),command:e.command.trim().slice(0,1024)}}function it(e){return e.command.trim()}function at(e){for(let t=0;t<100;t++){let t=`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;if(!e.has(t))return t}return`custom-${Date.now()}-${Math.random().toString(36).slice(2)}`}function ot(e,t){return e.some(e=>e.id===t)?t:e[0]?.id||`claude`}var W=He()(Ge((e,t)=>({defaultProjectDir:Xe,setDefaultProjectDir:t=>e({defaultProjectDir:t}),defaultCommand:Ze,setDefaultCommand:t=>e({defaultCommand:t}),lastProjectPath:null,setLastProjectPath:t=>e({lastProjectPath:t}),recentPaths:[],addRecentPath:t=>e(e=>({recentPaths:[t,...e.recentPaths.filter(e=>e!==t)].slice(0,5)})),sessionSortMode:`created`,setSessionSortMode:t=>e({sessionSortMode:t}),sessionSortDirection:`desc`,setSessionSortDirection:t=>e({sessionSortDirection:t}),manualSessionOrder:[],setManualSessionOrder:t=>e({manualSessionOrder:t}),sidebarAnchor:`top`,setSidebarAnchor:t=>e({sidebarAnchor:t}),useWebGL:Qe,setUseWebGL:t=>e({useWebGL:t}),fontSize:13,setFontSize:t=>e({fontSize:Math.max(6,Math.min(24,t))}),lineHeight:1,setLineHeight:t=>e({lineHeight:Math.max(1,Math.min(2,t))}),letterSpacing:0,setLetterSpacing:t=>e({letterSpacing:Math.max(-3,Math.min(3,t))}),fontOption:`jetbrains-mono`,setFontOption:t=>e({fontOption:t}),customFontFamily:``,setCustomFontFamily:t=>e({customFontFamily:t.slice(0,256)}),shortcutModifier:`auto`,setShortcutModifier:t=>e({shortcutModifier:t}),showProjectName:!0,setShowProjectName:t=>e({showProjectName:t}),showLastUserMessage:!0,setShowLastUserMessage:t=>e({showLastUserMessage:t}),showSessionIdPrefix:!1,setShowSessionIdPrefix:t=>e({showSessionIdPrefix:t}),historySessionsExpanded:!1,setHistorySessionsExpanded:t=>e({historySessionsExpanded:t}),hibernatingSessionsExpanded:!0,setHibernatingSessionsExpanded:t=>e({hibernatingSessionsExpanded:t}),sidebarWidth:240,setSidebarWidth:t=>e({sidebarWidth:Math.max(180,Math.min(400,t))}),projectFilters:[],setProjectFilters:t=>e({projectFilters:t}),hostFilters:[],setHostFilters:t=>e({hostFilters:t}),soundOnPermission:!1,setSoundOnPermission:t=>e({soundOnPermission:t}),soundOnIdle:!1,setSoundOnIdle:t=>e({soundOnIdle:t}),yoloMode:!1,setYoloMode:t=>e({yoloMode:t}),commandPresets:tt,setCommandPresets:t=>e({commandPresets:t}),defaultPresetId:`claude`,setDefaultPresetId:t=>e({defaultPresetId:t}),updatePresetCommand:(n,r)=>{let{commandPresets:i}=t();e({commandPresets:i.map(e=>e.id===n?{...e,command:r.trim().slice(0,1024)}:e)})},addPreset:n=>{let{commandPresets:r}=t();if(r.length>=50){console.warn(`[agentboard:settings] Max presets reached`);return}let i=new Set(r.map(e=>e.id)),a={...rt({...n,id:``,isBuiltIn:!1}),id:at(i),isBuiltIn:!1};e({commandPresets:[...r,a]})},removePreset:n=>{let{commandPresets:r,defaultPresetId:i}=t(),a=r.find(e=>e.id===n);if(!a||a.isBuiltIn)return;let o=r.filter(e=>e.id!==n);e({commandPresets:o,defaultPresetId:n===i?ot(o,i):i})}}),{name:`agentboard-settings`,storage:Ue(()=>Je),version:8,migrate:(e,t)=>{let n=e;typeof n.historySessionsExpanded!=`boolean`&&typeof n.inactiveSessionsExpanded==`boolean`&&(n.historySessionsExpanded=n.inactiveSessionsExpanded),typeof n.hibernatingSessionsExpanded!=`boolean`&&typeof n.snoozedSessionsExpanded==`boolean`&&(n.hibernatingSessionsExpanded=n.snoozedSessionsExpanded);let r=e=>{if(typeof e.command==`string`)return e;let t=typeof e.baseCommand==`string`?e.baseCommand.trim():``,n=typeof e.modifiers==`string`?e.modifiers.trim():``,r=n?`${t} ${n}`:t;return{id:e.id,label:e.label,command:r||`claude`,isBuiltIn:e.isBuiltIn,agentType:e.agentType}};if(t===0||!Array.isArray(n.commandPresets)){let e=typeof n.defaultCommand==`string`?n.defaultCommand:`claude`,t=[...tt],r=`claude`;if(e===`codex`)r=`codex`;else if(e!==`claude`){let n={id:at(new Set(t.map(e=>e.id))),label:`Migrated`,command:e,isBuiltIn:!1};t.push(n),r=n.id}return console.info(`[agentboard:settings] Migrated from v0 to v2`),{...n,commandPresets:t,defaultPresetId:r,defaultCommand:e,recentPaths:[]}}let i=n.commandPresets.map(r).filter(nt);if(!(i.some(e=>e.id===`claude`)&&i.some(e=>e.id===`codex`))||i.length===0)return console.warn(`[agentboard:settings] Invalid presets, resetting to defaults`),{...n,commandPresets:tt,defaultPresetId:`claude`};let a=new Set(i.map(e=>e.id)),o=tt.filter(e=>e.isBuiltIn&&!a.has(e.id)),s=[...i,...o];return t<8&&console.info(`[agentboard:settings] Migrated from v${t} to v8`),{...n,commandPresets:s.map(rt),defaultPresetId:ot(s,n.defaultPresetId)}}}));function st(){let[e,t]=(0,C.useState)(W.persist.hasHydrated());return(0,C.useEffect)(()=>{let e=W.persist.onFinishHydration(()=>t(!0));return W.persist.hasHydrated()&&t(!0),e},[]),e}function ct(){if(typeof navigator>`u`)return!1;let e=navigator.userAgent,t=/iPad|iPhone|iPod/.test(e),n=navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;return t||n}function lt(){return typeof navigator>`u`?!1:ct()&&navigator.standalone===!0}function ut(){return typeof navigator>`u`?!1:navigator.platform.toUpperCase().indexOf(`MAC`)>=0}function dt(e){return e===`auto`?ut()?`ctrl-option`:`ctrl-shift`:e}var ft={"ctrl-option":`⌃⌥`,"ctrl-shift":`⌃⇧`,"cmd-option":`⌘⌥`,"cmd-shift":`⌘⇧`};function pt(e){return ft[e]}function mt(e,t){switch(t){case`ctrl-option`:return e.ctrlKey&&e.altKey&&!e.metaKey&&!e.shiftKey;case`ctrl-shift`:return e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey;case`cmd-option`:return e.metaKey&&e.altKey&&!e.ctrlKey&&!e.shiftKey;case`cmd-shift`:return e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey}}var G={pill:12,default:14,primary:16,key:18},ht=`relative flex h-7 w-7 shrink-0 items-center justify-center rounded-md border transition-all active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-40`,gt={neutral:`border-border text-secondary hover:bg-hover hover:text-primary`,active:`border-accent/40 bg-accent/20 text-accent hover:bg-accent/30`,danger:`border-danger/30 bg-danger/10 text-danger hover:bg-danger/20`,primary:`border-transparent bg-accent text-white hover:bg-accent/90`};function _t(e=`neutral`){return`${ht} ${gt[e]}`}var vt=_t(`neutral`);function yt(e=`neutral`,t=`flex`){return`${t} size-[44px] shrink-0 items-center justify-center rounded-md border transition-all active:scale-95 disabled:cursor-not-allowed disabled:opacity-40 ${e===`neutral`?`bg-surface `:``}${gt[e]}`}var bt=`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted hover:text-primary`,xt=`max-md:flex max-md:min-h-[44px] max-md:flex-col max-md:justify-center`,St=`[@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,Ct={connected:`bg-working`,connecting:`bg-approval`,reconnecting:`bg-approval`,disconnected:`bg-danger`},wt={connected:`Connected`,connecting:`Connecting`,reconnecting:`Reconnecting`,disconnected:`Disconnected`};function Tt({connectionStatus:e,tailscaleIp:t,placement:n=`down`}){let[r,i]=(0,C.useState)(!1),[a,o]=(0,C.useState)(!1),s=(0,C.useId)(),c=(0,C.useRef)(null),l=(0,C.useRef)(null),u=`Connection: ${wt[e]}`,d=(0,S.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${Ct[e]}`});return(0,C.useEffect)(()=>{if(!r||typeof document>`u`||!document.addEventListener||!document.removeEventListener)return;let e=e=>{let t=e.target;t&&c.current?.contains(t)||i(!1)},t=e=>{e.key===`Escape`&&i(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e,{passive:!0}),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,C.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]),t?(0,S.jsxs)(`div`,{ref:c,className:`flex shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,"aria-label":`${u}. Tailscale remote access`,"aria-haspopup":`dialog`,"aria-expanded":r,"aria-controls":r?s:void 0,title:`${wt[e]} - Tailscale ${t}`,onClick:()=>i(e=>!e),className:vt,children:d}),r&&(0,S.jsxs)(`div`,{id:s,role:`dialog`,"aria-label":`Remote access`,className:`absolute left-2 right-2 z-20 ${n===`up`?`bottom-full mb-1`:`top-full mt-1`} rounded border border-border bg-surface p-2 text-xs shadow-lg`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 px-1 pb-1.5 text-muted`,children:[d,(0,S.jsx)(`span`,{children:wt[e]}),(0,S.jsx)(`span`,{className:`ml-auto`,children:`Tailscale`})]}),(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{let e=`http://${t}:${window.location.port||`4040`}`;navigator.clipboard.writeText(e),o(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>o(!1),1500)},className:`flex w-full items-center justify-between gap-2 rounded px-1 py-1 text-left text-secondary hover:bg-hover hover:text-primary`,title:`Tailscale IP - click to copy remote access URL`,children:[(0,S.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:a?`Copied!`:t}),!a&&(0,S.jsx)(F,{width:G.default,height:G.default,className:`shrink-0`})]})]})]}):(0,S.jsx)(`span`,{role:`img`,"aria-label":u,title:u,className:`flex h-7 w-5 shrink-0 items-center justify-center`,children:d})}function Et({connectionStatus:e,onNewSession:t,onOpenSettings:n,tailscaleIp:r,placement:i=`down`}){let a=pt(dt(W(e=>e.shortcutModifier)));return(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,S.jsx)(Tt,{connectionStatus:e,tailscaleIp:r,placement:i}),(0,S.jsx)(`button`,{type:`button`,onClick:t,className:_t(`primary`),title:`New session (${a}N)`,"aria-label":`New session`,children:(0,S.jsx)(ke,{width:G.primary,height:G.primary})}),(0,S.jsx)(`button`,{type:`button`,onClick:n,className:vt,title:`Settings (${a},)`,"aria-label":`Settings`,children:(0,S.jsx)(je,{width:G.default,height:G.default})})]})}var Dt=(0,C.createContext)({});function Ot(e){let t=(0,C.useRef)(null);return t.current===null&&(t.current=e()),t.current}var kt=typeof window<`u`,At=kt?C.useLayoutEffect:C.useEffect,jt=(0,C.createContext)(null);function Mt(e,t){e.indexOf(t)===-1&&e.push(t)}function Nt(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var Pt=(e,t,n)=>n>t?t:n<e?e:n,Ft={},It=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function Lt(e){return typeof e==`object`&&!!e}var Rt=e=>/^0[^.\s]+$/u.test(e);function zt(e){let t;return()=>(t===void 0&&(t=e()),t)}var Bt=e=>e,Vt=(e,t)=>n=>t(e(n)),Ht=(...e)=>e.reduce(Vt),Ut=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Wt=class{constructor(){this.subscriptions=[]}add(e){return Mt(this.subscriptions,e),()=>Nt(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},Gt=e=>e*1e3,Kt=e=>e/1e3;function qt(e,t){return t?1e3/t*e:0}var Jt=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Yt=1e-7,Xt=12;function Zt(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Jt(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Yt&&++s<Xt);return o}function Qt(e,t,n,r){if(e===t&&n===r)return Bt;let i=t=>Zt(t,0,1,e,n);return e=>e===0||e===1?e:Jt(i(e),t,r)}var $t=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,en=e=>t=>1-e(1-t),tn=Qt(.33,1.53,.69,.99),nn=en(tn),rn=$t(nn),an=e=>(e*=2)<1?.5*nn(e):.5*(2-2**(-10*(e-1))),on=e=>1-Math.sin(Math.acos(e)),sn=en(on),cn=$t(on),ln=Qt(.42,0,1,1),un=Qt(0,0,.58,1),dn=Qt(.42,0,.58,1),fn=e=>Array.isArray(e)&&typeof e[0]!=`number`,pn=e=>Array.isArray(e)&&typeof e[0]==`number`,mn={linear:Bt,easeIn:ln,easeInOut:dn,easeOut:un,circIn:on,circInOut:cn,circOut:sn,backIn:nn,backInOut:rn,backOut:tn,anticipate:an},hn=e=>typeof e==`string`,gn=e=>{if(pn(e)){e.length;let[t,n,r,i]=e;return Qt(t,n,r,i)}else if(hn(e))return mn[e],`${e}`,mn[e];return e},_n=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`],vn={value:null,addProjectionMetrics:null};function yn(e,t){let n=new Set,r=new Set,i=!1,a=!1,o=new WeakSet,s={delta:0,timestamp:0,isProcessing:!1},c=0;function l(t){o.has(t)&&(u.schedule(t),e()),c++,t(s)}let u={schedule:(e,t=!1,a=!1)=>{let s=a&&i?n:r;return t&&o.add(e),s.has(e)||s.add(e),e},cancel:e=>{r.delete(e),o.delete(e)},process:e=>{if(s=e,i){a=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),t&&vn.value&&vn.value.frameloop[t].push(c),c=0,n.clear(),i=!1,a&&(a=!1,u.process(e))}};return u}var bn=40;function xn(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=_n.reduce((e,n)=>(e[n]=yn(a,t?n:void 0),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=Ft.useManualTiming?i.timestamp:performance.now();n=!1,Ft.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,bn),1)),i.timestamp=a,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:_n.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<_n.length;t++)o[_n[t]].cancel(e)},state:i,steps:o}}var{schedule:Sn,cancel:Cn,state:wn,steps:Tn}=xn(typeof requestAnimationFrame<`u`?requestAnimationFrame:Bt,!0),En;function Dn(){En=void 0}var On={now:()=>(En===void 0&&On.set(wn.isProcessing||Ft.useManualTiming?wn.timestamp:performance.now()),En),set:e=>{En=e,queueMicrotask(Dn)}},kn={layout:0,mainThread:0,waapi:0},An=e=>t=>typeof t==`string`&&t.startsWith(e),jn=An(`--`),Mn=An(`var(--`),Nn=e=>Mn(e)?Pn.test(e.split(`/*`)[0].trim()):!1,Pn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Fn(e){return typeof e==`string`?e.split(`/*`)[0].includes(`var(--`):!1}var In={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Ln={...In,transform:e=>Pt(0,1,e)},Rn={...In,default:1},zn=e=>Math.round(e*1e5)/1e5,Bn=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Vn(e){return e==null}var Hn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Un=(e,t)=>n=>!!(typeof n==`string`&&Hn.test(n)&&n.startsWith(e)||t&&!Vn(n)&&Object.prototype.hasOwnProperty.call(n,t)),Wn=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(Bn);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},Gn=e=>Pt(0,255,e),Kn={...In,transform:e=>Math.round(Gn(e))},qn={test:Un(`rgb`,`red`),parse:Wn(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Kn.transform(e)+`, `+Kn.transform(t)+`, `+Kn.transform(n)+`, `+zn(Ln.transform(r))+`)`};function Jn(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Yn={test:Un(`#`),parse:Jn,transform:qn.transform},Xn=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Zn=Xn(`deg`),Qn=Xn(`%`),K=Xn(`px`),$n=Xn(`vh`),er=Xn(`vw`),tr={...Qn,parse:e=>Qn.parse(e)/100,transform:e=>Qn.transform(e*100)},nr={test:Un(`hsl`,`hue`),parse:Wn(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Qn.transform(zn(t))+`, `+Qn.transform(zn(n))+`, `+zn(Ln.transform(r))+`)`},rr={test:e=>qn.test(e)||Yn.test(e)||nr.test(e),parse:e=>qn.test(e)?qn.parse(e):nr.test(e)?nr.parse(e):Yn.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?qn.transform(e):nr.transform(e),getAnimatableNone:e=>{let t=rr.parse(e);return t.alpha=0,rr.transform(t)}},ir=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function ar(e){return isNaN(e)&&typeof e==`string`&&(e.match(Bn)?.length||0)+(e.match(ir)?.length||0)>0}var or=`number`,sr=`color`,cr=`var`,lr=`var(`,ur="${}",dr=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function fr(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(dr,e=>(rr.test(e)?(r.color.push(a),i.push(sr),n.push(rr.parse(e))):e.startsWith(lr)?(r.var.push(a),i.push(cr),n.push(e)):(r.number.push(a),i.push(or),n.push(parseFloat(e))),++a,ur)).split(ur),indexes:r,types:i}}function pr(e){return fr(e).values}function mr(e){let{split:t,types:n}=fr(e),r=t.length;return e=>{let i=``;for(let a=0;a<r;a++)if(i+=t[a],e[a]!==void 0){let t=n[a];t===or?i+=zn(e[a]):t===sr?i+=rr.transform(e[a]):i+=e[a]}return i}}var hr=e=>typeof e==`number`?0:rr.test(e)?rr.getAnimatableNone(e):e;function gr(e){let t=pr(e);return mr(e)(t.map(hr))}var _r={test:ar,parse:pr,createTransformer:mr,getAnimatableNone:gr};function vr(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yr({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=vr(s,r,e+1/3),a=vr(s,r,e),o=vr(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function br(e,t){return n=>n>0?t:e}var xr=(e,t,n)=>e+(t-e)*n,Sr=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Cr=[Yn,qn,nr],wr=e=>Cr.find(t=>t.test(e));function Tr(e){let t=wr(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===nr&&(n=yr(n)),n}var Er=(e,t)=>{let n=Tr(e),r=Tr(t);if(!n||!r)return br(e,t);let i={...n};return e=>(i.red=Sr(n.red,r.red,e),i.green=Sr(n.green,r.green,e),i.blue=Sr(n.blue,r.blue,e),i.alpha=xr(n.alpha,r.alpha,e),qn.transform(i))},Dr=new Set([`none`,`hidden`]);function Or(e,t){return Dr.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function kr(e,t){return n=>xr(e,t,n)}function Ar(e){return typeof e==`number`?kr:typeof e==`string`?Nn(e)?br:rr.test(e)?Er:Pr:Array.isArray(e)?jr:typeof e==`object`?rr.test(e)?Er:Mr:br}function jr(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>Ar(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function Mr(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Ar(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function Nr(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var Pr=(e,t)=>{let n=_r.createTransformer(t),r=fr(e),i=fr(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Dr.has(e)&&!i.values.length||Dr.has(t)&&!r.values.length?Or(e,t):Ht(jr(Nr(r,i),i.values),n):(`${e}${t}`,br(e,t))};function Fr(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?xr(e,t,n):Ar(e)(e,t)}var Ir=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Sn.update(t,e),stop:()=>Cn(t),now:()=>wn.isProcessing?wn.timestamp:On.now()}},Lr=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},Rr=2e4;function zr(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function Br(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(zr(r),Rr);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Kt(i)}}var Vr=5;function Hr(e,t,n){let r=Math.max(t-Vr,0);return qt(n-e(r),t-r)}var Ur={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},Wr=.001;function Gr({duration:e=Ur.duration,bounce:t=Ur.bounce,velocity:n=Ur.velocity,mass:r=Ur.mass}){let i,a;Ur.maxDuration;let o=1-t;o=Pt(Ur.minDamping,Ur.maxDamping,o),e=Pt(Ur.minDuration,Ur.maxDuration,Kt(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=Jr(t,o),c=Math.exp(-i);return Wr-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=Jr(t**2,o);return(-i(t)+Wr>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-Wr+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=qr(i,a,s);if(e=Gt(e),isNaN(c))return{stiffness:Ur.stiffness,damping:Ur.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Kr=12;function qr(e,t,n){let r=n;for(let n=1;n<Kr;n++)r-=e(r)/t(r);return r}function Jr(e,t){return e*Math.sqrt(1-t*t)}var Yr=[`duration`,`bounce`],Xr=[`stiffness`,`damping`,`mass`];function Zr(e,t){return t.some(t=>e[t]!==void 0)}function Qr(e){let t={velocity:Ur.velocity,stiffness:Ur.stiffness,damping:Ur.damping,mass:Ur.mass,isResolvedFromDuration:!1,...e};if(!Zr(e,Xr)&&Zr(e,Yr))if(e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Pt(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Ur.mass,stiffness:i,damping:a}}else{let n=Gr(e);t={...t,...n,mass:Ur.mass},t.isResolvedFromDuration=!0}return t}function $r(e=Ur.visualDuration,t=Ur.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Qr({...n,velocity:-Kt(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Kt(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?Ur.restSpeed.granular:Ur.restSpeed.default,i||=v?Ur.restDelta.granular:Ur.restDelta.default;let y;if(h<1){let e=Jr(_,h);y=t=>o-Math.exp(-h*_*t)*((m+h*_*g)/e*Math.sin(e*t)+g*Math.cos(e*t))}else if(h===1)y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e}}let b={calculatedDuration:p&&d||null,next:e=>{let t=y(e);if(p)s.done=e>=d;else{let n=e===0?m:0;h<1&&(n=e===0?Gt(m):Hr(y,e,t));let a=Math.abs(n)<=r,c=Math.abs(o-t)<=i;s.done=a&&c}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(zr(b),Rr),t=Lr(t=>b.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return b}$r.applyToOptions=e=>{let t=Br(e,100,$r);return e.ease=t.ease,e.duration=Gt(t.duration),e.type=`keyframes`,e};function ei({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=$r({keyframes:[f.value,m(f.value)],velocity:Hr(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function ti(e,t,n){let r=[],i=n||Ft.mix||Fr,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=Ht(Array.isArray(t)?t[n]||Bt:t,a)),r.push(a)}return r}function ni(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=ti(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=Ut(e[r],e[r+1],n);return s[r](i)};return n?t=>l(Pt(e[0],e[a-1],t)):l}function ri(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Ut(0,t,r);e.push(xr(n,1,i))}}function ii(e){let t=[0];return ri(t,e.length-1),t}function ai(e,t){return e.map(e=>e*t)}function oi(e,t){return e.map(()=>t||dn).splice(0,e.length-1)}function si({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=fn(r)?r.map(gn):gn(r),a={done:!1,value:t[0]},o=ni(ai(n&&n.length===t.length?n:ii(t),e),t,{ease:Array.isArray(i)?i:oi(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var ci=e=>e!==null;function li(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(ci),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var ui={decay:ei,inertia:ei,tween:si,keyframes:si,spring:$r};function di(e){typeof e.type==`string`&&(e.type=ui[e.type])}var fi=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},pi=e=>e/100,mi=class extends fi{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==On.now()&&this.tick(On.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},kn.mainThread++,this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;di(e);let{type:t=si,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||si;s!==si&&typeof o[0]!=`number`&&(this.mixKeyframes=Ht(pi,Fr(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=zr(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=Pt(0,1,n)*o}let b=_?{done:!1,value:l[0]}:y.next(v);i&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==ei&&(b.value=li(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return Kt(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Kt(e)}get time(){return Kt(this.currentTime)}set time(e){e=Gt(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(On.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Kt(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=Ir,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(On.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null,kn.mainThread--}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function hi(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var gi=e=>e*180/Math.PI,_i=e=>yi(gi(Math.atan2(e[1],e[0]))),vi={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:_i,rotateZ:_i,skewX:e=>gi(Math.atan(e[1])),skewY:e=>gi(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},yi=e=>(e%=360,e<0&&(e+=360),e),bi=_i,xi=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Si=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Ci={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:xi,scaleY:Si,scale:e=>(xi(e)+Si(e))/2,rotateX:e=>yi(gi(Math.atan2(e[6],e[5]))),rotateY:e=>yi(gi(Math.atan2(-e[2],e[0]))),rotateZ:bi,rotate:bi,skewX:e=>gi(Math.atan(e[4])),skewY:e=>gi(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function wi(e){return+!!e.includes(`scale`)}function Ti(e,t){if(!e||e===`none`)return wi(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Ci,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=vi,i=t}if(!i)return wi(t);let a=r[t],o=i[1].split(`,`).map(Di);return typeof a==`function`?a(o):o[a]}var Ei=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return Ti(n,t)};function Di(e){return parseFloat(e.trim())}var Oi=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],ki=new Set(Oi),Ai=e=>e===In||e===K,ji=new Set([`x`,`y`,`z`]),Mi=Oi.filter(e=>!ji.has(e));function Ni(e){let t=[];return Mi.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var Pi={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>Ti(t,`x`),y:(e,{transform:t})=>Ti(t,`y`)};Pi.translateX=Pi.x,Pi.translateY=Pi.y;var Fi=new Set,Ii=!1,Li=!1,Ri=!1;function zi(){if(Li){let e=Array.from(Fi).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=Ni(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}Li=!1,Ii=!1,Fi.forEach(e=>e.complete(Ri)),Fi.clear()}function Bi(){Fi.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(Li=!0)})}function Vi(){Ri=!0,Bi(),zi(),Ri=!1}var Hi=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(Fi.add(this),Ii||(Ii=!0,Sn.read(Bi),Sn.resolveKeyframes(zi))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}hi(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Fi.delete(this)}cancel(){this.state===`scheduled`&&(Fi.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},Ui=e=>e.startsWith(`--`);function Wi(e,t,n){Ui(t)?e.style.setProperty(t,n):e.style[t]=n}var Gi=zt(()=>window.ScrollTimeline!==void 0),Ki={};function qi(e,t){let n=zt(e);return()=>Ki[t]??n()}var Ji=qi(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),Yi=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Xi={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:Yi([0,.65,.55,1]),circOut:Yi([.55,0,1,.45]),backIn:Yi([.31,.01,.66,-.59]),backOut:Yi([.33,1.53,.69,.99])};function Zi(e,t){if(e)return typeof e==`function`?Ji()?Lr(e,t):`ease-out`:pn(e)?Yi(e):Array.isArray(e)?e.map(e=>Zi(e,t)||Xi.easeOut):Xi[e]}function Qi(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=Zi(s,i);Array.isArray(d)&&(u.easing=d),vn.value&&kn.waapi++;let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};l&&(f.pseudoElement=l);let p=e.animate(u,f);return vn.value&&p.finished.finally(()=>{kn.waapi--}),p}function $i(e){return typeof e==`function`&&`applyToOptions`in e}function ea({type:e,...t}){return $i(e)&&Ji()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var ta=class extends fi{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=ea(e);this.animation=Qi(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=li(r,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(e):Wi(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return Kt(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Kt(e)}get time(){return Kt(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Gt(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&Gi()?(this.animation.timeline=e,Bt):t(this)}},na={anticipate:an,backInOut:rn,circInOut:cn};function ra(e){return e in na}function ia(e){typeof e.ease==`string`&&ra(e.ease)&&(e.ease=na[e.ease])}var aa=10,oa=class extends ta{constructor(e){ia(e),di(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new mi({...a,autoplay:!1}),s=Math.max(aa,On.now()-this.startTime),c=Pt(0,aa,s-aa);t.setWithVelocity(o.sample(Math.max(0,s-c)).value,o.sample(s).value,c),o.stop()}},sa=(e,t)=>t===`zIndex`?!1:!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(_r.test(e)||e===`0`)&&!e.startsWith(`url(`));function ca(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function la(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=sa(i,t),s=sa(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:ca(e)||(n===`spring`||$i(n))&&r}function ua(e){e.duration=0,e.type=`keyframes`}var da=new Set([`opacity`,`clipPath`,`filter`,`transform`]),fa=zt(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function pa(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:s,transformTemplate:c}=t.owner.getProps();return fa()&&n&&da.has(n)&&(n!==`transform`||!c)&&!s&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var ma=40,ha=class extends fi{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=On.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u};this.keyframeResolver=new(l?.KeyframeResolver||Hi)(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=On.now(),la(e,i,a,o)||((Ft.instantAnimations||!s)&&l?.(li(e,n,t)),e[0]=e[e.length-1],ua(n),n.repeat=0);let u={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>ma?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},d=!c&&pa(u)?new oa({...u,element:u.motionValue.owner.current}):new mi(u);d.finished.then(()=>this.notifyFinished()).catch(Bt),this.pendingTimeline&&=(this.stopTimeline=d.attachTimeline(this.pendingTimeline),void 0),this._animation=d}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),Vi()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}},ga=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function _a(e){let t=ga.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function va(e,t,n=1){`${e}`;let[r,i]=_a(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return It(e)?parseFloat(e):e}return Nn(i)?va(i,t,n+1):i}function ya(e,t){return e?.[t]??e?.default??e}var ba=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...Oi]),xa={test:e=>e===`auto`,parse:e=>e},Sa=e=>t=>t.test(e),Ca=[In,K,Qn,Zn,er,$n,xa],wa=e=>Ca.find(Sa(e));function Ta(e){return typeof e==`number`?e===0:e===null?!0:e===`none`||e===`0`||Rt(e)}var Ea=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Da(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(Bn)||[];if(!r)return e;let i=n.replace(r,``),a=+!!Ea.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Oa=/\b([a-z-]*)\(.*?\)/gu,ka={..._r,getAnimatableNone:e=>{let t=e.match(Oa);return t?t.map(Da).join(` `):e}},Aa={...In,transform:Math.round},ja={borderWidth:K,borderTopWidth:K,borderRightWidth:K,borderBottomWidth:K,borderLeftWidth:K,borderRadius:K,radius:K,borderTopLeftRadius:K,borderTopRightRadius:K,borderBottomRightRadius:K,borderBottomLeftRadius:K,width:K,maxWidth:K,height:K,maxHeight:K,top:K,right:K,bottom:K,left:K,inset:K,insetBlock:K,insetBlockStart:K,insetBlockEnd:K,insetInline:K,insetInlineStart:K,insetInlineEnd:K,padding:K,paddingTop:K,paddingRight:K,paddingBottom:K,paddingLeft:K,paddingBlock:K,paddingBlockStart:K,paddingBlockEnd:K,paddingInline:K,paddingInlineStart:K,paddingInlineEnd:K,margin:K,marginTop:K,marginRight:K,marginBottom:K,marginLeft:K,marginBlock:K,marginBlockStart:K,marginBlockEnd:K,marginInline:K,marginInlineStart:K,marginInlineEnd:K,backgroundPositionX:K,backgroundPositionY:K,rotate:Zn,rotateX:Zn,rotateY:Zn,rotateZ:Zn,scale:Rn,scaleX:Rn,scaleY:Rn,scaleZ:Rn,skew:Zn,skewX:Zn,skewY:Zn,distance:K,translateX:K,translateY:K,translateZ:K,x:K,y:K,z:K,perspective:K,transformPerspective:K,opacity:Ln,originX:tr,originY:tr,originZ:K,zIndex:Aa,fillOpacity:Ln,strokeOpacity:Ln,numOctaves:Aa},Ma={...ja,color:rr,backgroundColor:rr,outlineColor:rr,fill:rr,stroke:rr,borderColor:rr,borderTopColor:rr,borderRightColor:rr,borderBottomColor:rr,borderLeftColor:rr,filter:ka,WebkitFilter:ka},Na=e=>Ma[e];function Pa(e,t){let n=Na(e);return n!==ka&&(n=_r),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Fa=new Set([`auto`,`none`,`0`]);function Ia(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Fa.has(t)&&fr(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Pa(n,i)}var La=class extends Hi{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),Nn(r))){let i=va(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!ba.has(n)||e.length!==2)return;let[r,i]=e,a=wa(r),o=wa(i);if(Fn(r)!==Fn(i)&&Pi[n]){this.needsMeasurement=!0;return}if(a!==o)if(Ai(a)&&Ai(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else Pi[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Ta(e[t]))&&n.push(t);n.length&&Ia(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Pi[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=Pi[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}};function Ra(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}var za=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function Ba(e){return Lt(e)&&`offsetHeight`in e}var Va=30,Ha=e=>!isNaN(parseFloat(e)),Ua={current:void 0},Wa=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=On.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=On.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Ha(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new Wt);let n=this.events[e].add(t);return e===`change`?()=>{n(),Sn.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Ua.current&&Ua.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=On.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Va)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Va);return qt(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Ga(e,t){return new Wa(e,t)}var{schedule:Ka,cancel:qa}=xn(queueMicrotask,!1),Ja={x:!1,y:!1};function Ya(){return Ja.x||Ja.y}function Xa(e){return e===`x`||e===`y`?Ja[e]?null:(Ja[e]=!0,()=>{Ja[e]=!1}):Ja.x||Ja.y?null:(Ja.x=Ja.y=!0,()=>{Ja.x=Ja.y=!1})}function Za(e,t){let n=Ra(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function Qa(e){return!(e.pointerType===`touch`||Ya())}function $a(e,t,n={}){let[r,i,a]=Za(e,n),o=e=>{if(!Qa(e))return;let{target:n}=e,r=t(n,e);if(typeof r!=`function`||!n)return;let a=e=>{Qa(e)&&(r(e),n.removeEventListener(`pointerleave`,a))};n.addEventListener(`pointerleave`,a,i)};return r.forEach(e=>{e.addEventListener(`pointerenter`,o,i)}),a}var eo=(e,t)=>t?e===t?!0:eo(e,t.parentElement):!1,to=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,no=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function ro(e){return no.has(e.tagName)||e.isContentEditable===!0}var io=new WeakSet;function ao(e){return t=>{t.key===`Enter`&&e(t)}}function oo(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var so=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=ao(()=>{if(io.has(n))return;oo(n,`down`);let e=ao(()=>{oo(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>oo(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function co(e){return to(e)&&!Ya()}function lo(e,t,n={}){let[r,i,a]=Za(e,n),o=e=>{let r=e.currentTarget;if(!co(e))return;io.add(r);let a=t(r,e),o=(e,t)=>{window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,c),io.has(r)&&io.delete(r),co(e)&&typeof a==`function`&&a(e,{success:t})},s=e=>{o(e,r===window||r===document||n.useGlobalTarget||eo(r,e.target))},c=e=>{o(e,!1)};window.addEventListener(`pointerup`,s,i),window.addEventListener(`pointercancel`,c,i)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),Ba(e)&&(e.addEventListener(`focus`,e=>so(e,i)),!ro(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function uo(e){return Lt(e)&&`ownerSVGElement`in e}function fo(e){return uo(e)&&e.tagName===`svg`}var po=e=>!!(e&&e.getVelocity),mo=[...Ca,rr,_r],ho=e=>mo.find(Sa(e)),go=(0,C.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function _o(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function vo(...e){return t=>{let n=!1,r=e.map(e=>{let r=_o(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():_o(e[t],null)}}}}function yo(...e){return C.useCallback(vo(...e),e)}var bo=class extends C.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,n=Ba(e)&&e.offsetWidth||0,r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft,r.right=n-r.width-r.left}return null}componentDidUpdate(){}render(){return this.props.children}};function xo({children:e,isPresent:t,anchorX:n,root:r}){let i=(0,C.useId)(),a=(0,C.useRef)(null),o=(0,C.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:s}=(0,C.useContext)(go),c=yo(a,e.props?.ref??e?.ref);return(0,C.useInsertionEffect)(()=>{let{width:e,height:c,top:l,left:u,right:d}=o.current;if(t||!a.current||!e||!c)return;let f=n===`left`?`left: ${u}`:`right: ${d}`;a.current.dataset.motionPopId=i;let p=document.createElement(`style`);s&&(p.nonce=s);let m=r??document.head;return m.appendChild(p),p.sheet&&p.sheet.insertRule(`
|
|
9
9
|
[data-motion-pop-id="${i}"] {
|
|
10
10
|
position: absolute !important;
|
|
11
11
|
width: ${e}px !important;
|
|
@@ -193,7 +193,7 @@ ${s.join(`
|
|
|
193
193
|
`)),e.length=0)},3e3),XU=new FinalizationRegistry(t=>{typeof t==`string`&&e.push(t)})}var ZU=class{constructor(e){this._size=0,this._options=e,this._leakageMon=BU>0||this._options?.leakWarningThreshold?new HU(e?.onListenerError??tU,this._options?.leakWarningThreshold??BU):void 0,this._perfMon=this._options?._profName?new zU(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){if(!this._disposed){if(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners){if(FU){let e=this._listeners;queueMicrotask(()=>{YU(e,e=>e.stack?.print())})}this._listeners=void 0,this._size=0}this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose()}}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new GU(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||tU)(n),kU.None}if(this._disposed)return kU.None;t&&(e=e.bind(t));let r=new qU(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=UU.create(),i=this._leakageMon.check(r.stack,this._size+1)),FU&&(r.stack=UU.create()),this._listeners?this._listeners instanceof qU?(this._deliveryQueue??=new QU,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=EU(()=>{XU?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof OU?n.add(a):Array.isArray(n)&&n.push(a),XU){let e=Error().stack.split(`
|
|
194
194
|
`).slice(2,3).join(`
|
|
195
195
|
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);XU.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*JU<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||tU;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof qU)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},QU=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},$U=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),eW;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof tW?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:LU.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:$U})})(eW||={});var tW=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?$U:(this._emitter||=new ZU,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},nW=`en`,rW=!1,iW=!1,aW=nW,oW,sW=globalThis,cW;typeof sW.vscode<`u`&&typeof sW.vscode.process<`u`?cW=sW.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(cW=process);var lW=typeof cW?.versions?.electron==`string`&&cW?.type===`renderer`;if(typeof cW==`object`){cW.platform,cW.platform,rW=cW.platform===`linux`,rW&&cW.env.SNAP&&cW.env.SNAP_REVISION,cW.env.CI||cW.env.BUILD_ARTIFACTSTAGINGDIRECTORY,aW=nW;let e=cW.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,aW=t.resolvedLanguage||nW,t.languagePack?.translationsConfigFile}catch{}}else typeof navigator==`object`&&!lW?(oW=navigator.userAgent,oW.indexOf(`Windows`),oW.indexOf(`Macintosh`),(oW.indexOf(`Macintosh`)>=0||oW.indexOf(`iPad`)>=0||oW.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,rW=oW.indexOf(`Linux`)>=0,oW?.indexOf(`Mobi`),iW=!0,aW=globalThis._VSCODE_NLS_LANGUAGE||nW,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);iW&&typeof sW.importScripts==`function`&&sW.origin;var uW=oW,dW=aW,fW;(e=>{function t(){return dW}e.value=t;function n(){return dW.length===2?dW===`en`:dW.length>=3?dW[0]===`e`&&dW[1]===`n`&&dW[2]===`-`:!1}e.isDefaultVariant=n;function r(){return dW===`en`}e.isDefault=r})(fW||={});var pW=typeof sW.postMessage==`function`&&!sW.importScripts;(()=>{if(pW){let e=[];sW.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),sW.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var mW=!!(uW&&uW.indexOf(`Chrome`)>=0);uW&&uW.indexOf(`Firefox`),!mW&&uW&&uW.indexOf(`Safari`),uW&&uW.indexOf(`Edg/`),uW&&uW.indexOf(`Android`);function hW(e,t=0,n){let r=setTimeout(()=>{e(),n&&i.dispose()},t),i=EU(()=>{clearTimeout(r),n?.deleteAndLeak(i)});return n?.add(i),i}(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var gW;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(gW||={});var _W=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new ZU,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await LU.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};_W.EMPTY=_W.fromArray([]);var vW=class extends kU{constructor(e){super(),this._terminal=e,this._linesCacheTimeout=this._register(new AU),this._linesCacheDisposables=this._register(new AU),this._register(EU(()=>this._destroyLinesCache()))}initLinesCache(){this._linesCache||(this._linesCache=Array(this._terminal.buffer.active.length),this._linesCacheDisposables.value=TU(this._terminal.onLineFeed(()=>this._destroyLinesCache()),this._terminal.onCursorMove(()=>this._destroyLinesCache()),this._terminal.onResize(()=>this._destroyLinesCache()))),this._linesCacheTimeout.value=hW(()=>this._destroyLinesCache(),15e3)}_destroyLinesCache(){this._linesCache=void 0,this._linesCacheDisposables.clear(),this._linesCacheTimeout.clear()}getLineFromCache(e){return this._linesCache?.[e]}setLineInCache(e,t){this._linesCache&&(this._linesCache[e]=t)}translateBufferLineToStringWithWrap(e,t){let n=[],r=[0],i=this._terminal.buffer.active.getLine(e);for(;i;){let a=this._terminal.buffer.active.getLine(e+1),o=a?a.isWrapped:!1,s=i.translateToString(!o&&t);if(o&&a){let e=i.getCell(i.length-1);e&&e.getCode()===0&&e.getWidth()===1&&a.getCell(0)?.getWidth()===2&&(s=s.slice(0,-1))}if(n.push(s),o)r.push(r[r.length-1]+s.length);else break;e++,i=a}return[n.join(``),r]}},yW=class{get cachedSearchTerm(){return this._cachedSearchTerm}set cachedSearchTerm(e){this._cachedSearchTerm=e}get lastSearchOptions(){return this._lastSearchOptions}set lastSearchOptions(e){this._lastSearchOptions=e}isValidSearchTerm(e){return!!(e&&e.length>0)}didOptionsChange(e){return this._lastSearchOptions?e?this._lastSearchOptions.caseSensitive!==e.caseSensitive||this._lastSearchOptions.regex!==e.regex||this._lastSearchOptions.wholeWord!==e.wholeWord:!1:!0}shouldUpdateHighlighting(e,t){return t?.decorations?this._cachedSearchTerm===void 0||e!==this._cachedSearchTerm||this.didOptionsChange(t):!1}clearCachedTerm(){this._cachedSearchTerm=void 0}reset(){this._cachedSearchTerm=void 0,this._lastSearchOptions=void 0}},bW=class{constructor(e,t){this._terminal=e,this._lineCache=t}find(e,t,n,r){if(!e||e.length===0){this._terminal.clearSelection();return}if(n>this._terminal.cols)throw Error(`Invalid col: ${n} to search in terminal of ${this._terminal.cols} cols`);this._lineCache.initLinesCache();let i={startRow:t,startCol:n},a=this._findInLine(e,i,r);if(!a)for(let n=t+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(i.startRow=n,i.startCol=0,a=this._findInLine(e,i,r),!a);n++);return a}findNextWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=0,a=0;r&&(n===e?(i=r.end.x,a=r.end.y):(i=r.start.x,a=r.start.y)),this._lineCache.initLinesCache();let o={startRow:a,startCol:i},s=this._findInLine(e,o,t);if(!s)for(let n=a+1;n<this._terminal.buffer.active.baseY+this._terminal.rows&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);if(!s&&a!==0)for(let n=0;n<a&&(o.startRow=n,o.startCol=0,s=this._findInLine(e,o,t),!s);n++);return!s&&r&&(o.startRow=r.start.y,o.startCol=0,s=this._findInLine(e,o,t)),s}findPreviousWithSelection(e,t,n){if(!e||e.length===0){this._terminal.clearSelection();return}let r=this._terminal.getSelectionPosition();this._terminal.clearSelection();let i=this._terminal.buffer.active.baseY+this._terminal.rows-1,a=this._terminal.cols;this._lineCache.initLinesCache();let o={startRow:i,startCol:a},s;if(r&&(o.startRow=i=r.start.y,o.startCol=a=r.start.x,n!==e&&(s=this._findInLine(e,o,t,!1),s||(o.startRow=i=r.end.y,o.startCol=a=r.end.x))),s||=this._findInLine(e,o,t,!0),!s){o.startCol=Math.max(o.startCol,this._terminal.cols);for(let n=i-1;n>=0&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);}if(!s&&i!==this._terminal.buffer.active.baseY+this._terminal.rows-1)for(let n=this._terminal.buffer.active.baseY+this._terminal.rows-1;n>=i&&(o.startRow=n,s=this._findInLine(e,o,t,!0),!s);n--);return s}_isWholeWord(e,t,n){return(e===0||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e-1]))&&(e+n.length===t.length||` ~!@#$%^&*()+\`-=[]{}|\\;:"',./<>?`.includes(t[e+n.length]))}_findInLine(e,t,n={},r=!1){let i=t.startRow,a=t.startCol;if(this._terminal.buffer.active.getLine(i)?.isWrapped){if(r){t.startCol+=this._terminal.cols;return}return t.startRow--,t.startCol+=this._terminal.cols,this._findInLine(e,t,n)}let o=this._lineCache.getLineFromCache(i);o||(o=this._lineCache.translateBufferLineToStringWithWrap(i,!0),this._lineCache.setLineInCache(i,o));let[s,c]=o,l=this._bufferColsToStringOffset(i,a),u=e,d=s;n.regex||(u=n.caseSensitive?e:e.toLowerCase(),d=n.caseSensitive?s:s.toLowerCase());let f=-1;if(n.regex){let t=RegExp(u,n.caseSensitive?`g`:`gi`),i;if(r)for(;i=t.exec(d.slice(0,l));)f=t.lastIndex-i[0].length,e=i[0],t.lastIndex-=e.length-1;else i=t.exec(d.slice(l)),i&&i[0].length>0&&(f=l+(t.lastIndex-i[0].length),e=i[0])}else r?l-u.length>=0&&(f=d.lastIndexOf(u,l-u.length)):f=d.indexOf(u,l);if(f>=0){if(n.wholeWord&&!this._isWholeWord(f,d,e))return;let t=0;for(;t<c.length-1&&f>=c[t+1];)t++;let r=t;for(;r<c.length-1&&f+e.length>=c[r+1];)r++;let a=f-c[t],o=f+e.length-c[r],s=this._stringLengthToBufferSize(i+t,a),l=this._stringLengthToBufferSize(i+r,o)-s+this._terminal.cols*(r-t);return{term:e,col:s,row:i+t,size:l}}}_stringLengthToBufferSize(e,t){let n=this._terminal.buffer.active.getLine(e);if(!n)return 0;for(let e=0;e<t;e++){let r=n.getCell(e);if(!r)break;let i=r.getChars();i.length>1&&(t-=i.length-1);let a=n.getCell(e+1);a&&a.getWidth()===0&&t++}return t}_bufferColsToStringOffset(e,t){let n=e,r=0,i=this._terminal.buffer.active.getLine(n);for(;t>0&&i;){for(let e=0;e<t&&e<this._terminal.cols;e++){let t=i.getCell(e);if(!t)break;t.getWidth()&&(r+=t.getCode()===0?1:t.getChars().length)}if(n++,i=this._terminal.buffer.active.getLine(n),i&&!i.isWrapped)break;t-=this._terminal.cols}return r}},xW=class extends kU{constructor(e){super(),this._terminal=e,this._highlightDecorations=[],this._highlightedLines=new Set,this._register(EU(()=>this.clearHighlightDecorations()))}createHighlightDecorations(e,t){this.clearHighlightDecorations();for(let n of e){let e=this._createResultDecorations(n,t,!1);if(e)for(let t of e)this._storeDecoration(t,n)}}createActiveDecoration(e,t){let n=this._createResultDecorations(e,t,!0);if(n)return{decorations:n,match:e,dispose(){wU(n)}}}clearHighlightDecorations(){wU(this._highlightDecorations),this._highlightDecorations=[],this._highlightedLines.clear()}_storeDecoration(e,t){this._highlightedLines.add(e.marker.line),this._highlightDecorations.push({decoration:e,match:t,dispose(){e.dispose()}})}_applyStyles(e,t,n){e.classList.contains(`xterm-find-result-decoration`)||(e.classList.add(`xterm-find-result-decoration`),t&&(e.style.outline=`1px solid ${t}`)),n&&e.classList.add(`xterm-find-active-result-decoration`)}_createResultDecorations(e,t,n){let r=[],i=e.col,a=e.size,o=-this._terminal.buffer.active.baseY-this._terminal.buffer.active.cursorY+e.row;for(;a>0;){let e=Math.min(this._terminal.cols-i,a);r.push([o,i,e]),i=0,a-=e,o++}let s=[];for(let e of r){let r=this._terminal.registerMarker(e[0]),i=this._terminal.registerDecoration({marker:r,x:e[1],width:e[2],backgroundColor:n?t.activeMatchBackground:t.matchBackground,overviewRulerOptions:this._highlightedLines.has(r.line)?void 0:{color:n?t.activeMatchColorOverviewRuler:t.matchOverviewRuler,position:`center`}});if(i){let e=[];e.push(r),e.push(i.onRender(e=>this._applyStyles(e,n?t.activeMatchBorder:t.matchBorder,!1))),e.push(i.onDispose(()=>wU(e))),s.push(i)}}return s.length===0?void 0:s}},SW=class extends kU{constructor(){super(...arguments),this._searchResults=[],this._onDidChangeResults=this._register(new ZU)}get onDidChangeResults(){return this._onDidChangeResults.event}get searchResults(){return this._searchResults}get selectedDecoration(){return this._selectedDecoration}set selectedDecoration(e){this._selectedDecoration=e}updateResults(e,t){this._searchResults=e.slice(0,t)}clearResults(){this._searchResults=[]}clearSelectedDecoration(){this._selectedDecoration&&=(this._selectedDecoration.dispose(),void 0)}findResultIndex(e){for(let t=0;t<this._searchResults.length;t++){let n=this._searchResults[t];if(n.row===e.row&&n.col===e.col&&n.size===e.size)return t}return-1}fireResultsChanged(e){if(!e)return;let t=-1;this._selectedDecoration&&(t=this.findResultIndex(this._selectedDecoration.match)),this._onDidChangeResults.fire({resultIndex:t,resultCount:this._searchResults.length})}reset(){this.clearSelectedDecoration(),this.clearResults()}},CW=class extends kU{constructor(e){super(),this._highlightTimeout=this._register(new AU),this._lineCache=this._register(new AU),this._state=new yW,this._resultTracker=this._register(new SW),this._highlightLimit=e?.highlightLimit??1e3}get onDidChangeResults(){return this._resultTracker.onDidChangeResults}activate(e){this._terminal=e,this._lineCache.value=new vW(e),this._engine=new bW(e,this._lineCache.value),this._decorationManager=new xW(e),this._register(this._terminal.onWriteParsed(()=>this._updateMatches())),this._register(this._terminal.onResize(()=>this._updateMatches())),this._register(EU(()=>this.clearDecorations()))}_updateMatches(){this._highlightTimeout.clear(),this._state.cachedSearchTerm&&this._state.lastSearchOptions?.decorations&&(this._highlightTimeout.value=hW(()=>{let e=this._state.cachedSearchTerm;this._state.clearCachedTerm(),this.findPrevious(e,{...this._state.lastSearchOptions,incremental:!0},{noScroll:!0})},200))}clearDecorations(e){this._resultTracker.clearSelectedDecoration(),this._decorationManager?.clearHighlightDecorations(),this._resultTracker.clearResults(),e||this._state.clearCachedTerm()}clearActiveDecoration(){this._resultTracker.clearSelectedDecoration()}findNext(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findNextAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_highlightAllMatches(e,t){if(!this._terminal||!this._engine||!this._decorationManager)throw Error(`Cannot use addon until it has been loaded`);if(!this._state.isValidSearchTerm(e)){this.clearDecorations();return}this.clearDecorations(!0);let n=[],r,i=this._engine.find(e,0,0,t);for(;i&&(r?.row!==i.row||r?.col!==i.col)&&!(n.length>=this._highlightLimit);)r=i,n.push(r),i=this._engine.find(e,r.col+r.term.length>=this._terminal.cols?r.row+1:r.row,r.col+r.term.length>=this._terminal.cols?0:r.col+1,t);this._resultTracker.updateResults(n,this._highlightLimit),t.decorations&&this._decorationManager.createHighlightDecorations(n,t.decorations)}_findNextAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findNextWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}findPrevious(e,t,n){if(!this._terminal||!this._engine)throw Error(`Cannot use addon until it has been loaded`);this._state.lastSearchOptions=t,this._state.shouldUpdateHighlighting(e,t)&&this._highlightAllMatches(e,t);let r=this._findPreviousAndSelect(e,t,n);return this._fireResults(t),this._state.cachedSearchTerm=e,r}_fireResults(e){this._resultTracker.fireResultsChanged(!!e?.decorations)}_findPreviousAndSelect(e,t,n){if(!this._terminal||!this._engine)return!1;if(!this._state.isValidSearchTerm(e))return this._terminal.clearSelection(),this.clearDecorations(),!1;let r=this._engine.findPreviousWithSelection(e,t,this._state.cachedSearchTerm);return this._selectResult(r,t?.decorations,n?.noScroll)}_selectResult(e,t,n){if(!this._terminal||!this._decorationManager)return!1;if(this._resultTracker.clearSelectedDecoration(),!e)return this._terminal.clearSelection(),!1;if(this._terminal.select(e.col,e.row,e.size),t){let n=this._decorationManager.createActiveDecoration(e,t);n&&(this._resultTracker.selectedDecoration=n)}if(!n&&(e.row>=this._terminal.buffer.active.viewportY+this._terminal.rows||e.row<this._terminal.buffer.active.viewportY)){let t=e.row-this._terminal.buffer.active.viewportY;t-=Math.floor(this._terminal.rows/2),this._terminal.scrollLines(t)}return!0}},wW=0,TW=0,EW=0,DW=0,OW;(e=>{function t(e,t,n,r){return r===void 0?`#${NW(e)}${NW(t)}${NW(n)}`:`#${NW(e)}${NW(t)}${NW(n)}${NW(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(OW||={});var kW;(e=>{function t(e,t){if(DW=(t.rgba&255)/255,DW===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return wW=a+Math.round((n-a)*DW),TW=o+Math.round((r-o)*DW),EW=s+Math.round((i-s)*DW),{css:OW.toCss(wW,TW,EW),rgba:OW.toRgba(wW,TW,EW)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=MW.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return OW.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[wW,TW,EW]=MW.toChannels(t),{css:OW.toCss(wW,TW,EW),rgba:t}}e.opaque=i;function a(e,t){return DW=Math.round(t*255),[wW,TW,EW]=MW.toChannels(e.rgba),{css:OW.toCss(wW,TW,EW,DW),rgba:OW.toRgba(wW,TW,EW,DW)}}e.opacity=a;function o(e,t){return DW=e.rgba&255,a(e,DW*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(kW||={});var AW;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return wW=parseInt(e.slice(1,2).repeat(2),16),TW=parseInt(e.slice(2,3).repeat(2),16),EW=parseInt(e.slice(3,4).repeat(2),16),OW.toColor(wW,TW,EW);case 5:return wW=parseInt(e.slice(1,2).repeat(2),16),TW=parseInt(e.slice(2,3).repeat(2),16),EW=parseInt(e.slice(3,4).repeat(2),16),DW=parseInt(e.slice(4,5).repeat(2),16),OW.toColor(wW,TW,EW,DW);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return wW=parseInt(r[1]),TW=parseInt(r[2]),EW=parseInt(r[3]),DW=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),OW.toColor(wW,TW,EW,DW);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[wW,TW,EW,DW]=t.getImageData(0,0,1,1).data,DW!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:OW.toRgba(wW,TW,EW,DW),css:e}}e.toColor=r})(AW||={});var jW;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(jW||={});var MW;(e=>{function t(e,t){if(DW=(t&255)/255,DW===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return wW=a+Math.round((n-a)*DW),TW=o+Math.round((r-o)*DW),EW=s+Math.round((i-s)*DW),OW.toRgba(wW,TW,EW)}e.blend=t;function n(e,t,n){let a=jW.relativeLuminance(e>>8),o=jW.relativeLuminance(t>>8);if(PW(a,o)<n){if(o<a){let o=r(e,t,n),s=PW(a,jW.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>PW(a,jW.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=PW(a,jW.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>PW(a,jW.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=PW(jW.relativeLuminance2(o,s,c),jW.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=PW(jW.relativeLuminance2(o,s,c),jW.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=PW(jW.relativeLuminance2(o,s,c),jW.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=PW(jW.relativeLuminance2(o,s,c),jW.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(MW||={});function NW(e){let t=e.toString(16);return t.length<2?`0`+t:t}function PW(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var FW=Object.freeze((()=>{let e=[AW.toColor(`#2e3436`),AW.toColor(`#cc0000`),AW.toColor(`#4e9a06`),AW.toColor(`#c4a000`),AW.toColor(`#3465a4`),AW.toColor(`#75507b`),AW.toColor(`#06989a`),AW.toColor(`#d3d7cf`),AW.toColor(`#555753`),AW.toColor(`#ef2929`),AW.toColor(`#8ae234`),AW.toColor(`#fce94f`),AW.toColor(`#729fcf`),AW.toColor(`#ad7fa8`),AW.toColor(`#34e2e2`),AW.toColor(`#eeeeec`)],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],a=t[n%6];e.push({css:OW.toCss(r,i,a),rgba:OW.toRgba(r,i,a)})}for(let t=0;t<24;t++){let n=8+t*10;e.push({css:OW.toCss(n,n,n),rgba:OW.toRgba(n,n,n)})}return e})());function IW(e,t,n){return Math.max(t,Math.min(e,n))}function LW(e){switch(e){case`&`:return`&`;case`<`:return`<`}return e}var RW=class{constructor(e){this._buffer=e}serialize(e,t){let n=this._buffer.getNullCell(),r=this._buffer.getNullCell(),i=n,a=e.start.y,o=e.end.y,s=e.start.x,c=e.end.x;this._beforeSerialize(o-a,a,o);for(let t=a;t<=o;t++){let a=this._buffer.getLine(t);if(a){let o=t===e.start.y?s:0,l=t===e.end.y?c:a.length;for(let e=o;e<l;e++){let o=a.getCell(e,i===n?r:n);if(!o){console.warn(`Can't get cell at row=${t}, col=${e}`);continue}this._nextCell(o,i,t,e),i=o}}this._rowEnd(t,t===o)}return this._afterSerialize(),this._serializeString(t)}_nextCell(e,t,n,r){}_rowEnd(e,t){}_beforeSerialize(e,t,n){}_afterSerialize(){}_serializeString(e){return``}};function zW(e,t){return e.getFgColorMode()===t.getFgColorMode()&&e.getFgColor()===t.getFgColor()}function BW(e,t){return e.getBgColorMode()===t.getBgColorMode()&&e.getBgColor()===t.getBgColor()}function VW(e,t){return e.isInverse()===t.isInverse()&&e.isBold()===t.isBold()&&e.isUnderline()===t.isUnderline()&&e.isOverline()===t.isOverline()&&e.isBlink()===t.isBlink()&&e.isInvisible()===t.isInvisible()&&e.isItalic()===t.isItalic()&&e.isDim()===t.isDim()&&e.isStrikethrough()===t.isStrikethrough()}var HW=class extends RW{constructor(e,t){super(e),this._terminal=t,this._rowIndex=0,this._allRows=[],this._allRowSeparators=[],this._currentRow=``,this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(e,t,n){this._allRows=Array(e),this._lastContentCursorRow=t,this._lastCursorRow=t,this._firstRow=t}_rowEnd(e,t){this._nullCellCount>0&&!BW(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let n=``;if(!t){e-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let t=this._buffer.getLine(e),r=this._buffer.getLine(e+1);if(!r.isWrapped)n=`\r
|
|
196
|
-
`,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&BW(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&BW(i,o)&&BW(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!zW(e,t),i=!BW(e,t),a=!VW(e,t);if(r||i||a)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!BW(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(BW(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(BW(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},UW=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:IW(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new HW(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new WW(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:IW(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`;break}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},WW=class extends RW{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=FW}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!zW(e,t),i=!BW(e,t),a=!VW(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=LW(e.getChars())}_serializeString(){return this._htmlContent}};function GW(e){let t=0;for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r<48||57<r)return-1;t=t*10+r-48}return t}var KW=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,e=>{if(!e.startsWith(`4;`))return!1;let t=e.split(`;`);if(t.length>3)return!0;t.length===2&&t.push(``);let n=GW(t[1]),r=GW(t[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(r<0)return!0;this.progress={state:n,value:r};break;case 2:case 4:if(r<0)return!0;this.progress={state:n,value:r||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn(`progress state out of bounds, not applied`);return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function qW(e){return`\x1b[200~${e}\x1b[201~`}function JW(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function YW(e,t){let n=JW(e);return t===`codex`?n:qW(n)}var XW=40*1024*1024,ZW=`40 MB`;function QW(e){if(!e)return[];let t=Array.from(e.files??[]).filter(e=>e instanceof File);return t.length?t:Array.from(e.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>e instanceof File)}function $W(e){let t=e.find(e=>e.type.startsWith(`image/`)&&e.size===0);if(t)return`${t.name} contains no image data. Choose the file to upload it.`;let n=e.find(e=>e.size>XW);return n?`${n.name} exceeds the ${ZW} limit`:null}async function eG(e,t){let n=$W([e]);if(n)throw Error(n);let r=new FormData,i=/^image\/(png|jpeg|gif|webp)$/.test(e.type);r.append(i?`image`:`file`,e,e.name);let a;try{a=await fetch(i?`/api/paste-image`:`/api/paste-file`,{method:`POST`,body:r,signal:t})}catch(n){throw t?.aborted?n:Error(`Could not upload ${e.name}. Check your connection and try again.`)}let o=await a.json().catch(()=>null);if(!a.ok||typeof o?.path!=`string`||!o.path.startsWith(`/`))throw Error(typeof o?.error==`string`?o.error:`Could not upload ${e.name}. Try again.`);return o.path}function tG(e){return`'${e.replace(/[\x00-\x1f\x7f]/g,``).replace(/'/g,`'\\''`)}'`}async function nG(){try{let e=await navigator.clipboard.read(),t=[],n=``;for(let r of e){let e=r.types.find(e=>e.startsWith(`image/`));e?t.push(new File([await r.getType(e)],`clipboard.${e.split(`/`)[1]||`png`}`,{type:e})):r.types.includes(`text/plain`)&&(n+=await(await r.getType(`text/plain`)).text())}return{text:n,files:t}}catch{return{text:await navigator.clipboard.readText(),files:[]}}}var rG=new Map,iG=20;function aG(e){rG.delete(e)}function oG(){rG.clear()}var sG=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,cG=/[.,;:!?]+$/,lG=[[`(`,`)`],[`[`,`]`],[`{`,`}`]],uG=(e,t)=>e.split(t).length-1;function dG(e){let t=e.trim();if(!t)return t;let n=()=>{t=t.replace(cG,``)};n();let r=!0;for(;r;){r=!1;for(let[e,n]of lG){if(!t.endsWith(n))continue;let i=uG(t,e);uG(t,n)>i&&(t=t.slice(0,-1),r=!0)}}return n(),t}var fG=()=>typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),pG=`\x1B[200~\x1B[201~`,mG=``,hG=`\x1B[?1000h\x1B[?1002h\x1B[?1006h`,gG=`\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l`,_G=new Set([9,1e3,1002,1003,1005,1006,1015,1016]),vG=/\x1b\[\?([0-9;]+)([hl])/g,yG=/\x1b(?:\[[0-9;<=>?]*)?$/,bG=(e,t)=>{let n=t.current+e,r=n.match(yG),i=r?n.length-r[0].length:n.length;return t.current=r?.[0]??``,n.slice(0,i).replace(vG,(e,t,n)=>{let r=t.split(`;`).filter(e=>!_G.has(Number(e)));return r.length?`\x1b[?${r.join(`;`)}${n}`:``})};async function xG(e){try{let t=(e.type.split(`/`)[1]||`png`).toLowerCase(),n=new FormData;n.append(`image`,e,`paste.${t}`);let r=await fetch(`/api/paste-image`,{method:`POST`,body:n});if(!r.ok)return null;let i=await r.json();return typeof i.path==`string`?i.path:null}catch{return null}}async function SG(){try{let e=await fetch(`/api/clipboard-file-path`);if(!e.ok)return null;let t=await e.json();return t.isImage===!0&&typeof t.path==`string`?t.path:null}catch{return null}}async function CG(e,t){if(e===`codex`)return mG;let n=t.path??null;return!n&&t.blob&&(n=await xG(t.blob)),n||=await SG(),n?qW(JW(n)):pG}var wG=/\/Users\/[^/\n]+\/Library\/Group Containers\/group\.com\.apple\.coreservices\.useractivityd\/shared-pasteboard\/items\//;function TG(e){return wG.test(e)}function EG(e){if(!e)return!1;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return!0;for(let t of Array.from(e.items??[]))if(t?.type?.startsWith(`image/`))return!0;return!1}function DG(e){if(!e)return null;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return t;for(let t of Array.from(e.items??[]))if(t?.kind===`file`&&t.type?.startsWith(`image/`)){let e=t.getAsFile?.();if(e)return e}return null}var OG=class{constructor(e={}){this.callbacks=e}async readText(e){if(e!==`c`)return``;try{return await navigator.clipboard.readText()}catch{return``}}async writeText(e,t){if(e!==`c`||!t?.trim())return;let n=performance.now();try{if(!navigator.clipboard?.writeText)throw Error(`navigator.clipboard.writeText unavailable`);await navigator.clipboard.writeText(t),KO(`clipboard_write_success`,{source:`osc52`,chars:t.length,durationMs:Math.round(performance.now()-n)})}catch(e){KO(`clipboard_write_failed`,{source:`osc52`,chars:t.length,error:e instanceof Error?e.message:String(e)},`warn`),this.callbacks.onWriteFailed?.(t,`osc52`)}}},kG=`︎`,AG=[`⏺`],jG=new RegExp(AG.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),`g`);function MG(e){for(let t of AG)if(e.indexOf(t)!==-1)return e.replace(jG,`$&${kG}`);return e}function NG({sessionId:e,tmuxTarget:t,agentType:n,allowAttach:r=!0,connectionStatus:i=`connected`,connectionEpoch:a=0,sendMessage:o,subscribe:s,theme:c,fontSize:l,lineHeight:u,letterSpacing:d,fontFamily:f,useWebGL:p,onScrollChange:m,onPasteFiles:h,onPasteError:g}){let _=(0,C.useRef)(h);_.current=h;let v=(0,C.useRef)(g);v.current=g;let y=()=>!_.current||typeof location<`u`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(location.hostname),b=ct(),x=(0,C.useRef)(null),S=(0,C.useRef)(null),w=(0,C.useRef)(!1),T=(0,C.useRef)(null),E=(0,C.useRef)(null),D=(0,C.useRef)(null),O=(0,C.useRef)(null),k=(0,C.useRef)(null),A=(0,C.useRef)(null),j=(0,C.useRef)(null),M=(0,C.useRef)(null),N=(0,C.useRef)(null),P=(0,C.useRef)(null),F=(0,C.useRef)(0),I=(0,C.useRef)(!1),[L,ee]=(0,C.useState)(!1),R=(0,C.useRef)(!1),z=(0,C.useRef)(!1),B=(0,C.useRef)(null),te=(0,C.useRef)(0),[V,H]=(0,C.useState)(null),ne=(0,C.useCallback)((e,t)=>{e?.trim()&&(te.current+=1,H({id:te.current,text:e,source:t}))},[]),re=(0,C.useCallback)(()=>{V&&(mh(V.text),KO(`clipboard_manual_copy`,{source:V.source,chars:V.text.length},`info`),H(null))},[V]),ie=(0,C.useCallback)(()=>{H(null)},[]),U=(0,C.useRef)(null),ae=(0,C.useRef)(null),oe=(0,C.useRef)(e&&r&&i===`connected`?e:null),se=(0,C.useRef)(null),ce=(0,C.useRef)(-1),le=(0,C.useRef)(null),ue=(0,C.useRef)(null),de=(0,C.useRef)(o),fe=(0,C.useRef)(n),pe=(0,C.useRef)(m),me=(0,C.useRef)(p),he=(0,C.useRef)([]),ge=(0,C.useRef)(null),_e=(0,C.useRef)(null),ve=(0,C.useRef)({count:0,bytes:0,lastEmit:0,timer:null,lastMessageSessionId:null}),ye=(0,C.useRef)(!1),be=(0,C.useRef)(``),[xe,Se]=(0,C.useState)(!1),Ce=(0,C.useRef)(null),we=(0,C.useRef)(null),Te=(0,C.useRef)(null),Ee=()=>{if(Ce.current!==null&&(window.clearTimeout(Ce.current),Ce.current=null),we.current!==null&&(cancelAnimationFrame(we.current),we.current=null),Te.current!==null){let e=x.current;e&&(e.style.display=Te.current),Te.current=null}},De=(e,t)=>{let n=x.current;n&&(Ee(),KO(`ios_repaint_schedule`,{delayMs:e,trigger:t,sessionId:ae.current}),Ce.current=window.setTimeout(()=>{Ce.current=null;let e=S.current;e&&e.refresh(0,e.rows-1),KO(`ios_repaint_exec`,{trigger:t,hasContent:e?e.buffer.active.length>0:!1,bufferLines:e?.buffer.active.length??0,sessionId:ae.current}),Te.current=n.style.display,n.style.display=`none`,we.current=requestAnimationFrame(()=>{we.current=requestAnimationFrame(()=>{we.current=null,n.style.display=Te.current??``,Te.current=null})})},e))};(0,C.useEffect)(()=>{de.current=o},[o]),(0,C.useEffect)(()=>{fe.current=n},[n]),(0,C.useEffect)(()=>{pe.current=m},[m]);let Oe=(0,C.useCallback)(()=>{let e=S.current;if(!e||!pe.current)return;let t=e.buffer.active,n=!I.current&&t.viewportY>=t.baseY;pe.current(n)},[]),ke=(0,C.useCallback)(e=>{if(I.current===e)return;I.current=e,ee(e);let t=S.current;t&&e&&t.write(gG),Oe()},[Oe]),Ae=(0,C.useCallback)(()=>{let e=oe.current;e&&(B.current!==null&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>{B.current=null,de.current({type:`tmux-check-copy-mode`,sessionId:e})},150))},[]),je=(0,C.useCallback)(()=>{let e=S.current,t=T.current;if(!e||!t)return;t.fit();let n=ae.current;n&&de.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})},[]);return(0,C.useEffect)(()=>{let t=x.current;if(!t||S.current)return;let n=!1;t.innerHTML=``;let r=new gL({fontFamily:f,fontSize:l,lineHeight:((e,t)=>Math.round(e*t)/e)(l,u),letterSpacing:d,scrollback:0,cursorBlink:!1,cursorStyle:`underline`,convertEol:!1,theme:c,screenReaderMode:b,minimumContrastRatio:4.5,macOptionClickForcesSelection:!0}),i=new yL;r.loadAddon(i),r.loadAddon(new ZH(void 0,new OG({onWriteFailed:ne})));let a=new CW;r.loadAddon(a),k.current=a;let o=new UW;r.loadAddon(o),A.current=o;let s=new KW;r.loadAddon(s),j.current=s;let p=()=>{if(!n){if(me.current)try{let t=new sH;t.onContextLoss(()=>{KO(`webgl_context_loss`,{sessionId:e},`info`);try{t.dispose()}catch{}E.current=null}),r.loadAddon(t),E.current=t}catch{}r.open(t),i.fit(),w.current||(w.current=!0,KO(`terminal_init`,{isiOS:b,useWebGL:me.current,hasWebGL:!!E.current,userAgent:navigator.userAgent.slice(0,120),platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints},`info`)),m&&r.element&&r.element.appendChild(m)}};document.fonts?.ready?document.fonts.ready.then(p).catch(p):p();let m=null,h=null,g=null;typeof document<`u`&&document.createElement&&(m=document.createElement(`div`),m.className=`xterm-hover`,m.style.cssText=`
|
|
196
|
+
`,this._lastCursorRow=e+1,this._lastCursorCol=0;else{n=``;let i=t.getCell(t.length-1,this._thisRowLastChar),a=t.getCell(t.length-2,this._thisRowLastSecondChar),o=r.getCell(0,this._nextRowFirstChar),s=o.getWidth()>1,c=!1;(o.getChars()&&s?this._nullCellCount<=1:this._nullCellCount<=0)&&((i.getChars()||i.getWidth()===0)&&BW(i,o)&&(c=!0),s&&(a.getChars()||a.getWidth()===0)&&BW(i,o)&&BW(a,o)&&(c=!0)),c||(n=`-`.repeat(this._nullCellCount+1),n+=`\x1B[1D\x1B[1X`,this._nullCellCount>0&&(n+=`\x1B[A`,n+=`\x1B[${t.length-this._nullCellCount}C`,n+=`\x1B[${this._nullCellCount}X`,n+=`\x1B[${t.length-this._nullCellCount}D`,n+=`\x1B[B`),this._lastContentCursorRow=e+1,this._lastContentCursorCol=0,this._lastCursorRow=e+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=n,this._currentRow=``,this._nullCellCount=0}_diffStyle(e,t){let n=[],r=!zW(e,t),i=!BW(e,t),a=!VW(e,t);if(r||i||a)if(e.isAttributeDefault())t.isAttributeDefault()||n.push(0);else{if(r){let t=e.getFgColor();e.isFgRGB()?n.push(38,2,t>>>16&255,t>>>8&255,t&255):e.isFgPalette()?t>=16?n.push(38,5,t):n.push(t&8?90+(t&7):30+(t&7)):n.push(39)}if(i){let t=e.getBgColor();e.isBgRGB()?n.push(48,2,t>>>16&255,t>>>8&255,t&255):e.isBgPalette()?t>=16?n.push(48,5,t):n.push(t&8?100+(t&7):40+(t&7)):n.push(49)}a&&(e.isInverse()!==t.isInverse()&&n.push(e.isInverse()?7:27),e.isBold()!==t.isBold()&&n.push(e.isBold()?1:22),e.isUnderline()!==t.isUnderline()&&n.push(e.isUnderline()?4:24),e.isOverline()!==t.isOverline()&&n.push(e.isOverline()?53:55),e.isBlink()!==t.isBlink()&&n.push(e.isBlink()?5:25),e.isInvisible()!==t.isInvisible()&&n.push(e.isInvisible()?8:28),e.isItalic()!==t.isItalic()&&n.push(e.isItalic()?3:23),e.isDim()!==t.isDim()&&n.push(e.isDim()?2:22),e.isStrikethrough()!==t.isStrikethrough()&&n.push(e.isStrikethrough()?9:29))}return n}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,this._cursorStyle);if(i?!BW(this._cursorStyle,e):a.length>0){this._nullCellCount>0&&(BW(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r,this._currentRow+=`\x1B[${a.join(`;`)}m`;let e=this._buffer.getLine(n);e!==void 0&&(e.getCell(r,this._cursorStyle),this._cursorStyleRow=n,this._cursorStyleCol=r)}i?this._nullCellCount+=e.getWidth():(this._nullCellCount>0&&(BW(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=e.getChars(),this._lastContentCursorRow=this._lastCursorRow=n,this._lastContentCursorCol=this._lastCursorCol=r+e.getWidth())}_serializeString(e){let t=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(t=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let n=``;for(let e=0;e<t;e++)n+=this._allRows[e],e+1<t&&(n+=this._allRowSeparators[e]);if(!e){let e=this._buffer.baseY+this._buffer.cursorY,t=this._buffer.cursorX;(e!==this._lastCursorRow||t!==this._lastCursorCol)&&((e=>{e>0?n+=`\x1B[${e}B`:e<0&&(n+=`\x1B[${-e}A`)})(e-this._lastCursorRow),(e=>{e>0?n+=`\x1B[${e}C`:e<0&&(n+=`\x1B[${-e}D`)})(t-this._lastCursorCol))}let r=this._terminal._core._inputHandler._curAttrData,i=this._diffStyle(r,this._cursorStyle);return i.length>0&&(n+=`\x1B[${i.join(`;`)}m`),n}},UW=class{activate(e){this._terminal=e}_serializeBufferByScrollback(e,t,n){let r=t.length,i=n===void 0?r:IW(n+e.rows,0,r);return this._serializeBufferByRange(e,t,{start:r-i,end:r-1},!1)}_serializeBufferByRange(e,t,n,r){return new HW(t,e).serialize({start:{x:0,y:typeof n.start==`number`?n.start:n.start.line},end:{x:e.cols,y:typeof n.end==`number`?n.end:n.end.line}},r)}_serializeBufferAsHTML(e,t){let n=e.buffer.active,r=new WW(n,e,t),i=t.onlySelection??!1,a=t.range;if(a)return r.serialize({start:{x:a.startCol,y:(a.startLine,a.startLine)},end:{x:e.cols,y:(a.endLine,a.endLine)}});if(!i){let i=n.length,a=t.scrollback,o=a===void 0?i:IW(a+e.rows,0,i);return r.serialize({start:{x:0,y:i-o},end:{x:e.cols,y:i-1}})}let o=this._terminal?.getSelectionPosition();return o===void 0?``:r.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}})}_serializeModes(e){let t=``,n=e.modes;if(n.applicationCursorKeysMode&&(t+=`\x1B[?1h`),n.applicationKeypadMode&&(t+=`\x1B[?66h`),n.bracketedPasteMode&&(t+=`\x1B[?2004h`),n.insertMode&&(t+=`\x1B[4h`),n.originMode&&(t+=`\x1B[?6h`),n.reverseWraparoundMode&&(t+=`\x1B[?45h`),n.sendFocusMode&&(t+=`\x1B[?1004h`),n.wraparoundMode===!1&&(t+=`\x1B[?7l`),n.mouseTrackingMode!==`none`)switch(n.mouseTrackingMode){case`x10`:t+=`\x1B[?9h`;break;case`vt200`:t+=`\x1B[?1000h`;break;case`drag`:t+=`\x1B[?1002h`;break;case`any`:t+=`\x1B[?1003h`;break}return t}serialize(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);let t=e?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,e.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,e?.scrollback);if(!e?.excludeAltBuffer&&this._terminal.buffer.active.type===`alternate`){let e=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);t+=`\x1B[?1049h\x1B[H${e}`}return e?.excludeModes||(t+=this._serializeModes(this._terminal)),t}serializeAsHTML(e){if(!this._terminal)throw Error(`Cannot use addon until it has been loaded`);return this._serializeBufferAsHTML(this._terminal,e||{})}dispose(){}},WW=class extends RW{constructor(e,t,n){super(e),this._terminal=t,this._options=n,this._currentRow=``,this._htmlContent=``,t._core._themeService?this._ansiColors=t._core._themeService.colors.ansi:this._ansiColors=FW}_padStart(e,t,n){return t>>=0,n??=` `,e.length>t?e:(t-=e.length,t>n.length&&(n+=n.repeat(t/n.length)),n.slice(0,t)+e)}_beforeSerialize(e,t,n){this._htmlContent+=`<html><body><!--StartFragment--><pre>`;let r=`#000000`,i=`#ffffff`;(this._options.includeGlobalBackground??!1)&&(r=this._terminal.options.theme?.foreground??`#ffffff`,i=this._terminal.options.theme?.background??`#000000`);let a=[];a.push(`color: `+r+`;`),a.push(`background-color: `+i+`;`),a.push(`font-family: `+this._terminal.options.fontFamily+`;`),a.push(`font-size: `+this._terminal.options.fontSize+`px;`),this._htmlContent+=`<div style='`+a.join(` `)+`'>`}_afterSerialize(){this._htmlContent+=`</div>`,this._htmlContent+=`</pre><!--EndFragment--></body></html>`}_rowEnd(e,t){this._htmlContent+=`<div><span>`+this._currentRow+`</span></div>`,this._currentRow=``}_getHexColor(e,t){let n=t?e.getFgColor():e.getBgColor();if(t?e.isFgRGB():e.isBgRGB())return`#`+[n>>16&255,n>>8&255,n&255].map(e=>this._padStart(e.toString(16),2,`0`)).join(``);if(t?e.isFgPalette():e.isBgPalette())return this._ansiColors[n].css}_diffStyle(e,t){let n=[],r=!zW(e,t),i=!BW(e,t),a=!VW(e,t);if(r||i||a){let t=this._getHexColor(e,!0);t&&n.push(`color: `+t+`;`);let r=this._getHexColor(e,!1);return r&&n.push(`background-color: `+r+`;`),e.isInverse()&&n.push(`color: #000000; background-color: #BFBFBF;`),e.isBold()&&n.push(`font-weight: bold;`),e.isUnderline()&&e.isOverline()?n.push(`text-decoration: overline underline;`):e.isUnderline()?n.push(`text-decoration: underline;`):e.isOverline()&&n.push(`text-decoration: overline;`),e.isBlink()&&n.push(`text-decoration: blink;`),e.isInvisible()&&n.push(`visibility: hidden;`),e.isItalic()&&n.push(`font-style: italic;`),e.isDim()&&n.push(`opacity: 0.5;`),e.isStrikethrough()&&n.push(`text-decoration: line-through;`),n}}_nextCell(e,t,n,r){if(e.getWidth()===0)return;let i=e.getChars()===``,a=this._diffStyle(e,t);a&&(this._currentRow+=a.length===0?`</span><span>`:`</span><span style='`+a.join(` `)+`'>`),i?this._currentRow+=` `:this._currentRow+=LW(e.getChars())}_serializeString(){return this._htmlContent}};function GW(e){let t=0;for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);if(r<48||57<r)return-1;t=t*10+r-48}return t}var KW=class{constructor(){this._st=0,this._pr=0}dispose(){this._seqHandler?.dispose(),this._onChange?.dispose()}activate(e){this._seqHandler=e.parser.registerOscHandler(9,e=>{if(!e.startsWith(`4;`))return!1;let t=e.split(`;`);if(t.length>3)return!0;t.length===2&&t.push(``);let n=GW(t[1]),r=GW(t[2]);switch(n){case 0:this.progress={state:n,value:0};break;case 1:if(r<0)return!0;this.progress={state:n,value:r};break;case 2:case 4:if(r<0)return!0;this.progress={state:n,value:r||this._pr};break;case 3:this.progress={state:n,value:this._pr};break}return!0}),this._onChange=new e._core._onData.constructor,this.onChange=this._onChange.event}get progress(){return{state:this._st,value:this._pr}}set progress(e){if(e.state<0||e.state>4){console.warn(`progress state out of bounds, not applied`);return}this._st=e.state,this._pr=Math.min(Math.max(e.value,0),100),this._onChange?.fire({state:this._st,value:this._pr})}};function qW(e){return`\x1b[200~${e}\x1b[201~`}function JW(e){return e.replace(/[\x00-\x1f\x7f]/g,``)}function YW(e,t){let n=JW(e);return t===`codex`?n:qW(n)}var XW=40*1024*1024,ZW=`40 MB`;function QW(e){if(!e)return[];let t=Array.from(e.files??[]).filter(e=>e instanceof File);return t.length?t:Array.from(e.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile?.()).filter(e=>e instanceof File)}function $W(e){let t=e.find(e=>e.type.startsWith(`image/`)&&e.size===0);if(t)return`${t.name} contains no image data. Choose the file to upload it.`;let n=e.find(e=>e.size>XW);return n?`${n.name} exceeds the ${ZW} limit`:null}async function eG(e,t){let n=$W([e]);if(n)throw Error(n);let r=new FormData,i=/^image\/(png|jpeg|gif|webp)$/.test(e.type);r.append(i?`image`:`file`,e,e.name);let a;try{a=await fetch(i?`/api/paste-image`:`/api/paste-file`,{method:`POST`,body:r,signal:t})}catch(n){throw t?.aborted?n:Error(`Could not upload ${e.name}. Check your connection and try again.`)}let o=await a.json().catch(()=>null);if(!a.ok||typeof o?.path!=`string`||!o.path.startsWith(`/`))throw Error(typeof o?.error==`string`?o.error:`Could not upload ${e.name}. Try again.`);return o.path}function tG(e){return`'${e.replace(/[\x00-\x1f\x7f]/g,``).replace(/'/g,`'\\''`)}'`}async function nG(){try{let e=await navigator.clipboard.read(),t=[],n=``;for(let r of e){let e=r.types.find(e=>e.startsWith(`image/`));e?t.push(new File([await r.getType(e)],`clipboard.${e.split(`/`)[1]||`png`}`,{type:e})):r.types.includes(`text/plain`)&&(n+=await(await r.getType(`text/plain`)).text())}return{text:n,files:t}}catch{return{text:await navigator.clipboard.readText(),files:[]}}}var rG=new Map,iG=20;function aG(e){rG.delete(e)}function oG(){rG.clear()}var sG=/https?:\/\/[^\s"'<>]+|\b(?:localhost|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/[^\s"'<>]*)?\b/,cG=/[.,;:!?]+$/,lG=[[`(`,`)`],[`[`,`]`],[`{`,`}`]],uG=(e,t)=>e.split(t).length-1;function dG(e){let t=e.trim();if(!t)return t;let n=()=>{t=t.replace(cG,``)};n();let r=!0;for(;r;){r=!1;for(let[e,n]of lG){if(!t.endsWith(n))continue;let i=uG(t,e);uG(t,n)>i&&(t=t.slice(0,-1),r=!0)}}return n(),t}var fG=()=>typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform),pG=`\x1B[200~\x1B[201~`,mG=``,hG=`\x1B[?1000h\x1B[?1002h\x1B[?1006h`,gG=`\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l`,_G=new Set([9,1e3,1002,1003,1005,1006,1015,1016]),vG=/\x1b\[\?([0-9;]+)([hl])/g,yG=/\x1b(?:\[[0-9;<=>?]*)?$/,bG=(e,t)=>{let n=t.current+e,r=n.match(yG),i=r?n.length-r[0].length:n.length;return t.current=r?.[0]??``,n.slice(0,i).replace(vG,(e,t,n)=>{let r=t.split(`;`).filter(e=>!_G.has(Number(e)));return r.length?`\x1b[?${r.join(`;`)}${n}`:``})};async function xG(e){try{let t=(e.type.split(`/`)[1]||`png`).toLowerCase(),n=new FormData;n.append(`image`,e,`paste.${t}`);let r=await fetch(`/api/paste-image`,{method:`POST`,body:n});if(!r.ok)return null;let i=await r.json();return typeof i.path==`string`?i.path:null}catch{return null}}async function SG(){try{let e=await fetch(`/api/clipboard-file-path`);if(!e.ok)return null;let t=await e.json();return t.isImage===!0&&typeof t.path==`string`?t.path:null}catch{return null}}async function CG(e,t){if(e===`codex`)return mG;let n=t.path??null;return!n&&t.blob&&(n=await xG(t.blob)),n||=await SG(),n?qW(JW(n)):pG}var wG=/\/Users\/[^/\n]+\/Library\/Group Containers\/group\.com\.apple\.coreservices\.useractivityd\/shared-pasteboard\/items\//;function TG(e){return wG.test(e)}function EG(e){if(!e)return!1;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return!0;for(let t of Array.from(e.items??[]))if(t?.type?.startsWith(`image/`))return!0;return!1}function DG(e){if(!e)return null;for(let t of Array.from(e.files??[]))if(t?.type?.startsWith(`image/`))return t;for(let t of Array.from(e.items??[]))if(t?.kind===`file`&&t.type?.startsWith(`image/`)){let e=t.getAsFile?.();if(e)return e}return null}var OG=class{constructor(e={}){this.callbacks=e}async readText(e){if(e!==`c`)return``;try{return await navigator.clipboard.readText()}catch{return``}}async writeText(e,t){if(e!==`c`||!t?.trim())return;let n=performance.now();try{if(!navigator.clipboard?.writeText)throw Error(`navigator.clipboard.writeText unavailable`);await navigator.clipboard.writeText(t),KO(`clipboard_write_success`,{source:`osc52`,chars:t.length,durationMs:Math.round(performance.now()-n)})}catch(e){KO(`clipboard_write_failed`,{source:`osc52`,chars:t.length,error:e instanceof Error?e.message:String(e)},`warn`),this.callbacks.onWriteFailed?.(t,`osc52`)}}},kG=`︎`,AG=[`⏺`],jG=new RegExp(AG.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),`g`);function MG(e){for(let t of AG)if(e.indexOf(t)!==-1)return e.replace(jG,`$&${kG}`);return e}function NG({sessionId:e,tmuxTarget:t,agentType:n,allowAttach:r=!0,connectionStatus:i=`connected`,connectionEpoch:a=0,sendMessage:o,subscribe:s,theme:c,fontSize:l,lineHeight:u,letterSpacing:d,fontFamily:f,useWebGL:p,onScrollChange:m,onPasteFiles:h,onPasteError:g}){let _=(0,C.useRef)(h);_.current=h;let v=(0,C.useRef)(g);v.current=g;let y=()=>!_.current||typeof location<`u`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(location.hostname),b=ct(),x=(0,C.useRef)(null),S=(0,C.useRef)(null),w=(0,C.useRef)(!1),T=(0,C.useRef)(null),E=(0,C.useRef)(null),D=(0,C.useRef)(null),O=(0,C.useRef)(null),k=(0,C.useRef)(null),A=(0,C.useRef)(null),j=(0,C.useRef)(null),M=(0,C.useRef)(null),N=(0,C.useRef)(null),P=(0,C.useRef)(null),F=(0,C.useRef)(0),I=(0,C.useRef)(!1),[L,ee]=(0,C.useState)(!1),R=(0,C.useRef)(!1),z=(0,C.useRef)(!1),B=(0,C.useRef)(null),te=(0,C.useRef)(0),[V,H]=(0,C.useState)(null),ne=(0,C.useCallback)((e,t)=>{e?.trim()&&(te.current+=1,H({id:te.current,text:e,source:t}))},[]),re=(0,C.useCallback)(()=>{V&&(mh(V.text),KO(`clipboard_manual_copy`,{source:V.source,chars:V.text.length},`info`),H(null))},[V]),ie=(0,C.useCallback)(()=>{H(null)},[]),U=(0,C.useRef)(null),ae=(0,C.useRef)(null),oe=(0,C.useRef)(e&&r&&i===`connected`?e:null),se=(0,C.useRef)(null),ce=(0,C.useRef)(-1),le=(0,C.useRef)(null),ue=(0,C.useRef)(null),de=(0,C.useRef)(o),fe=(0,C.useRef)(n),pe=(0,C.useRef)(m),me=(0,C.useRef)(p),he=(0,C.useRef)([]),ge=(0,C.useRef)(null),_e=(0,C.useRef)(null),ve=(0,C.useRef)({count:0,bytes:0,lastEmit:0,timer:null,lastMessageSessionId:null}),ye=(0,C.useRef)(!1),be=(0,C.useRef)(``),[xe,Se]=(0,C.useState)(!1),Ce=(0,C.useRef)(null),we=(0,C.useRef)(null),Te=(0,C.useRef)(null),Ee=()=>{if(Ce.current!==null&&(window.clearTimeout(Ce.current),Ce.current=null),we.current!==null&&(cancelAnimationFrame(we.current),we.current=null),Te.current!==null){let e=x.current;e&&(e.style.display=Te.current),Te.current=null}},De=(e,t)=>{let n=x.current;n&&(Ee(),KO(`ios_repaint_schedule`,{delayMs:e,trigger:t,sessionId:ae.current}),Ce.current=window.setTimeout(()=>{Ce.current=null;let e=S.current;e&&e.refresh(0,e.rows-1),KO(`ios_repaint_exec`,{trigger:t,hasContent:e?e.buffer.active.length>0:!1,bufferLines:e?.buffer.active.length??0,sessionId:ae.current}),Te.current=n.style.display,n.style.display=`none`,we.current=requestAnimationFrame(()=>{we.current=requestAnimationFrame(()=>{we.current=null,n.style.display=Te.current??``,Te.current=null})})},e))};(0,C.useEffect)(()=>{de.current=o},[o]),(0,C.useEffect)(()=>{fe.current=n},[n]),(0,C.useEffect)(()=>{pe.current=m},[m]);let Oe=(0,C.useCallback)(()=>{let e=S.current;if(!e||!pe.current)return;let t=e.buffer.active,n=!I.current&&t.viewportY>=t.baseY;pe.current(n)},[]),ke=(0,C.useCallback)(e=>{if(I.current===e)return;I.current=e,ee(e);let t=S.current;t&&e&&t.write(gG),Oe()},[Oe]),Ae=(0,C.useCallback)(()=>{let e=oe.current;e&&(B.current!==null&&window.clearTimeout(B.current),B.current=window.setTimeout(()=>{B.current=null,de.current({type:`tmux-check-copy-mode`,sessionId:e})},150))},[]),je=(0,C.useCallback)(()=>{let e=S.current,t=T.current;if(!e||!t)return;t.fit();let n=ae.current;n&&de.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})},[]);return(0,C.useEffect)(()=>{let t=x.current;if(!t||S.current)return;let n=!1;t.innerHTML=``;let r=new gL({fontFamily:f,fontSize:l,lineHeight:((e,t)=>Math.round(e*t)/e)(l,u),letterSpacing:d,scrollback:0,cursorBlink:!1,cursorStyle:`underline`,convertEol:!1,theme:c,screenReaderMode:b,minimumContrastRatio:4.5,macOptionClickForcesSelection:!0}),i=new yL;r.loadAddon(i),r.loadAddon(new ZH(void 0,new OG({onWriteFailed:ne})));let a=new CW;r.loadAddon(a),k.current=a;let o=new UW;r.loadAddon(o),A.current=o;let s=new KW;r.loadAddon(s),j.current=s;let p=()=>{if(!n){if(me.current&&!E.current)try{let t=new sH;t.onContextLoss(()=>{KO(`webgl_context_loss`,{sessionId:e},`info`);try{t.dispose()}catch{}E.current=null}),r.loadAddon(t),E.current=t}catch{}r.open(t),i.fit(),w.current||(w.current=!0,KO(`terminal_init`,{isiOS:b,useWebGL:me.current,hasWebGL:!!E.current,userAgent:navigator.userAgent.slice(0,120),platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints},`info`)),m&&r.element&&r.element.appendChild(m)}};document.fonts?.ready?document.fonts.ready.then(p).catch(p):p();let m=null,h=null,g=null;typeof document<`u`&&document.createElement&&(m=document.createElement(`div`),m.className=`xterm-hover`,m.style.cssText=`
|
|
197
197
|
position: absolute;
|
|
198
198
|
display: none;
|
|
199
199
|
z-index: 20;
|
|
@@ -207,9 +207,9 @@ ${s.join(`
|
|
|
207
207
|
pointer-events: none;
|
|
208
208
|
max-width: 400px;
|
|
209
209
|
word-break: break-all;
|
|
210
|
-
`,h=document.createElement(`div`),m.appendChild(h),g=document.createElement(`div`),g.style.color=`var(--text-muted)`,g.style.marginTop=`2px`,g.style.fontSize=`11px`,m.appendChild(g),O.current=m);let C=(e,t)=>{if(!r.element||!m||!h||!g)return;let n=dG(t);if(!n)return;let i=r.element.getBoundingClientRect(),a=n.length>60?n.slice(0,57)+`...`:n;h.textContent=a,g.textContent=`${fG()?`⌘`:`Ctrl`}+click to open`,m.style.left=`${e.clientX-i.left+10}px`,m.style.top=`${e.clientY-i.top+10}px`,m.style.display=`block`},M=()=>{m&&(m.style.display=`none`)},P=null,L=!1,ee=null,z={activate:(e,t)=>{if(!L&&(e.metaKey||e.ctrlKey)){let e=dG(t);if(!e)return;window.open(e,`_blank`,`noopener`)}},hover:(e,t)=>{P=dG(t)||null,C(e,t)},leave:()=>{P=null,M()}},te=e=>{P&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),L=!0,window.open(P,`_blank`,`noopener`),ee&&clearTimeout(ee),ee=setTimeout(()=>{L=!1},100))};t.addEventListener(`mousedown`,te,!0),r.options.linkHandler=z;let V=new pH((e,t)=>z.activate(e,t),{urlRegex:sG,hover:(e,t)=>z.hover(e,t),leave:()=>z.leave()});r.loadAddon(V),D.current=V;let H=null,re=null,ie=fG()?`metaKey`:`ctrlKey`,U=(e,t)=>{t&&ae.current===e&&oe.current===e&&(I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:e}),ke(!1)),de.current({type:`terminal-input`,sessionId:e,data:t}))};r.attachCustomKeyEventHandler(e=>{if(e.type===`keydown`&&/^Digit[1-9]$/.test(e.code)&&mt(e,dt(W.getState().shortcutModifier)))return!1;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`c`&&r.hasSelection()){let e=r.getSelection();return e?.trim()&&navigator.clipboard&&navigator.clipboard.writeText(e),!1}if(fG()&&!b&&e.ctrlKey&&!e.metaKey&&e.key.toLowerCase()===`v`&&e.type===`keydown`){let e=oe.current;if(e){if(!y())return v.current?.(`Use browser paste or choose a file from this device.`),!1;I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:e}),ke(!1)),(async()=>{U(e,await CG(fe.current,{}))})()}return!e}if(e[ie]&&e.key.toLowerCase()===`v`&&e.type===`keydown`){re!==null&&(clearTimeout(re),re=null),H=null;let e=new Promise(e=>{re=setTimeout(()=>{re=null,H=null,e(null)},100),H=t=>{re!==null&&(clearTimeout(re),re=null),e(t)}});return(async()=>{try{let t=oe.current;if(!t)return;let n=await e;if(!n&&_.current)return;let r=n?.text??null;if(r===null)try{r=await navigator.clipboard.readText()}catch{r=``}if(n?.files.length&&_.current){if(ae.current===t&&oe.current===t){let e=n.files.map(e=>e.name).join(`
|
|
210
|
+
`,h=document.createElement(`div`),m.appendChild(h),g=document.createElement(`div`),g.style.color=`var(--text-muted)`,g.style.marginTop=`2px`,g.style.fontSize=`11px`,m.appendChild(g),O.current=m);let C=(e,t)=>{if(!r.element||!m||!h||!g)return;let n=dG(t);if(!n)return;let i=r.element.getBoundingClientRect(),a=n.length>60?n.slice(0,57)+`...`:n;h.textContent=a,g.textContent=`${fG()?`⌘`:`Ctrl`}+click to open`,m.style.left=`${e.clientX-i.left+10}px`,m.style.top=`${e.clientY-i.top+10}px`,m.style.display=`block`},M=()=>{m&&(m.style.display=`none`)},P=null,L=!1,ee=null,z={activate:(e,t)=>{if(!L&&(e.metaKey||e.ctrlKey)){let e=dG(t);if(!e)return;window.open(e,`_blank`,`noopener`)}},hover:(e,t)=>{P=dG(t)||null,C(e,t)},leave:()=>{P=null,M()}},te=e=>{P&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.stopPropagation(),L=!0,window.open(P,`_blank`,`noopener`),ee&&clearTimeout(ee),ee=setTimeout(()=>{L=!1},100))};t.addEventListener(`mousedown`,te,!0),r.options.linkHandler=z;let V=new pH((e,t)=>z.activate(e,t),{urlRegex:sG,hover:(e,t)=>z.hover(e,t),leave:()=>z.leave()});r.loadAddon(V),D.current=V;let H=null,re=null,ie=fG()?`metaKey`:`ctrlKey`,U=(e,t)=>{t&&ae.current===e&&oe.current===e&&(I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:e}),ke(!1)),de.current({type:`terminal-input`,sessionId:e,data:t}))};r.attachCustomKeyEventHandler(e=>{if(e.type===`keydown`&&/^(Digit[1-9]|Comma)$/.test(e.code)&&mt(e,dt(W.getState().shortcutModifier)))return!1;if((e.ctrlKey||e.metaKey)&&e.key.toLowerCase()===`c`&&r.hasSelection()){let e=r.getSelection();return e?.trim()&&navigator.clipboard&&navigator.clipboard.writeText(e),!1}if(fG()&&!b&&e.ctrlKey&&!e.metaKey&&e.key.toLowerCase()===`v`&&e.type===`keydown`){let e=oe.current;if(e){if(!y())return v.current?.(`Use browser paste or choose a file from this device.`),!1;I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:e}),ke(!1)),(async()=>{U(e,await CG(fe.current,{}))})()}return!e}if(e[ie]&&e.key.toLowerCase()===`v`&&e.type===`keydown`){re!==null&&(clearTimeout(re),re=null),H=null;let e=new Promise(e=>{re=setTimeout(()=>{re=null,H=null,e(null)},100),H=t=>{re!==null&&(clearTimeout(re),re=null),e(t)}});return(async()=>{try{let t=oe.current;if(!t)return;let n=await e;if(!n&&_.current)return;let r=n?.text??null;if(r===null)try{r=await navigator.clipboard.readText()}catch{r=``}if(n?.files.length&&_.current){if(ae.current===t&&oe.current===t){let e=n.files.map(e=>e.name).join(`
|
|
211
211
|
`);_.current({files:n.files,text:r.trim()===e?``:r})}return}if(n?.hasImage&&fG()&&!b){if(!y()){if(n.imageBlob){let e=n.imageBlob;_.current?.({text:``,files:[new File([e],`clipboard.${e.type.split(`/`)[1]||`png`}`,{type:e.type})]})}else v.current?.(`The browser did not provide image data. Choose the file to upload it.`);return}U(t,await CG(fe.current,{blob:n.imageBlob}));return}if(n?.hasFiles&&!y()){v.current?.(`The browser did not provide file data. Drop the file onto the terminal or choose it to upload.`);return}if((!r||n?.hasFiles)&&fG()&&!b&&y())try{let e=await fetch(`/api/clipboard-file-path`);if(e.ok){let{path:n,isImage:r}=await e.json();if(n){if(r){U(t,await CG(fe.current,{path:n}));return}U(t,JW(n)+` `);return}}}catch{}if(r&&!TG(r)){ae.current===t&&oe.current===t&&(I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:t}),ke(!1)),de.current({type:`terminal-paste`,sessionId:t,data:r}));return}fG()&&!b&&y()&&U(t,await CG(fe.current,{}))}finally{H=null}})(),!!_.current&&ie===`metaKey`}if(e.ctrlKey&&e.key===`Backspace`&&e.type===`keydown`){let e=oe.current;return e&&de.current({type:`terminal-input`,sessionId:e,data:``}),!1}return!0});let se=e=>{if(!H){let t=QW(e.clipboardData),n=e.clipboardData?.getData(`text/plain`)??``;if(!t.length&&!n||!_.current)return;if(e.preventDefault(),e.stopPropagation(),oe.current&&oe.current===ae.current){let e=t.map(e=>e.name).join(`
|
|
212
|
-
`);_.current({text:t.length&&n.trim()===e?``:n,files:t})}return}e.preventDefault(),e.stopPropagation();let t=e.clipboardData?.getData(`text/plain`)??``,n=DG(e.clipboardData),r=n!==null||EG(e.clipboardData),i=H;H=null,i({text:t,hasImage:r,hasFiles:(e.clipboardData?.files?.length??0)>0||Array.from(e.clipboardData?.items??[]).some(e=>e.kind===`file`)||Array.from(e.clipboardData?.types??[]).includes(`Files`),imageBlob:n,files:QW(e.clipboardData)})};return t.addEventListener(`paste`,se,{capture:!0}),r.onData(e=>{let t=oe.current;if(t){let n=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(e);if(I.current&&n)return;I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:t}),ke(!1)),de.current({type:`terminal-input`,sessionId:t,data:e})}}),r.attachCustomWheelEventHandler(e=>{let t=oe.current;if(!t||e.target?.closest(`input, textarea, [contenteditable="true"], .xterm-hover`)||r.hasSelection()||e.shiftKey)return!0;F.current+=e.deltaY;let n=r.cols,i=r.rows,a=Math.floor(n/2),o=Math.floor(i/2),s=!1,c=!1;for(;Math.abs(F.current)>=30;){c=!0;let e=F.current>0;F.current+=e?-30:30;let n=e?65:64;e||(s=!0),de.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${n};${a};${o}M`})}return s&&!R.current&&ke(!0),c&&!R.current&&Ae(),!1}),S.current=r,T.current=i,()=>{if(n=!0,ee&&clearTimeout(ee),P=null,t.removeEventListener(`mousedown`,te,!0),t.removeEventListener(`paste`,se,!0),re!==null&&(clearTimeout(re),re=null),H=null,O.current&&=(O.current.remove(),null),D.current){try{D.current.dispose()}catch{}D.current=null}if(E.current){try{E.current.dispose()}catch{}E.current=null}try{r.dispose()}catch{}t&&(t.innerHTML=``),S.current=null,T.current=null,k.current=null,A.current=null,j.current=null,N.current&&window.clearTimeout(N.current),B.current!==null&&window.clearTimeout(B.current)}},[je]),(0,C.useEffect)(()=>{S.current&&(S.current.options.theme=c)},[c]),(0,C.useEffect)(()=>{let e=S.current,t=T.current;if(e&&t){e.options.fontFamily=f,e.options.fontSize=l,e.options.lineHeight=Math.round(l*u)/l,e.options.letterSpacing=d,t.fit();let n=ae.current;n&&de.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})}},[l,u,d,f]),(0,C.useEffect)(()=>{let e=S.current;if(!e)return;let t=me.current;if(me.current=p,t!==p){if(p){if(!E.current)try{let t=new sH;t.onContextLoss(()=>{try{t.dispose()}catch{}E.current=null}),e.loadAddon(t),E.current=t}catch{}}else if(E.current){try{E.current.dispose()}catch{}E.current=null}}},[p]),(0,C.useLayoutEffect)(()=>{(oe.current!==e||!r||i!==`connected`||ce.current>=0&&ce.current!==a)&&(oe.current=null,e&&r&&i===`connected`&&Se(!0))},[e,r,i,a]),(0,C.useEffect)(()=>{let n=S.current;if(!n)return;let o=ae.current,s=se.current;if(!r){oe.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(de.current({type:`terminal-detach`,sessionId:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,ke(!1)),n.reset(),ye.current=!1,Se(!1);return}if(i!==`connected`){oe.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(KO(`terminal_detach_on_disconnect`,{connectionStatus:i,prevAttached:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,ke(!1)),oG(),ye.current=!1,Se(!1);return}if(o&&o!==e){oe.current=null;try{let e=A.current?.serialize();if(e&&(rG.set(o,e),rG.size>iG)){let e=rG.keys().next().value;e&&rG.delete(e)}}catch{}de.current({type:`terminal-detach`,sessionId:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,ke(!1)}let c=ce.current,l=a!==c;if(e&&(e!==o||t!==s||l)){KO(`terminal_attach`,{sessionId:e,tmuxTarget:t,prevAttached:o,prevTarget:s,connectionStatus:i,connectionEpoch:a,attachedEpoch:c});let r=performance.now();he.current=[],ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null),_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null),ye.current=!0,Se(!0),o!==null&&(oe.current=null);let l=rG.get(e);l&&(n.reset(),n.write(bG(l,be)));let u=T.current;u&&u.fit();let d=performance.now();ae.current=e,se.current=t??null,ce.current=a,le.current=e,ue.current=r,P.current!==null&&(window.clearTimeout(P.current),P.current=null);let f={type:`terminal-attach`,sessionId:e,tmuxTarget:t??void 0,cols:n.cols,rows:n.rows},p=o!==null&&o!==e;if(p){let t=e;queueMicrotask(()=>{ae.current===t&&(de.current(f),de.current({type:`tmux-check-copy-mode`,sessionId:e}))})}else P.current=window.setTimeout(()=>{P.current=null,de.current(f),de.current({type:`tmux-check-copy-mode`,sessionId:e})},50);KO(`switch_attach_sent`,{sessionId:e,fitMs:Math.round(d-r),totalMs:Math.round(performance.now()-r),from:o??null,immediate:p})}return e&&e===o&&t===s&&!l&&KO(`terminal_attach_skip`,{sessionId:e,prevAttached:o,connectionStatus:i,connectionEpoch:a,attachedEpoch:c}),!e&&o&&(P.current!==null&&(window.clearTimeout(P.current),P.current=null),ae.current=null,se.current=null,ce.current=-1,le.current=null,oe.current=null),()=>{P.current!==null&&(KO(`attach_debounce_cancelled`,{sessionId:e,attachedSession:ae.current},`info`),window.clearTimeout(P.current),P.current=null)}},[e,t,r,i,a,Oe,ke]),(0,C.useEffect)(()=>{if(U.current!==null&&(globalThis.clearInterval(U.current),U.current=null),!(!e||!r||i!==`connected`))return U.current=globalThis.setInterval(()=>{ae.current===e&&de.current({type:`tmux-check-copy-mode`,sessionId:e})},750),()=>{U.current!==null&&(globalThis.clearInterval(U.current),U.current=null)}},[e,r,i]),(0,C.useEffect)(()=>{let e=()=>{ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null),_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null);let e=S.current,t=he.current;if(!e||t.length===0)return;he.current=[];let n=t.join(``);ye.current&&=(e.reset(),!1);let r=performance.now(),i=n.length;e.write(bG(n,be),()=>{let e=Math.round(performance.now()-r);e>50&&KO(`switch_write_slow`,{sessionId:ae.current,writeMs:e,bytes:i}),b&&e>50&&KO(`ios_write_slow`,{sessionId:ae.current,writeMs:e,bytes:i}),Oe()})},t=()=>{ge.current!==null&&window.clearTimeout(ge.current),ge.current=window.setTimeout(e,2),_e.current===null&&(_e.current=window.setTimeout(e,16))},n=()=>{let e=ve.current;e.timer=null,e.count!==0&&(KO(`terminal_output_dropped`,{messageSessionId:e.lastMessageSessionId,attachedSession:ae.current,drops:e.count,bytes:e.bytes,hasSwitchStart:ue.current!==null},`info`),e.count=0,e.bytes=0,e.lastEmit=performance.now())},r=s(r=>{let i=ae.current;if(r.type===`terminal-output`&&(!i||r.sessionId!==i)){let e=ve.current;e.count+=1,e.bytes+=r.data.length,e.lastMessageSessionId=r.sessionId;let t=performance.now();t-e.lastEmit>=1e3?n():e.timer===null&&(e.timer=window.setTimeout(n,1e3-(t-e.lastEmit)))}if(r.type===`terminal-output`&&i&&r.sessionId===i){let e=ue.current;e&&(KO(`switch_first_output`,{sessionId:r.sessionId,serverRoundtripMs:Math.round(performance.now()-e),bytes:r.data.length,parseMs:r._parseMs??-1,rawLength:r._rawLength??-1}),ue.current=null),he.current.push(b?MG(r.data):r.data),t()}if(r.type===`terminal-ready`&&i&&r.sessionId===i){oe.current=r.sessionId,ye.current&&he.current.length>0?e():ye.current&&=(S.current?.reset(),!1),Se(!1);let t=ue.current;t&&(KO(`switch_ready`,{sessionId:r.sessionId,totalMs:Math.round(performance.now()-t)}),ue.current=null),le.current===r.sessionId&&(S.current?.focus(),le.current=null),b&&(e(),De(50,`terminal-ready`))}if(r.type===`terminal-error`&&i&&(!r.sessionId||r.sessionId===i)&&(oe.current=null,ye.current=!1,Se(!1)),r.type===`clipboard-offer`&&i&&r.sessionId===i){let e=r.text;if(!e?.trim())return;if(!b&&navigator.clipboard?.writeText){let t=performance.now();navigator.clipboard.writeText(e).then(()=>{KO(`clipboard_write_success`,{source:r.source,chars:e.length,durationMs:Math.round(performance.now()-t)})}).catch(t=>{KO(`clipboard_write_failed`,{source:r.source,chars:e.length,error:t instanceof Error?t.message:String(t)},`warn`),ne(e,r.source)})}else ne(e,r.source)}if(r.type===`tmux-copy-mode-status`&&i&&r.sessionId===i){let e=r.appMouse===!0&&!r.inCopyMode;R.current=e,z.current=r.altScreen===!0;let t=S.current;if(t){let n=t.modes.mouseTrackingMode;(e?n!==`drag`:n!==`none`)&&t.write(e?hG:gG)}ke(r.inCopyMode)}});return()=>{r(),e(),Ee(),ve.current.timer!==null&&window.clearTimeout(ve.current.timer),n()}},[s,Oe,ke,ne]),(0,C.useEffect)(()=>{let e=x.current,t=S.current,n=T.current;if(!e||!t||!n)return;let r=()=>{M.current&&window.clearTimeout(M.current),M.current=window.setTimeout(()=>{je()},150)},i=new ResizeObserver(r);return i.observe(e),r(),()=>{i.disconnect(),M.current&&window.clearTimeout(M.current)}},[]),(0,C.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=()=>{document.visibilityState!==`hidden`&&KO(`terminal_visibility_resume`,{isiOS:b,hasWebGL:!!E.current,useWebGL:me.current,hasTerminal:!!S.current,bufferLines:S.current?.buffer.active.length??0,sessionId:ae.current},`info`)};if(document.addEventListener(`visibilitychange`,e),!b)return()=>{document.removeEventListener(`visibilitychange`,e)};let t=e=>{let t=S.current;if(t&&E.current&&me.current){try{E.current.dispose()}catch{}E.current=null;try{let n=new sH;n.onContextLoss(()=>{KO(`webgl_context_loss`,{sessionId:ae.current},`info`);try{n.dispose()}catch{}E.current=null}),t.loadAddon(n),E.current=n,KO(`ios_webgl_recreated`,{trigger:e},`info`)}catch{KO(`ios_webgl_recreate_failed`,{trigger:e},`info`)}}},n=()=>{document.visibilityState!==`hidden`&&(t(`visibilitychange`),De(200,`visibilitychange`))},r=e=>{e.persisted&&(t(`pageshow`),De(200,`pageshow`))},i=()=>{t(`focus`),De(200,`focus`)};return document.addEventListener(`visibilitychange`,n),window.addEventListener(`pageshow`,r),window.addEventListener(`focus`,i),()=>{document.removeEventListener(`visibilitychange`,e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pageshow`,r),window.removeEventListener(`focus`,i),Ee()}},[]),{containerRef:x,terminalRef:S,searchAddonRef:k,serializeAddonRef:A,progressAddonRef:j,inTmuxCopyModeRef:I,isTmuxCopyMode:L,appMouseRef:R,setTmuxCopyMode:ke,isSwitching:xe,isInputReady:!!e&&r&&i===`connected`&&oe.current===e,pendingClipboardOffer:V,copyPendingClipboardOffer:re,dismissPendingClipboardOffer:ie}}function PG(e=`(max-width: 767px)`){let[t,n]=(0,C.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(e).matches);return(0,C.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}function FG(e,t,n){(0,C.useEffect)(()=>{if(!t)return;let r=t=>{e.current&&!e.current.contains(t.target)&&n()};return document.addEventListener(`mousedown`,r),document.addEventListener(`touchstart`,r),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`touchstart`,r)}},[e,t,n])}function IG(e,t){(0,C.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t])}function LG({enabled:e,isOpen:t,onOpen:n,edgeThresholdPx:r=30,swipeDistancePx:i=50,swipeRatio:a=1.5}){let o=(0,C.useRef)(!1);return(0,C.useEffect)(()=>{if(!e)return;let s=0,c=0,l=!1,u=e=>{if(t)return;let n=e.touches[0];n.clientX<=r?(s=n.clientX,c=n.clientY,l=!0,o.current=!0):l=!1},d=e=>{if(o.current=!1,!l||t)return;let r=e.changedTouches[0],u=r.clientX-s,d=Math.abs(r.clientY-c);u>=i&&u>d*a&&n(),l=!1};return document.addEventListener(`touchstart`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{o.current=!1,document.removeEventListener(`touchstart`,u),document.removeEventListener(`touchend`,d)}},[e,t,n,r,i,a]),o}var RG=He()(Ge(e=>({theme:`dark`,setTheme:t=>e({theme:t}),toggleTheme:()=>e(e=>({theme:e.theme===`dark`?`light`:`dark`}))}),{name:`agentboard-theme`,storage:Ue(()=>Je)})),zG={dark:{background:`#2d2d2d`,foreground:`#d4d4d4`,cursor:`#3b82f6`,cursorAccent:`#2d2d2d`,selectionBackground:`rgba(59, 130, 246, 0.35)`,selectionForeground:`#ffffff`,black:`#808080`,red:`#f87171`,green:`#4ade80`,yellow:`#fbbf24`,blue:`#60a5fa`,magenta:`#c084fc`,cyan:`#22d3ee`,white:`#d4d4d4`,brightBlack:`#a0a0a0`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde047`,brightBlue:`#93c5fd`,brightMagenta:`#d8b4fe`,brightCyan:`#67e8f9`,brightWhite:`#ffffff`},light:{background:`#fafafa`,foreground:`#171717`,cursor:`#2563eb`,cursorAccent:`#fafafa`,selectionBackground:`rgba(37, 99, 235, 0.2)`,selectionForeground:`#000000`,black:`#171717`,red:`#dc2626`,green:`#16a34a`,yellow:`#ca8a04`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#f5f5f5`,brightBlack:`#737373`,brightRed:`#ef4444`,brightGreen:`#22c55e`,brightYellow:`#eab308`,brightBlue:`#3b82f6`,brightMagenta:`#a855f7`,brightCyan:`#06b6d4`,brightWhite:`#ffffff`}},BG=new WeakSet;function VG(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return!n?.get||!n.set?null:{get:n.get,set:n.set,enumerable:n.enumerable??!0,configurable:n.configurable??!0}}var HG=!1,UG=null,WG=null;function GG(){HG||(HG=!0,!(typeof Node>`u`||typeof HTMLElement>`u`)&&(UG=VG(Node.prototype,`textContent`),WG=VG(HTMLElement.prototype,`innerText`)))}function KG(e){if(BG.has(e))return;BG.add(e);let t=UG?.get;if(t)for(let[n,r]of[[`textContent`,UG],[`innerText`,WG]])r&&Object.defineProperty(e,n,{configurable:r.configurable,enumerable:r.enumerable,get(){return r.get.call(this)},set(e){t.call(this)!==e&&r.set.call(this,e)}})}function qG(e){GG();let t=()=>{for(let t of Array.from(e.children))t instanceof HTMLElement&&KG(t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0}),()=>n.disconnect()}var JG={working:`Working`,waiting:`Waiting`,permission:`Needs Input`,unknown:`Unknown`},YG={working:`text-working`,waiting:`text-waiting`,permission:`text-approval`,unknown:`text-muted`};function XG({anchor:e,items:t,anchorFromBottom:n=!1,onClose:r}){let i=(0,C.useRef)(null);return(0,C.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,S.jsx)(`div`,{ref:i,className:`fixed z-50 min-w-[180px] rounded-md border border-border bg-elevated py-1 shadow-lg`,style:{left:typeof window>`u`?e.x:Math.min(e.x,Math.max(8,window.innerWidth-190)),top:e.y,transform:n?`translateY(calc(-100% - 6px))`:void 0},role:`menu`,children:t.map((e,t)=>e===`divider`?(0,S.jsx)(`div`,{className:`my-1 border-t border-border`},`divider-${t}`):(0,S.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r(),e.onSelect()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm ${e.danger?`text-danger hover:bg-danger/10`:`text-secondary hover:bg-hover hover:text-primary`}`,role:`menuitem`,title:e.title,children:[e.icon,e.label]},e.key))})}var ZG=`flex h-7 shrink-0 items-center gap-2 rounded-md px-2.5 text-xs font-medium transition-colors active:scale-95`,QG=`flex h-7 shrink-0 items-center gap-2 rounded-md border border-border bg-surface px-2.5 text-xs text-secondary transition-colors hover:bg-hover hover:text-primary`,$G=`text-[11px]`,eK=`inline-flex shrink-0 items-center rounded-full bg-hover px-1.5 py-0.5 text-[11px] leading-none text-secondary`,tK=()=>(0,S.jsx)(`span`,{"aria-hidden":!0,className:`mx-2 h-5 w-px shrink-0 bg-border`}),nK=`inline-block w-[11ch] shrink-0 whitespace-nowrap text-left text-xs`;function rK(){let[e,t]=(0,C.useState)(!1),n=(0,C.useRef)(null);return(0,C.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),[e,(0,C.useCallback)(()=>{t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),1500)},[])]}function iK({session:e,hibernatingSession:t,hibernatingDisplayName:n,showHostBadge:r,sessionCount:i,connectionStatus:a,isSwitching:o,canControl:s,canHibernate:c,modDisplay:l,onKill:u,onHibernate:d,onWake:f,onRename:p,onDuplicate:m,onMoveToHistory:h,isTmuxCopyMode:g,showJumpToBottom:_,onJumpToBottom:v,selectionReady:y,onCopySelection:b,onDismissSelection:x}){let w=W(e=>e.showProjectName),T=W(e=>e.showSessionIdPrefix),[E,O]=(0,C.useState)(null),[k,A]=(0,C.useState)(!1),[j,M]=(0,C.useState)(``),N=(0,C.useRef)(null),[P,I]=rK(),[L,ee]=rK(),R=e?e.agentSessionName||e.name:``,z=e?R:n,B=e?.projectPath&&dh(e.projectPath)!==R?dh(e.projectPath):``,te=t?.projectPath&&dh(t.projectPath)!==n?dh(t.projectPath):``,H=e?.agentSessionId?.trim(),re=T&&H?ph(H):null,ie=!!re||r&&!!e?.host?.trim()||w&&!!B,U=r&&!!t?.host?.trim()||w&&!!te,ae=y&&!!e||g&&!!e||_&&!!e;(0,C.useEffect)(()=>{k&&N.current&&(N.current.focus(),N.current.select())},[k]),(0,C.useEffect)(()=>{A(!1)},[e?.id??t?.sessionId??null]);let oe=(0,C.useCallback)(()=>{M(z),A(!0)},[z]),se=(0,C.useCallback)(()=>{let e=j.trim();e&&e!==z&&p(e),A(!1)},[j,z,p]),ce=e=>{e.preventDefault(),e.stopPropagation(),O({x:e.clientX,y:e.clientY})},le=[];e?(le.push({key:`rename`,label:`Rename`,icon:(0,S.jsx)(V,{width:G.default,height:G.default}),onSelect:oe},...m?[{key:`duplicate`,label:`Duplicate`,icon:(0,S.jsx)(F,{width:G.default,height:G.default}),title:`Create a copy in a new tmux window`,onSelect:m}]:[],...c?[{key:`hibernate`,label:`Hibernate`,icon:(0,S.jsx)(xe,{width:G.default,height:G.default}),title:`Close the live window and keep this session ready to wake`,onSelect:d}]:[],...H?[{key:`copy-id`,label:`Copy Session ID`,icon:(0,S.jsx)(pe,{width:G.default,height:G.default}),title:H,onSelect:()=>mh(H)}]:[],...e.logFilePath?[{key:`copy-log`,label:`Copy Log Path`,icon:(0,S.jsx)(ne,{width:G.default,height:G.default}),title:e.logFilePath,onSelect:()=>mh(e.logFilePath)}]:[]),s&&le.push(`divider`,{key:`kill`,label:`Kill Session`,icon:(0,S.jsx)(Fe,{width:G.default,height:G.default}),danger:!0,onSelect:u})):t&&(le.push({key:`wake`,label:`Wake`,icon:(0,S.jsx)(De,{width:G.default,height:G.default}),onSelect:f},{key:`rename`,label:`Rename`,icon:(0,S.jsx)(V,{width:G.default,height:G.default}),onSelect:oe},{key:`copy-id`,label:`Copy Session ID`,icon:(0,S.jsx)(pe,{width:G.default,height:G.default}),title:t.sessionId,onSelect:()=>mh(t.sessionId)},...t.logFilePath?[{key:`copy-log`,label:`Copy Log Path`,icon:(0,S.jsx)(ne,{width:G.default,height:G.default}),title:t.logFilePath,onSelect:()=>mh(t.logFilePath)}]:[]),h&&le.push(`divider`,{key:`move-to-history`,label:`Move to History`,icon:(0,S.jsx)(Fe,{width:G.default,height:G.default}),onSelect:h}));let ue=(0,S.jsx)(`input`,{ref:N,type:`text`,value:j,onChange:e=>M(e.target.value),onBlur:se,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),se()):e.key===`Escape`&&A(!1)},onClick:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:`w-40 max-w-48 select-text rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`,"aria-label":`Rename session`}),de=(e,t)=>L?(0,S.jsx)(`span`,{className:eK,children:`Copied!`}):(0,S.jsx)(`button`,{type:`button`,onClick:()=>{mh(t),ee()},className:`shrink-0 cursor-pointer`,title:t,"aria-label":`Copy project path ${t}`,children:(0,S.jsx)(m_,{name:e,fullPath:t,className:$G})});return(0,S.jsxs)(`footer`,{className:`hidden h-10 shrink-0 select-none items-center justify-between gap-3 border-t border-border bg-elevated px-4 md:flex`,children:[(0,S.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:e?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center`,onContextMenu:ce,children:[k?ue:(0,S.jsx)(`span`,{className:`max-w-48 truncate text-sm font-medium text-primary`,children:R}),(0,S.jsx)(tK,{}),(0,S.jsx)(`span`,{className:`${nK} ${YG[e.status]}`,children:JG[e.status]}),ie&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(tK,{}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[re&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>{mh(H),I()},className:`shrink-0 cursor-pointer text-xs text-muted transition-colors hover:text-primary`,title:`${H} — click to copy`,"aria-label":`Copy session ID`,children:P?`Copied!`:re}),r&&e.host?.trim()&&(0,S.jsx)(h_,{name:e.host.trim(),className:$G}),w&&B&&de(B,e.projectPath)]})]})]}),e.prs&&e.prs.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(tK,{}),(0,S.jsx)(B_,{prs:e.prs,className:`min-w-0 flex-1`})]})]}):t?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center`,onContextMenu:ce,children:[k?ue:(0,S.jsx)(`span`,{className:`max-w-48 truncate text-sm font-medium text-primary`,children:n}),(0,S.jsx)(tK,{}),(0,S.jsx)(`span`,{className:`shrink-0 rounded-full bg-blue-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),U&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(tK,{}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[r&&t.host?.trim()&&(0,S.jsx)(h_,{name:t.host.trim(),className:$G}),w&&te&&de(te,t.projectPath)]})]})]}),t.prs&&t.prs.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(tK,{}),(0,S.jsx)(B_,{prs:t.prs,className:`min-w-0 flex-1`})]})]}):(0,S.jsxs)(`span`,{className:`text-xs text-muted`,children:[i,` `,i===1?`session`:`sessions`]})}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5`,children:[y&&e&&(0,S.jsxs)(`span`,{className:`${QG} cursor-default`,children:[(0,S.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full bg-accent`}),`Selection ready`,(0,S.jsxs)(`button`,{type:`button`,onClick:b,className:`flex h-5 items-center gap-1 rounded px-1 font-medium text-accent hover:text-primary`,"aria-label":`Copy selection`,children:[(0,S.jsx)(F,{width:G.pill,height:G.pill}),`Copy`]}),(0,S.jsx)(`button`,{type:`button`,onClick:x,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted hover:text-primary`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,S.jsx)(Fe,{width:G.pill,height:G.pill})})]}),g&&e?(0,S.jsxs)(`button`,{type:`button`,onClick:v,className:QG,title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,S.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full bg-amber-400`}),`Copy mode`,(0,S.jsx)(`span`,{"aria-hidden":!0,className:`text-muted`,children:`·`}),(0,S.jsx)(`span`,{className:`font-medium text-amber-400`,children:`Exit`})]}):_&&e?(0,S.jsxs)(`button`,{type:`button`,onClick:v,className:QG,title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,S.jsx)(D,{width:G.pill,height:G.pill}),`Jump to bottom`]}):null,ae&&(0,S.jsx)(tK,{}),a!==`connected`&&(0,S.jsx)(`span`,{className:`text-xs text-approval`,children:a}),t&&(0,S.jsx)(`button`,{type:`button`,onClick:f,className:`${ZG} border border-border bg-surface text-secondary hover:bg-hover hover:text-primary`,children:`Wake`}),e&&c&&(0,S.jsx)(`button`,{onClick:d,className:_t(`neutral`),title:`Hibernate session`,"aria-label":`Hibernate session`,children:(0,S.jsx)(xe,{width:G.default,height:G.default})}),e&&s&&(0,S.jsx)(`button`,{disabled:o,onClick:u,className:_t(`danger`),title:`Kill session (${l}X)`,"aria-label":`Kill session`,children:(0,S.jsx)(Fe,{width:G.default,height:G.default})})]}),E&&le.length>0&&(0,S.jsx)(XG,{anchor:E,items:le,anchorFromBottom:!0,onClose:()=>O(null)})]})}function aK(e,t){let n=(0,C.useRef)(!1);return(0,C.useEffect)(()=>{if(n.current=!1,t||typeof document>`u`)return;let e=document,r=window,i=e=>{e.key===`Shift`&&(n.current=!0)},a=e=>{e.key===`Shift`&&(n.current=!1)},o=()=>{n.current=!1},s=()=>{e.visibilityState===`hidden`&&o()};return e.addEventListener(`keydown`,i,!0),e.addEventListener(`keyup`,a,!0),e.addEventListener(`focusout`,o,!0),e.addEventListener(`visibilitychange`,s),r.addEventListener(`blur`,o),()=>{o(),e.removeEventListener(`keydown`,i,!0),e.removeEventListener(`keyup`,a,!0),e.removeEventListener(`focusout`,o,!0),e.removeEventListener(`visibilitychange`,s),r.removeEventListener(`blur`,o)}},[e,t]),n}var oK={up:`\x1B[A`,down:`\x1B[B`,left:`\x1B[D`,right:`\x1B[C`},sK={up:`\x1B[1;2A`,down:`\x1B[1;2B`,left:`\x1B[1;2D`,right:`\x1B[1;2C`},cK=44,lK=6,uK=8,dK=10,fK=8,pK=700;3*cK+2*lK+2*uK,2*cK+lK+2*uK;var mK={up:`↑`,down:`↓`,left:`←`,right:`→`},hK={up:`1 / 2 / 2 / 3`,left:`2 / 1 / 3 / 2`,down:`2 / 2 / 3 / 3`,right:`2 / 3 / 3 / 4`};function gK(e=10){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate(e)}function _K(e,t){let n=e.left-t.left+e.width/2,r=fK+160/2,i=t.width-fK-160/2;return r>i?t.width/2:Math.max(r,Math.min(i,n))}function vK({onSendKey:e,disabled:t=!1,onRefocus:n,isKeyboardVisible:r,sessionKey:i=null}){let[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(0),[l,u]=(0,C.useState)(null),d=(0,C.useId)(),f=aK(i,t),p=(0,C.useRef)(null),m=(0,C.useRef)(!1),h=(0,C.useRef)(null),g=(0,C.useRef)(null),_=(0,C.useRef)(null),v=(0,C.useRef)(null),y=(0,C.useRef)(0),b=(0,C.useRef)(e),x=(0,C.useRef)(t);b.current=e,x.current=t;let w=(0,C.useCallback)(()=>{h.current&&=(clearTimeout(h.current),null),g.current&&=(clearInterval(g.current),null),_.current=null,v.current=null},[]),T=(0,C.useCallback)(()=>{w(),u(null)},[w]),E=(0,C.useCallback)(()=>{T(),o(!1),m.current&&n?.()},[T,n]),D=(0,C.useCallback)(()=>{let e=p.current,t=e?.getBoundingClientRect?.(),n=e?.closest?.(`.terminal-controls`)?.getBoundingClientRect?.();if(!t||!n){c(160/2+fK);return}c(_K(t,n))},[]),O=(0,C.useCallback)(()=>{m.current=r?.()??!1,D(),o(!0)},[r,D]),k=(0,C.useCallback)(()=>{t||(gK(),a?E():O())},[t,a,E,O]),A=(0,C.useCallback)(e=>{e.preventDefault(),y.current=Date.now(),k()},[k]),j=(0,C.useCallback)(()=>Date.now()-y.current<pK,[]),M=(0,C.useCallback)(e=>{j()||k()},[j,k]),N=(0,C.useCallback)(e=>{if(x.current)return;let t=f.current?sK:oK;b.current(t[e])},[f]),P=(0,C.useCallback)(e=>{w(),_.current=e,u(e),gK(8),N(e),h.current=setTimeout(()=>{g.current=setInterval(()=>{_.current===e&&(gK(5),N(e))},100)},400)},[w,N]),F=(0,C.useCallback)(e=>n=>{t||(n.preventDefault(),v.current===null&&(n.currentTarget.setPointerCapture?.(n.pointerId),y.current=Date.now(),P(e),v.current=n.pointerId))},[t,P]),I=(0,C.useCallback)(e=>{e.preventDefault(),!(v.current!==null&&e.pointerId!==v.current)&&T()},[T]),L=(0,C.useCallback)(e=>n=>{t||j()||(gK(8),N(e))},[t,j,N]),ee=(0,C.useCallback)(e=>{e.preventDefault(),E()},[E]);(0,C.useEffect)(()=>{t&&a&&E()},[t,a,E]);let R=(0,C.useRef)(i);return(0,C.useEffect)(()=>{R.current!==i&&(R.current=i,T())},[i,T]),(0,C.useEffect)(()=>{if(!a)return;let e=p.current?.parentElement;if(e?.addEventListener)return e.addEventListener(`scroll`,D,{passive:!0}),()=>e.removeEventListener(`scroll`,D)},[a,D]),(0,C.useEffect)(()=>w,[w]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{ref:p,type:`button`,"aria-label":`Arrow keys`,"aria-haspopup":`true`,"aria-expanded":a,"aria-controls":a?d:void 0,className:`
|
|
212
|
+
`);_.current({text:t.length&&n.trim()===e?``:n,files:t})}return}e.preventDefault(),e.stopPropagation();let t=e.clipboardData?.getData(`text/plain`)??``,n=DG(e.clipboardData),r=n!==null||EG(e.clipboardData),i=H;H=null,i({text:t,hasImage:r,hasFiles:(e.clipboardData?.files?.length??0)>0||Array.from(e.clipboardData?.items??[]).some(e=>e.kind===`file`)||Array.from(e.clipboardData?.types??[]).includes(`Files`),imageBlob:n,files:QW(e.clipboardData)})};return t.addEventListener(`paste`,se,{capture:!0}),r.onData(e=>{let t=oe.current;if(t){let n=/^\x1b\[(<[\d;]+[Mm]|[\d;]+M|M[\x20-\xff]{3})$/.test(e);if(I.current&&n)return;I.current&&(de.current({type:`tmux-cancel-copy-mode`,sessionId:t}),ke(!1)),de.current({type:`terminal-input`,sessionId:t,data:e})}}),r.attachCustomWheelEventHandler(e=>{let t=oe.current;if(!t||e.target?.closest(`input, textarea, [contenteditable="true"], .xterm-hover`)||r.hasSelection()||e.shiftKey)return!0;F.current+=e.deltaY;let n=r.cols,i=r.rows,a=Math.floor(n/2),o=Math.floor(i/2),s=!1,c=!1;for(;Math.abs(F.current)>=30;){c=!0;let e=F.current>0;F.current+=e?-30:30;let n=e?65:64;e||(s=!0),de.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${n};${a};${o}M`})}return s&&!R.current&&ke(!0),c&&!R.current&&Ae(),!1}),S.current=r,T.current=i,()=>{if(n=!0,ee&&clearTimeout(ee),P=null,t.removeEventListener(`mousedown`,te,!0),t.removeEventListener(`paste`,se,!0),re!==null&&(clearTimeout(re),re=null),H=null,O.current&&=(O.current.remove(),null),D.current){try{D.current.dispose()}catch{}D.current=null}if(E.current){try{E.current.dispose()}catch{}E.current=null}try{r.dispose()}catch{}t&&(t.innerHTML=``),S.current=null,T.current=null,k.current=null,A.current=null,j.current=null,N.current&&window.clearTimeout(N.current),B.current!==null&&window.clearTimeout(B.current)}},[je]),(0,C.useEffect)(()=>{S.current&&(S.current.options.theme=c)},[c]),(0,C.useEffect)(()=>{let e=S.current,t=T.current;if(e&&t){e.options.fontFamily=f,e.options.fontSize=l,e.options.lineHeight=Math.round(l*u)/l,e.options.letterSpacing=d,t.fit();let n=ae.current;n&&de.current({type:`terminal-resize`,sessionId:n,cols:e.cols,rows:e.rows})}},[l,u,d,f]),(0,C.useEffect)(()=>{let e=S.current;if(!e)return;let t=me.current;if(me.current=p,t!==p){if(p){if(!E.current)try{let t=new sH;t.onContextLoss(()=>{try{t.dispose()}catch{}E.current=null}),e.loadAddon(t),E.current=t}catch{}}else if(E.current){try{E.current.dispose()}catch{}E.current=null}}},[p]),(0,C.useLayoutEffect)(()=>{(oe.current!==e||!r||i!==`connected`||ce.current>=0&&ce.current!==a)&&(oe.current=null,e&&r&&i===`connected`&&Se(!0))},[e,r,i,a]),(0,C.useEffect)(()=>{let n=S.current;if(!n)return;let o=ae.current,s=se.current;if(!r){oe.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(de.current({type:`terminal-detach`,sessionId:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,ke(!1)),n.reset(),ye.current=!1,Se(!1);return}if(i!==`connected`){oe.current=null,P.current!==null&&(window.clearTimeout(P.current),P.current=null),o&&(KO(`terminal_detach_on_disconnect`,{connectionStatus:i,prevAttached:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,ke(!1)),oG(),ye.current=!1,Se(!1);return}if(o&&o!==e){oe.current=null;try{let e=A.current?.serialize();if(e&&(rG.set(o,e),rG.size>iG)){let e=rG.keys().next().value;e&&rG.delete(e)}}catch{}de.current({type:`terminal-detach`,sessionId:o}),ae.current=null,se.current=null,ce.current=-1,le.current=null,ke(!1)}let c=ce.current,l=a!==c;if(e&&(e!==o||t!==s||l)){KO(`terminal_attach`,{sessionId:e,tmuxTarget:t,prevAttached:o,prevTarget:s,connectionStatus:i,connectionEpoch:a,attachedEpoch:c});let r=performance.now();he.current=[],ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null),_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null),ye.current=!0,Se(!0),o!==null&&(oe.current=null);let l=rG.get(e);l&&(n.reset(),n.write(bG(l,be)));let u=T.current;u&&u.fit();let d=performance.now();ae.current=e,se.current=t??null,ce.current=a,le.current=e,ue.current=r,P.current!==null&&(window.clearTimeout(P.current),P.current=null);let f={type:`terminal-attach`,sessionId:e,tmuxTarget:t??void 0,cols:n.cols,rows:n.rows},p=o!==null&&o!==e;if(p){let t=e;queueMicrotask(()=>{ae.current===t&&(de.current(f),de.current({type:`tmux-check-copy-mode`,sessionId:e}))})}else P.current=window.setTimeout(()=>{P.current=null,de.current(f),de.current({type:`tmux-check-copy-mode`,sessionId:e})},50);KO(`switch_attach_sent`,{sessionId:e,fitMs:Math.round(d-r),totalMs:Math.round(performance.now()-r),from:o??null,immediate:p})}return e&&e===o&&t===s&&!l&&KO(`terminal_attach_skip`,{sessionId:e,prevAttached:o,connectionStatus:i,connectionEpoch:a,attachedEpoch:c}),!e&&o&&(P.current!==null&&(window.clearTimeout(P.current),P.current=null),ae.current=null,se.current=null,ce.current=-1,le.current=null,oe.current=null),()=>{P.current!==null&&(KO(`attach_debounce_cancelled`,{sessionId:e,attachedSession:ae.current},`info`),window.clearTimeout(P.current),P.current=null)}},[e,t,r,i,a,Oe,ke]),(0,C.useEffect)(()=>{if(U.current!==null&&(globalThis.clearInterval(U.current),U.current=null),!(!e||!r||i!==`connected`))return U.current=globalThis.setInterval(()=>{ae.current===e&&de.current({type:`tmux-check-copy-mode`,sessionId:e})},750),()=>{U.current!==null&&(globalThis.clearInterval(U.current),U.current=null)}},[e,r,i]),(0,C.useEffect)(()=>{let e=()=>{ge.current!==null&&(window.clearTimeout(ge.current),ge.current=null),_e.current!==null&&(window.clearTimeout(_e.current),_e.current=null);let e=S.current,t=he.current;if(!e||t.length===0)return;he.current=[];let n=t.join(``);ye.current&&=(e.reset(),!1);let r=performance.now(),i=n.length;e.write(bG(n,be),()=>{let e=Math.round(performance.now()-r);e>50&&KO(`switch_write_slow`,{sessionId:ae.current,writeMs:e,bytes:i}),b&&e>50&&KO(`ios_write_slow`,{sessionId:ae.current,writeMs:e,bytes:i}),Oe()})},t=()=>{ge.current!==null&&window.clearTimeout(ge.current),ge.current=window.setTimeout(e,2),_e.current===null&&(_e.current=window.setTimeout(e,16))},n=()=>{let e=ve.current;e.timer=null,e.count!==0&&(KO(`terminal_output_dropped`,{messageSessionId:e.lastMessageSessionId,attachedSession:ae.current,drops:e.count,bytes:e.bytes,hasSwitchStart:ue.current!==null},`info`),e.count=0,e.bytes=0,e.lastEmit=performance.now())},r=s(r=>{let i=ae.current;if(r.type===`terminal-output`&&(!i||r.sessionId!==i)){let e=ve.current;e.count+=1,e.bytes+=r.data.length,e.lastMessageSessionId=r.sessionId;let t=performance.now();t-e.lastEmit>=1e3?n():e.timer===null&&(e.timer=window.setTimeout(n,1e3-(t-e.lastEmit)))}if(r.type===`terminal-output`&&i&&r.sessionId===i){let e=ue.current;e&&(KO(`switch_first_output`,{sessionId:r.sessionId,serverRoundtripMs:Math.round(performance.now()-e),bytes:r.data.length,parseMs:r._parseMs??-1,rawLength:r._rawLength??-1}),ue.current=null),he.current.push(b?MG(r.data):r.data),t()}if(r.type===`terminal-ready`&&i&&r.sessionId===i){oe.current=r.sessionId,ye.current&&he.current.length>0?e():ye.current&&=(S.current?.reset(),!1),Se(!1);let t=ue.current;t&&(KO(`switch_ready`,{sessionId:r.sessionId,totalMs:Math.round(performance.now()-t)}),ue.current=null),le.current===r.sessionId&&(S.current?.focus(),le.current=null),b&&(e(),De(50,`terminal-ready`))}if(r.type===`terminal-error`&&i&&(!r.sessionId||r.sessionId===i)&&(oe.current=null,ye.current=!1,Se(!1)),r.type===`clipboard-offer`&&i&&r.sessionId===i){let e=r.text;if(!e?.trim())return;if(!b&&navigator.clipboard?.writeText){let t=performance.now();navigator.clipboard.writeText(e).then(()=>{KO(`clipboard_write_success`,{source:r.source,chars:e.length,durationMs:Math.round(performance.now()-t)})}).catch(t=>{KO(`clipboard_write_failed`,{source:r.source,chars:e.length,error:t instanceof Error?t.message:String(t)},`warn`),ne(e,r.source)})}else ne(e,r.source)}if(r.type===`tmux-copy-mode-status`&&i&&r.sessionId===i){let e=r.appMouse===!0&&!r.inCopyMode;R.current=e,z.current=r.altScreen===!0;let t=S.current;if(t){let n=t.modes.mouseTrackingMode;(e?n!==`drag`:n!==`none`)&&t.write(e?hG:gG)}ke(r.inCopyMode)}});return()=>{r(),e(),Ee(),ve.current.timer!==null&&window.clearTimeout(ve.current.timer),n()}},[s,Oe,ke,ne]),(0,C.useEffect)(()=>{let e=x.current,t=S.current,n=T.current;if(!e||!t||!n)return;let r=()=>{M.current&&window.clearTimeout(M.current),M.current=window.setTimeout(()=>{je()},150)},i=new ResizeObserver(r);return i.observe(e),r(),()=>{i.disconnect(),M.current&&window.clearTimeout(M.current)}},[]),(0,C.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=()=>{document.visibilityState!==`hidden`&&KO(`terminal_visibility_resume`,{isiOS:b,hasWebGL:!!E.current,useWebGL:me.current,hasTerminal:!!S.current,bufferLines:S.current?.buffer.active.length??0,sessionId:ae.current},`info`)};if(document.addEventListener(`visibilitychange`,e),!b)return()=>{document.removeEventListener(`visibilitychange`,e)};let t=e=>{let t=S.current;if(t&&E.current&&me.current){try{E.current.dispose()}catch{}E.current=null;try{let n=new sH;n.onContextLoss(()=>{KO(`webgl_context_loss`,{sessionId:ae.current},`info`);try{n.dispose()}catch{}E.current=null}),t.loadAddon(n),E.current=n,KO(`ios_webgl_recreated`,{trigger:e},`info`)}catch{KO(`ios_webgl_recreate_failed`,{trigger:e},`info`)}}},n=()=>{document.visibilityState!==`hidden`&&(t(`visibilitychange`),De(200,`visibilitychange`))},r=e=>{e.persisted&&(t(`pageshow`),De(200,`pageshow`))},i=()=>{t(`focus`),De(200,`focus`)};return document.addEventListener(`visibilitychange`,n),window.addEventListener(`pageshow`,r),window.addEventListener(`focus`,i),()=>{document.removeEventListener(`visibilitychange`,e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pageshow`,r),window.removeEventListener(`focus`,i),Ee()}},[]),{containerRef:x,terminalRef:S,searchAddonRef:k,serializeAddonRef:A,progressAddonRef:j,inTmuxCopyModeRef:I,isTmuxCopyMode:L,appMouseRef:R,setTmuxCopyMode:ke,isSwitching:xe,isInputReady:!!e&&r&&i===`connected`&&oe.current===e,pendingClipboardOffer:V,copyPendingClipboardOffer:re,dismissPendingClipboardOffer:ie}}function PG(e=`(max-width: 767px)`){let[t,n]=(0,C.useState)(()=>typeof window>`u`||!window.matchMedia?!1:window.matchMedia(e).matches);return(0,C.useEffect)(()=>{if(typeof window>`u`||!window.matchMedia)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),typeof t.addEventListener==`function`?(t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)):(t.addListener(r),()=>t.removeListener(r))},[e]),t}function FG(e,t,n){(0,C.useEffect)(()=>{if(!t)return;let r=t=>{e.current&&!e.current.contains(t.target)&&n()};return document.addEventListener(`mousedown`,r),document.addEventListener(`touchstart`,r),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`touchstart`,r)}},[e,t,n])}function IG(e,t){(0,C.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t])}function LG({enabled:e,isOpen:t,onOpen:n,edgeThresholdPx:r=30,swipeDistancePx:i=50,swipeRatio:a=1.5}){let o=(0,C.useRef)(!1);return(0,C.useEffect)(()=>{if(!e)return;let s=0,c=0,l=!1,u=e=>{if(t)return;let n=e.touches[0];n.clientX<=r?(s=n.clientX,c=n.clientY,l=!0,o.current=!0):l=!1},d=e=>{if(o.current=!1,!l||t)return;let r=e.changedTouches[0],u=r.clientX-s,d=Math.abs(r.clientY-c);u>=i&&u>d*a&&n(),l=!1};return document.addEventListener(`touchstart`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{o.current=!1,document.removeEventListener(`touchstart`,u),document.removeEventListener(`touchend`,d)}},[e,t,n,r,i,a]),o}var RG=`(prefers-color-scheme: dark)`;function zG(){return typeof window>`u`||typeof window.matchMedia!=`function`?!0:window.matchMedia(RG).matches}function BG(e,t){return e===`system`?t?`dark`:`light`:e}var VG=He()(Ge((e,t)=>({theme:`dark`,systemDark:zG(),setTheme:t=>e({theme:t}),setSystemDark:t=>e({systemDark:t}),toggleTheme:()=>{let{theme:n,systemDark:r}=t();e({theme:BG(n,r)===`dark`?`light`:`dark`})}}),{name:`agentboard-theme`,storage:Ue(()=>Je),partialize:e=>({theme:e.theme})}));function HG(){return VG(e=>BG(e.theme,e.systemDark))}function UG(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let e=window.matchMedia(RG),t=e=>{VG.getState().setSystemDark(e.matches)};return VG.getState().setSystemDark(e.matches),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}var WG={dark:{background:`#2d2d2d`,foreground:`#d4d4d4`,cursor:`#3b82f6`,cursorAccent:`#2d2d2d`,selectionBackground:`rgba(59, 130, 246, 0.35)`,selectionForeground:`#ffffff`,black:`#808080`,red:`#f87171`,green:`#4ade80`,yellow:`#fbbf24`,blue:`#60a5fa`,magenta:`#c084fc`,cyan:`#22d3ee`,white:`#d4d4d4`,brightBlack:`#a0a0a0`,brightRed:`#fca5a5`,brightGreen:`#86efac`,brightYellow:`#fde047`,brightBlue:`#93c5fd`,brightMagenta:`#d8b4fe`,brightCyan:`#67e8f9`,brightWhite:`#ffffff`},light:{background:`#fafafa`,foreground:`#171717`,cursor:`#2563eb`,cursorAccent:`#fafafa`,selectionBackground:`rgba(37, 99, 235, 0.2)`,selectionForeground:`#000000`,black:`#171717`,red:`#dc2626`,green:`#16a34a`,yellow:`#ca8a04`,blue:`#2563eb`,magenta:`#9333ea`,cyan:`#0891b2`,white:`#f5f5f5`,brightBlack:`#737373`,brightRed:`#ef4444`,brightGreen:`#22c55e`,brightYellow:`#eab308`,brightBlue:`#3b82f6`,brightMagenta:`#a855f7`,brightCyan:`#06b6d4`,brightWhite:`#ffffff`}},GG=new WeakSet;function KG(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return!n?.get||!n.set?null:{get:n.get,set:n.set,enumerable:n.enumerable??!0,configurable:n.configurable??!0}}var qG=!1,JG=null,YG=null;function XG(){qG||(qG=!0,!(typeof Node>`u`||typeof HTMLElement>`u`)&&(JG=KG(Node.prototype,`textContent`),YG=KG(HTMLElement.prototype,`innerText`)))}function ZG(e){if(GG.has(e))return;GG.add(e);let t=JG?.get;if(t)for(let[n,r]of[[`textContent`,JG],[`innerText`,YG]])r&&Object.defineProperty(e,n,{configurable:r.configurable,enumerable:r.enumerable,get(){return r.get.call(this)},set(e){t.call(this)!==e&&r.set.call(this,e)}})}function QG(e){XG();let t=()=>{for(let t of Array.from(e.children))t instanceof HTMLElement&&ZG(t)};t();let n=new MutationObserver(t);return n.observe(e,{childList:!0}),()=>n.disconnect()}var $G={working:`Working`,waiting:`Waiting`,permission:`Needs Input`,unknown:`Unknown`},eK={working:`text-working`,waiting:`text-waiting`,permission:`text-approval`,unknown:`text-muted`};function tK({anchor:e,items:t,anchorFromBottom:n=!1,onClose:r}){let i=(0,C.useRef)(null);return(0,C.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,S.jsx)(`div`,{ref:i,className:`fixed z-50 min-w-[180px] rounded-md border border-border bg-elevated py-1 shadow-lg`,style:{left:typeof window>`u`?e.x:Math.min(e.x,Math.max(8,window.innerWidth-190)),top:e.y,transform:n?`translateY(calc(-100% - 6px))`:void 0},role:`menu`,children:t.map((e,t)=>e===`divider`?(0,S.jsx)(`div`,{className:`my-1 border-t border-border`},`divider-${t}`):(0,S.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r(),e.onSelect()},className:`flex w-full items-center gap-2 px-3 py-2 text-left text-sm ${e.danger?`text-danger hover:bg-danger/10`:`text-secondary hover:bg-hover hover:text-primary`}`,role:`menuitem`,title:e.title,children:[e.icon,e.label]},e.key))})}var nK=`flex h-7 shrink-0 items-center gap-2 rounded-md px-2.5 text-xs font-medium transition-colors active:scale-95`,rK=`flex h-7 shrink-0 items-center gap-2 rounded-md border border-border bg-surface px-2.5 text-xs text-secondary transition-colors hover:bg-hover hover:text-primary`,iK=`text-[11px]`,aK=`inline-flex shrink-0 items-center rounded-full bg-hover px-1.5 py-0.5 text-[11px] leading-none text-secondary`,oK=()=>(0,S.jsx)(`span`,{"aria-hidden":!0,className:`mx-2 h-5 w-px shrink-0 bg-border`}),sK=`inline-block w-[11ch] shrink-0 whitespace-nowrap text-left text-xs`;function cK(){let[e,t]=(0,C.useState)(!1),n=(0,C.useRef)(null);return(0,C.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),[e,(0,C.useCallback)(()=>{t(!0),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>t(!1),1500)},[])]}function lK({session:e,hibernatingSession:t,hibernatingDisplayName:n,showHostBadge:r,sessionCount:i,connectionStatus:a,isSwitching:o,canControl:s,canHibernate:c,modDisplay:l,onKill:u,onHibernate:d,onWake:f,onRename:p,onDuplicate:m,onMoveToHistory:h,isTmuxCopyMode:g,showJumpToBottom:_,onJumpToBottom:v,selectionReady:y,onCopySelection:b,onDismissSelection:x}){let w=W(e=>e.showProjectName),T=W(e=>e.showSessionIdPrefix),[E,O]=(0,C.useState)(null),[k,A]=(0,C.useState)(!1),[j,M]=(0,C.useState)(``),N=(0,C.useRef)(null),[P,I]=cK(),[L,ee]=cK(),R=e?e.agentSessionName||e.name:``,z=e?R:n,B=e?.projectPath&&dh(e.projectPath)!==R?dh(e.projectPath):``,te=t?.projectPath&&dh(t.projectPath)!==n?dh(t.projectPath):``,H=e?.agentSessionId?.trim(),re=T&&H?ph(H):null,ie=!!re||r&&!!e?.host?.trim()||w&&!!B,U=r&&!!t?.host?.trim()||w&&!!te,ae=y&&!!e||g&&!!e||_&&!!e;(0,C.useEffect)(()=>{k&&N.current&&(N.current.focus(),N.current.select())},[k]),(0,C.useEffect)(()=>{A(!1)},[e?.id??t?.sessionId??null]);let oe=(0,C.useCallback)(()=>{M(z),A(!0)},[z]),se=(0,C.useCallback)(()=>{let e=j.trim();e&&e!==z&&p(e),A(!1)},[j,z,p]),ce=e=>{e.preventDefault(),e.stopPropagation(),O({x:e.clientX,y:e.clientY})},le=[];e?(le.push({key:`rename`,label:`Rename`,icon:(0,S.jsx)(V,{width:G.default,height:G.default}),onSelect:oe},...m?[{key:`duplicate`,label:`Duplicate`,icon:(0,S.jsx)(F,{width:G.default,height:G.default}),title:`Create a copy in a new tmux window`,onSelect:m}]:[],...c?[{key:`hibernate`,label:`Hibernate`,icon:(0,S.jsx)(xe,{width:G.default,height:G.default}),title:`Close the live window and keep this session ready to wake`,onSelect:d}]:[],...H?[{key:`copy-id`,label:`Copy Session ID`,icon:(0,S.jsx)(pe,{width:G.default,height:G.default}),title:H,onSelect:()=>mh(H)}]:[],...e.logFilePath?[{key:`copy-log`,label:`Copy Log Path`,icon:(0,S.jsx)(ne,{width:G.default,height:G.default}),title:e.logFilePath,onSelect:()=>mh(e.logFilePath)}]:[]),s&&le.push(`divider`,{key:`kill`,label:`Kill Session`,icon:(0,S.jsx)(Fe,{width:G.default,height:G.default}),danger:!0,onSelect:u})):t&&(le.push({key:`wake`,label:`Wake`,icon:(0,S.jsx)(De,{width:G.default,height:G.default}),onSelect:f},{key:`rename`,label:`Rename`,icon:(0,S.jsx)(V,{width:G.default,height:G.default}),onSelect:oe},{key:`copy-id`,label:`Copy Session ID`,icon:(0,S.jsx)(pe,{width:G.default,height:G.default}),title:t.sessionId,onSelect:()=>mh(t.sessionId)},...t.logFilePath?[{key:`copy-log`,label:`Copy Log Path`,icon:(0,S.jsx)(ne,{width:G.default,height:G.default}),title:t.logFilePath,onSelect:()=>mh(t.logFilePath)}]:[]),h&&le.push(`divider`,{key:`move-to-history`,label:`Move to History`,icon:(0,S.jsx)(Fe,{width:G.default,height:G.default}),onSelect:h}));let ue=(0,S.jsx)(`input`,{ref:N,type:`text`,value:j,onChange:e=>M(e.target.value),onBlur:se,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),se()):e.key===`Escape`&&A(!1)},onClick:e=>e.stopPropagation(),onContextMenu:e=>e.stopPropagation(),className:`w-40 max-w-48 select-text rounded border border-border bg-surface px-1.5 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`,"aria-label":`Rename session`}),de=(e,t)=>L?(0,S.jsx)(`span`,{className:aK,children:`Copied!`}):(0,S.jsx)(`button`,{type:`button`,onClick:()=>{mh(t),ee()},className:`shrink-0 cursor-pointer`,title:t,"aria-label":`Copy project path ${t}`,children:(0,S.jsx)(m_,{name:e,fullPath:t,className:iK})});return(0,S.jsxs)(`footer`,{className:`hidden h-10 shrink-0 select-none items-center justify-between gap-3 border-t border-border bg-elevated px-4 md:flex`,children:[(0,S.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center`,children:e?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center`,onContextMenu:ce,children:[k?ue:(0,S.jsx)(`span`,{className:`max-w-48 truncate text-sm font-medium text-primary`,children:R}),(0,S.jsx)(oK,{}),(0,S.jsx)(`span`,{className:`${sK} ${eK[e.status]}`,children:$G[e.status]}),ie&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(oK,{}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[re&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>{mh(H),I()},className:`shrink-0 cursor-pointer text-xs text-muted transition-colors hover:text-primary`,title:`${H} — click to copy`,"aria-label":`Copy session ID`,children:P?`Copied!`:re}),r&&e.host?.trim()&&(0,S.jsx)(h_,{name:e.host.trim(),className:iK}),w&&B&&de(B,e.projectPath)]})]})]}),e.prs&&e.prs.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(oK,{}),(0,S.jsx)(B_,{prs:e.prs,className:`min-w-0 flex-1`})]})]}):t?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center`,onContextMenu:ce,children:[k?ue:(0,S.jsx)(`span`,{className:`max-w-48 truncate text-sm font-medium text-primary`,children:n}),(0,S.jsx)(oK,{}),(0,S.jsx)(`span`,{className:`shrink-0 rounded-full bg-blue-500/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),U&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(oK,{}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[r&&t.host?.trim()&&(0,S.jsx)(h_,{name:t.host.trim(),className:iK}),w&&te&&de(te,t.projectPath)]})]})]}),t.prs&&t.prs.length>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(oK,{}),(0,S.jsx)(B_,{prs:t.prs,className:`min-w-0 flex-1`})]})]}):(0,S.jsxs)(`span`,{className:`text-xs text-muted`,children:[i,` `,i===1?`session`:`sessions`]})}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2.5`,children:[y&&e&&(0,S.jsxs)(`span`,{className:`${rK} cursor-default`,children:[(0,S.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full bg-accent`}),`Selection ready`,(0,S.jsxs)(`button`,{type:`button`,onClick:b,className:`flex h-5 items-center gap-1 rounded px-1 font-medium text-accent hover:text-primary`,"aria-label":`Copy selection`,children:[(0,S.jsx)(F,{width:G.pill,height:G.pill}),`Copy`]}),(0,S.jsx)(`button`,{type:`button`,onClick:x,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted hover:text-primary`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,S.jsx)(Fe,{width:G.pill,height:G.pill})})]}),g&&e?(0,S.jsxs)(`button`,{type:`button`,onClick:v,className:rK,title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,S.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 rounded-full bg-amber-400`}),`Copy mode`,(0,S.jsx)(`span`,{"aria-hidden":!0,className:`text-muted`,children:`·`}),(0,S.jsx)(`span`,{className:`font-medium text-amber-400`,children:`Exit`})]}):_&&e?(0,S.jsxs)(`button`,{type:`button`,onClick:v,className:rK,title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,S.jsx)(D,{width:G.pill,height:G.pill}),`Jump to bottom`]}):null,ae&&(0,S.jsx)(oK,{}),a!==`connected`&&(0,S.jsx)(`span`,{className:`text-xs text-approval`,children:a}),t&&(0,S.jsx)(`button`,{type:`button`,onClick:f,className:`${nK} border border-border bg-surface text-secondary hover:bg-hover hover:text-primary`,children:`Wake`}),e&&c&&(0,S.jsx)(`button`,{onClick:d,className:_t(`neutral`),title:`Hibernate session`,"aria-label":`Hibernate session`,children:(0,S.jsx)(xe,{width:G.default,height:G.default})}),e&&s&&(0,S.jsx)(`button`,{disabled:o,onClick:u,className:_t(`danger`),title:`Kill session (${l}X)`,"aria-label":`Kill session`,children:(0,S.jsx)(Fe,{width:G.default,height:G.default})})]}),E&&le.length>0&&(0,S.jsx)(tK,{anchor:E,items:le,anchorFromBottom:!0,onClose:()=>O(null)})]})}function uK(e,t){let n=(0,C.useRef)(!1);return(0,C.useEffect)(()=>{if(n.current=!1,t||typeof document>`u`)return;let e=document,r=window,i=e=>{e.key===`Shift`&&(n.current=!0)},a=e=>{e.key===`Shift`&&(n.current=!1)},o=()=>{n.current=!1},s=()=>{e.visibilityState===`hidden`&&o()};return e.addEventListener(`keydown`,i,!0),e.addEventListener(`keyup`,a,!0),e.addEventListener(`focusout`,o,!0),e.addEventListener(`visibilitychange`,s),r.addEventListener(`blur`,o),()=>{o(),e.removeEventListener(`keydown`,i,!0),e.removeEventListener(`keyup`,a,!0),e.removeEventListener(`focusout`,o,!0),e.removeEventListener(`visibilitychange`,s),r.removeEventListener(`blur`,o)}},[e,t]),n}var dK={up:`\x1B[A`,down:`\x1B[B`,left:`\x1B[D`,right:`\x1B[C`},fK={up:`\x1B[1;2A`,down:`\x1B[1;2B`,left:`\x1B[1;2D`,right:`\x1B[1;2C`},pK=44,mK=6,hK=8,gK=10,_K=8,vK=700;3*pK+2*mK+2*hK,2*pK+mK+2*hK;var yK={up:`↑`,down:`↓`,left:`←`,right:`→`},bK={up:`1 / 2 / 2 / 3`,left:`2 / 1 / 3 / 2`,down:`2 / 2 / 3 / 3`,right:`2 / 3 / 3 / 4`};function xK(e=10){typeof navigator<`u`&&`vibrate`in navigator&&navigator.vibrate(e)}function SK(e,t){let n=e.left-t.left+e.width/2,r=_K+160/2,i=t.width-_K-160/2;return r>i?t.width/2:Math.max(r,Math.min(i,n))}function CK({onSendKey:e,disabled:t=!1,onRefocus:n,isKeyboardVisible:r,sessionKey:i=null}){let[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(0),[l,u]=(0,C.useState)(null),d=(0,C.useId)(),f=uK(i,t),p=(0,C.useRef)(null),m=(0,C.useRef)(!1),h=(0,C.useRef)(null),g=(0,C.useRef)(null),_=(0,C.useRef)(null),v=(0,C.useRef)(null),y=(0,C.useRef)(0),b=(0,C.useRef)(e),x=(0,C.useRef)(t);b.current=e,x.current=t;let w=(0,C.useCallback)(()=>{h.current&&=(clearTimeout(h.current),null),g.current&&=(clearInterval(g.current),null),_.current=null,v.current=null},[]),T=(0,C.useCallback)(()=>{w(),u(null)},[w]),E=(0,C.useCallback)(()=>{T(),o(!1),m.current&&n?.()},[T,n]),D=(0,C.useCallback)(()=>{let e=p.current,t=e?.getBoundingClientRect?.(),n=e?.closest?.(`.terminal-controls`)?.getBoundingClientRect?.();if(!t||!n){c(160/2+_K);return}c(SK(t,n))},[]),O=(0,C.useCallback)(()=>{m.current=r?.()??!1,D(),o(!0)},[r,D]),k=(0,C.useCallback)(()=>{t||(xK(),a?E():O())},[t,a,E,O]),A=(0,C.useCallback)(e=>{e.preventDefault(),y.current=Date.now(),k()},[k]),j=(0,C.useCallback)(()=>Date.now()-y.current<vK,[]),M=(0,C.useCallback)(e=>{j()||k()},[j,k]),N=(0,C.useCallback)(e=>{if(x.current)return;let t=f.current?fK:dK;b.current(t[e])},[f]),P=(0,C.useCallback)(e=>{w(),_.current=e,u(e),xK(8),N(e),h.current=setTimeout(()=>{g.current=setInterval(()=>{_.current===e&&(xK(5),N(e))},100)},400)},[w,N]),F=(0,C.useCallback)(e=>n=>{t||(n.preventDefault(),v.current===null&&(n.currentTarget.setPointerCapture?.(n.pointerId),y.current=Date.now(),P(e),v.current=n.pointerId))},[t,P]),I=(0,C.useCallback)(e=>{e.preventDefault(),!(v.current!==null&&e.pointerId!==v.current)&&T()},[T]),L=(0,C.useCallback)(e=>n=>{t||j()||(xK(8),N(e))},[t,j,N]),ee=(0,C.useCallback)(e=>{e.preventDefault(),E()},[E]);(0,C.useEffect)(()=>{t&&a&&E()},[t,a,E]);let R=(0,C.useRef)(i);return(0,C.useEffect)(()=>{R.current!==i&&(R.current=i,T())},[i,T]),(0,C.useEffect)(()=>{if(!a)return;let e=p.current?.parentElement;if(e?.addEventListener)return e.addEventListener(`scroll`,D,{passive:!0}),()=>e.removeEventListener(`scroll`,D)},[a,D]),(0,C.useEffect)(()=>w,[w]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{ref:p,type:`button`,"aria-label":`Arrow keys`,"aria-haspopup":`true`,"aria-expanded":a,"aria-controls":a?d:void 0,className:`
|
|
213
213
|
terminal-key
|
|
214
214
|
flex items-center justify-center
|
|
215
215
|
size-[44px] p-0
|
|
@@ -220,12 +220,12 @@ ${s.join(`
|
|
|
220
220
|
select-none
|
|
221
221
|
${t?`opacity-50`:``}
|
|
222
222
|
${a?`bg-accent/20 text-accent border-accent/40`:`bg-surface border-border text-secondary active:bg-hover`}
|
|
223
|
-
`,style:{touchAction:`none`,WebkitTouchCallout:`none`,WebkitUserSelect:`none`},onPointerDown:A,onClick:M,disabled:t,children:(0,S.jsx)(Ce,{width:G.key,height:G.key,strokeWidth:2})}),a&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{"data-testid":`arrow-keys-backdrop`,className:`absolute left-0 right-0 z-40`,style:{bottom:`100%`,height:`100vh`,touchAction:`none`},onPointerDown:ee}),(0,S.jsx)(`div`,{id:d,role:`group`,"aria-label":`Arrow key cluster`,className:`absolute z-50 select-none rounded-2xl bg-black/40 backdrop-blur-md border-2 border-white/20`,style:{left:s,bottom:`calc(100% + ${
|
|
223
|
+
`,style:{touchAction:`none`,WebkitTouchCallout:`none`,WebkitUserSelect:`none`},onPointerDown:A,onClick:M,disabled:t,children:(0,S.jsx)(Ce,{width:G.key,height:G.key,strokeWidth:2})}),a&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{"data-testid":`arrow-keys-backdrop`,className:`absolute left-0 right-0 z-40`,style:{bottom:`100%`,height:`100vh`,touchAction:`none`},onPointerDown:ee}),(0,S.jsx)(`div`,{id:d,role:`group`,"aria-label":`Arrow key cluster`,className:`absolute z-50 select-none rounded-2xl bg-black/40 backdrop-blur-md border-2 border-white/20`,style:{left:s,bottom:`calc(100% + ${gK}px)`,transform:`translateX(-50%)`,padding:hK,touchAction:`none`,WebkitTouchCallout:`none`,WebkitUserSelect:`none`},children:(0,S.jsx)(`div`,{className:`grid`,style:{gridTemplateColumns:`repeat(3, ${pK}px)`,gridTemplateRows:`repeat(2, ${pK}px)`,gap:mK},children:Object.keys(dK).map(e=>(0,S.jsx)(`button`,{type:`button`,"aria-label":`Arrow ${e}`,className:`
|
|
224
224
|
flex items-center justify-center
|
|
225
225
|
rounded-lg text-xl font-bold
|
|
226
226
|
select-none transition-all duration-75
|
|
227
227
|
${l===e?`bg-accent text-white scale-110`:`bg-white/90 text-gray-800`}
|
|
228
|
-
`,style:{gridArea:
|
|
228
|
+
`,style:{gridArea:bK[e],touchAction:`none`,WebkitTouchCallout:`none`,WebkitUserSelect:`none`},onMouseDown:e=>e.preventDefault(),onPointerDown:F(e),onPointerUp:I,onPointerCancel:I,onLostPointerCapture:I,onClick:L(e),disabled:t,children:yK[e]},e))})})]})]})}var wK=150,TK=56,EK=48,DK=6,OK=8,kK=2,AK=kK+OK,jK=20+DK+2,MK=3*TK+2*DK+2*AK,NK=3*EK+2*DK+2*AK+jK;function PK(e=10){`vibrate`in navigator&&navigator.vibrate(e)}var FK=[[`7`,`8`,`9`],[`4`,`5`,`6`],[`1`,`2`,`3`]];function IK(e,t,n){let r=n.x-MK/2,i=n.y-NK/2,a=e-r-AK,o=t-i-AK,s=3*TK+2*DK,c=3*EK+2*DK;if(a<0||a>s||o<0||o>c)return null;let l=Math.floor(a/(TK+DK)),u=Math.floor(o/(EK+DK));if(l<0||l>2||u<0||u>2)return null;let d=l*(TK+DK),f=u*(EK+DK);return a>d+TK||o>f+EK?null:FK[u]?.[l]||null}function LK({onSendKey:e,disabled:t=!1,onRefocus:n,isKeyboardVisible:r}){let[i,a]=(0,C.useState)(!1),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)({x:0,y:0}),u=(0,C.useRef)(null),d=(0,C.useRef)(!1),f=(0,C.useRef)(!1),p=(0,C.useCallback)(()=>{a(!1),s(null),f.current=!1,d.current&&n?.()},[n]),m=(0,C.useCallback)(e=>{if(t)return;e.preventDefault(),e.stopPropagation();let n=e.touches[0];d.current=r?.()??!1,f.current=!1,u.current=setTimeout(()=>{PK(15);let e=n.clientX,t=n.clientY-120;e=Math.max(10+MK/2,Math.min(window.innerWidth-10-MK/2,e)),t=Math.max(10+NK/2,t),l({x:e,y:t}),a(!0)},wK)},[t,r]),h=(0,C.useCallback)((e,t)=>IK(e,t,c),[c]),g=(0,C.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!i)return;let t=e.touches[0],n=h(t.clientX,t.clientY);n!==o&&(s(n),n&&PK(5))},[i,o,h]),_=(0,C.useCallback)(t=>{t.preventDefault(),t.stopPropagation(),u.current&&=(clearTimeout(u.current),null),i&&o&&!f.current&&(PK(10),e(o),f.current=!0),p()},[i,o,e,p]),v=(0,C.useCallback)(e=>{e.preventDefault(),u.current&&=(clearTimeout(u.current),null),p()},[p]);return(0,C.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,className:`
|
|
229
229
|
terminal-key
|
|
230
230
|
flex items-center justify-center
|
|
231
231
|
size-[44px] p-0
|
|
@@ -237,16 +237,16 @@ ${s.join(`
|
|
|
237
237
|
text-secondary
|
|
238
238
|
${t?`opacity-50`:``}
|
|
239
239
|
${i?`bg-hover scale-95`:``}
|
|
240
|
-
`,style:{touchAction:`none`,WebkitTouchCallout:`none`,WebkitUserSelect:`none`},onTouchStart:m,onTouchMove:g,onTouchEnd:_,onTouchCancel:v,disabled:t,children:`123`}),i&&(0,S.jsxs)(`div`,{className:`fixed inset-0 z-50 select-none`,style:{touchAction:`none`,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},onTouchMove:g,onTouchEnd:_,onTouchCancel:v,children:[(0,S.jsx)(`div`,{className:`absolute inset-0 bg-black/20`}),(0,S.jsx)(`div`,{className:`absolute select-none`,style:{left:c.x-
|
|
240
|
+
`,style:{touchAction:`none`,WebkitTouchCallout:`none`,WebkitUserSelect:`none`},onTouchStart:m,onTouchMove:g,onTouchEnd:_,onTouchCancel:v,disabled:t,children:`123`}),i&&(0,S.jsxs)(`div`,{className:`fixed inset-0 z-50 select-none`,style:{touchAction:`none`,WebkitTouchCallout:`none`,WebkitUserSelect:`none`,userSelect:`none`},onTouchMove:g,onTouchEnd:_,onTouchCancel:v,children:[(0,S.jsx)(`div`,{className:`absolute inset-0 bg-black/20`}),(0,S.jsx)(`div`,{className:`absolute select-none`,style:{left:c.x-MK/2,top:c.y-NK/2,width:MK,WebkitUserSelect:`none`,userSelect:`none`},children:(0,S.jsxs)(`div`,{className:`rounded-2xl bg-black/40 backdrop-blur-md border-white/20 select-none`,style:{padding:OK,borderWidth:kK},children:[(0,S.jsx)(`div`,{className:`grid grid-cols-3 select-none`,style:{gap:DK},children:FK.flat().map((e,t)=>e?(0,S.jsx)(`div`,{className:`
|
|
241
241
|
flex items-center justify-center
|
|
242
242
|
rounded-lg text-xl font-bold
|
|
243
243
|
select-none
|
|
244
244
|
transition-all duration-75
|
|
245
245
|
${o===e?`bg-accent text-white scale-110`:`bg-white/90 text-gray-800`}
|
|
246
|
-
`,style:{width:
|
|
247
|
-
`)&&a(e=>e+n)}}),n&&(0,S.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Attach files`,(0,S.jsx)(`input`,{type:`file`,multiple:!0,"aria-label":`Choose files`,className:`mt-2 block w-full text-sm`,onChange:e=>{let t=Array.from(e.target.files??[]);s(e=>[...e,...t]),e.target.value=``}})]}),o.length>0&&(0,S.jsx)(`ul`,{className:`mt-2 text-sm`,children:o.map((e,t)=>(0,S.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,S.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-2`,"aria-label":`Remove ${e.name}`,onClick:()=>s(e=>e.filter((e,n)=>n!==t)),children:`Remove`})]},t))}),(0,S.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-3 text-secondary`,onClick:e,children:`Cancel`}),(0,S.jsx)(`button`,{type:`submit`,disabled:!i&&o.length===0,className:`min-h-[44px] rounded bg-accent px-3 text-white disabled:opacity-50`,children:`Submit`})]})]})});return typeof document>`u`?c:(0,Vd.createPortal)(c,document.body)}function
|
|
248
|
-
`);l&&r.current.onPasteText(l+(a.length?` `:``));for(let{path:e}of c)r.current.onPasteImage(YW(e,r.current.agentType)+` `);s.current=null,n({status:`idle`}),r.current.onRefocus?.()}catch(e){u()&&!i.signal.aborted&&n({status:`error`,message:e instanceof Error?e.message:`Upload failed. Try again.`})}finally{o.current===i&&(o.current=null)}}),a.current):Promise.resolve()},[]);return{state:t,paste:l,pasteClipboard:()=>l(nG(),!0),openDialog:()=>{r.current.disabled||(c(),n({status:`awaiting-paste`}))},retry:()=>s.current?l(s.current):Promise.resolve(),cancel:c,fail:e=>{c(),n({status:`error`,message:e})}}}var
|
|
249
|
-
`};function
|
|
246
|
+
`,style:{width:TK,height:EK,WebkitUserSelect:`none`,userSelect:`none`},children:e},t):(0,S.jsx)(`div`,{style:{width:TK,height:EK}},t))}),(0,S.jsx)(`div`,{className:`text-center text-white text-sm font-medium select-none`,style:{marginTop:DK+2,height:20},children:o?`Release to send "${o}"`:`\xA0`})]})})]})]})}function RK({state:e,cancel:t,retry:n,paste:r,allowFiles:i}){return e.status===`idle`?null:e.status===`awaiting-paste`?(0,S.jsx)(zK,{cancel:t,paste:r,allowFiles:i}):(0,S.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border bg-elevated px-3 py-2 text-sm text-primary`,children:[(0,S.jsx)(`span`,{role:e.status===`error`?`alert`:`status`,children:e.status===`error`?e.message:e.status===`reading`?`Reading clipboard…`:`Uploading files…`}),e.status===`error`&&(0,S.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-2`,onClick:n,children:`Retry`}),(0,S.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-2 text-secondary`,onClick:t,children:e.status===`error`?`Dismiss`:`Cancel`})]})}function zK({cancel:e,paste:t,allowFiles:n}){let r=(0,C.useRef)(null),[i,a]=(0,C.useState)(``),[o,s]=(0,C.useState)([]);(0,C.useLayoutEffect)(()=>{r.current?.showModal()},[]);let c=(0,S.jsx)(`dialog`,{ref:r,"aria-label":`Paste from this device`,onCancel:e,style:{top:`calc(var(--viewport-offset-top, 0px) + 1rem)`,bottom:`auto`,maxHeight:`calc(var(--visual-viewport-height, 100dvh) - 2rem)`},className:`mx-auto my-0 w-[calc(100%_-_2rem)] max-w-sm overflow-y-auto rounded-lg border border-border bg-elevated p-4 text-primary backdrop:bg-black/50`,children:(0,S.jsxs)(`form`,{onSubmit:n=>{n.preventDefault(),(i||o.length)&&(e(),t({text:i,files:o}))},children:[(0,S.jsx)(`p`,{className:`mb-3 text-sm text-primary`,children:`Type or paste text, then submit it to your terminal.`}),(0,S.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Paste here`,placeholder:`Type or paste here`,rows:4,value:i,onChange:e=>a(e.target.value),className:`w-full rounded border border-border bg-surface p-3 text-base text-primary`,onPaste:e=>{let t=QW(e.clipboardData);if(!t.length)return;e.preventDefault(),s(e=>[...e,...t]);let n=e.clipboardData.getData(`text/plain`);n&&n.trim()!==t.map(e=>e.name).join(`
|
|
247
|
+
`)&&a(e=>e+n)}}),n&&(0,S.jsxs)(`label`,{className:`mt-3 block text-sm`,children:[`Attach files`,(0,S.jsx)(`input`,{type:`file`,multiple:!0,"aria-label":`Choose files`,className:`mt-2 block w-full text-sm`,onChange:e=>{let t=Array.from(e.target.files??[]);s(e=>[...e,...t]),e.target.value=``}})]}),o.length>0&&(0,S.jsx)(`ul`,{className:`mt-2 text-sm`,children:o.map((e,t)=>(0,S.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,S.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-2`,"aria-label":`Remove ${e.name}`,onClick:()=>s(e=>e.filter((e,n)=>n!==t)),children:`Remove`})]},t))}),(0,S.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,className:`min-h-[44px] px-3 text-secondary`,onClick:e,children:`Cancel`}),(0,S.jsx)(`button`,{type:`submit`,disabled:!i&&o.length===0,className:`min-h-[44px] rounded bg-accent px-3 text-white disabled:opacity-50`,children:`Submit`})]})]})});return typeof document>`u`?c:(0,Vd.createPortal)(c,document.body)}function BK(e){let[t,n]=(0,C.useState)({status:`idle`}),r=(0,C.useRef)(e);r.current=e;let i=(0,C.useRef)(0),a=(0,C.useRef)(Promise.resolve()),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useCallback)(()=>{i.current++,o.current?.abort(),o.current=null,a.current=Promise.resolve(),s.current=null,n({status:`idle`})},[]);(0,C.useLayoutEffect)(()=>(c(),()=>{i.current++,o.current?.abort()}),[e.sessionId,e.disabled,c]);let l=(0,C.useCallback)((e,t=!1)=>{let c=Promise.resolve(e).then(e=>({value:e}),e=>({error:e})),l=i.current,u=()=>l===i.current&&!r.current.disabled;return u()?(t&&n({status:`reading`}),a.current=a.current.then(async()=>{if(!u())return;let e=await c;if(!u())return;if(`error`in e){n({status:`awaiting-paste`});return}let t=e.value;s.current=t;let i=new AbortController;o.current=i;try{let e=$W(t.files);if(e)throw Error(e);if(t.files.length&&r.current.fileUploadsAllowed===!1)throw Error(`File uploads are unavailable for SSH sessions.`);t.files.length&&n({status:`uploading`});let a=[];for(let e of t.files){if(!u())return;a.push({file:e,path:await eG(e,i.signal)})}if(!u()||i.signal.aborted)return;let o=a.filter(({file:e})=>!/^image\/(png|jpeg|gif|webp)$/.test(e.type)),c=a.filter(({file:e})=>/^image\/(png|jpeg|gif|webp)$/.test(e.type)),l=[t.text,...o.map(({path:e})=>tG(e))].filter(Boolean).join(`
|
|
248
|
+
`);l&&r.current.onPasteText(l+(a.length?` `:``));for(let{path:e}of c)r.current.onPasteImage(YW(e,r.current.agentType)+` `);s.current=null,n({status:`idle`}),r.current.onRefocus?.()}catch(e){u()&&!i.signal.aborted&&n({status:`error`,message:e instanceof Error?e.message:`Upload failed. Try again.`})}finally{o.current===i&&(o.current=null)}}),a.current):Promise.resolve()},[]);return{state:t,paste:l,pasteClipboard:()=>l(nG(),!0),openDialog:()=>{r.current.disabled||(c(),n({status:`awaiting-paste`}))},retry:()=>s.current?l(s.current):Promise.resolve(),cancel:c,fail:e=>{c(),n({status:`error`,message:e})}}}var VK=(0,S.jsx)(R,{width:G.key,height:G.key,strokeWidth:2}),HK=(0,S.jsx)(N,{width:G.key,height:G.key,strokeWidth:2}),UK=(0,S.jsx)(he,{width:G.key,height:G.key,strokeWidth:2}),WK=`bg-surface border-border text-secondary`,GK={label:(0,S.jsx)(L,{width:G.key,height:G.key,strokeWidth:2}),key:`\r`,className:`bg-accent/20 text-accent border-accent/40`,ariaLabel:`Enter`},KK={label:`esc`,key:`\x1B`},qK={label:VK,key:``,ariaLabel:`Delete word`},JK={label:`tab`,key:` `},YK={[JK.key]:`\x1B[Z`,[GK.key]:`
|
|
249
|
+
`};function XK(){`vibrate`in navigator&&navigator.vibrate(10)}function ZK(e,t){if(!t||e.length!==1)return{output:e,consumeCtrl:!1};let n=e.toUpperCase().charCodeAt(0);return n>=65&&n<=90?{output:String.fromCharCode(n-64),consumeCtrl:!0}:{output:e,consumeCtrl:!0}}var QK={working:`bg-working`,waiting:`bg-waiting`,permission:`bg-approval`,unknown:`bg-muted`};function $K({onSendKey:e,onPasteText:t,onPasteImage:n,disabled:r=!1,sessions:i,currentSessionId:a,agentType:o,fileUploadsAllowed:s=!0,onSelectSession:c,hideSessionSwitcher:l=!1,onRefocus:u,isKeyboardVisible:d,onEnterTextMode:f}){let p=BK({sessionId:a,disabled:r,fileUploadsAllowed:s,agentType:o,onPasteText:t??e,onPasteImage:n??e,onRefocus:u}),[m,h]=(0,C.useState)(!1),g=uK(a,r),_=(0,C.useRef)(0),v=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!m||r||p.state.status===`awaiting-paste`||typeof document>`u`)return;let t=t=>{let{output:n,consumeCtrl:r}=ZK(t.key,!0);r&&(t.preventDefault(),t.stopPropagation(),XK(),e(n),h(!1))};return document.addEventListener(`keydown`,t,{capture:!0}),()=>{document.removeEventListener(`keydown`,t,{capture:!0})}},[m,r,p.state.status,e]);let y=t=>{if(r)return;let n=d?.()??!1;XK();let{output:i,consumeCtrl:a}=ZK(g.current?YK[t]??t:t,m);a&&h(!1),e(i),n&&u?.()},b=()=>{r||(XK(),h(!m))},x=t=>{let{output:n,consumeCtrl:r}=ZK(t,m);r&&h(!1),e(n)},w=()=>{if(!r)return XK(),p.openDialog()},T=e=>{XK(),c(e)},E=()=>{r||(XK(),d?.()?document.activeElement instanceof HTMLElement&&document.activeElement.blur():f?.())},D=i.length>1&&!l,O=e=>t=>{if(r)return;let n=v.current,i=t.changedTouches[0];!n||!i||Math.hypot(i.clientX-n.x,i.clientY-n.y)>10||(t.preventDefault(),t.stopPropagation(),_.current=Date.now(),e())},k=e=>()=>{r||Date.now()-_.current<700||e()},A=e=>(0,S.jsx)(`button`,{type:`button`,"aria-label":e.ariaLabel,className:`
|
|
250
250
|
terminal-key
|
|
251
251
|
flex items-center justify-center
|
|
252
252
|
size-[44px] p-0
|
|
@@ -255,7 +255,7 @@ ${s.join(`
|
|
|
255
255
|
active:bg-hover active:scale-95
|
|
256
256
|
transition-transform duration-75
|
|
257
257
|
select-none touch-manipulation
|
|
258
|
-
${e.className??
|
|
258
|
+
${e.className??WK}
|
|
259
259
|
${r?`opacity-50`:``}
|
|
260
260
|
`,onMouseDown:e=>e.preventDefault(),onTouchEnd:O(()=>y(e.key)),onClick:k(()=>y(e.key)),disabled:r,children:e.label},e.key);return(0,S.jsxs)(`div`,{className:`terminal-controls flex flex-col gap-[6px] border-t border-border bg-elevated p-[6px] ${ct()?``:`md:hidden`}`,children:[D&&(0,S.jsxs)(`div`,{className:`relative -mx-[6px]`,children:[(0,S.jsx)(`div`,{className:`absolute left-0 top-0 bottom-0 w-3 bg-gradient-to-r from-elevated to-transparent z-10 pointer-events-none`}),(0,S.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-3 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none`}),(0,S.jsx)(`div`,{className:`flex items-center gap-[6px] overflow-x-auto px-[6px] scrollbar-none scroll-smooth snap-x snap-mandatory`,style:{WebkitOverflowScrolling:`touch`},children:i.map((e,t)=>(0,S.jsxs)(`button`,{type:`button`,className:`
|
|
261
261
|
terminal-key flex items-center justify-center gap-1.5 shrink-0 snap-start
|
|
@@ -263,7 +263,7 @@ ${s.join(`
|
|
|
263
263
|
active:scale-95 transition-transform duration-75
|
|
264
264
|
select-none touch-manipulation
|
|
265
265
|
${e.id===a?`bg-accent/20 text-accent border border-accent/40`:`bg-surface border border-border text-secondary`}
|
|
266
|
-
`,onClick:()=>T(e.id),children:[(0,S.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${
|
|
266
|
+
`,onClick:()=>T(e.id),children:[(0,S.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${QK[e.status]}`}),(0,S.jsx)(`span`,{className:`truncate`,children:t+1})]},e.id))})]}),(0,S.jsxs)(`div`,{className:`grid grid-flow-col auto-cols-[44px] items-center gap-[4px] overflow-x-auto scrollbar-none`,onTouchStartCapture:e=>{let t=e.touches[0];v.current=t?{x:t.clientX,y:t.clientY}:null},onTouchMoveCapture:e=>{let t=v.current,n=e.touches[0];t&&n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>10&&(v.current=null)},onTouchCancel:()=>{v.current=null},children:[A(GK),A(KK),(0,S.jsx)(CK,{onSendKey:x,disabled:r,onRefocus:u,isKeyboardVisible:d,sessionKey:a}),(0,S.jsx)(`button`,{type:`button`,"aria-label":`Paste`,className:`
|
|
267
267
|
terminal-key
|
|
268
268
|
flex items-center justify-center
|
|
269
269
|
size-[44px] p-0
|
|
@@ -274,7 +274,7 @@ ${s.join(`
|
|
|
274
274
|
select-none touch-manipulation
|
|
275
275
|
text-secondary
|
|
276
276
|
${r?`opacity-50`:``}
|
|
277
|
-
`,onMouseDown:e=>e.preventDefault(),"data-native-gesture":!0,onClick:w,disabled:r,children:
|
|
277
|
+
`,onMouseDown:e=>e.preventDefault(),"data-native-gesture":!0,onClick:w,disabled:r,children:HK}),A(qK),(0,S.jsx)(LK,{onSendKey:x,disabled:r,onRefocus:u,isKeyboardVisible:d}),A(JK),(0,S.jsx)(`button`,{type:`button`,className:`
|
|
278
278
|
terminal-key
|
|
279
279
|
flex items-center justify-center
|
|
280
280
|
size-[44px] p-0
|
|
@@ -296,11 +296,11 @@ ${s.join(`
|
|
|
296
296
|
select-none touch-manipulation
|
|
297
297
|
text-secondary
|
|
298
298
|
${r?`opacity-50`:``}
|
|
299
|
-
`,onMouseDown:e=>e.preventDefault(),onTouchEnd:O(E),onClick:k(E),disabled:r,children:RK})]}),(0,S.jsx)(NK,{...p,allowFiles:s})]})}function YK({isOpen:e,onClose:t,sessions:n,hibernatingSessions:r=[],historySessions:i=[],selectedSessionId:a,selectedHibernatingSessionId:o=null,onSelect:s,onSelectHibernating:c,onRename:l,onResume:u,onHibernate:d,onMoveToHistory:f,onNewSession:p,loading:m,error:h}){let g=Bd(),_=(0,C.useRef)(null),v=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!e||typeof document>`u`)return;let{body:t}=document,n=window.scrollY,r={position:t.style.position,top:t.style.top,width:t.style.width};return t.style.position=`fixed`,t.style.top=`-${n}px`,t.style.width=`100%`,()=>{t.style.position=r.position,t.style.top=r.top,t.style.width=r.width,window.scrollTo(0,n)}},[e]),(0,C.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),(0,C.useEffect)(()=>{e?(v.current=document.activeElement,_.current?.focus({preventScroll:!0})):v.current&&=(v.current.focus({preventScroll:!0}),null)},[e]),(0,C.useEffect)(()=>{if(!e)return;let n=_.current;if(!n)return;let r=0,i=0,a=e=>{let t=e.touches[0];r=t.clientX,i=t.clientY},o=e=>{let n=e.changedTouches[0],a=r-n.clientX,o=Math.abs(n.clientY-i);a>=50&&a>o*1.5&&(`vibrate`in navigator&&navigator.vibrate(10),t())};return n.addEventListener(`touchstart`,a,{passive:!0}),n.addEventListener(`touchend`,o,{passive:!0}),()=>{n.removeEventListener(`touchstart`,a),n.removeEventListener(`touchend`,o)}},[e,t]);let y=e=>{s(e),t()},b=e=>{c?.(e),t()},x=g?{transition:`none`}:void 0;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`session-drawer-backdrop ${e?`open`:``}`,style:x,onClick:t,"aria-hidden":`true`}),(0,S.jsxs)(`div`,{ref:_,className:`session-drawer ${e?`open`:``}`,style:x,role:`dialog`,"aria-modal":`true`,"aria-label":`Session list`,tabIndex:-1,children:[(0,S.jsx)(BO,{sessions:n,hibernatingSessions:r,historySessions:i,selectedSessionId:a,selectedHibernatingSessionId:o,onSelect:y,onSelectHibernating:b,onRename:l,onResume:u,onHibernate:d,onMoveToHistory:f,scrollSelectionActive:e,onNewSession:()=>{p()!==!1&&t()},loading:m,error:h}),(0,S.jsx)(`div`,{className:`shrink-0 border-t border-border px-2 pt-2`,style:{paddingBottom:`max(0.5rem, env(safe-area-inset-bottom, 0.5rem))`},children:(0,S.jsx)(`button`,{onClick:()=>{p()!==!1&&t()},className:`btn btn-primary min-h-[44px] w-full py-2 text-sm`,children:`New Session`})})]})]})}var XK={working:`bg-green-500/35 text-white`,waiting:`bg-blue-500/35 text-white`,permission:`bg-amber-500/35 text-white`,unknown:`bg-gray-500/35 text-white`},ZK={working:`bg-working text-white`,waiting:`bg-waiting text-white`,permission:`bg-approval text-white`,unknown:`bg-muted text-white`};function QK(){`vibrate`in navigator&&navigator.vibrate(10)}function $K({session:e,sessions:t,drawerSessions:n,hibernatingSession:r=null,hibernatingSessions:i=[],historySessions:a=[],connectionStatus:o,connectionEpoch:s=0,sendMessage:c,subscribe:l,onClose:u,onSelectSession:d,onSelectHibernatingSession:f,onNewSession:p,onKillSession:m,onRenameSession:h,onDuplicateSession:g,onResumeSession:_,onHibernateSession:v,onMoveToHistory:y,onOpenSettings:b,loading:x=!1,error:w=null}){let E=zG[RG(e=>e.theme)],O=W(e=>e.useWebGL),k=W(e=>e.fontSize),A=W(e=>e.lineHeight),j=W(e=>e.letterSpacing),M=et(W(e=>e.fontOption),W(e=>e.customFontFamily)),N=pt(dt(W(e=>e.shortcutModifier))),P=ct(),I=PG(),[L,ee]=(0,C.useState)(!1),[R,z]=(0,C.useState)(!1),[te,H]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(!1),[ie,U]=(0,C.useState)(!1),[ae,oe]=(0,C.useState)(!1),[se,ce]=(0,C.useState)(``),le=(0,C.useRef)(!1),ue=(0,C.useRef)(null),de=(0,C.useRef)(null),fe=(0,C.useRef)(null);Oh(fe,e?.id??null);let pe=(0,C.useRef)(null),me=(0,C.useRef)(null),he=(0,C.useRef)(()=>{}),ge=(0,C.useRef)(()=>{}),ve=e?.remote===!0,ye=Sh(e=>e.remoteAllowControl),be=Sh(e=>e.remoteAllowAttach),Se=Sh(e=>e.preferWindowName),Ce=ve&&!be,we=!ve||ye&&e?.source===`managed`,Te=r?r.displayName||dh(r.projectPath)||r.sessionId.slice(0,8):``,Ee=r?dh(r.projectPath):``,De=r?uh(r.lastActivityAt):``,Oe=!!e&&!!v&&e.source===`managed`&&!e.remote&&!!e.agentSessionId?.trim(),Ae=(0,C.useMemo)(()=>{let e=new Set;for(let n of t)n.host?.trim()&&e.add(n.host.trim());for(let t of i)t.host?.trim()&&e.add(t.host.trim());return e.size>1},[t,i]),{containerRef:Me,terminalRef:Ne,inTmuxCopyModeRef:Pe,isTmuxCopyMode:Le,appMouseRef:Re,setTmuxCopyMode:ze,isSwitching:Be,isInputReady:Ve,pendingClipboardOffer:He,copyPendingClipboardOffer:Ue,dismissPendingClipboardOffer:We}=NG({sessionId:e?.id??null,tmuxTarget:e?.tmuxWindow??null,agentType:e?.agentType,onPasteFiles:e=>he.current(e),onPasteError:e=>ge.current(e),allowAttach:!Ce,connectionStatus:o,connectionEpoch:s,sendMessage:c,subscribe:l,theme:E,fontSize:k,lineHeight:A,letterSpacing:j,fontFamily:M,useWebGL:O,onScrollChange:e=>{ee(!e)}}),Ge=(0,C.useCallback)(()=>{!e||Ce||(c({type:`tmux-cancel-copy-mode`,sessionId:e.id}),ze(!1),Ne.current?.scrollToBottom())},[e,Ce,c,ze,Ne]),Ke=(0,C.useCallback)(()=>{U(!0),QK()},[]),qe=LG({enabled:I||P,isOpen:ie,onOpen:Ke});(0,C.useEffect)(()=>{!I&&!P&&ie&&U(!1)},[ie,I,P]),FG(de,ne,(0,C.useCallback)(()=>re(!1),[])),(0,C.useEffect)(()=>{ae&&pe.current&&(pe.current.focus(),pe.current.select())},[ae]),(0,C.useEffect)(()=>{te&&me.current&&me.current.focus()},[te]),IG(te,(0,C.useCallback)(()=>H(!1),[]));let Je=()=>{e&&(m(e.id,`terminal_confirm_modal`),H(!1))},Ye=()=>{!e||!Oe||(v?.(e.agentSessionId.trim()),re(!1))},Xe=()=>{e&&(ce(e.agentSessionName||e.name),oe(!0),re(!1))},Ze=()=>{if(!e)return;let t=se.trim(),n=e.agentSessionName||e.name;t&&t!==n&&h(e.id,t),oe(!1)},Qe=e=>{e.key===`Enter`?(e.preventDefault(),Ze()):e.key===`Escape`&&(e.preventDefault(),oe(!1))};(0,C.useEffect)(()=>{if(!P||!e){z(!1);return}let t=Me.current;if(!t)return;let n=e=>{let n=t.querySelector(`.xterm-accessibility-tree`);if(!n)return!1;let r=e.anchorNode,i=e.focusNode;return!!r&&n.contains(r)||!!i&&n.contains(i)},r=()=>{let e=t.querySelector(`.xterm-accessibility`),n=t.querySelector(`.xterm-accessibility-tree`);!e||!n||(e.style.setProperty(`opacity`,`0`),n.style.setProperty(`opacity`,`0`),e.style.setProperty(`-webkit-user-select`,`none`),e.style.setProperty(`user-select`,`none`),n.style.setProperty(`-webkit-user-select`,`none`),n.style.setProperty(`user-select`,`none`),e.offsetHeight,requestAnimationFrame(()=>{e.style.removeProperty(`opacity`),n.style.removeProperty(`opacity`),e.style.removeProperty(`-webkit-user-select`),e.style.removeProperty(`user-select`),n.style.removeProperty(`-webkit-user-select`),n.style.removeProperty(`user-select`)}))},i=()=>{le.current=!1;let e=window.getSelection();try{e?.removeAllRanges()}catch{}Ne.current?.clearSelection(),r(),z(!1)};ue.current=i;let a=()=>{let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed){le.current?i():z(e=>e&&!1);return}let t=n(e);if(!t&&le.current){i();return}le.current=t;let r=t;z(e=>e===r?e:r)},o=()=>{let e=window.getSelection();!e||e.isCollapsed||n(e)&&setTimeout(i,0)},s=null,c=!1,l=e=>{if(e.touches.length===1){let t=e.touches[0];s={x:t.clientX,y:t.clientY},c=!1}},u=e=>{if(c||!s||e.touches.length!==1)return;let t=e.touches[0],n=Math.abs(t.clientX-s.x),r=Math.abs(t.clientY-s.y);(n>10||r>10)&&(c=!0)},d=e=>{let r=c;s=null,c=!1;let a=window.getSelection();if(!a||a.rangeCount===0||a.isCollapsed){z(!1);return}let o=t.querySelector(`.xterm-accessibility-tree`);if(!o)return;if(!n(a)){z(!1);return}if(r)return;let l=e.target,u=l?o.contains(l):!1,d=!1;if(u&&l)try{d=a.containsNode(l,!0)}catch{d=!1}(!u||!d)&&setTimeout(i,0)};return document.addEventListener(`selectionchange`,a),document.addEventListener(`copy`,o),document.addEventListener(`touchstart`,l,{passive:!0}),document.addEventListener(`touchmove`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{document.removeEventListener(`selectionchange`,a),document.removeEventListener(`copy`,o),document.removeEventListener(`touchstart`,l),document.removeEventListener(`touchmove`,u),document.removeEventListener(`touchend`,d),ue.current=null,le.current=!1}},[Me,P,e?.id]),(0,C.useEffect)(()=>{if(!P)return;let t=Me.current;if(!t)return;let n=null,r=()=>{let e=Ne.current,r=t.querySelector(`.xterm`);if(!e||!r)return;let i=r.querySelector(`.xterm-screen`),a=r.querySelector(`.xterm-accessibility`),o=r.querySelector(`.xterm-accessibility-tree`);if(!i||!a||!o)return;n||=qG(o);let s=r.getBoundingClientRect(),c=i.getBoundingClientRect(),l=c.left-s.left,u=c.top-s.top;Object.assign(a.style,{left:`${l}px`,top:`${u}px`,right:`auto`,bottom:`auto`,width:`${c.width}px`,height:`${c.height}px`});let d=c.width/e.cols,f=c.height/e.rows,p=document.createElement(`span`);p.textContent=`0`.repeat(200),p.style.cssText=`position:absolute;visibility:hidden;white-space:pre;pointer-events:none;letter-spacing:0px`,o.appendChild(p);let m=p.getBoundingClientRect().width/200;p.remove();let h=Math.max(-2,Math.min(2,d-m));t.style.setProperty(`--xterm-font-size`,`${e.options.fontSize}px`),t.style.setProperty(`--xterm-cell-height`,`${f}px`),t.style.setProperty(`--xterm-a11y-letter-spacing`,`${h}px`)},i=performance.now();r();let a=Math.round(performance.now()-i);a>10&&KO(`switch_a11y_overlay`,{sessionId:e?.id,a11yMs:a});let o=window.requestAnimationFrame(r),s=window.setTimeout(r,100),c=()=>window.requestAnimationFrame(r);return window.visualViewport?.addEventListener(`resize`,c),window.addEventListener(`orientationchange`,c),()=>{window.cancelAnimationFrame(o),window.clearTimeout(s),window.visualViewport?.removeEventListener(`resize`,c),window.removeEventListener(`orientationchange`,c),n?.()}},[Me,k,P,e?.id,Ne]);let $e=(0,C.useRef)(R);(0,C.useEffect)(()=>{$e.current=R},[R]);let tt=(0,C.useRef)(e?.id);(0,C.useEffect)(()=>{tt.current=e?.id},[e?.id]);let nt=(0,C.useRef)(c);(0,C.useEffect)(()=>{nt.current=c},[c]);let rt=(0,C.useRef)(!1),it=(0,C.useRef)(`idle`);(0,C.useEffect)(()=>{if(!P)return;let e=Me.current;if(!e)return;let t=null,n=()=>e.querySelector(`.xterm-helper-textarea`),r=e=>{e.target===n()&&(it.current=`focused`)},i=e=>{e.target===n()&&(t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null;let e=n(),r=typeof document.hasFocus!=`function`||document.hasFocus();document.activeElement!==e&&document.visibilityState!==`hidden`&&r&&(it.current=`idle`)},0))},a=()=>{let e=n();(document.activeElement===e||it.current===`focused`)&&(it.current=`interrupted`)},o=()=>{it.current===`interrupted`&&(it.current=`armed`)},s=()=>{document.visibilityState===`hidden`?a():o()},c=e=>{e.persisted&&o()};return document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,i),document.addEventListener(`visibilitychange`,s),window.addEventListener(`blur`,a),window.addEventListener(`focus`,o),window.addEventListener(`pageshow`,c),()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,i),document.removeEventListener(`visibilitychange`,s),window.removeEventListener(`blur`,a),window.removeEventListener(`focus`,o),window.removeEventListener(`pageshow`,c),t!==null&&window.clearTimeout(t),it.current=`idle`}},[Me,P,e?.id]),(0,C.useEffect)(()=>{let t=Me.current;if(!t||!e?.id||!I&&!P)return;let n={x:0,y:0},r=0,i=!1,a=null,o=0,s=0,c=0,l=Math.round(k*A),u=null,d=null,f=!1,p=null,m=()=>{let e=window.getComputedStyle(t).getPropertyValue(`--xterm-cell-height`).trim(),n=Number.parseFloat(e);return!Number.isNaN(n)&&n>0?n:Math.round(k*A)},h=()=>t.querySelector(`.xterm-helper-textarea`),g=e=>{let n=Ne.current;if(!n)return null;let r=(t.querySelector(`.xterm`)?.querySelector(`.xterm-screen`))?.getBoundingClientRect();if(!r||r.width<=0||r.height<=0)return null;let i=r.width/n.cols,a=r.height/n.rows;return i<=0||a<=0?null:{col:Math.min(n.cols,Math.max(1,Math.floor((e.clientX-r.left)/i)+1)),row:Math.min(n.rows,Math.max(1,Math.floor((e.clientY-r.top)/a)+1))}},_=()=>{let e=h();e&&document.activeElement!==e&&(e.disabled=!0)},v=()=>{let e=h();e&&(e.disabled=!1)};_();let y=()=>{if(Pe.current)return;let e=h();e&&(e.disabled=!1,e.focus())},b=()=>{u!==null&&(cancelAnimationFrame(u),u=null),s=0},x=()=>{d!==null&&(clearTimeout(d),d=null)},S=(e,t,n)=>{let r=tt.current;return r?(nt.current({type:`terminal-input`,sessionId:r,data:`\x1b[<${e};${t.col};${t.row}${n}`}),!0):!1},C=e=>{let t=tt.current;if(!t||e===0)return!1;let n=Ne.current,r=n?.cols??80,i=n?.rows??24,a=Math.floor(r/2),o=Math.floor(i/2),s=e>0?65:64,c=Math.abs(e),l=e<0;for(let e=0;e<c;e++)nt.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${s};${a};${o}M`});return l&&!Re.current&&ze(!0),l},w=e=>{let t=tt.current,n=g(e);return!t||!n?!1:(nt.current({type:`terminal-input`,sessionId:t,data:`\x1b[<0;${n.col};${n.row}M\x1b[<0;${n.col};${n.row}m`}),!0)},T=e=>{if(!P||!Re.current)return!1;let t=g(e);return t?(f=!0,p=t,_(),QK(),S(0,t,`M`)):!1},E=e=>{let t=g(e);return t?p&&p.col===t.col&&p.row===t.row?!0:(p=t,S(32,t,`M`)):!1},D=e=>{let t=e?g(e):p;return f=!1,p=null,t?S(0,t,`m`):!1},O=()=>{x(),f=!1,p=null,a=null,s=0,c=0},j=()=>{if(!P)return!1;let e=window.getSelection();if(!e||e.isCollapsed)return!1;let n=t.querySelector(`.xterm-accessibility-tree`);if(!n)return!1;let r=e.anchorNode,i=e.focusNode;return!!r&&n.contains(r)||!!i&&n.contains(i)},M=()=>{!P||!le.current||j()||ue.current?.()},N=e=>{if(b(),M(),qe.current||ie){O();return}if($e.current){O();return}if(it.current===`armed`&&!Pe.current&&(it.current=`idle`,y()),e.touches.length===1){let t=e.touches[0];if(n={x:t.clientX,y:t.clientY},r=performance.now(),i=!1,a=t.clientY,o=r,s=0,c=0,l=m(),v(),P&&Re.current){let e={clientX:t.clientX,clientY:t.clientY};d=setTimeout(()=>{d=null,!(i||qe.current||ie)&&($e.current||j()||T(e))},350)}}},F=e=>{if(e.touches.length!==1||a===null)return;if(M(),qe.current||ie){O();return}let t=performance.now(),r=e.touches[0],u=r.clientX,d=r.clientY;if(f){e.preventDefault(),e.stopPropagation(),E(r),a=d,o=t;return}if($e.current||j()){O();return}e.preventDefault(),e.stopPropagation();let p=Math.abs(u-n.x),m=Math.abs(d-n.y);!i&&(p>6||m>6)&&(i=!0,x(),_());let h=a-d,g=t-o;if(a=d,o=t,g>0){let e=h/g;s=s*.7+e*.3}c+=h;let v=Math.max(6,l*.6),y=Math.trunc(c/v);y!==0&&(C(y),c-=y*v)},L=e=>{let t=s,n=performance.now()-r;if(x(),f){D(e.changedTouches[0]),O(),e.preventDefault(),e.stopPropagation();return}if(O(),qe.current||ie)return;let a=j();if($e.current&&!a&&ue.current?.(),$e.current||a){Pe.current&&(rt.current=!0);return}if(!i){if(P&&n>=350)return;if(Re.current){let t=e.changedTouches[0];if(t&&w(t)){y(),e.preventDefault(),e.stopPropagation();return}}if(Pe.current){e.preventDefault(),e.stopPropagation(),rt.current=!0;return}y();return}if(Math.abs(t)>.12){let e=t,n=performance.now(),r=()=>{let t=performance.now(),i=t-n;n=t;let a=e*i;c+=a;let o=Math.max(6,l*.6),s=Math.trunc(c/o);s!==0&&(C(s),c-=s*o),e*=.95**(i/16.67),u=Math.abs(e)>.02?requestAnimationFrame(r):null};u=requestAnimationFrame(r)}},ee=e=>{rt.current&&=(e.preventDefault(),e.stopPropagation(),!1)},R={passive:!0,capture:!0},z={passive:!1,capture:!0},B={passive:!1,capture:!0},te={capture:!0};return t.addEventListener(`touchstart`,N,R),t.addEventListener(`touchmove`,F,z),t.addEventListener(`touchend`,L,B),t.addEventListener(`mousedown`,ee,te),()=>{t.removeEventListener(`touchstart`,N,R),t.removeEventListener(`touchmove`,F,z),t.removeEventListener(`touchend`,L,B),t.removeEventListener(`mousedown`,ee,te),x();let e=h();e&&(e.disabled=!1)}},[e?.id,Me,Ne,P,I,ie,k,A]);let at=(0,C.useCallback)(t=>{!e||Ce||!Ve||c({type:`terminal-input`,sessionId:e.id,data:t})},[e,Ce,Ve,c]),ot=(0,C.useCallback)(t=>{!e||Ce||!Ve||(Pe.current&&(c({type:`tmux-cancel-copy-mode`,sessionId:e.id}),ze(!1)),c({type:`terminal-paste`,sessionId:e.id,data:t}))},[e,Ce,Ve,c,Pe,ze]),st=(0,C.useCallback)(t=>{!e||Ce||!Ve||(Pe.current&&(c({type:`tmux-cancel-copy-mode`,sessionId:e.id}),ze(!1)),at(t))},[e,Ce,Ve,c,Pe,ze,at]),lt=(0,C.useCallback)(()=>{let e=Me.current;if(!e)return;let t=e.querySelector(`.xterm-helper-textarea`);t&&(t.removeAttribute(`disabled`),t.focus())},[Me]),ut=FK({sessionId:e?.id??null,disabled:o!==`connected`||Ce||!Ve,fileUploadsAllowed:!ve,agentType:e?.agentType,onPasteText:ot,onPasteImage:st,onRefocus:lt});he.current=ut.paste,ge.current=ut.fail;let ft=(0,C.useCallback)(()=>{if(!e||Ce||!Ve)return;Pe.current&&(c({type:`tmux-cancel-copy-mode`,sessionId:e.id}),ze(!1));let t=Me.current;if(!t)return;let n=t.querySelector(`.xterm-helper-textarea`);n&&(n.removeAttribute(`disabled`),n.focus())},[e,Ce,Ve,c,Me,Pe,ze]),mt=(0,C.useCallback)(()=>{if(typeof document>`u`)return!1;let e=Me.current;if(!e)return!1;let t=e.querySelector(`.xterm-helper-textarea`);if(t&&document.activeElement===t)return!0;let n=document.activeElement,r=typeof HTMLInputElement<`u`&&n instanceof HTMLInputElement,i=typeof HTMLTextAreaElement<`u`&&n instanceof HTMLTextAreaElement;return r||i||n&&n.isContentEditable?!1:!!document.documentElement?.classList?.contains(`keyboard-visible`)},[Me]);(0,C.useEffect)(()=>{if(!P)return;let e=Me.current;if(!e)return;let t=e.querySelector(`.xterm-accessibility`),n=e.querySelector(`.xterm-accessibility-tree`);if(!t||!n)return;let r=()=>{let r=e.querySelector(`.xterm-helper-textarea`);r&&document.activeElement===r&&!$e.current?(t.style.pointerEvents=`none`,n.style.pointerEvents=`none`):(t.style.removeProperty(`pointer-events`),n.style.removeProperty(`pointer-events`))};return r(),document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,r)}},[Me,P,R]),(0,C.useEffect)(()=>{let e=Me.current;e&&(e.inert=!!r)},[Me,r]);let ht=(0,C.useMemo)(()=>{if(!Se||t.length===0)return!1;let e=t.map(e=>e.name.trim()).filter(Boolean);return e.length===t.length&&new Set(e).size===t.length},[Se,t]);return(0,S.jsxs)(`section`,{className:`flex flex-1 flex-col bg-base terminal-mobile-overlay md:relative md:inset-auto ${P?`ios-native-term-selection`:``}`,"data-testid":`terminal-panel`,onDragOver:t=>{Array.from(t.dataTransfer.types).includes(`Files`)&&(t.preventDefault(),t.dataTransfer.dropEffect=e&&!Ce&&Ve&&!ve&&o===`connected`?`copy`:`none`)},onDrop:t=>{if(!Array.from(t.dataTransfer.types).includes(`Files`)||(t.preventDefault(),t.stopPropagation(),!e||Ce||!Ve||ve||o!==`connected`))return;let n=QW(t.dataTransfer);n.length&&ut.paste({text:``,files:n})},children:[(0,S.jsxs)(`div`,{className:`flex min-h-[52px] shrink-0 items-center justify-between border-b border-border bg-elevated px-[6px] md:hidden`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[7px]`,children:[(0,S.jsx)(`button`,{onClick:()=>U(!0),className:yt(`neutral`),"aria-label":`Open session menu`,children:(0,S.jsx)(_e,{width:G.primary,height:G.primary})}),e?(0,S.jsxs)(`div`,{className:`flex min-w-[72px] flex-col items-start gap-px leading-none`,children:[ae?(0,S.jsx)(`input`,{ref:pe,type:`text`,value:se,onChange:e=>ce(e.target.value),onBlur:Ze,onKeyDown:Qe,className:`w-full max-w-[112px] rounded border border-border bg-surface px-2 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`}):(0,S.jsx)(`span`,{className:`max-w-[112px] truncate text-sm font-medium text-primary`,children:e.agentSessionName||e.name}),(0,S.jsx)(`span`,{className:`shrink-0 text-[10px] ${o===`connected`?YG[e.status]:`text-approval`}`,children:o===`connected`?JG[e.status]:o})]}):r?(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-px leading-none`,children:[(0,S.jsx)(`span`,{className:`max-w-[112px] truncate text-sm font-medium text-primary`,children:Te}),(0,S.jsx)(`span`,{className:`text-[10px] font-medium text-blue-400`,children:`Hibernating`})]}):(0,S.jsx)(`span`,{className:`text-sm font-medium text-primary`,children:`Sessions`})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-[4px]`,children:[(0,S.jsx)(`button`,{onClick:p,className:yt(`primary`),title:`New session (${N}N)`,"aria-label":`New session`,children:(0,S.jsx)(ke,{width:G.primary,height:G.primary})}),e&&we&&(0,S.jsx)(`button`,{disabled:Be,onClick:()=>H(!0),className:yt(`danger`),title:`Kill session (${N}X)`,"aria-label":`Kill session`,children:(0,S.jsx)(Fe,{width:G.primary,height:G.primary})}),Oe&&(0,S.jsx)(`button`,{onClick:Ye,className:`${yt(`neutral`,`hidden`)} min-[360px]:flex`,title:`Hibernate session`,"aria-label":`Hibernate session`,children:(0,S.jsx)(xe,{width:G.primary,height:G.primary})}),r&&(0,S.jsx)(`button`,{onClick:()=>_(r.sessionId),className:`btn btn-primary h-[44px] px-3 text-xs`,children:`Wake`}),e&&(0,S.jsxs)(`div`,{className:`relative`,ref:de,children:[(0,S.jsx)(`button`,{onClick:()=>re(!ne),className:yt(`neutral`),title:`More options`,"aria-label":`More options`,children:(0,S.jsx)(B,{width:G.primary,height:G.primary})}),ne&&(0,S.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border bg-elevated shadow-lg py-1`,children:[we&&(0,S.jsxs)(`button`,{onClick:Xe,className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,S.jsx)(V,{width:G.default,height:G.default}),`Rename`]}),Oe&&(0,S.jsxs)(`button`,{onClick:Ye,className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,S.jsx)(xe,{width:G.default,height:G.default}),`Hibernate`]}),(0,S.jsxs)(`button`,{onClick:()=>{b(),re(!1)},className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,S.jsx)(je,{width:G.default,height:G.default}),`Settings`]})]})]})]})]}),e&&t.length>1&&(0,S.jsxs)(`div`,{className:`relative overflow-hidden bg-elevated border-b border-border md:hidden`,children:[(0,S.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-4 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none`}),(0,S.jsx)(`div`,{ref:fe,className:`flex items-center gap-[6px] overflow-x-auto scroll-pe-4 px-[8px] py-[5px] scrollbar-none snap-x snap-mandatory`,style:{WebkitOverflowScrolling:`touch`},children:t.map((t,n)=>{let r=t.id===e.id,i=ht?t.name.trim():n+1;return(0,S.jsx)(`button`,{type:`button`,"data-session-id":t.id,className:`
|
|
299
|
+
`,onMouseDown:e=>e.preventDefault(),onTouchEnd:O(E),onClick:k(E),disabled:r,children:UK})]}),(0,S.jsx)(RK,{...p,allowFiles:s})]})}function eq({isOpen:e,onClose:t,sessions:n,hibernatingSessions:r=[],historySessions:i=[],selectedSessionId:a,selectedHibernatingSessionId:o=null,onSelect:s,onSelectHibernating:c,onRename:l,onResume:u,onHibernate:d,onMoveToHistory:f,onNewSession:p,loading:m,error:h}){let g=Bd(),_=(0,C.useRef)(null),v=(0,C.useRef)(null);(0,C.useEffect)(()=>{if(!e||typeof document>`u`)return;let{body:t}=document,n=window.scrollY,r={position:t.style.position,top:t.style.top,width:t.style.width};return t.style.position=`fixed`,t.style.top=`-${n}px`,t.style.width=`100%`,()=>{t.style.position=r.position,t.style.top=r.top,t.style.width=r.width,window.scrollTo(0,n)}},[e]),(0,C.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),t())};return document.addEventListener(`keydown`,n),()=>document.removeEventListener(`keydown`,n)},[e,t]),(0,C.useEffect)(()=>{e?(v.current=document.activeElement,_.current?.focus({preventScroll:!0})):v.current&&=(v.current.focus({preventScroll:!0}),null)},[e]),(0,C.useEffect)(()=>{if(!e)return;let n=_.current;if(!n)return;let r=0,i=0,a=e=>{let t=e.touches[0];r=t.clientX,i=t.clientY},o=e=>{let n=e.changedTouches[0],a=r-n.clientX,o=Math.abs(n.clientY-i);a>=50&&a>o*1.5&&(`vibrate`in navigator&&navigator.vibrate(10),t())};return n.addEventListener(`touchstart`,a,{passive:!0}),n.addEventListener(`touchend`,o,{passive:!0}),()=>{n.removeEventListener(`touchstart`,a),n.removeEventListener(`touchend`,o)}},[e,t]);let y=e=>{s(e),t()},b=e=>{c?.(e),t()},x=g?{transition:`none`}:void 0;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`session-drawer-backdrop ${e?`open`:``}`,style:x,onClick:t,"aria-hidden":`true`}),(0,S.jsxs)(`div`,{ref:_,className:`session-drawer ${e?`open`:``}`,style:x,role:`dialog`,"aria-modal":`true`,"aria-label":`Session list`,tabIndex:-1,children:[(0,S.jsx)(BO,{sessions:n,hibernatingSessions:r,historySessions:i,selectedSessionId:a,selectedHibernatingSessionId:o,onSelect:y,onSelectHibernating:b,onRename:l,onResume:u,onHibernate:d,onMoveToHistory:f,scrollSelectionActive:e,onNewSession:()=>{p()!==!1&&t()},loading:m,error:h}),(0,S.jsx)(`div`,{className:`shrink-0 border-t border-border px-2 pt-2`,style:{paddingBottom:`max(0.5rem, env(safe-area-inset-bottom, 0.5rem))`},children:(0,S.jsx)(`button`,{onClick:()=>{p()!==!1&&t()},className:`btn btn-primary min-h-[44px] w-full py-2 text-sm`,children:`New Session`})})]})]})}var tq={working:`bg-green-500/35 text-white`,waiting:`bg-blue-500/35 text-white`,permission:`bg-amber-500/35 text-white`,unknown:`bg-gray-500/35 text-white`},nq={working:`bg-working text-white`,waiting:`bg-waiting text-white`,permission:`bg-approval text-white`,unknown:`bg-muted text-white`};function rq(){`vibrate`in navigator&&navigator.vibrate(10)}function iq({session:e,sessions:t,drawerSessions:n,hibernatingSession:r=null,hibernatingSessions:i=[],historySessions:a=[],connectionStatus:o,connectionEpoch:s=0,sendMessage:c,subscribe:l,onClose:u,onSelectSession:d,onSelectHibernatingSession:f,onNewSession:p,onKillSession:m,onRenameSession:h,onDuplicateSession:g,onResumeSession:_,onHibernateSession:v,onMoveToHistory:y,onOpenSettings:b,loading:x=!1,error:w=null}){let E=WG[HG()],O=W(e=>e.useWebGL),k=W(e=>e.fontSize),A=W(e=>e.lineHeight),j=W(e=>e.letterSpacing),M=et(W(e=>e.fontOption),W(e=>e.customFontFamily)),N=pt(dt(W(e=>e.shortcutModifier))),P=ct(),I=PG(),[L,ee]=(0,C.useState)(!1),[R,z]=(0,C.useState)(!1),[te,H]=(0,C.useState)(!1),[ne,re]=(0,C.useState)(!1),[ie,U]=(0,C.useState)(!1),[ae,oe]=(0,C.useState)(!1),[se,ce]=(0,C.useState)(``),le=(0,C.useRef)(!1),ue=(0,C.useRef)(null),de=(0,C.useRef)(null),fe=(0,C.useRef)(null);Oh(fe,e?.id??null);let pe=(0,C.useRef)(null),me=(0,C.useRef)(null),he=(0,C.useRef)(()=>{}),ge=(0,C.useRef)(()=>{}),ve=e?.remote===!0,ye=Sh(e=>e.remoteAllowControl),be=Sh(e=>e.remoteAllowAttach),Se=Sh(e=>e.preferWindowName),Ce=ve&&!be,we=!ve||ye&&e?.source===`managed`,Te=r?r.displayName||dh(r.projectPath)||r.sessionId.slice(0,8):``,Ee=r?dh(r.projectPath):``,De=r?uh(r.lastActivityAt):``,Oe=!!e&&!!v&&e.source===`managed`&&!e.remote&&!!e.agentSessionId?.trim(),Ae=(0,C.useMemo)(()=>{let e=new Set;for(let n of t)n.host?.trim()&&e.add(n.host.trim());for(let t of i)t.host?.trim()&&e.add(t.host.trim());return e.size>1},[t,i]),{containerRef:Me,terminalRef:Ne,inTmuxCopyModeRef:Pe,isTmuxCopyMode:Le,appMouseRef:Re,setTmuxCopyMode:ze,isSwitching:Be,isInputReady:Ve,pendingClipboardOffer:He,copyPendingClipboardOffer:Ue,dismissPendingClipboardOffer:We}=NG({sessionId:e?.id??null,tmuxTarget:e?.tmuxWindow??null,agentType:e?.agentType,onPasteFiles:e=>he.current(e),onPasteError:e=>ge.current(e),allowAttach:!Ce,connectionStatus:o,connectionEpoch:s,sendMessage:c,subscribe:l,theme:E,fontSize:k,lineHeight:A,letterSpacing:j,fontFamily:M,useWebGL:O,onScrollChange:e=>{ee(!e)}}),Ge=(0,C.useCallback)(()=>{!e||Ce||(c({type:`tmux-cancel-copy-mode`,sessionId:e.id}),ze(!1),Ne.current?.scrollToBottom())},[e,Ce,c,ze,Ne]),Ke=(0,C.useCallback)(()=>{U(!0),rq()},[]),qe=LG({enabled:I||P,isOpen:ie,onOpen:Ke});(0,C.useEffect)(()=>{!I&&!P&&ie&&U(!1)},[ie,I,P]),FG(de,ne,(0,C.useCallback)(()=>re(!1),[])),(0,C.useEffect)(()=>{ae&&pe.current&&(pe.current.focus(),pe.current.select())},[ae]),(0,C.useEffect)(()=>{te&&me.current&&me.current.focus()},[te]),IG(te,(0,C.useCallback)(()=>H(!1),[]));let Je=()=>{e&&(m(e.id,`terminal_confirm_modal`),H(!1))},Ye=()=>{!e||!Oe||(v?.(e.agentSessionId.trim()),re(!1))},Xe=()=>{e&&(ce(e.agentSessionName||e.name),oe(!0),re(!1))},Ze=()=>{if(!e)return;let t=se.trim(),n=e.agentSessionName||e.name;t&&t!==n&&h(e.id,t),oe(!1)},Qe=e=>{e.key===`Enter`?(e.preventDefault(),Ze()):e.key===`Escape`&&(e.preventDefault(),oe(!1))};(0,C.useEffect)(()=>{if(!P||!e){z(!1);return}let t=Me.current;if(!t)return;let n=e=>{let n=t.querySelector(`.xterm-accessibility-tree`);if(!n)return!1;let r=e.anchorNode,i=e.focusNode;return!!r&&n.contains(r)||!!i&&n.contains(i)},r=()=>{let e=t.querySelector(`.xterm-accessibility`),n=t.querySelector(`.xterm-accessibility-tree`);!e||!n||(e.style.setProperty(`opacity`,`0`),n.style.setProperty(`opacity`,`0`),e.style.setProperty(`-webkit-user-select`,`none`),e.style.setProperty(`user-select`,`none`),n.style.setProperty(`-webkit-user-select`,`none`),n.style.setProperty(`user-select`,`none`),e.offsetHeight,requestAnimationFrame(()=>{e.style.removeProperty(`opacity`),n.style.removeProperty(`opacity`),e.style.removeProperty(`-webkit-user-select`),e.style.removeProperty(`user-select`),n.style.removeProperty(`-webkit-user-select`),n.style.removeProperty(`user-select`)}))},i=()=>{le.current=!1;let e=window.getSelection();try{e?.removeAllRanges()}catch{}Ne.current?.clearSelection(),r(),z(!1)};ue.current=i;let a=()=>{let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed){le.current?i():z(e=>e&&!1);return}let t=n(e);if(!t&&le.current){i();return}le.current=t;let r=t;z(e=>e===r?e:r)},o=()=>{let e=window.getSelection();!e||e.isCollapsed||n(e)&&setTimeout(i,0)},s=null,c=!1,l=e=>{if(e.touches.length===1){let t=e.touches[0];s={x:t.clientX,y:t.clientY},c=!1}},u=e=>{if(c||!s||e.touches.length!==1)return;let t=e.touches[0],n=Math.abs(t.clientX-s.x),r=Math.abs(t.clientY-s.y);(n>10||r>10)&&(c=!0)},d=e=>{let r=c;s=null,c=!1;let a=window.getSelection();if(!a||a.rangeCount===0||a.isCollapsed){z(!1);return}let o=t.querySelector(`.xterm-accessibility-tree`);if(!o)return;if(!n(a)){z(!1);return}if(r)return;let l=e.target,u=l?o.contains(l):!1,d=!1;if(u&&l)try{d=a.containsNode(l,!0)}catch{d=!1}(!u||!d)&&setTimeout(i,0)};return document.addEventListener(`selectionchange`,a),document.addEventListener(`copy`,o),document.addEventListener(`touchstart`,l,{passive:!0}),document.addEventListener(`touchmove`,u,{passive:!0}),document.addEventListener(`touchend`,d,{passive:!0}),()=>{document.removeEventListener(`selectionchange`,a),document.removeEventListener(`copy`,o),document.removeEventListener(`touchstart`,l),document.removeEventListener(`touchmove`,u),document.removeEventListener(`touchend`,d),ue.current=null,le.current=!1}},[Me,P,e?.id]),(0,C.useEffect)(()=>{if(!P)return;let t=Me.current;if(!t)return;let n=null,r=()=>{let e=Ne.current,r=t.querySelector(`.xterm`);if(!e||!r)return;let i=r.querySelector(`.xterm-screen`),a=r.querySelector(`.xterm-accessibility`),o=r.querySelector(`.xterm-accessibility-tree`);if(!i||!a||!o)return;n||=QG(o);let s=r.getBoundingClientRect(),c=i.getBoundingClientRect(),l=c.left-s.left,u=c.top-s.top;Object.assign(a.style,{left:`${l}px`,top:`${u}px`,right:`auto`,bottom:`auto`,width:`${c.width}px`,height:`${c.height}px`});let d=c.width/e.cols,f=c.height/e.rows,p=document.createElement(`span`);p.textContent=`0`.repeat(200),p.style.cssText=`position:absolute;visibility:hidden;white-space:pre;pointer-events:none;letter-spacing:0px`,o.appendChild(p);let m=p.getBoundingClientRect().width/200;p.remove();let h=Math.max(-2,Math.min(2,d-m));t.style.setProperty(`--xterm-font-size`,`${e.options.fontSize}px`),t.style.setProperty(`--xterm-cell-height`,`${f}px`),t.style.setProperty(`--xterm-a11y-letter-spacing`,`${h}px`)},i=performance.now();r();let a=Math.round(performance.now()-i);a>10&&KO(`switch_a11y_overlay`,{sessionId:e?.id,a11yMs:a});let o=window.requestAnimationFrame(r),s=window.setTimeout(r,100),c=()=>window.requestAnimationFrame(r);return window.visualViewport?.addEventListener(`resize`,c),window.addEventListener(`orientationchange`,c),()=>{window.cancelAnimationFrame(o),window.clearTimeout(s),window.visualViewport?.removeEventListener(`resize`,c),window.removeEventListener(`orientationchange`,c),n?.()}},[Me,k,P,e?.id,Ne]);let $e=(0,C.useRef)(R);(0,C.useEffect)(()=>{$e.current=R},[R]);let tt=(0,C.useRef)(e?.id);(0,C.useEffect)(()=>{tt.current=e?.id},[e?.id]);let nt=(0,C.useRef)(c);(0,C.useEffect)(()=>{nt.current=c},[c]);let rt=(0,C.useRef)(!1),it=(0,C.useRef)(`idle`);(0,C.useEffect)(()=>{if(!P)return;let e=Me.current;if(!e)return;let t=null,n=()=>e.querySelector(`.xterm-helper-textarea`),r=e=>{e.target===n()&&(it.current=`focused`)},i=e=>{e.target===n()&&(t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null;let e=n(),r=typeof document.hasFocus!=`function`||document.hasFocus();document.activeElement!==e&&document.visibilityState!==`hidden`&&r&&(it.current=`idle`)},0))},a=()=>{let e=n();(document.activeElement===e||it.current===`focused`)&&(it.current=`interrupted`)},o=()=>{it.current===`interrupted`&&(it.current=`armed`)},s=()=>{document.visibilityState===`hidden`?a():o()},c=e=>{e.persisted&&o()};return document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,i),document.addEventListener(`visibilitychange`,s),window.addEventListener(`blur`,a),window.addEventListener(`focus`,o),window.addEventListener(`pageshow`,c),()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,i),document.removeEventListener(`visibilitychange`,s),window.removeEventListener(`blur`,a),window.removeEventListener(`focus`,o),window.removeEventListener(`pageshow`,c),t!==null&&window.clearTimeout(t),it.current=`idle`}},[Me,P,e?.id]),(0,C.useEffect)(()=>{let t=Me.current;if(!t||!e?.id||!I&&!P)return;let n={x:0,y:0},r=0,i=!1,a=null,o=0,s=0,c=0,l=Math.round(k*A),u=null,d=null,f=!1,p=null,m=()=>{let e=window.getComputedStyle(t).getPropertyValue(`--xterm-cell-height`).trim(),n=Number.parseFloat(e);return!Number.isNaN(n)&&n>0?n:Math.round(k*A)},h=()=>t.querySelector(`.xterm-helper-textarea`),g=e=>{let n=Ne.current;if(!n)return null;let r=(t.querySelector(`.xterm`)?.querySelector(`.xterm-screen`))?.getBoundingClientRect();if(!r||r.width<=0||r.height<=0)return null;let i=r.width/n.cols,a=r.height/n.rows;return i<=0||a<=0?null:{col:Math.min(n.cols,Math.max(1,Math.floor((e.clientX-r.left)/i)+1)),row:Math.min(n.rows,Math.max(1,Math.floor((e.clientY-r.top)/a)+1))}},_=()=>{let e=h();e&&document.activeElement!==e&&(e.disabled=!0)},v=()=>{let e=h();e&&(e.disabled=!1)};_();let y=()=>{if(Pe.current)return;let e=h();e&&(e.disabled=!1,e.focus())},b=()=>{u!==null&&(cancelAnimationFrame(u),u=null),s=0},x=()=>{d!==null&&(clearTimeout(d),d=null)},S=(e,t,n)=>{let r=tt.current;return r?(nt.current({type:`terminal-input`,sessionId:r,data:`\x1b[<${e};${t.col};${t.row}${n}`}),!0):!1},C=e=>{let t=tt.current;if(!t||e===0)return!1;let n=Ne.current,r=n?.cols??80,i=n?.rows??24,a=Math.floor(r/2),o=Math.floor(i/2),s=e>0?65:64,c=Math.abs(e),l=e<0;for(let e=0;e<c;e++)nt.current({type:`terminal-input`,sessionId:t,data:`\x1b[<${s};${a};${o}M`});return l&&!Re.current&&ze(!0),l},w=e=>{let t=tt.current,n=g(e);return!t||!n?!1:(nt.current({type:`terminal-input`,sessionId:t,data:`\x1b[<0;${n.col};${n.row}M\x1b[<0;${n.col};${n.row}m`}),!0)},T=e=>{if(!P||!Re.current)return!1;let t=g(e);return t?(f=!0,p=t,_(),rq(),S(0,t,`M`)):!1},E=e=>{let t=g(e);return t?p&&p.col===t.col&&p.row===t.row?!0:(p=t,S(32,t,`M`)):!1},D=e=>{let t=e?g(e):p;return f=!1,p=null,t?S(0,t,`m`):!1},O=()=>{x(),f=!1,p=null,a=null,s=0,c=0},j=()=>{if(!P)return!1;let e=window.getSelection();if(!e||e.isCollapsed)return!1;let n=t.querySelector(`.xterm-accessibility-tree`);if(!n)return!1;let r=e.anchorNode,i=e.focusNode;return!!r&&n.contains(r)||!!i&&n.contains(i)},M=()=>{!P||!le.current||j()||ue.current?.()},N=e=>{if(b(),M(),qe.current||ie){O();return}if($e.current){O();return}if(it.current===`armed`&&!Pe.current&&(it.current=`idle`,y()),e.touches.length===1){let t=e.touches[0];if(n={x:t.clientX,y:t.clientY},r=performance.now(),i=!1,a=t.clientY,o=r,s=0,c=0,l=m(),v(),P&&Re.current){let e={clientX:t.clientX,clientY:t.clientY};d=setTimeout(()=>{d=null,!(i||qe.current||ie)&&($e.current||j()||T(e))},350)}}},F=e=>{if(e.touches.length!==1||a===null)return;if(M(),qe.current||ie){O();return}let t=performance.now(),r=e.touches[0],u=r.clientX,d=r.clientY;if(f){e.preventDefault(),e.stopPropagation(),E(r),a=d,o=t;return}if($e.current||j()){O();return}e.preventDefault(),e.stopPropagation();let p=Math.abs(u-n.x),m=Math.abs(d-n.y);!i&&(p>6||m>6)&&(i=!0,x(),_());let h=a-d,g=t-o;if(a=d,o=t,g>0){let e=h/g;s=s*.7+e*.3}c+=h;let v=Math.max(6,l*.6),y=Math.trunc(c/v);y!==0&&(C(y),c-=y*v)},L=e=>{let t=s,n=performance.now()-r;if(x(),f){D(e.changedTouches[0]),O(),e.preventDefault(),e.stopPropagation();return}if(O(),qe.current||ie)return;let a=j();if($e.current&&!a&&ue.current?.(),$e.current||a){Pe.current&&(rt.current=!0);return}if(!i){if(P&&n>=350)return;if(Re.current){let t=e.changedTouches[0];if(t&&w(t)){y(),e.preventDefault(),e.stopPropagation();return}}if(Pe.current){e.preventDefault(),e.stopPropagation(),rt.current=!0;return}y();return}if(Math.abs(t)>.12){let e=t,n=performance.now(),r=()=>{let t=performance.now(),i=t-n;n=t;let a=e*i;c+=a;let o=Math.max(6,l*.6),s=Math.trunc(c/o);s!==0&&(C(s),c-=s*o),e*=.95**(i/16.67),u=Math.abs(e)>.02?requestAnimationFrame(r):null};u=requestAnimationFrame(r)}},ee=e=>{rt.current&&=(e.preventDefault(),e.stopPropagation(),!1)},R={passive:!0,capture:!0},z={passive:!1,capture:!0},B={passive:!1,capture:!0},te={capture:!0};return t.addEventListener(`touchstart`,N,R),t.addEventListener(`touchmove`,F,z),t.addEventListener(`touchend`,L,B),t.addEventListener(`mousedown`,ee,te),()=>{t.removeEventListener(`touchstart`,N,R),t.removeEventListener(`touchmove`,F,z),t.removeEventListener(`touchend`,L,B),t.removeEventListener(`mousedown`,ee,te),x();let e=h();e&&(e.disabled=!1)}},[e?.id,Me,Ne,P,I,ie,k,A]);let at=(0,C.useCallback)(t=>{!e||Ce||!Ve||c({type:`terminal-input`,sessionId:e.id,data:t})},[e,Ce,Ve,c]),ot=(0,C.useCallback)(t=>{!e||Ce||!Ve||(Pe.current&&(c({type:`tmux-cancel-copy-mode`,sessionId:e.id}),ze(!1)),c({type:`terminal-paste`,sessionId:e.id,data:t}))},[e,Ce,Ve,c,Pe,ze]),st=(0,C.useCallback)(t=>{!e||Ce||!Ve||(Pe.current&&(c({type:`tmux-cancel-copy-mode`,sessionId:e.id}),ze(!1)),at(t))},[e,Ce,Ve,c,Pe,ze,at]),lt=(0,C.useCallback)(()=>{let e=Me.current;if(!e)return;let t=e.querySelector(`.xterm-helper-textarea`);t&&(t.removeAttribute(`disabled`),t.focus())},[Me]),ut=BK({sessionId:e?.id??null,disabled:o!==`connected`||Ce||!Ve,fileUploadsAllowed:!ve,agentType:e?.agentType,onPasteText:ot,onPasteImage:st,onRefocus:lt});he.current=ut.paste,ge.current=ut.fail;let ft=(0,C.useCallback)(()=>{if(!e||Ce||!Ve)return;Pe.current&&(c({type:`tmux-cancel-copy-mode`,sessionId:e.id}),ze(!1));let t=Me.current;if(!t)return;let n=t.querySelector(`.xterm-helper-textarea`);n&&(n.removeAttribute(`disabled`),n.focus())},[e,Ce,Ve,c,Me,Pe,ze]),mt=(0,C.useCallback)(()=>{if(typeof document>`u`)return!1;let e=Me.current;if(!e)return!1;let t=e.querySelector(`.xterm-helper-textarea`);if(t&&document.activeElement===t)return!0;let n=document.activeElement,r=typeof HTMLInputElement<`u`&&n instanceof HTMLInputElement,i=typeof HTMLTextAreaElement<`u`&&n instanceof HTMLTextAreaElement;return r||i||n&&n.isContentEditable?!1:!!document.documentElement?.classList?.contains(`keyboard-visible`)},[Me]);(0,C.useEffect)(()=>{if(!P)return;let e=Me.current;if(!e)return;let t=e.querySelector(`.xterm-accessibility`),n=e.querySelector(`.xterm-accessibility-tree`);if(!t||!n)return;let r=()=>{let r=e.querySelector(`.xterm-helper-textarea`);r&&document.activeElement===r&&!$e.current?(t.style.pointerEvents=`none`,n.style.pointerEvents=`none`):(t.style.removeProperty(`pointer-events`),n.style.removeProperty(`pointer-events`))};return r(),document.addEventListener(`focusin`,r),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`focusin`,r),document.removeEventListener(`focusout`,r)}},[Me,P,R]),(0,C.useEffect)(()=>{let e=Me.current;e&&(e.inert=!!r)},[Me,r]);let ht=(0,C.useMemo)(()=>{if(!Se||t.length===0)return!1;let e=t.map(e=>e.name.trim()).filter(Boolean);return e.length===t.length&&new Set(e).size===t.length},[Se,t]);return(0,S.jsxs)(`section`,{className:`flex flex-1 flex-col bg-base terminal-mobile-overlay md:relative md:inset-auto ${P?`ios-native-term-selection`:``}`,"data-testid":`terminal-panel`,onDragOver:t=>{Array.from(t.dataTransfer.types).includes(`Files`)&&(t.preventDefault(),t.dataTransfer.dropEffect=e&&!Ce&&Ve&&!ve&&o===`connected`?`copy`:`none`)},onDrop:t=>{if(!Array.from(t.dataTransfer.types).includes(`Files`)||(t.preventDefault(),t.stopPropagation(),!e||Ce||!Ve||ve||o!==`connected`))return;let n=QW(t.dataTransfer);n.length&&ut.paste({text:``,files:n})},children:[(0,S.jsxs)(`div`,{className:`flex min-h-[52px] shrink-0 items-center justify-between border-b border-border bg-elevated px-[6px] md:hidden`,children:[(0,S.jsxs)(`div`,{className:`flex min-w-0 items-center gap-[7px]`,children:[(0,S.jsx)(`button`,{onClick:()=>U(!0),className:yt(`neutral`),"aria-label":`Open session menu`,children:(0,S.jsx)(_e,{width:G.primary,height:G.primary})}),e?(0,S.jsxs)(`div`,{className:`flex min-w-[72px] flex-col items-start gap-px leading-none`,children:[ae?(0,S.jsx)(`input`,{ref:pe,type:`text`,value:se,onChange:e=>ce(e.target.value),onBlur:Ze,onKeyDown:Qe,className:`w-full max-w-[112px] rounded border border-border bg-surface px-2 py-0.5 text-sm font-medium text-primary outline-none focus:border-accent`}):(0,S.jsx)(`span`,{className:`max-w-[112px] truncate text-sm font-medium text-primary`,children:e.agentSessionName||e.name}),(0,S.jsx)(`span`,{className:`shrink-0 text-[10px] ${o===`connected`?eK[e.status]:`text-approval`}`,children:o===`connected`?$G[e.status]:o})]}):r?(0,S.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-px leading-none`,children:[(0,S.jsx)(`span`,{className:`max-w-[112px] truncate text-sm font-medium text-primary`,children:Te}),(0,S.jsx)(`span`,{className:`text-[10px] font-medium text-blue-400`,children:`Hibernating`})]}):(0,S.jsx)(`span`,{className:`text-sm font-medium text-primary`,children:`Sessions`})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-[4px]`,children:[(0,S.jsx)(`button`,{onClick:p,className:yt(`primary`),title:`New session (${N}N)`,"aria-label":`New session`,children:(0,S.jsx)(ke,{width:G.primary,height:G.primary})}),e&&we&&(0,S.jsx)(`button`,{disabled:Be,onClick:()=>H(!0),className:yt(`danger`),title:`Kill session (${N}X)`,"aria-label":`Kill session`,children:(0,S.jsx)(Fe,{width:G.primary,height:G.primary})}),Oe&&(0,S.jsx)(`button`,{onClick:Ye,className:`${yt(`neutral`,`hidden`)} min-[360px]:flex`,title:`Hibernate session`,"aria-label":`Hibernate session`,children:(0,S.jsx)(xe,{width:G.primary,height:G.primary})}),r&&(0,S.jsx)(`button`,{onClick:()=>_(r.sessionId),className:`btn btn-primary h-[44px] px-3 text-xs`,children:`Wake`}),e&&(0,S.jsxs)(`div`,{className:`relative`,ref:de,children:[(0,S.jsx)(`button`,{onClick:()=>re(!ne),className:yt(`neutral`),title:`More options`,"aria-label":`More options`,children:(0,S.jsx)(B,{width:G.primary,height:G.primary})}),ne&&(0,S.jsxs)(`div`,{className:`absolute right-0 top-full mt-1 z-20 min-w-[140px] rounded-md border border-border bg-elevated shadow-lg py-1`,children:[we&&(0,S.jsxs)(`button`,{onClick:Xe,className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,S.jsx)(V,{width:G.default,height:G.default}),`Rename`]}),Oe&&(0,S.jsxs)(`button`,{onClick:Ye,className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,S.jsx)(xe,{width:G.default,height:G.default}),`Hibernate`]}),(0,S.jsxs)(`button`,{onClick:()=>{b(),re(!1)},className:`flex min-h-[44px] w-full items-center gap-2 px-3 py-2 text-left text-sm text-secondary hover:bg-hover hover:text-primary`,children:[(0,S.jsx)(je,{width:G.default,height:G.default}),`Settings`]})]})]})]})]}),e&&t.length>1&&(0,S.jsxs)(`div`,{className:`relative overflow-hidden bg-elevated border-b border-border md:hidden`,children:[(0,S.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-4 bg-gradient-to-l from-elevated to-transparent z-10 pointer-events-none`}),(0,S.jsx)(`div`,{ref:fe,className:`flex items-center gap-[6px] overflow-x-auto scroll-pe-4 px-[8px] py-[5px] scrollbar-none snap-x snap-mandatory`,style:{WebkitOverflowScrolling:`touch`},children:t.map((t,n)=>{let r=t.id===e.id,i=ht?t.name.trim():n+1;return(0,S.jsx)(`button`,{type:`button`,"data-session-id":t.id,className:`
|
|
300
300
|
flex items-center justify-center shrink-0 snap-start
|
|
301
301
|
h-[44px] ${ht?`min-w-[44px] px-2.5 max-w-[8rem] truncate`:`w-[44px]`}
|
|
302
302
|
text-sm font-extrabold rounded-lg
|
|
303
303
|
active:scale-95 transition-all duration-75
|
|
304
304
|
select-none touch-manipulation
|
|
305
|
-
${r?
|
|
306
|
-
`,onClick:()=>{QK(),d(t.id)},title:ht?t.name:void 0,children:i},t.id)})})]}),(0,S.jsxs)(`div`,{className:`relative flex-1`,children:[(0,S.jsx)(`div`,{ref:Me,className:`absolute inset-0`,style:{backgroundColor:E.background}}),Be&&e&&(0,S.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,S.jsx)(Ie,{width:G.pill,height:G.pill,className:`animate-spin`}),`Loading`]}),He&&e&&(0,S.jsxs)(`div`,{className:`absolute ${L&&!R?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:hidden`,children:[(0,S.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,S.jsxs)(`button`,{type:`button`,onClick:Ue,className:`relative flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,S.jsx)(F,{width:G.default,height:G.default}),`Copy`]}),(0,S.jsx)(`button`,{type:`button`,onClick:We,className:`relative flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,S.jsx)(Fe,{width:G.default,height:G.default})})]}),!e&&(0,S.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:r?null:`Select a session to view terminal`}),e&&Ce&&(0,S.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),r&&(0,S.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,S.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,S.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,S.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:Te}),(0,S.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),Ee&&(0,S.jsx)(`span`,{className:`text-muted`,children:Ee}),(0,S.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,De]})]}),r.lastResumeError&&(0,S.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${r.lastResumeError}`,children:[(0,S.jsx)(T,{width:G.pill,height:G.pill}),`Last wake failed`]}),r.lastUserMessage&&(0,S.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:r.lastUserMessage})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>_(r.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),y&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>y(r.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,S.jsx)(DO,{session:r})]})}),Le&&e&&!R?(0,S.jsxs)(`button`,{type:`button`,onClick:Ge,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:hidden ${St}`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,S.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,S.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,S.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):L&&e&&!R?(0,S.jsxs)(`button`,{type:`button`,onClick:Ge,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all md:hidden ${St}`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,S.jsx)(D,{width:G.primary,height:G.primary}),(0,S.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,S.jsx)(NK,{...ut}),(0,S.jsx)(iK,{session:e,hibernatingSession:r,hibernatingDisplayName:Te,showHostBadge:Ae,sessionCount:t.length,connectionStatus:o,isSwitching:Be,canControl:we,canHibernate:Oe,modDisplay:N,onKill:()=>H(!0),onHibernate:Ye,onWake:()=>r&&_(r.sessionId),onRename:t=>{let n=e?.id??r?.sessionId;n&&h(n,t)},onDuplicate:e&&g?()=>g(e.id):void 0,onMoveToHistory:r&&y?()=>y(r.sessionId):void 0,isTmuxCopyMode:Le,showJumpToBottom:L&&!R,onJumpToBottom:Ge,selectionReady:!!He,onCopySelection:Ue,onDismissSelection:We}),e&&(0,S.jsx)(JK,{onSendKey:at,onPasteText:ot,onPasteImage:st,disabled:o!==`connected`||Ce||!Ve,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!ve,onSelectSession:d,hideSessionSwitcher:!0,onRefocus:lt,isKeyboardVisible:mt,onEnterTextMode:ft}),(I||P)&&(0,S.jsx)(YK,{isOpen:ie,onClose:()=>U(!1),sessions:n??t,hibernatingSessions:i,historySessions:a,selectedSessionId:e?.id??null,selectedHibernatingSessionId:r?.sessionId??null,onSelect:d,onSelectHibernating:f,onRename:h,onResume:_,onHibernate:v,onMoveToHistory:y,onNewSession:p,loading:x,error:w}),te&&e&&(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,S.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,S.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,S.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,S.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{onClick:()=>H(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,S.jsx)(`button`,{ref:me,onClick:Je,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function eq({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,C.useState)(n||`~`),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(!0),[d,f]=(0,C.useState)(-1),p=(0,C.useRef)(null),m=W(e=>e.recentPaths),h=(0,C.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,C.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,C.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,S.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,S.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,S.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,S.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,S.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,S.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,S.jsx)(`p`,{className:`text-danger`,children:s}),(0,S.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,S.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,S.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,S.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,S.jsx)(ae,{width:G.default,height:G.default,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,S.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,S.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,S.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,S.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,S.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,S.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,S.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function tq(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function nq(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?tq(o):null}function rq(e){return e?e===`claude-rp`?`claude`:e:null}function iq(e){let t=e.trim();if(!t)return``;let n=tq(t);return nq(n)??n}function aq(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`;if(e===`omp`)return`omp`}function oq(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=e.includes(`@oh-my-pi/`)?`omp`:aq(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function sq(e){let t=iq(e);if(t)return oq(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var cq={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null,omp:`--auto-approve`},lq={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[],omp:[`--auto-approve`,`--approval-mode yolo`,`--approval-mode=yolo`]};function uq(e){let t=rq(e);return t?cq[t]:null}function dq(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fq(e){return RegExp(`(^|\\s)${dq(e)}(?=\\s|$)`,`g`)}function pq(e,t){return(t?[rq(t)].filter(e=>e!==null):Object.keys(lq)).some(t=>lq[t].some(t=>fq(t).test(e)))}function mq(e,t){let n=oq(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function hq(e,t){let n=uq(t);if(!n)return e;let r=e.trim();if(!r||pq(r,t))return r;let i=mq(r,n);if(i)return i;let a=iq(r);if(a&&a!==r){let e=mq(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function gq(e,t){let n=rq(t);if(!n||pq(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}if(n===`omp`){let t=/(^|\s)--approval-mode(?:\s+|=)(always-ask|write)/.exec(e);if(t)return`conflicts with --approval-mode ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function _q(e,t){let n=rq(t);if(!n)return e;let r=e;for(let e of lq[n])r=r.replace(fq(e),` `);return r.replace(/\s+/g,` `).trim()}function vq({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(``),[x,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(``),D=W(e=>e.yoloMode),O=W(e=>e.setYoloMode),k=(0,C.useRef)(null),A=(0,C.useRef)(null),j=(0,C.useRef)(null),M=(0,C.useRef)(!1),N=l&&c.length>0,P=e=>{if(!D)return e;let t=sq(e);return t&&!gq(e,t)?hq(e,t):e},F=e=>{let t=i.find(t=>t.id===e);t&&(v(e),b(P(it(t))))},I=()=>{v(null),b(``)};if((0,C.useEffect)(()=>{let t=M.current;if(M.current=e,!e){m(``),g(``),v(null),b(``),w(!1),E(u??``),t&&setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),E(u??``);let n=f?.trim();if(n){let e=i.find(e=>it(e)===n);e?(v(e.id),b(it(e))):(v(null),b(n))}else{let e=i.find(e=>e.id===a);e?(v(a),b(P(it(e)))):i.length>0?(v(i[0].id),b(P(it(i[0])))):(v(null),b(``))}setTimeout(()=>{if(j.current?.focus(),A.current){let e=A.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,C.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>k.current?Array.from(k.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!x){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),k.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?I():F(i[n].id),(k.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,x,i,D]),!e)return null;let L=_===null,ee=T!==``,R=sq(y),z=uq(R)!==null,B=R?pq(y,R):!1,te=R&&!B?gq(y,R):null,V=!z||te!==null,H=R?R===`pi`?`Pi has no permission prompts — nothing to enable`:te??`Append ${uq(R)}`:`Enter a supported agent command (claude, codex, grok, devin)`,ne=e=>{O(e),R&&b(e?hq(y,R):_q(y,R))},re=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=y.trim();n(r,h.trim()||void 0,i||void 0,ee?T:void 0),t()},ie=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],U=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],ae=p.trim()||`~`;return(0,S.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,S.jsxs)(`form`,{ref:k,onSubmit:re,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,S.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,S.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[N&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:U.map((e,t)=>{let n=T===e.id,r=!e.ok&&!n;return(0,S.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>E(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%U.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+U.length)%U.length;else return;let r=U[n];E(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:ie.map((e,t)=>{let n=e.isCustom?L:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,S.jsxs)(`button`,{ref:n?j:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?I():F(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];r.isCustom?I():F(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,S.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,S.jsx)(Bh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,S.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,S.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${V?`text-muted opacity-60`:`text-secondary`}`,title:H,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:B,disabled:V,onChange:e=>ne(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(`input`,{ref:A,value:p,onChange:e=>m(e.target.value),placeholder:ee?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!ee&&(0,S.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>w(!0),children:`Browse`})]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,S.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,S.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,S.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),x&&!ee&&(0,S.jsx)(eq,{initialPath:ae,onSelect:e=>{m(e),w(!1)},onCancel:()=>w(!1)})]})}function yq({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=C.useRef(e!==void 0),[a,o]=C.useState(t);return[i?e:a,C.useCallback(e=>{i||o(e)},[])]}var bq={};function xq(e,t){let n=C.useRef(bq);return n.current===bq&&(n.current=e(t)),n}var Sq=C[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Cq=Sq&&Sq!==C.useLayoutEffect?Sq:e=>e();function wq(e){let t=xq(Tq).current;return t.next=e,Cq(t.effect),t.trampoline}function Tq(){let e={next:void 0,callback:Eq,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Eq(){}function Dq(e,t,n,r){let i=xq(kq).current;return Aq(i,e,t,n,r)&&Mq(i,[e,t,n,r]),i.callback}function Oq(e){let t=xq(kq).current;return jq(t,e)&&Mq(t,e),t.callback}function kq(){return{callback:null,cleanup:null,refs:[]}}function Aq(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function jq(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function Mq(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var Nq=typeof document<`u`?C.useLayoutEffect:()=>{},Pq={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Fq={...Pq,position:`fixed`,top:0,left:0},Iq={...Pq,position:`absolute`};function Lq(){}Object.freeze([]);var Rq=Object.freeze({});function zq(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var Bq=18;function Vq(e){return Bq>=e}function Hq(e){if(!C.isValidElement(e))return null;let t=e,n=t.props;return(Vq(19)?n?.ref:t.ref)??null}function Uq(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Wq(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function Gq(e,t){return typeof e==`function`?e(t):e}function Kq(e,t){return typeof e==`function`?e(t):e}var qq={};function Jq(e,t,n,r,i){let a={...eJ(e,qq)};return t&&(a=Xq(a,t)),n&&(a=Xq(a,n)),r&&(a=Xq(a,r)),i&&(a=Xq(a,i)),a}function Yq(e){if(e.length===0)return qq;if(e.length===1)return eJ(e[0],qq);let t={...eJ(e[0],qq)};for(let n=1;n<e.length;n+=1)t=Xq(t,e[n]);return t}function Xq(e,t){return $q(t)?t(e):Zq(e,t)}function Zq(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Uq(e.style,r);break;case`className`:e[n]=rJ(e.className,r);break;default:Qq(n,r)?e[n]=tJ(e[n],r):e[n]=r}}return e}function Qq(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function $q(e){return typeof e==`function`}function eJ(e,t){return $q(e)?e(t):e??qq}function tJ(e,t){return t?e?n=>{if(iJ(n)){let r=n;nJ(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function nJ(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function rJ(e,t){return t?e?t+` `+e:t:e}function iJ(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function aJ(e,t,n={}){let r=t.render,i=oJ(t,n);return n.enabled===!1?null:cJ(e,r,i,n.state??Rq)}function oJ(e,t={}){let{className:n,style:r,render:i}=e,{state:a=Rq,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?Gq(n,a):void 0,d=l?Kq(r,a):void 0,f=l?Wq(a,c):Rq,p=l?Uq(f,Array.isArray(s)?Yq(s):s)??Rq:Rq;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=Oq([p.ref,Hq(i),...o]):p.ref=Dq(p.ref,Hq(i),o):Dq(null,null)),l?(u!==void 0&&(p.className=rJ(p.className,u)),d!==void 0&&(p.style=Uq(p.style,d)),p):Rq}var sJ=Symbol.for(`react.lazy`);function cJ(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Jq(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===sJ&&(i=C.Children.toArray(t)[0]),C.cloneElement(i,e)}if(e&&typeof e==`string`)return lJ(e,n);throw Error(zq(8))}function lJ(e,t){return e===`button`?(0,C.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,C.createElement)(`img`,{alt:``,...t,key:t.key}):C.createElement(e,t)}var uJ={...C},dJ=0;function fJ(e,t=`mui`){let[n,r]=C.useState(e),i=e||n;return C.useEffect(()=>{n??(dJ+=1,r(`${t}-${dJ}`))},[n,t]),i}var pJ=uJ.useId;function mJ(e,t){if(pJ!==void 0){let n=pJ();return e??(t?`${t}-${n}`:n)}return fJ(e,t)}function hJ(e){return mJ(e,`base-ui`)}function gJ(){return typeof window<`u`}function _J(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vJ(e){return gJ()?e instanceof Element||e instanceof _J(e).Element:!1}function yJ(e){return gJ()?e instanceof HTMLElement||e instanceof _J(e).HTMLElement:!1}function bJ(e){return!gJ()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof _J(e).ShadowRoot}var xJ=C.createContext(void 0);function SJ(e=!1){let t=C.useContext(xJ);if(t===void 0&&!e)throw Error(zq(16));return t}function CJ(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:C.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function wJ(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=C.useRef(null),o=SJ(!0)!==void 0,s=wq(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=CJ({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=C.useCallback(()=>{let e=a.current;TJ(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return Nq(l,[l]),{getButtonProps:C.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return Jq({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(nJ(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(nJ(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:wq(e=>{a.current=e,l()})}}function TJ(e){return yJ(e)&&e.tagName===`BUTTON`}var EJ=C.createContext(void 0);function DJ(){let e=C.useContext(EJ);if(e===void 0)throw Error(zq(63));return e}var OJ=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}({}),kJ={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},AJ={valid(e){return e===null?null:e?{[OJ.valid]:``}:{[OJ.invalid]:``}}},jJ=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}({}),MJ={...AJ,checked(e){return e?{[jJ.checked]:``}:{[jJ.unchecked]:``}}};function NJ(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var PJ=C.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Lq,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function FJ(){return C.useContext(PJ)}var IJ=C.createContext({invalid:void 0,name:void 0,validityData:{state:kJ,errors:[],error:``,value:``,initialValue:null},setValidityData:Lq,disabled:void 0,touched:!1,setTouched:Lq,dirty:!1,setDirty:Lq,filled:!1,setFilled:Lq,focused:!1,setFocused:Lq,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Rq)=>e,getInputValidationProps:(e=Rq)=>e,inputRef:{current:null},commit:async()=>{}}});function LJ(e=!0){let t=C.useContext(IJ);if(t.setValidityData===Lq&&!e)throw Error(zq(28));return t}function RJ(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=FJ(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=LJ(),f=wq(e.getValue);Nq(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),Nq(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:NJ(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?Vd.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),Nq(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var zJ=C.createContext({controlId:void 0,registerControlId:Lq,labelId:void 0,setLabelId:Lq,messageIds:[],setMessageIds:Lq,getDescriptionProps:e=>e});function BJ(){return C.useContext(zJ)}function VJ(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=BJ(),o=hJ(t),s=n?i:void 0,c=xq(()=>Symbol(`labelable-control`)),l=C.useRef(!1),u=C.useRef(t!=null),d=wq(()=>{!l.current||a===Lq||(l.current=!1,a(c.current,void 0))});return Nq(()=>{if(a===Lq)return;let e;if(n){let n=r?.current;e=vJ(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),C.useEffect(()=>d,[d]),i??o}var HJ=`none`;function UJ(e,t,n,r){let i=!1,a=!1,o=r??Rq;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function WJ(e,t){let n=C.useRef(e),r=wq(t);Nq(()=>{n.current!==e&&r(n.current)},[e,r]),Nq(()=>{n.current=e},[e])}var GJ=C.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=FJ(),{state:v,setTouched:y,setDirty:b,validityData:x,setFilled:w,setFocused:T,shouldValidateOnChange:E,validationMode:D,disabled:O,name:k,validation:A}=LJ(),{labelId:j}=BJ(),M=O||f,N=k??s,P=wq(l),F=C.useRef(null),I=Dq(F,o,A.inputRef),L=C.useRef(null),ee=hJ(),R=VJ({id:a,implicit:!1,controlRef:L}),z=c?void 0:R,[B,te]=yq({controlled:n,default:!!i,name:`Switch`,state:`checked`});RJ({id:ee,commit:A.commit,value:B,controlRef:L,name:N,getValue:()=>B}),Nq(()=>{F.current&&w(F.current.checked)},[F,w]),WJ(B,()=>{_(N),b(B!==x.initialValue),w(B),E()?A.commit(B):A.commit(B,!0)});let{getButtonProps:V,buttonRef:H}=wJ({disabled:M,native:c}),ne={id:c?R:ee,role:`switch`,"aria-checked":B,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":j,onFocus(){M||T(!0)},onBlur(){let e=F.current;!e||M||(y(!0),T(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){u||M||(e.preventDefault(),F.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},re=C.useMemo(()=>Jq({checked:B,disabled:M,id:z,name:N,required:d,style:N?Iq:Fq,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:I,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=UJ(HJ,e.nativeEvent);P?.(t,n),!n.isCanceled&&te(t)},onFocus(){L.current?.focus()}},A.getInputValidationProps,h===void 0?Rq:{value:h}),[B,M,I,z,N,P,d,te,A,h]),ie=C.useMemo(()=>({...v,checked:B,disabled:M,readOnly:u,required:d}),[v,B,M,u,d]),U=aJ(`span`,e,{state:ie,ref:[t,L,H],props:[ne,A.getValidationProps,g,V],stateAttributesMapping:MJ});return(0,S.jsxs)(EJ.Provider,{value:ie,children:[U,!B&&N&&m!==void 0&&(0,S.jsx)(`input`,{type:`hidden`,name:N,value:m}),(0,S.jsx)(`input`,{...re})]})}),KJ=C.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=LJ(),o=DJ();return aJ(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:MJ,props:i})});function qJ({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i}){return(0,S.jsx)(GJ,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,className:l_(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,S.jsx)(KJ,{className:l_(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}var JJ=null,YJ=!1,XJ={},ZJ=500;function QJ(){if(typeof window>`u`)return null;if(JJ?.state===`closed`&&(JJ=null),!JJ){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;JJ=new e}return JJ}function $J(){JJ&&=(JJ.close().catch(()=>{}),null),QJ()}function eY(){return YJ}function tY(){JJ&&($J(),YJ=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&tY()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&tY()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&tY(),e=t},5e3)}async function nY(){let e=QJ();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),YJ=!1}async function rY(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function iY(e){let t=QJ();if(!t||(await rY(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function aY(){let e=Date.now();if(!(e-(XJ.permission||0)<ZJ)){XJ.permission=e;try{await iY({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function oY(){let e=Date.now();if(!(e-(XJ.idle||0)<ZJ)){XJ.idle=e;try{await iY({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function sY({isOpen:e,onClose:t}){let n=W(e=>e.defaultProjectDir),r=W(e=>e.setDefaultProjectDir),i=W(e=>e.commandPresets),a=W(e=>e.setCommandPresets),o=W(e=>e.defaultPresetId),s=W(e=>e.setDefaultPresetId),c=W(e=>e.sessionSortMode),l=W(e=>e.setSessionSortMode),u=W(e=>e.sessionSortDirection),d=W(e=>e.setSessionSortDirection),f=W(e=>e.sidebarAnchor),p=W(e=>e.setSidebarAnchor),m=W(e=>e.useWebGL),h=W(e=>e.setUseWebGL),g=W(e=>e.fontSize),_=W(e=>e.setFontSize),v=W(e=>e.lineHeight),y=W(e=>e.setLineHeight),b=W(e=>e.letterSpacing),x=W(e=>e.setLetterSpacing),w=W(e=>e.fontOption),T=W(e=>e.setFontOption),E=W(e=>e.customFontFamily),D=W(e=>e.setCustomFontFamily),O=W(e=>e.shortcutModifier),k=W(e=>e.setShortcutModifier),A=W(e=>e.showProjectName),j=W(e=>e.setShowProjectName),M=W(e=>e.showLastUserMessage),N=W(e=>e.setShowLastUserMessage),P=W(e=>e.showSessionIdPrefix),F=W(e=>e.setShowSessionIdPrefix),I=RG(e=>e.theme),L=RG(e=>e.setTheme),ee=W(e=>e.soundOnPermission),R=W(e=>e.setSoundOnPermission),z=W(e=>e.soundOnIdle),B=W(e=>e.setSoundOnIdle),[te,V]=(0,C.useState)(n),[H,ne]=(0,C.useState)(i),[re,ie]=(0,C.useState)(o),[U,ae]=(0,C.useState)(c),[oe,se]=(0,C.useState)(u),[ce,le]=(0,C.useState)(f),[ue,de]=(0,C.useState)(m),[fe,pe]=(0,C.useState)(g),[me,he]=(0,C.useState)(v),[ge,_e]=(0,C.useState)(b),[ve,be]=(0,C.useState)(w),[xe,Se]=(0,C.useState)(E),[Ce,we]=(0,C.useState)(O),[Te,Ee]=(0,C.useState)(A),[De,Oe]=(0,C.useState)(M),[Ae,je]=(0,C.useState)(P),[Me,Ne]=(0,C.useState)(I),[Pe,Fe]=(0,C.useState)(ee),[Ie,Le]=(0,C.useState)(z),[Re,ze]=(0,C.useState)(!0),[Be,Ve]=(0,C.useState)(!1),[He,Ue]=(0,C.useState)(!0),[We,Ge]=(0,C.useState)(!0),[Ke,qe]=(0,C.useState)(!1),[Je,Ye]=(0,C.useState)(!1),[Ze,Qe]=(0,C.useState)(24),[et,tt]=(0,C.useState)(!1),[nt,rt]=(0,C.useState)(!1),[it,at]=(0,C.useState)(``),[ot,st]=(0,C.useState)(``),[ct,lt]=(0,C.useState)(``),ut=(0,C.useRef)(null),ft=(0,C.useRef)(0),mt=(0,C.useRef)(!1);if((0,C.useEffect)(()=>{let t=++ft.current,r=mt.current;if(mt.current=e,ut.current&&=(clearTimeout(ut.current),null),e){if(V(n),ne(i),ie(o),ae(c),se(u),le(f),de(m),pe(g),he(v),_e(b),be(w),Se(E),we(O),Ee(A),Oe(M),je(P),Ne(I),Fe(ee),Le(z),rt(!1),at(``),st(``),lt(``),fetch(`/api/settings/tmux-mouse-mode`).then(e=>e.json()).then(e=>ze(e.enabled)).catch(()=>{}),Ge(!0),fetch(`/api/settings/terminal-colors`).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{ft.current===t&&Ue(e.enabled)}).catch(()=>{}).finally(()=>{ft.current===t&&Ge(!1)}),fetch(`/api/settings/history-max-age-hours`).then(e=>e.json()).then(e=>Qe(e.hours)).catch(()=>{}),fetch(`/api/settings/prefer-window-name`).then(e=>e.json()).then(e=>qe(e.enabled)).catch(()=>{}),typeof document<`u`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}}else r&&typeof document<`u`&&(ut.current=setTimeout(()=>{if(typeof document>`u`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300));return()=>{ut.current&&=(clearTimeout(ut.current),null)}},[i,o,n,c,u,f,m,g,v,b,w,E,O,A,M,P,I,ee,z,e]),(0,C.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=e=>{e.key===`Escape`&&(typeof e.stopPropagation==`function`&&e.stopPropagation(),t())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),!e)return null;let ht=e=>{e.preventDefault();let n=te.trim(),i=ue!==m;r(n||`~/Documents/GitHub`),a(H),s(re),l(U),d(oe),p(ce),h(ue),_(fe),y(me),x(ge),T(ve),D(xe),k(Ce),j(Te),N(De),F(Ae),L(Me),R(Pe),B(Ie),t({webglChanged:i})},gt=(e,t)=>{ne(n=>n.map(n=>n.id===e?{...n,...t}:n))},_t=e=>{let t=H.find(t=>t.id===e);if(!t||t.isBuiltIn)return;let n=H.filter(t=>t.id!==e);ne(n),e===re&&ie(n[0]?.id||`claude`)},yt=()=>{if(!it.trim()||!ot.trim()||H.length>=50)return;let e={id:`custom-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,label:it.trim(),command:ot.trim(),isBuiltIn:!1,agentType:ct||void 0};ne([...H,e]),rt(!1),at(``),st(``),lt(``)},bt=H.length<50,xt=e=>{Ve(!0),ze(e),fetch(`/api/settings/tmux-mouse-mode`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>ze(!e)).finally(()=>Ve(!1))},St=e=>{Ye(!0),qe(e),fetch(`/api/settings/prefer-window-name`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>qe(!e)).finally(()=>Ye(!1))},Ct=e=>{Ge(!0),Ue(e),fetch(`/api/settings/terminal-colors`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Ue(!e)).finally(()=>Ge(!1))},wt=e=>{let t=Ze;tt(!0),Qe(e),fetch(`/api/settings/history-max-age-hours`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hours:e})}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`)}).catch(()=>Qe(t)).finally(()=>tt(!1))};return(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,S.jsxs)(`form`,{onSubmit:ht,className:`w-full max-w-lg max-h-[90vh] flex flex-col border border-border bg-elevated`,children:[(0,S.jsxs)(`div`,{className:`p-6 pb-0`,children:[(0,S.jsx)(`h2`,{className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`Settings`}),(0,S.jsx)(`p`,{className:`mt-2 text-xs text-muted text-pretty`,children:`Configure default directory, command presets, and display options.`})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 pb-4`,children:(0,S.jsxs)(`div`,{className:`mt-5 space-y-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Default Project Directory`}),(0,S.jsx)(`input`,{value:te,onChange:e=>V(e.target.value),placeholder:Xe,className:`input`,autoFocus:!0})]}),(0,S.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,S.jsx)(`label`,{className:`text-xs text-secondary`,children:`Command Presets`}),(0,S.jsx)(`select`,{value:re,onChange:e=>ie(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:H.map(e=>(0,S.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,S.jsx)(`p`,{className:`text-[10px] text-muted mb-3`,children:`Default preset is pre-selected when creating new sessions.`}),(0,S.jsx)(`div`,{className:`space-y-3`,children:H.map(e=>(0,S.jsxs)(`div`,{className:`border border-border p-3 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`input`,{value:e.label,onChange:t=>gt(e.id,{label:t.target.value}),className:`input text-sm py-1 px-2 w-32`,placeholder:`Label`})}),!e.isBuiltIn&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>_t(e.id),className:`btn text-xs px-2 py-1 text-danger hover:bg-danger/10`,children:`Delete`})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Command`}),(0,S.jsx)(`input`,{value:e.command,onChange:t=>gt(e.id,{command:t.target.value}),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`})]}),!e.isBuiltIn&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`text-[10px] text-muted block mb-1`,children:`Icon`}),(0,S.jsxs)(`select`,{value:e.agentType||``,onChange:t=>gt(e.id,{agentType:t.target.value||void 0}),className:`input text-xs py-1 px-2 w-auto`,children:[(0,S.jsx)(`option`,{value:``,children:`Terminal`}),(0,S.jsx)(`option`,{value:`claude`,children:`Claude`}),(0,S.jsx)(`option`,{value:`codex`,children:`Codex`}),(0,S.jsx)(`option`,{value:`pi`,children:`Pi`}),(0,S.jsx)(`option`,{value:`devin`,children:`Devin`}),(0,S.jsx)(`option`,{value:`grok`,children:`Grok`}),(0,S.jsx)(`option`,{value:`omp`,children:`OMP`})]})]})]},e.id))}),nt?(0,S.jsxs)(`div`,{className:`mt-3 border border-border p-3 space-y-2`,children:[(0,S.jsx)(`div`,{className:`text-xs text-secondary mb-2`,children:`New Preset`}),(0,S.jsx)(`input`,{value:it,onChange:e=>at(e.target.value),className:`input text-xs py-1 px-2 w-full`,placeholder:`Label`}),(0,S.jsx)(`input`,{value:ot,onChange:e=>st(e.target.value),className:`input text-xs py-1 px-2 font-mono w-full`,placeholder:`command --flags`}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsxs)(`select`,{value:ct,onChange:e=>lt(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:[(0,S.jsx)(`option`,{value:``,children:`Terminal Icon`}),(0,S.jsx)(`option`,{value:`claude`,children:`Claude Icon`}),(0,S.jsx)(`option`,{value:`codex`,children:`Codex Icon`}),(0,S.jsx)(`option`,{value:`pi`,children:`Pi Icon`}),(0,S.jsx)(`option`,{value:`devin`,children:`Devin Icon`}),(0,S.jsx)(`option`,{value:`grok`,children:`Grok Icon`}),(0,S.jsx)(`option`,{value:`omp`,children:`OMP Icon`})]}),(0,S.jsx)(`div`,{className:`flex-1`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>rt(!1),className:`btn text-xs px-2 py-1`,children:`Cancel`}),(0,S.jsx)(`button`,{type:`button`,onClick:yt,disabled:!it.trim()||!ot.trim(),className:`btn btn-primary text-xs px-2 py-1`,children:`Add`})]})]}):(0,S.jsx)(`button`,{type:`button`,onClick:()=>rt(!0),disabled:!bt,className:`btn text-xs mt-3 w-full`,children:bt?`+ Add Preset`:`Max 50 presets`})]}),(0,S.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,S.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Session List Order`}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn flex-1 ${U===`created`?`btn-primary`:``}`,onClick:()=>ae(`created`),children:`Created`}),(0,S.jsx)(`button`,{type:`button`,className:`btn flex-1 ${U===`status`?`btn-primary`:``}`,onClick:()=>ae(`status`),children:`Status`}),(0,S.jsx)(`button`,{type:`button`,className:`btn flex-1 ${U===`manual`?`btn-primary`:``}`,onClick:()=>ae(`manual`),children:`Manual`})]}),(0,S.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:U===`status`?`Sessions auto-resort by status (waiting, working, unknown)`:U===`manual`?`Drag sessions to reorder manually`:`Sessions stay in creation order`})]}),U===`created`&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Sort Direction`}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`desc`?`btn-primary`:``}`,onClick:()=>se(`desc`),children:`Newest First`}),(0,S.jsx)(`button`,{type:`button`,className:`btn flex-1 ${oe===`asc`?`btn-primary`:``}`,onClick:()=>se(`asc`),children:`Oldest First`})]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Sidebar Anchor`}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ce===`top`?`btn-primary`:``}`,onClick:()=>le(`top`),children:`Top`}),(0,S.jsx)(`button`,{type:`button`,className:`btn flex-1 ${ce===`bottom`?`btn-primary`:``}`,onClick:()=>le(`bottom`),children:`Bottom`})]}),(0,S.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:ce===`bottom`?`Desktop sidebar is mirrored: the first session sits at the bottom, next to the prompt`:`First session at the top of the sidebar`})]}),(0,S.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,S.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Session List Details`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Project Name`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the project folder name under each session.`})]}),(0,S.jsx)(qJ,{checked:Te,onCheckedChange:Ee})]}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Last User Message`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show the most recent user input next to the project name.`})]}),(0,S.jsx)(qJ,{checked:De,onCheckedChange:Oe})]}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Session ID Prefix`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Show first 5 characters of agent session IDs in the list.`})]}),(0,S.jsx)(qJ,{checked:Ae,onCheckedChange:je})]}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`History Sessions Lookback`}),(0,S.jsxs)(`div`,{className:`text-[10px] text-muted`,children:[`Show history sessions from the last N hours (`,1,`-`,168,`).`]})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`input`,{type:`number`,min:1,max:168,value:Ze,onChange:e=>{let t=parseInt(e.target.value,10);t>=1&&t<=168&&wt(t)},disabled:et,className:`input text-xs py-1 px-2 w-16 text-center`}),(0,S.jsx)(`span`,{className:`text-xs text-muted`,children:`hrs`})]})]})]}),(0,S.jsxs)(`div`,{className:`border-t border-border pt-4 space-y-3`,children:[(0,S.jsx)(`label`,{className:`mb-1 block text-xs text-secondary`,children:`Notifications`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Permission Sound`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a ping when any session needs permission.`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>void aY(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,S.jsx)(qJ,{checked:Pe,onCheckedChange:e=>{Fe(e),e&&nY()}})]})]}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Idle Sound`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Play a chime when a session finishes working.`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>void oY(),className:`btn text-xs px-2 py-1`,children:`Test`}),(0,S.jsx)(qJ,{checked:Ie,onCheckedChange:e=>{Le(e),e&&nY()}})]})]})]}),(0,S.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,S.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Terminal Rendering`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`WebGL Acceleration`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`GPU rendering for better performance. Turn off if text looks fuzzy or flickering.`})]}),(0,S.jsx)(qJ,{checked:ue,onCheckedChange:de})]}),ue!==m&&(0,S.jsx)(`p`,{className:`mt-2 text-[10px] text-approval`,children:`Terminal will reload when saved`}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Mouse Mode`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Enable tmux mouse mode for trackpad/scroll wheel support.`})]}),(0,S.jsx)(qJ,{checked:Re,onCheckedChange:xt,disabled:Be})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-4`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Terminal Colors`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Preserve ANSI colors for terminal output. Hibernate then Wake running agents after changing this setting.`})]}),(0,S.jsx)(qJ,{checked:He,onCheckedChange:Ct,disabled:We,ariaLabel:`Enable terminal colors`})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Prefer Window Names`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Label discovered sessions with their tmux window name instead of the session name. Applies immediately.`})]}),(0,S.jsx)(qJ,{checked:Ke,onCheckedChange:St,disabled:Je})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Size`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal text size in pixels (6-24)`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>pe(Math.max(6,fe-1)),className:vt,"aria-label":`Decrease font size`,children:(0,S.jsx)(ye,{width:G.default,height:G.default})}),(0,S.jsx)(`span`,{className:`text-sm text-secondary w-6 text-center`,children:fe}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>pe(Math.min(24,fe+1)),className:vt,"aria-label":`Increase font size`,children:(0,S.jsx)(ke,{width:G.default,height:G.default})})]})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Line Height`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Vertical spacing (1.0 = compact, 2.0 = spacious)`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`input`,{type:`range`,min:`1.0`,max:`2.0`,step:`0.1`,value:me,onChange:e=>he(parseFloat(e.target.value)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,S.jsx)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:me.toFixed(1)})]})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Letter Spacing`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Horizontal spacing between characters in pixels`})]}),(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`input`,{type:`range`,min:`-3`,max:`3`,step:`1`,value:ge,onChange:e=>_e(parseInt(e.target.value,10)),className:`w-20 h-1 bg-border rounded-lg appearance-none cursor-pointer accent-accent`}),(0,S.jsxs)(`span`,{className:`text-xs text-secondary w-8 text-right`,children:[ge,`px`]})]})]}),(0,S.jsxs)(`div`,{className:`mt-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Font Family`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Terminal typeface`})]}),(0,S.jsx)(`select`,{value:ve,onChange:e=>be(e.target.value),className:`input text-xs py-1 px-2 w-auto`,children:$e.map(e=>(0,S.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),ve===`custom`&&(0,S.jsx)(`input`,{value:xe,onChange:e=>Se(e.target.value),placeholder:`"Fira Code", monospace`,className:`input text-xs mt-2 font-mono`})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex items-center justify-between`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`text-sm text-primary`,children:`Dark Mode`}),(0,S.jsx)(`div`,{className:`text-[10px] text-muted`,children:`Switch between dark and light themes.`})]}),(0,S.jsx)(qJ,{checked:Me===`dark`,onCheckedChange:e=>Ne(e?`dark`:`light`)})]})]}),(0,S.jsxs)(`div`,{className:`border-t border-border pt-4`,children:[(0,S.jsx)(`label`,{className:`mb-2 block text-xs text-secondary`,children:`Keyboard Shortcut Modifier`}),(0,S.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`].map(e=>(0,S.jsx)(`button`,{type:`button`,className:`btn text-xs px-2 ${Ce===e?`btn-primary`:``}`,onClick:()=>we(e),children:e===`auto`?`Auto`:pt(e)},e))}),(0,S.jsx)(`p`,{className:`mt-1.5 text-[10px] text-muted`,children:Ce===`auto`?`Shortcuts: ${pt(dt(`auto`))}+[1-9/N/X/[/]]`:`Shortcuts: ${pt(Ce)}+[1-9/N/X/[/]]`})]})]})}),(0,S.jsxs)(`div`,{className:`flex justify-end gap-2 p-6 pt-4 border-t border-border bg-elevated`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>t(),className:`btn`,children:`Cancel`}),(0,S.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Save`})]})]})})}var cY=[];function lY(e){C.useEffect(e,cY)}var uY=C.createContext(void 0);function dY(){let e=C.useContext(uY);if(!e)throw Error(zq(73));return e}var fY=Symbol(`NOT_FOUND`);function pY(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function mY(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function hY(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var gY=e=>Array.isArray(e)?e:[e];function _Y(e){let t=Array.isArray(e[0])?e[0]:e;return hY(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function vY(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function yY(e){let t;return{get(n){return t&&e(t.key,n)?t.value:fY},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function bY(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return fY}function i(t,i){r(t)===fY&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var xY=(e,t)=>e===t;function SY(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function CY(e,t){let{equalityCheck:n=xY,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=SY(n),o=0,s=r<=1?yY(a):bY(r,a);function c(){let t=s.get(arguments);if(t===fY){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var wY=class{constructor(e){this.value=e}deref(){return this.value}},TY=typeof WeakRef<`u`?WeakRef:wY,EY=0,DY=1;function OY(){return{s:EY,v:void 0,o:null,p:null}}function kY(e,t={}){let n=OY(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=OY(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=OY(),e.set(n,t)):t=r}}let s=t,c;if(t.s===DY)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new TY(c):c}return s.s=DY,s.v=c,c}return o.clearCache=()=>{n=OY(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function AY(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),pY(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=kY,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=gY(c),p=gY(u),m=_Y(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=vY(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var jY=AY(kY),MY=Object.assign((e,t=jY)=>{mY(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>MY}),NY=AY({memoize:CY,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),PY=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(zq(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},FY=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(zq(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(zq(2))}u=NY(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},IY=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),LY=s(((e,t)=>{t.exports=IY()})),RY=s((e=>{var t=p(),n=LY();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),zY=s(((e,t)=>{t.exports=RY()})),BY=[],VY=void 0;function HY(){return VY}function UY(e){BY.push(e)}var WY=LY(),GY=zY(),KY=Vq(19)?YY:XY;function qY(e,t,n,r,i){return KY(e,t,n,r,i)}function JY(e,t,n,r,i){let a=C.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,WY.useSyncExternalStore)(e.subscribe,a,a)}UY({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,WY.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function YY(e,t,n,r,i){let a=HY();if(!a)return JY(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function XY(e,t,n,r,i){return(0,GY.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var ZY=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return qY(this,e,t,n,r)}},QY=class extends ZY{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){C.useDebugValue(e),Nq(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;Nq(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Nq(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){C.useDebugValue(e);let n=t!==void 0;Nq(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return C.useDebugValue(e),qY(this,this.selectors[e],t,n,r)}useContextCallback(e,t){C.useDebugValue(e);let n=wq(t??Lq);this.context[e]=n}useStateSetter(e){let t=C.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},$Y=null;globalThis.requestAnimationFrame;var eX=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},tX=class e{static create(){return new e}static request(e){return eX.request(e)}static cancel(e){return eX.cancel(e)}currentId=$Y;request(e){this.cancel(),this.currentId=eX.request(()=>{this.currentId=$Y,e()})}cancel=()=>{this.currentId!==$Y&&(eX.cancel(this.currentId),this.currentId=$Y)};disposeEffect=()=>this.cancel};function nX(){let e=xq(tX.create).current;return lY(e.disposeEffect),e}var rX=0,iX=class e{static create(){return new e}currentId=rX;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=rX,t()},e)}isStarted(){return this.currentId!==rX}clear=()=>{this.currentId!==rX&&(clearTimeout(this.currentId),this.currentId=rX)};disposeEffect=()=>this.clear};function aX(){let e=xq(iX.create).current;return lY(e.disposeEffect),e}var oX=0;function sX(e){return oX+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${oX}`}function cX(e){return e?.ownerDocument||document}function lX(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var uX=typeof navigator<`u`,dX=gX(),fX=vX(),pX=_X();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),dX.platform===`MacIntel`&&dX.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(dX.platform),uX&&/firefox/i.test(pX);var mX=uX&&/apple/i.test(navigator.vendor);uX&&/Edg/i.test(pX),uX&&/android/i.test(fX)||/android/i.test(pX),uX&&fX.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var hX=pX.includes(`jsdom/`);function gX(){if(!uX)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function _X(){if(!uX)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function vX(){if(!uX)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function yX(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function bX(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&bJ(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function xX(e){return`composedPath`in e?e.composedPath()[0]:e.target}function SX(e){if(!e||hX)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var CX=FY(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),wX={toasts:PY(e=>e.toasts),isEmpty:PY(e=>e.toasts.length===0),toast:PY(CX,(e,t)=>e.get(t)?.value),toastIndex:PY(CX,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:PY(CX,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:PY(CX,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:PY(e=>e.hovering),focused:PY(e=>e.focused),expanded:PY(e=>e.hovering||e.focused),expandedOrOutOfFocus:PY(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:PY(e=>e.prevFocusElement)},TX=class extends QY{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},wX)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=wX.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||sX(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),wX.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=wX.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),wX.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{wX.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=lX(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=lX(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=lX(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=iX.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=xX(e);bX(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!wX.expandedOrOutOfFocus(this.state),a=i?iX.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=yX(cX(this.state.viewport));if(!this.state.viewport||!bX(this.state.viewport,t)||!SX(t))return;let n=wX.toasts(this.state),r=wX.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},EX=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=xq(()=>new TX({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return lY(a.disposeEffect),C.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,S.jsx)(uY.Provider,{value:a,children:t})},DX=C.forwardRef(function(e,t){let[n,r]=C.useState();Nq(()=>{mX&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,S.jsx)(`span`,{...e,ref:t,style:Fq,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),OX=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),kX=C.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=dY(),s=aX(),c=C.useRef(!1),l=C.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=C.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);C.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(yX(cX(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=_J(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),C.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=_J(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=xX(n),i=yX(cX(e));(!bX(e,r)||!SX(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),C.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=cX(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}C.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function y(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function b(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function x(){if(c.current){c.current=!1;return}f||SX(cX(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function w(e){!f||bX(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let T={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:y,onMouseMove:y,onMouseLeave:b,onFocus:x,onBlur:w,onKeyDown:v,onClick:x},E={expanded:p},D=aJ(`div`,e,{ref:[t,o.setViewport],state:E,props:[T,{style:{[OX.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,S.jsxs)(C.Fragment,{children:[!u&&m&&(0,S.jsx)(DX,{onFocus:_}),i,!u&&m&&(0,S.jsx)(DX,{onFocus:_})]})}]}),O=C.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,S.jsxs)(C.Fragment,{children:[!u&&m&&(0,S.jsx)(DX,{onFocus:_}),D,!f&&O.length>0&&(0,S.jsx)(`div`,{style:Fq,children:O.map(e=>(0,S.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,S.jsx)(`div`,{children:e.title}),(0,S.jsx)(`div`,{children:e.description})]},e.id))})]})});function AX(e){return Vq(19)?e:e?`true`:void 0}var jX=C.createContext(void 0);function MX(){let e=C.useContext(jX);if(!e)throw Error(zq(66));return e}var NX=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),PX={[NX.startingStyle]:``},FX={[NX.endingStyle]:``},IX={transitionStatus(e){return e===`starting`?PX:e===`ending`?FX:null}};function LX(e){return e==null?e:`current`in e?e.current:e}function RX(e,t=!1,n=!0){let r=nX();return wq((i,a=null)=>{r.cancel();function o(){Vd.flushSync(i)}let s=LX(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=NX.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function zX(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=wq(i),o=RX(r,n,!1);C.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var BX=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),VX={...IX,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},HX=40,UX=10,WX=.5,GX=1;function KX(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function qX(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var JX=C.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=dY(),[d,f]=C.useState(void 0),[p,m]=C.useState(!1),[h,g]=C.useState(!1),[_,v]=C.useState(!1),[y,b]=C.useState({x:0,y:0}),[x,w]=C.useState({x:0,y:0,scale:1}),[T,E]=C.useState(),[D,O]=C.useState(),[k,A]=C.useState(null),j=C.useRef(null),M=C.useRef({x:0,y:0}),N=C.useRef({x:0,y:0,scale:1}),P=C.useRef(void 0),F=C.useRef(0),I=C.useRef(!1),L=C.useRef({x:0,y:0}),ee=C.useRef(!1),R=u.useState(`toastIndex`,n.id),z=u.useState(`toastVisibleIndex`,n.id),B=u.useState(`toastOffsetY`,n.id),te=u.useState(`focused`),V=u.useState(`expanded`);zX({open:n.transitionStatus!==`ending`,ref:j,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let H=wq((e=!1)=>{let t=j.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:j,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?Vd.flushSync(a):a()});Nq(H,[H]);function ne(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**WX:-(Math.abs(e)**WX):(!c.includes(`right`)&&e>0&&(n=e**WX),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**WX))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**WX:-(Math.abs(t)**WX):(!c.includes(`down`)&&t>0&&(r=t**WX),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**WX))),{x:n,y:r}}function re(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=xX(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(I.current=!1,P.current=void 0,F.current=0,M.current={x:e.clientX,y:e.clientY},L.current=M.current,j.current){let e=qX(j.current);N.current=e,w(e),b({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),A(null),ee.current=!0,j.current?.setPointerCapture(e.pointerId)}}function ie(e){if(!p)return;e.preventDefault(),ee.current&&=(M.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>L.current.y||i>0&&t<L.current.y)&&(L.current={x:L.current.x,y:t}),(r<0&&n>L.current.x||r>0&&n<L.current.x)&&(L.current={x:n,y:L.current.y});let a=n-M.current.x,o=t-M.current.y,s=t-L.current.y,l=n-L.current.x;if(!h&&Math.sqrt(a*a+o*o)>=GX&&(g(!0),k===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&A(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!P.current)k===`vertical`?o>0?u=`down`:o<0&&(u=`up`):k===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(P.current=u,F.current=KX(u,a,o),f(u));else{let e=P.current,t=KX(e,l,s);t>HX?(I.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&F.current-t>=UX&&(I.current=!0)}let d=ne(a,o),m=N.current.x,_=N.current.y;k===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(k===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),b({x:m,y:_})}function U(e){if(!p)return;if(m(!1),g(!1),A(null),j.current?.releasePointerCapture(e.pointerId),I.current){b({x:x.x,y:x.y}),f(void 0);return}let t=!1,r=y.x-x.x,i=y.y-x.y,a;for(let e of c){switch(e){case`right`:r>HX&&(t=!0,a=`right`);break;case`left`:r<-HX&&(t=!0,a=`left`);break;case`down`:i>HX&&(t=!0,a=`down`);break;case`up`:i<-HX&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(b({x:x.x,y:x.y}),f(void 0))}function ae(e){if(e.key===`Escape`){if(!j.current||!bX(j.current,yX(cX(j.current))))return;u.closeToast(n.id)}}C.useEffect(()=>{if(!l)return;let e=j.current;if(!e)return;function t(t){bX(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function oe(){if(!p&&y.x===x.x&&y.y===x.y&&!_)return{[BX.swipeMovementX]:`0px`,[BX.swipeMovementY]:`0px`};let e=y.x-x.x,t=y.y-x.y;return{transition:p?`none`:void 0,transform:p?`translateX(${y.x}px) translateY(${y.y}px) scale(${x.scale})`:void 0,[BX.swipeMovementX]:`${e}px`,[BX.swipeMovementY]:`${t}px`}}let se=n.priority===`high`,ce={role:se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":T,"aria-describedby":D,"aria-hidden":se&&!te?!0:void 0,onPointerDown:l?re:void 0,onPointerMove:l?ie:void 0,onPointerUp:l?U:void 0,onKeyDown:ae,inert:AX(n.limited),style:{...oe(),[BX.index]:n.transitionStatus===`ending`?R:z,[BX.offsetY]:`${B}px`,[BX.height]:n.height?`${n.height}px`:void 0}},le=C.useMemo(()=>({rootRef:j,toast:n,titleId:T,setTitleId:E,descriptionId:D,setDescriptionId:O,swiping:p,swipeDirection:d,recalculateHeight:H,index:R,visibleIndex:z,expanded:V}),[n,T,D,p,d,H,R,z,V]),ue={transitionStatus:n.transitionStatus,expanded:V,limited:n.limited||!1,type:n.type,swiping:le.swiping,swipeDirection:le.swipeDirection},de=aJ(`div`,e,{ref:[t,le.rootRef],state:ue,stateAttributesMapping:VX,props:[ce,o]});return(0,S.jsx)(jX.Provider,{value:le,children:de})}),YX=C.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=MX(),l=a??s.description,u=!!l,d=mJ(i);Nq(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=aJ(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),XX=C.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=MX(),l=a??s.title,u=!!l,d=mJ(i);Nq(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=aJ(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),ZX=C.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=dY(),{toast:c}=MX(),l=s.useState(`expanded`),[u,d]=C.useState(!1),{getButtonProps:f,buttonRef:p}=wJ({disabled:i,native:a}),m={type:c.type};return aJ(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function QX(){let e=C.useContext(uY);if(!e)throw Error(zq(73));let t=e.useState(`toasts`);return C.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function $X(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||sX(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var eZ=5e3,tZ=$X();function nZ({toast:e}){return(0,S.jsxs)(JX,{toast:e,className:l_(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-danger/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsx)(XX,{className:l_(`text-sm font-medium`,e.type===`error`&&`text-danger`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,S.jsx)(YX,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,S.jsx)(ZX,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,S.jsx)(Fe,{width:G.default,height:G.default})})]})}function rZ(){let{toasts:e}=QX();return(0,S.jsx)(S.Fragment,{children:e.map(e=>(0,S.jsx)(nZ,{toast:e},e.id))})}function iZ(){return(0,S.jsxs)(EX,{timeout:eZ,toastManager:tZ,children:[(0,S.jsx)(rZ,{}),(0,S.jsx)(kX,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var aZ=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],oZ=3e3,sZ=8e3,cZ=15e3,lZ=5e3,uZ=2e4,dZ=1e4,fZ=1500,pZ=5e3,mZ=750,hZ=4,gZ=5e3,_Z=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.stallCount=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(KO(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,KO(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{KO(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?aZ[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,stalls:this.stallCount,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){KO(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){KO(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}KO(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;KO(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?sZ:oZ;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(KO(`ws_connect_timeout`,{wsState:aZ[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){KO(`ws_onopen_stale`,this.wsSnap(),`info`);return}KO(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),KO(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(pZ)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(KO(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){KO(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}KO(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>cZ&&(KO(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},lZ))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return KO(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(KO(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){KO(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(KO(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},fZ)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){KO(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){KO(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){KO(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,KO(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},mZ)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,KO(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},dZ)))};e!==void 0&&e<uZ?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,uZ)},e):this.heartbeatTimer=window.setInterval(t,uZ)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){KO(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=hZ){KO(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets();let e=Math.min(gZ*2**this.stallCount,3e4);this.stallCount+=1,this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);KO(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){KO(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function vZ(){let e=Sh(e=>e.setConnectionState);return(0,C.useEffect)(()=>{_Z.connect(),_Z.startLifecycleListeners();let t=_Z.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),_Z.stopLifecycleListeners()}},[e]),{sendMessage:(0,C.useMemo)(()=>e=>{_Z.send(e)},[]),subscribe:(0,C.useMemo)(()=>_Z.subscribe.bind(_Z),[]),getConnectionEpoch:(0,C.useMemo)(()=>()=>_Z.getConnectionEpoch(),[])}}var yZ=100;function bZ({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>yZ?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function xZ(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function SZ(){(0,C.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{bZ({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),xZ(document)}},[])}var CZ=[`theme`,`commandPresets`,`defaultPresetId`,`defaultProjectDir`,`lastProjectPath`,`recentPaths`,`sessionSortMode`,`sessionSortDirection`,`manualSessionOrder`,`sidebarAnchor`,`projectFilters`,`hostFilters`],wZ=[`claude`,`claude-rp`,`codex`,`pi`,`devin`,`grok`,`omp`];function TZ(e,t){return Array.isArray(e)&&e.length<=t&&e.every(e=>typeof e==`string`)}function EZ(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||wZ.includes(t.agentType))}var DZ={theme:e=>e===`dark`||e===`light`,commandPresets:e=>Array.isArray(e)&&e.length<=50&&e.every(EZ),defaultPresetId:e=>typeof e==`string`&&e.length<=128,defaultProjectDir:e=>typeof e==`string`&&e.length<=4096,lastProjectPath:e=>e===null||typeof e==`string`&&e.length<=4096,recentPaths:e=>TZ(e,50),sessionSortMode:e=>e===`status`||e===`created`||e===`manual`,sessionSortDirection:e=>e===`asc`||e===`desc`,manualSessionOrder:e=>TZ(e,1e3),sidebarAnchor:e=>e===`top`||e===`bottom`,projectFilters:e=>TZ(e,500),hostFilters:e=>TZ(e,500)};function OZ(e){return CZ.includes(e)}function kZ(e,t){return DZ[e](t)}var AZ=`agentboard-theme`,jZ=`agentboard-settings`,MZ=200,NZ=new Map,PZ=new Set,FZ=null,IZ=!1;function LZ(e){return e===`theme`?RG.getState().theme:W.getState()[e]}function RZ(e){let t=e===`theme`?AZ:jZ;return Je.getItem(t)!==null}function zZ(){if(FZ=null,PZ.size===0)return;let e={};for(let t of PZ){let n=LZ(t);e[t]=n,NZ.set(t,JSON.stringify(n))}PZ.clear();try{fetch(`/api/settings/synced`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({settings:e})}).then(e=>{e.ok||KO(`synced_settings_push_rejected`,{status:e.status},`warn`)}).catch(e=>{KO(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)})}catch(e){KO(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)}}function BZ(e){PZ.add(e),!FZ&&(FZ=setTimeout(zZ,MZ))}function VZ(e){let t=new Map;for(let e of CZ)t.set(e,RZ(e));let n={},r;for(let[t,i]of Object.entries(e))!OZ(t)||!kZ(t,i)||(NZ.set(t,JSON.stringify(i)),t===`theme`?r=i:n[t]=i);r!==void 0&&RG.setState({theme:r}),Object.keys(n).length>0&&W.setState(n);for(let n of CZ){if(n in e||!t.get(n))continue;let r=LZ(n);kZ(n,r)&&NZ.get(n)!==JSON.stringify(r)&&BZ(n)}}function HZ(){if(IZ)return()=>{};IZ=!0;let e=W.subscribe((e,t)=>{let n=e,r=t;for(let e of CZ)e!==`theme`&&n[e]!==r[e]&&NZ.get(e)!==JSON.stringify(n[e])&&BZ(e)}),t=RG.subscribe((e,t)=>{e.theme!==t.theme&&NZ.get(`theme`)!==JSON.stringify(e.theme)&&BZ(`theme`)});return()=>{e(),t(),IZ=!1,FZ&&=(clearTimeout(FZ),null),PZ.clear(),NZ.clear()}}function UZ(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function WZ(){let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(void 0),[i,a]=(0,C.useState)(void 0),[o,s]=(0,C.useState)(void 0),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(null),g=Sh(e=>e.sessions),_=Sh(e=>e.agentSessions),v=Sh(e=>e.agentSessionsEpoch),y=Sh(e=>e.selectedSessionId),b=Sh(e=>e.selectedHibernatingSessionId),x=Sh(e=>e.setSessions),w=Sh(e=>e.setAgentSessions),T=Sh(e=>e.setActiveAgentSessions),E=Sh(e=>e.setHostStatuses),D=Sh(e=>e.updateSession),O=Sh(e=>e.setSelectedSessionId),k=Sh(e=>e.setSelectedHibernatingSessionId),A=Sh(e=>e.hasLoaded),j=Sh(e=>e.connectionStatus),M=Sh(e=>e.connectionError),N=Sh(e=>e.clearExitingSession),P=Sh(e=>e.markSessionExiting),F=Sh(e=>e.setRemoteAllowControl),I=Sh(e=>e.setRemoteAllowAttach),L=Sh(e=>e.setHostLabel),ee=Sh(e=>e.setPreferWindowName),R=Sh(e=>e.hostStatuses),z=Sh(e=>e.remoteAllowControl),B=Sh(e=>e.hostLabel),te=RG(e=>e.theme),V=st(),H=W(e=>e.defaultProjectDir),ne=W(e=>e.commandPresets),re=W(e=>e.defaultPresetId),ie=W(e=>e.lastProjectPath),U=W(e=>e.setLastProjectPath),ae=W(e=>e.addRecentPath),oe=W(e=>e.shortcutModifier),se=W(e=>e.sidebarWidth),ce=W(e=>e.sidebarAnchor),le=W(e=>e.setSidebarWidth),ue=W(e=>e.projectFilters),de=W(e=>e.hostFilters),fe=W(e=>e.soundOnPermission),pe=W(e=>e.soundOnIdle),me=Sh(e=>e.connectionEpoch),{sendMessage:he,subscribe:ge,getConnectionEpoch:_e}=vZ();(0,C.useEffect)(()=>HZ(),[]),SZ(),(0,C.useEffect)(()=>{if(typeof document>`u`||!fe&&!pe)return;let e=!1,t=()=>{e&&!eY()||(e=!0,nY())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[fe,pe]);let ve=(0,C.useRef)(!1),ye=(0,C.useCallback)(e=>{e.preventDefault(),ve.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,C.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!ve.current)return;let t=e.clientX;le(Math.max(180,Math.min(400,t)))},t=()=>{ve.current&&(ve.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[le]),(0,C.useEffect)(()=>{let e=ge(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=Sh.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=W.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&aY(),e.status===`working`&&i.status===`waiting`&&r&&oY())}if(Fe.current.size>0){let e=_e();for(let[t,n]of Fe.current)n.epoch!==e&&Fe.current.delete(t)}let i=Fe.current.size>0?e.sessions.filter(e=>!Fe.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=Sh.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(je.current=s),x(i);let c=Me.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=Sh.getState(),{projectFilters:d,hostFilters:f}=W.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Me.current=null,O(e.id))}}if(e.type===`host-status`&&E(e.hosts),e.type===`server-config`&&(F(e.remoteAllowControl),I(e.remoteAllowAttach),L(e.hostLabel),ee(e.preferWindowName),e.clientLogLevel&&GO(e.clientLogLevel)),e.type===`synced-settings`&&VZ(e.settings),e.type===`session-update`){let t=Sh.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(D(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=W.getState();t!==`permission`&&n===`permission`&&e&&aY(),t===`working`&&n===`waiting`&&r&&oY()}}if(e.type===`session-created`){let t=Sh.getState().sessions;t.some(t=>t.id===e.session.id)||x([e.session,...t]),O(e.session.id),ae(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=W.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){aG(e.sessionId);let t=Sh.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&x(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=Sh.getState(),a=je.current;i&&!n.some(e=>e.sessionId===i)&&(Me.current=i),w(t,n,r),h(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(je.current=null,k(a)):a&&(je.current=null)}if(e.type===`agent-sessions-active`&&T(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=Sh.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&x(n)}if(e.type===`session-activated`){let t=Sh.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&D({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isHibernating:e.session.isHibernating,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){h(t=>t?.sessionId===e.sessionId?null:t);let t=Sh.getState().sessions;t.some(t=>t.id===e.session.id)||x([e.session,...t]),O(e.session.id)}else e.ok||(d(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>d(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&h(e.session),k(e.sessionId)):(d(e.error??`Failed to hibernate session`),window.setTimeout(()=>d(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===y)&&(d(`${e.code}: ${e.message}`),window.setTimeout(()=>d(null),6e3)),e.type===`terminal-ready`&&e.sessionId===y&&d(null),e.type===`error`&&(d(e.message),window.setTimeout(()=>d(null),6e3)),e.type===`kill-failed`){let t=Fe.current.get(e.sessionId);if(t){let n=Sh.getState().sessions;n.some(t=>t.id===e.sessionId)||x([t.session,...n]),t.wasSelected&&O(e.sessionId),Fe.current.delete(e.sessionId)}N(e.sessionId),d(e.message),window.setTimeout(()=>d(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(d(e.error),window.setTimeout(()=>d(null),6e3))}});return()=>{e()}},[y,b,ae,N,he,O,k,h,x,w,T,E,F,I,L,ee,ge,D]);let be=(0,C.useMemo)(()=>g.find(e=>e.id===y)||null,[y,g]),xe=_.hibernating??[],Se=_.history??[],Ce=(0,C.useMemo)(()=>UZ(xe,ue,de),[xe,ue,de]),we=(0,C.useMemo)(()=>Ce.find(e=>e.sessionId===b)||(m?.sessionId===b?m:null),[Ce,m,b]);(0,C.useEffect)(()=>{be?.projectPath&&!be.remote&&U(be.projectPath)},[be?.projectPath,be?.remote,U]);let Te=W(e=>e.sessionSortMode),Ee=W(e=>e.sessionSortDirection),De=W(e=>e.manualSessionOrder),Oe=(0,C.useMemo)(()=>oh(g,{mode:Te,direction:Ee,manualOrder:De}),[g,Te,Ee,De]),ke=(0,C.useMemo)(()=>{let e=Oe;return ue.length>0&&(e=e.filter(e=>ue.includes(e.projectPath))),de.length>0&&(e=e.filter(e=>de.includes(e.host??``))),e},[Oe,ue,de]),Ae=(0,C.useRef)(b),je=(0,C.useRef)(null),Me=(0,C.useRef)(null),Ne=(0,C.useRef)(me),Pe=(0,C.useCallback)(()=>ke.length>0?(O(ke[0].id),!0):Ce.length>0?(k(Ce[0].sessionId),!0):!1,[ke,Ce,O,k]);(0,C.useEffect)(()=>{let e=Ae.current;e&&b===null&&!xe.some(t=>t.sessionId===e)?Me.current=e:b!==null&&(Me.current=null),Ae.current=b},[xe,b]),(0,C.useEffect)(()=>{m&&b!==m.sessionId&&h(null)},[m,b]),(0,C.useEffect)(()=>{Ne.current!==me&&(Ne.current=me,je.current=null,Me.current=null,h(null))},[me]),(0,C.useEffect)(()=>{A&&(b||y&&(ke.some(e=>e.id===y)||Pe()||O(null)))},[A,y,b,Pe,O]),(0,C.useEffect)(()=>{if(!b||m?.sessionId===b||v!==me||Ce.some(e=>e.sessionId===b))return;let e=ke.find(e=>e.agentSessionId?.trim()===b);if(e){O(e.id);return}Pe()||k(null)},[Ce,ke,v,m,b,Pe,O,k,me]),(0,C.useEffect)(()=>{let e=Me.current;if(!e)return;if(b!==null){Me.current=null;return}let t=ke.find(t=>t.agentSessionId?.trim()===e);if(t){Me.current=null,O(t.id);return}if(y!==null){Me.current=null;return}Pe()&&(Me.current=null)},[ke,y,b,Pe,O]),(0,C.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&A&&y===null&&b===null&&(ke.length>0||Ce.length>0)&&Pe()},[Ce.length,ke.length,A,Pe,y,b]);let Fe=(0,C.useRef)(new Map),Ie=(0,C.useCallback)((e,t=`unknown`)=>{aG(e);let{sessions:n,selectedSessionId:r}=Sh.getState(),i=n.find(t=>t.id===e);i&&Fe.current.set(e,{session:i,wasSelected:r===e,epoch:_e()}),(0,Vd.flushSync)(()=>{P(e),x(n.filter(t=>t.id!==e))}),he({type:`session-kill`,sessionId:e,source:t})},[P,x,he]);(0,C.useEffect)(()=>{let n=dt(oe),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=mt(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=(i===`BracketLeft`?-1:1)*(ce===`bottom`?-1:1),t=ke;if(t.length===0){let t=Ce;if(t.length===0)return;let n=t.findIndex(e=>e.sessionId===b);if(n===-1){k(t[0].sessionId);return}k(t[(n+e+t.length)%t.length].sessionId);return}let n=t.findIndex(e=>e.id===y);if(n===-1){O(t[0].id);return}O(t[(n+e+t.length)%t.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(ke.length>0){let t=ke[e];if(!t)return;r.preventDefault(),O(t.id);return}let t=Ce[e];if(!t)return;r.preventDefault(),k(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&V&&t(!0);return}if(a&&i===`KeyX`){r.preventDefault(),y&&!e&&Ie(y,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,y,b,O,k,ke,Ce,Ie,ce,oe,V]);let Le=()=>V?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,Re=()=>l(!0),ze=(e,t,n,r)=>{he({type:`session-create`,projectPath:e,name:t,command:n,host:r}),r||U(e)},Be=e=>{he({type:`session-wake`,sessionId:e})},Ve=(0,C.useCallback)(e=>{he({type:`session-hibernate`,sessionId:e})},[he]),He=(e,t)=>{he({type:`session-rename`,sessionId:e,newName:t})},Ue=(0,C.useCallback)(e=>{let t=g.find(t=>t.id===e);t&&he({type:`session-create`,projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[g,he]),We=(0,C.useCallback)(e=>{he({type:`session-move-to-history`,sessionId:e})},[he]);(0,C.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,te)},[te]),(0,C.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>p(e)).catch(()=>{})},[]);let Ge=(0,C.useMemo)(()=>B?R.filter(e=>e.host!==B):R,[R,B]);return(0,S.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,S.jsx)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:se},children:(0,S.jsx)(BO,{sessions:g,hibernatingSessions:xe,historySessions:Se,selectedSessionId:y,selectedHibernatingSessionId:b,onSelect:O,onSelectHibernating:k,onRename:He,onResume:Be,onHibernate:Ve,onKill:Ie,onDuplicate:Ue,onMoveToHistory:We,onNewSession:Le,loading:!A,error:M||u,anchor:ce,filterBarControls:(0,S.jsx)(Et,{connectionStatus:j,onNewSession:Le,onOpenSettings:Re,tailscaleIp:f?.tailscaleIp??null,placement:ce===`bottom`?`up`:`down`})})}),(0,S.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:ye}),(0,S.jsx)($K,{session:be,sessions:ke,drawerSessions:g,hibernatingSession:we,hibernatingSessions:xe,connectionStatus:j,connectionEpoch:me,sendMessage:he,subscribe:ge,onClose:()=>O(null),onSelectSession:O,onSelectHibernatingSession:k,onNewSession:Le,onKillSession:Ie,onRenameSession:He,onDuplicateSession:Ue,onOpenSettings:Re,onResumeSession:Be,onHibernateSession:Ve,onMoveToHistory:We,historySessions:Se,loading:!A,error:M||u}),(0,S.jsx)(vq,{isOpen:e,onClose:()=>t(!1),onCreate:ze,defaultProjectDir:H,commandPresets:ne,defaultPresetId:re,lastProjectPath:ie,activeProjectPath:be&&!be.remote?be.projectPath:void 0,remoteHosts:Ge,remoteAllowControl:z,initialHost:n,initialPath:i,initialCommand:o}),(0,S.jsx)(sY,{isOpen:c,onClose:()=>l(!1)}),(0,S.jsx)(iZ,{})]})}var GZ=`modulepreload`,KZ=function(e){return`/`+e},qZ={},JZ=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=KZ(t,n),t in qZ)return;qZ[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:GZ,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},YZ=`true`,XZ=`false`,ZZ=YZ===`true`,QZ=XZ===`true`;function $Z(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,ZZ||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await JZ(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!QZ)if(ZZ)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}ct()&&document.documentElement.classList.add(`ios`),lt()&&document.documentElement.classList.add(`ios-pwa`),$Z({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var eQ=document.getElementById(`root`);if(!eQ)throw Error(`Root element not found`);(0,x.createRoot)(eQ).render((0,S.jsx)(C.StrictMode,{children:(0,S.jsx)(WZ,{})}));
|
|
305
|
+
${r?nq[t.status]:tq[t.status]}
|
|
306
|
+
`,onClick:()=>{rq(),d(t.id)},title:ht?t.name:void 0,children:i},t.id)})})]}),(0,S.jsxs)(`div`,{className:`relative flex-1`,children:[(0,S.jsx)(`div`,{ref:Me,className:`absolute inset-0`,style:{backgroundColor:E.background}}),Be&&e&&(0,S.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-2 z-50 flex items-center gap-1.5 rounded-lg bg-black/60 px-2.5 py-1.5 text-xs text-white/90 shadow-lg backdrop-blur-md`,children:[(0,S.jsx)(Ie,{width:G.pill,height:G.pill,className:`animate-spin`}),`Loading`]}),He&&e&&(0,S.jsxs)(`div`,{className:`absolute ${L&&!R?`bottom-20`:`bottom-8`} left-1/2 z-30 flex max-w-[calc(100%-2rem)] -translate-x-1/2 items-center gap-2 rounded-lg border border-border bg-elevated/95 px-2 py-2 shadow-lg backdrop-blur-sm md:hidden`,children:[(0,S.jsx)(`span`,{className:`max-w-[12rem] truncate text-xs text-secondary md:max-w-[18rem]`,children:`Selection ready`}),(0,S.jsxs)(`button`,{type:`button`,onClick:Ue,className:`relative flex h-8 shrink-0 items-center justify-center gap-1.5 rounded bg-accent px-2.5 text-xs font-medium text-white hover:bg-accent/90 active:scale-95 transition-all [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,title:`Copy selection`,"aria-label":`Copy selection`,children:[(0,S.jsx)(F,{width:G.default,height:G.default}),`Copy`]}),(0,S.jsx)(`button`,{type:`button`,onClick:We,className:`relative flex h-8 w-8 shrink-0 items-center justify-center rounded border border-border text-secondary hover:bg-hover hover:text-primary active:scale-95 transition-all [@media(pointer:coarse)]:before:absolute [@media(pointer:coarse)]:before:inset-[calc(50%-22px)] [@media(pointer:coarse)]:before:content-['']`,title:`Dismiss`,"aria-label":`Dismiss`,children:(0,S.jsx)(Fe,{width:G.default,height:G.default})})]}),!e&&(0,S.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-muted`,children:r?null:`Select a session to view terminal`}),e&&Ce&&(0,S.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-center text-sm text-muted`,children:`Remote session (read-only). Use SSH to attach on the host.`}),r&&(0,S.jsx)(`div`,{className:`absolute inset-0 z-10 overflow-y-auto bg-base`,children:(0,S.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col gap-4 p-4 md:p-6`,children:[(0,S.jsx)(`div`,{className:`border-b border-border pb-4`,children:(0,S.jsxs)(`div`,{className:`flex flex-col gap-3 md:flex-row md:items-start md:justify-between`,children:[(0,S.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-sm`,children:[(0,S.jsx)(`h2`,{className:`min-w-0 truncate text-lg font-semibold text-primary`,children:Te}),(0,S.jsx)(`span`,{className:`rounded-full bg-blue-500/15 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-blue-400`,children:`Hibernating`}),Ee&&(0,S.jsx)(`span`,{className:`text-muted`,children:Ee}),(0,S.jsxs)(`span`,{className:`text-muted`,children:[`Last active `,De]})]}),r.lastResumeError&&(0,S.jsxs)(`div`,{className:`inline-flex items-center gap-1 rounded bg-amber-500/15 px-2 py-1 text-xs text-amber-400`,title:`Last wake failed: ${r.lastResumeError}`,children:[(0,S.jsx)(T,{width:G.pill,height:G.pill}),`Last wake failed`]}),r.lastUserMessage&&(0,S.jsx)(`p`,{className:`max-h-28 max-w-3xl overflow-y-auto whitespace-pre-wrap break-words pr-2 text-sm leading-6 text-secondary`,children:r.lastUserMessage})]}),(0,S.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>_(r.sessionId),className:`btn btn-primary hidden md:inline-flex`,children:`Wake`}),y&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>y(r.sessionId),className:`btn btn-secondary`,children:`Move to History`})]})]})}),(0,S.jsx)(DO,{session:r})]})}),Le&&e&&!R?(0,S.jsxs)(`button`,{type:`button`,onClick:Ge,className:`absolute bottom-14 left-1/2 z-20 flex h-10 items-center justify-center rounded-full border border-amber-400/35 bg-amber-500/20 text-amber-100 shadow-lg backdrop-blur-sm transition-all hover:bg-amber-500/30 active:scale-95 md:hidden ${St}`,style:{transform:`translateX(-50%)`},title:`Exit tmux copy mode and return to live output`,"aria-label":`Exit copy mode`,children:[(0,S.jsx)(`span`,{className:`px-3 text-[11px] font-semibold uppercase tracking-wide`,children:`Copy mode`}),(0,S.jsx)(`span`,{className:`self-stretch border-l border-amber-400/25`,"aria-hidden":`true`}),(0,S.jsx)(`span`,{className:`px-3 text-sm font-medium`,children:`Exit`})]}):L&&e&&!R?(0,S.jsxs)(`button`,{type:`button`,onClick:Ge,className:`absolute bottom-8 left-1/2 z-20 flex h-10 px-4 items-center justify-center gap-1.5 rounded-full bg-blue-600/90 text-white shadow-lg hover:bg-blue-600 active:scale-95 transition-all md:hidden ${St}`,style:{transform:`translateX(-50%)`},title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:[(0,S.jsx)(D,{width:G.primary,height:G.primary}),(0,S.jsx)(`span`,{className:`text-sm font-medium`,children:`Jump to bottom`})]}):null]}),(0,S.jsx)(RK,{...ut}),(0,S.jsx)(lK,{session:e,hibernatingSession:r,hibernatingDisplayName:Te,showHostBadge:Ae,sessionCount:t.length,connectionStatus:o,isSwitching:Be,canControl:we,canHibernate:Oe,modDisplay:N,onKill:()=>H(!0),onHibernate:Ye,onWake:()=>r&&_(r.sessionId),onRename:t=>{let n=e?.id??r?.sessionId;n&&h(n,t)},onDuplicate:e&&g?()=>g(e.id):void 0,onMoveToHistory:r&&y?()=>y(r.sessionId):void 0,isTmuxCopyMode:Le,showJumpToBottom:L&&!R,onJumpToBottom:Ge,selectionReady:!!He,onCopySelection:Ue,onDismissSelection:We}),e&&(0,S.jsx)($K,{onSendKey:at,onPasteText:ot,onPasteImage:st,disabled:o!==`connected`||Ce||!Ve,sessions:t.map(e=>({id:e.id,name:e.name,status:e.status})),currentSessionId:e.id,agentType:e.agentType,fileUploadsAllowed:!ve,onSelectSession:d,hideSessionSwitcher:!0,onRefocus:lt,isKeyboardVisible:mt,onEnterTextMode:ft}),(I||P)&&(0,S.jsx)(eq,{isOpen:ie,onClose:()=>U(!1),sessions:n??t,hibernatingSessions:i,historySessions:a,selectedSessionId:e?.id??null,selectedHibernatingSessionId:r?.sessionId??null,onSelect:d,onSelectHibernating:f,onRename:h,onResume:_,onHibernate:v,onMoveToHistory:y,onNewSession:p,loading:x,error:w}),te&&e&&(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,children:(0,S.jsxs)(`div`,{className:`mx-4 w-full max-w-sm rounded-lg border border-border bg-elevated p-4 shadow-xl`,children:[(0,S.jsx)(`h3`,{className:`text-base font-medium text-primary mb-2 text-balance`,children:`Kill Session`}),(0,S.jsxs)(`p`,{className:`text-sm text-secondary mb-4 text-pretty`,children:[`Kill "`,e.agentSessionName||e.name,`"? The process will be terminated. Conversation history is preserved in logs.`]}),(0,S.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{onClick:()=>H(!1),className:`btn py-1.5 px-3 text-sm`,children:`Cancel`}),(0,S.jsx)(`button`,{ref:me,onClick:Je,className:`btn btn-danger py-1.5 px-3 text-sm`,children:`Kill Session`})]})]})})]})}function aq({onSelect:e,onCancel:t,initialPath:n}){let[r,i]=(0,C.useState)(n||`~`),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(!0),[d,f]=(0,C.useState)(-1),p=(0,C.useRef)(null),m=W(e=>e.recentPaths),h=(0,C.useCallback)(async e=>{p.current?.abort();let t=new AbortController;p.current=t;let{signal:n}=t;u(!0),c(null),o(null),f(-1),i(e);try{let r=await fetch(`/api/directories?path=${encodeURIComponent(e)}`,{signal:n});if(!r.ok){let e=await r.json();throw Error(e.message||`Failed to load directory`)}let a=await r.json();if(p.current!==t)return;o(a),i(a.path)}catch(e){if(p.current!==t)return;let n=e;n?.name!==`AbortError`&&c(n?.message||`Failed to load directory`)}finally{p.current===t&&u(!1)}},[]);(0,C.useEffect)(()=>(h(n||`~`),()=>{p.current?.abort()}),[h,n]);let g=a?.directories??[],_=a?.path||r,v=a?.parent;return(0,C.useEffect)(()=>{let n=n=>{if(n.key===`Escape`){n.preventDefault(),t();return}if(!l){if(n.key===`ArrowDown`){n.preventDefault(),f(e=>g.length===0?-1:e<0?0:Math.min(e+1,g.length-1));return}if(n.key===`ArrowUp`){n.preventDefault(),f(e=>g.length===0?-1:e<0?g.length-1:Math.max(e-1,0));return}if(n.key===`Enter`){n.preventDefault();let t=g[d];t?h(t.path):_&&e(_);return}n.key===`Backspace`&&v&&(n.preventDefault(),h(v))}};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[g,_,h,d,l,t,e,v]),(0,S.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Directory browser`,className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},"data-testid":`directory-browser`,children:(0,S.jsxs)(`div`,{className:`w-full max-w-lg border border-border bg-elevated p-4`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border pb-2`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{v&&h(v)},disabled:!v||l,children:`Up`}),(0,S.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-xs font-mono text-secondary`,title:_,"data-testid":`directory-current-path`,children:_})]}),(0,S.jsx)(`div`,{className:`mt-3 max-h-60 overflow-y-auto border border-border bg-surface`,children:l?(0,S.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-loading`,children:`Loading directories...`}):s?(0,S.jsxs)(`div`,{className:`px-3 py-4 text-xs`,"data-testid":`directory-error`,children:[(0,S.jsx)(`p`,{className:`text-danger`,children:s}),(0,S.jsx)(`button`,{type:`button`,className:`btn mt-3`,onClick:()=>h(r),children:`Retry`})]}):g.length===0?(0,S.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted`,"data-testid":`directory-empty`,children:`No subdirectories`}):(0,S.jsx)(`div`,{className:`py-1`,children:g.map((e,t)=>(0,S.jsxs)(`button`,{type:`button`,onClick:()=>h(e.path),onMouseEnter:()=>f(t),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-xs ${t===d?`bg-hover text-primary`:`text-secondary`}`,"data-testid":`directory-entry`,"data-entry-name":e.name,"data-entry-path":e.path,children:[(0,S.jsx)(ae,{width:G.default,height:G.default,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,S.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path))})}),a?.truncated?(0,S.jsx)(`p`,{className:`mt-2 text-[10px] text-muted`,children:`Showing first 200 directories.`}):null,(0,S.jsxs)(`div`,{className:`mt-4 border-t border-border pt-3`,children:[(0,S.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider text-secondary`,children:`Recent`}),m.length===0?(0,S.jsx)(`p`,{className:`mt-2 text-xs text-muted`,children:`No recent paths yet.`}):(0,S.jsx)(`div`,{className:`mt-2 space-y-1`,children:m.map(e=>(0,S.jsx)(`button`,{type:`button`,className:`block w-full truncate text-left text-xs text-secondary hover:text-primary`,onClick:()=>h(e),title:e,"data-testid":`directory-recent`,"data-recent-path":e,children:e},e))})]}),(0,S.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,S.jsx)(`button`,{type:`button`,onClick:()=>{_&&e(_)},className:`btn btn-primary`,disabled:l||!_,children:`Select`})]})]})})}function oq(e){let t=e.trim();if(t.length>=2){let e=t[0],n=t[t.length-1];if(e===`'`&&n===`'`)return t.slice(1,-1).replace(/'\\''/g,`'`);if(e===`"`&&n===`"`)return t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\\\/g,`\\`)}return t}function sq(e){let t=e.trim(),n=t.search(/\s/);if(n===-1||t.slice(0,n).split(`/`).pop()!==`bash`)return null;let r=n;for(;r<t.length&&/\s/.test(t[r]);)r++;let i=!1,a=!1;for(;r<t.length;){let e=r;for(;r<t.length&&!/\s/.test(t[r]);)r++;let n=t.slice(e,r);for(;r<t.length&&/\s/.test(t[r]);)r++;if(!n.startsWith(`-`)||n===`-`)return null;if(n===`--`)break;if(n.startsWith(`--`)||!/^-[a-zA-Z]+$/.test(n))continue;let o=n.slice(1);if(o.includes(`l`)&&(i=!0),o.includes(`c`)){a=!0;break}}if(!i||!a)return null;let o=t.slice(r).trim();return o?oq(o):null}function cq(e){return e?e===`claude-rp`?`claude`:e:null}function lq(e){let t=e.trim();if(!t)return``;let n=oq(t);return sq(n)??n}function uq(e){if(e===`claude`)return`claude`;if(e===`codex`)return`codex`;if(e===`pi`)return`pi`;if(e===`devin`||e===`devin-cli`)return`devin`;if(e===`grok`||e.startsWith(`grok-`))return`grok`;if(e===`omp`)return`omp`}function dq(e){let t=/\S+/g,n;for(;n=t.exec(e);){let e=n[0].toLowerCase().replace(/^["']+|["']+$/g,``);if([`npx`,`bunx`,`pnpm`,`yarn`,`env`].includes(e)||e.includes(`=`)||e.startsWith(`-`))continue;let t=e.includes(`@oh-my-pi/`)?`omp`:uq(e.split(`/`).pop()||e);return t?{agentType:t,end:n.index+n[0].length}:void 0}}function fq(e){let t=lq(e);if(t)return dq(t.toLowerCase().trim().replace(/^["']|["']$/g,``))?.agentType}var pq={claude:`--dangerously-skip-permissions`,codex:`--yolo`,grok:`--always-approve`,devin:`--permission-mode dangerous`,pi:null,omp:`--auto-approve`},mq={claude:[`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],codex:[`--yolo`,`--dangerously-bypass-approvals-and-sandbox`],grok:[`--always-approve`,`--yolo`,`--dangerously-skip-permissions`,`--permission-mode bypassPermissions`,`--permission-mode=bypassPermissions`],devin:[`--permission-mode dangerous`,`--permission-mode=dangerous`],pi:[],omp:[`--auto-approve`,`--approval-mode yolo`,`--approval-mode=yolo`]};function hq(e){let t=cq(e);return t?pq[t]:null}function gq(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _q(e){return RegExp(`(^|\\s)${gq(e)}(?=\\s|$)`,`g`)}function vq(e,t){return(t?[cq(t)].filter(e=>e!==null):Object.keys(mq)).some(t=>mq[t].some(t=>_q(t).test(e)))}function yq(e,t){let n=dq(e);return n?`${e.slice(0,n.end)} ${t}${e.slice(n.end)}`:null}function bq(e,t){let n=hq(t);if(!n)return e;let r=e.trim();if(!r||vq(r,t))return r;let i=yq(r,n);if(i)return i;let a=lq(r);if(a&&a!==r){let e=yq(a,n);if(e)return`bash -lc '${e.replace(/'/g,`'\\''`)}'`}return`${r} ${n}`}function xq(e,t){let n=cq(t);if(!n||vq(e,t))return null;if(n===`codex`){let t=/(^|\s)(--full-auto|--ask-for-approval|-a)(?=\s|=|$)/.exec(e);if(t)return`conflicts with ${t[2]}`}if(n===`omp`){let t=/(^|\s)--approval-mode(?:\s+|=)(always-ask|write)/.exec(e);if(t)return`conflicts with --approval-mode ${t[2]}`}let r=/(^|\s)--permission-mode(?:\s+|=)(\S+)/.exec(e);return r&&n!==`codex`?`conflicts with --permission-mode ${r[2]}`:null}function Sq(e,t){let n=cq(t);if(!n)return e;let r=e;for(let e of mq[n])r=r.replace(_q(e),` `);return r.replace(/\s+/g,` `).trim()}function Cq({isOpen:e,onClose:t,onCreate:n,defaultProjectDir:r,commandPresets:i,defaultPresetId:a,lastProjectPath:o,activeProjectPath:s,remoteHosts:c=[],remoteAllowControl:l=!1,initialHost:u,initialPath:d,initialCommand:f}){let[p,m]=(0,C.useState)(``),[h,g]=(0,C.useState)(``),[_,v]=(0,C.useState)(null),[y,b]=(0,C.useState)(``),[x,w]=(0,C.useState)(!1),[T,E]=(0,C.useState)(``),D=W(e=>e.yoloMode),O=W(e=>e.setYoloMode),k=(0,C.useRef)(null),A=(0,C.useRef)(null),j=(0,C.useRef)(null),M=(0,C.useRef)(!1),N=l&&c.length>0,P=e=>{if(!D)return e;let t=fq(e);return t&&!xq(e,t)?bq(e,t):e},F=e=>{let t=i.find(t=>t.id===e);t&&(v(e),b(P(it(t))))},I=()=>{v(null),b(``)};if((0,C.useEffect)(()=>{let t=M.current;if(M.current=e,!e){m(``),g(``),v(null),b(``),w(!1),E(u??``),t&&setTimeout(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;let e=document.querySelector(`.xterm-helper-textarea`);e&&(e.removeAttribute(`disabled`),e.focus())},300);return}if(typeof document<`u`&&typeof document.querySelector==`function`){let e=document.querySelector(`.xterm-helper-textarea`);e&&typeof e.setAttribute==`function`&&(typeof e.blur==`function`&&e.blur(),e.setAttribute(`disabled`,`true`))}m(d?.trim()||s?.trim()||o||r||``),g(``),E(u??``);let n=f?.trim();if(n){let e=i.find(e=>it(e)===n);e?(v(e.id),b(it(e))):(v(null),b(n))}else{let e=i.find(e=>e.id===a);e?(v(a),b(P(it(e)))):i.length>0?(v(i[0].id),b(P(it(i[0])))):(v(null),b(``))}setTimeout(()=>{if(j.current?.focus(),A.current){let e=A.current;e.scrollLeft=e.scrollWidth}},50)},[s,i,a,r,e,o,u,d,f]),(0,C.useEffect)(()=>{if(!e||typeof window>`u`||typeof window.addEventListener!=`function`)return;let n=()=>k.current?Array.from(k.current.querySelectorAll(`input:not([disabled]), select:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex="0"]`)):[],r=e=>{if(!x){if(e.key===`Escape`){typeof e.stopPropagation==`function`&&e.stopPropagation(),t();return}if(e.key===`Enter`){let t=document.activeElement;if(!t||t.tagName===`INPUT`||t.closest(`[data-testid="host-select"]`)||!t.closest(`[data-testid="command-select"]`))return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),k.current?.requestSubmit();return}if(/^[0-9]$/.test(e.key)&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let t=document.activeElement;if(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable))return;let n;if(e.key===`0`)n=i.length;else if(n=Number(e.key)-1,n>=i.length)return;e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation(),n===i.length?I():F(i[n].id),(k.current?.querySelectorAll?.(`[data-testid="command-select"] [role="radio"]`))?.[n]?.focus();return}if(e.key===`Tab`){e.preventDefault(),typeof e.stopPropagation==`function`&&e.stopPropagation();let t=n();if(t.length===0)return;let r=document.activeElement,i=t.indexOf(r),a;a=i===-1?e.shiftKey?t.length-1:0:e.shiftKey?i<=0?t.length-1:i-1:i>=t.length-1?0:i+1,t[a]?.focus()}}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,x,i,D]),!e)return null;let L=_===null,ee=T!==``,R=fq(y),z=hq(R)!==null,B=R?vq(y,R):!1,te=R&&!B?xq(y,R):null,V=!z||te!==null,H=R?R===`pi`?`Pi has no permission prompts — nothing to enable`:te??`Append ${hq(R)}`:`Enter a supported agent command (claude, codex, grok, devin)`,ne=e=>{O(e),R&&b(e?bq(y,R):Sq(y,R))},re=e=>{e.preventDefault();let r=p.trim();if(!r)return;let i=y.trim();n(r,h.trim()||void 0,i||void 0,ee?T:void 0),t()},ie=[...i.map(e=>({id:e.id,label:e.label,isCustom:!1,agentType:e.agentType,command:e.command})),{id:`custom`,label:`Custom`,isCustom:!0,agentType:void 0,command:void 0}],U=[{id:``,label:`Local`,ok:!0,error:void 0},...c.map(e=>({id:e.host,label:e.host,ok:e.ok,error:e.error}))],ae=p.trim()||`~`;return(0,S.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`new-session-title`,"data-suspends-terminal":``,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4`,onClick:e=>{e.target===e.currentTarget&&t()},children:[(0,S.jsxs)(`form`,{ref:k,onSubmit:re,className:`w-full max-w-md border border-border bg-elevated p-6`,children:[(0,S.jsx)(`h2`,{id:`new-session-title`,className:`text-sm font-semibold uppercase tracking-wider text-primary text-balance`,children:`New Session`}),(0,S.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[N&&(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Host`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Host`,"data-testid":`host-select`,children:U.map((e,t)=>{let n=T===e.id,r=!e.ok&&!n;return(0,S.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":n,"aria-label":e.label,title:e.ok?void 0:e.error||`Unreachable`,tabIndex:n?0:-1,onClick:()=>E(e.id),onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%U.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+U.length)%U.length;else return;let r=U[n];E(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``} ${r?`opacity-60`:``}`,children:e.label},e.id||`local`)})})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Command`}),(0,S.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`radiogroup`,"aria-label":`Command preset`,"data-testid":`command-select`,children:ie.map((e,t)=>{let n=e.isCustom?L:_===e.id,r=e.isCustom?`0`:t<9?String(t+1):null;return(0,S.jsxs)(`button`,{ref:n?j:void 0,type:`button`,role:`radio`,"aria-checked":n,"aria-keyshortcuts":r??void 0,tabIndex:n?0:-1,onClick:()=>{e.isCustom?I():F(e.id)},onKeyDown:e=>{let n=t;if(e.key===`ArrowRight`||e.key===`ArrowDown`)e.preventDefault(),n=(t+1)%ie.length;else if(e.key===`ArrowLeft`||e.key===`ArrowUp`)e.preventDefault(),n=(t-1+ie.length)%ie.length;else return;let r=ie[n];r.isCustom?I():F(r.id),(e.currentTarget.parentElement?.querySelectorAll(`[role="radio"]`))?.[n]?.focus()},className:`btn text-xs focus:outline-none focus:ring-2 focus:ring-primary ${n?`btn-primary`:``}`,children:[r&&(0,S.jsx)(`kbd`,{"aria-hidden":`true`,className:`shortcut-badge`,children:r}),(0,S.jsx)(Bh,{agentType:e.agentType,command:e.command,className:`inline-block h-3.5 w-3.5 shrink-0`}),e.label]},e.id)})}),(0,S.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),placeholder:`Enter command...`,className:`input mt-2 font-mono text-xs`}),(0,S.jsxs)(`label`,{className:`mt-2 flex items-center gap-2 text-xs ${V?`text-muted opacity-60`:`text-secondary`}`,title:H,children:[(0,S.jsx)(`input`,{type:`checkbox`,checked:B,disabled:V,onChange:e=>ne(e.target.checked)}),`yolo mode — skip permission prompts`]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Project Path`}),(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(`input`,{ref:A,value:p,onChange:e=>m(e.target.value),placeholder:ee?`/home/user/project`:s||o||r||`/Users/you/code/my-project`,className:`input flex-1 text-sm`}),!ee&&(0,S.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>w(!0),children:`Browse`})]})]}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`label`,{className:`mb-1.5 block text-xs text-secondary`,children:`Display Name`}),(0,S.jsx)(`input`,{value:h,onChange:e=>g(e.target.value),placeholder:`auto-generated`,className:`input text-sm placeholder:italic`})]})]}),(0,S.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:t,className:`btn`,children:`Cancel`}),(0,S.jsx)(`button`,{type:`submit`,className:`btn btn-primary`,children:`Create`})]})]}),x&&!ee&&(0,S.jsx)(aq,{initialPath:ae,onSelect:e=>{m(e),w(!1)},onCancel:()=>w(!1)})]})}var wq=[{id:`new-sessions`,label:`New sessions`},{id:`session-list`,label:`Session list`},{id:`appearance`,label:`Appearance`},{id:`terminal`,label:`Terminal`},{id:`notifications`,label:`Notifications`}];function Tq(e){return wq.some(t=>t.id===e)}function Eq(e){return wq.find(t=>t.id===e)?.label??e}var Dq=`agentboard-settings-page`,Oq=`new-sessions`;function kq(){let e=Je.getItem(Dq);return Tq(e)?e:Oq}function Aq(e){Je.setItem(Dq,e)}var jq=`h-[32px] max-md:h-[44px]`,Mq=`${jq} inline-flex shrink-0 items-center justify-center border text-[12px] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`,Nq=`${Mq} border-border bg-surface px-3 text-secondary hover:bg-hover hover:text-primary`,Pq=`${Mq} w-[32px] max-md:w-[44px] border-border bg-surface text-secondary hover:bg-hover hover:text-primary`,Fq=`input ${jq} px-2 py-0 text-[13px] max-md:text-[16px] focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-50 aria-[invalid=true]:border-danger`;function Iq(e,t){let[n,r]=(0,C.useState)(null),[i,a]=(0,C.useState)(null),o=(0,C.useRef)({draft:n,stored:e,commit:t});o.current={draft:n,stored:e,commit:t},(0,C.useEffect)(()=>()=>{let{draft:e,stored:t,commit:n}=o.current;e!==null&&e!==t&&n(e)},[]);let s=()=>{if(n===null)return;if(n===e){r(null),a(null);return}let i=t(n);if(i){a(i);return}r(null),a(null)};return{value:n??e,error:i,dirty:n!==null,onChange:e=>{r(e.target.value),a(null)},onBlur:s,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),s()):e.key===`Escape`&&n!==null&&(e.preventDefault(),r(null),a(null))}}}var Lq=(0,C.forwardRef)(function({value:e,onCommit:t,describedBy:n,id:r,className:i,wrapperClassName:a,...o},s){let c=Iq(e,t),l=r?`${r}-error`:void 0,u=[n,c.error?l:void 0].filter(Boolean).join(` `);return(0,S.jsxs)(`div`,{className:l_(`min-w-0`,a),children:[(0,S.jsx)(`input`,{...o,ref:s,id:r,value:c.value,onChange:c.onChange,onBlur:c.onBlur,onKeyDown:c.onKeyDown,"aria-invalid":c.error?!0:void 0,"aria-describedby":u||void 0,className:l_(Fq,i)}),c.error&&(0,S.jsx)(`p`,{id:l,className:l_(`text-[12px] leading-snug text-danger`,`mt-1`),role:`alert`,children:c.error})]})});function Rq(e,t,n){let r=e.trim();return/^-?\d+$/.test(r)?Math.min(n,Math.max(t,Number.parseInt(r,10))):null}function zq({value:e,min:t,max:n,onChange:r,noun:i,labelledBy:a,describedBy:o}){return(0,S.jsxs)(`div`,{role:`group`,"aria-labelledby":a,"aria-describedby":o,className:`flex items-center`,children:[(0,S.jsx)(`button`,{type:`button`,className:Pq,"aria-label":`Decrease ${i}`,disabled:e<=t,onClick:()=>r(Math.max(t,e-1)),children:(0,S.jsx)(ye,{width:G.default,height:G.default})}),(0,S.jsx)(`output`,{"aria-live":`polite`,className:l_(jq,`flex w-10 items-center justify-center border-y border-border bg-base text-[13px] tabular-nums text-primary`),children:e}),(0,S.jsx)(`button`,{type:`button`,className:Pq,"aria-label":`Increase ${i}`,disabled:e>=n,onClick:()=>r(Math.min(n,e+1)),children:(0,S.jsx)(ke,{width:G.default,height:G.default})})]})}function Bq({id:e,value:t,min:n,max:r,step:i,onChange:a,format:o,labelledBy:s,describedBy:c}){return(0,S.jsxs)(`div`,{className:l_(jq,`flex items-center gap-3`),children:[(0,S.jsx)(`input`,{id:e,type:`range`,min:n,max:r,step:i,value:t,"aria-labelledby":s,"aria-describedby":c,"aria-valuetext":o(t),onChange:e=>{let t=Number.parseFloat(e.target.value);Number.isFinite(t)&&a(Math.min(r,Math.max(n,t)))},className:`h-1 w-28 max-md:w-36 cursor-pointer appearance-none bg-border accent-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,S.jsx)(`span`,{className:`w-10 text-right text-[13px] tabular-nums text-secondary`,children:o(t)})]})}function Vq({options:e,value:t,onChange:n,labelledBy:r,describedBy:i,fill:a=!1}){let o=(0,C.useRef)([]),s=Math.max(0,e.findIndex(e=>e.value===t)),c=t=>{let r=e[t];r&&(n(r.value),o.current[t]?.focus())},l=(t,n)=>{let r=e.length-1,i=null;t.key===`ArrowRight`||t.key===`ArrowDown`?i=n===r?0:n+1:t.key===`ArrowLeft`||t.key===`ArrowUp`?i=n===0?r:n-1:t.key===`Home`?i=0:t.key===`End`&&(i=r),i!==null&&(t.preventDefault(),c(i))};return(0,S.jsx)(`div`,{role:`radiogroup`,"aria-labelledby":r,"aria-describedby":i,className:l_(`flex border border-border bg-base p-[2px]`,a?`w-full`:`w-max max-w-full`),children:e.map((e,t)=>{let n=t===s;return(0,S.jsx)(`button`,{ref:e=>{o.current[t]=e},type:`button`,role:`radio`,"aria-checked":n,tabIndex:n?0:-1,onClick:()=>c(t),onKeyDown:e=>l(e,t),className:l_(`h-[26px] max-md:h-[38px] min-w-0 whitespace-nowrap px-3 text-[12px] transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,a&&`flex-1`,n?`bg-hover text-primary shadow-[inset_0_0_0_1px_var(--border)]`:`text-muted hover:text-primary`),children:e.label},e.value)})})}function Hq({ids:e}){return(0,S.jsx)(Vq,{options:[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`System`}],value:VG(e=>e.theme),onChange:VG(e=>e.setTheme),labelledBy:e.label,describedBy:e.description})}function Uq({ids:e}){let t=W(e=>e.fontOption),n=W(e=>e.setFontOption);return(0,S.jsx)(`select`,{id:e.control,value:t,"aria-describedby":e.description,onChange:e=>n(e.target.value),className:`${Fq} w-44 max-md:w-full`,children:$e.map(e=>(0,S.jsx)(`option`,{value:e.id,children:e.label},e.id))})}function Wq({ids:e}){let t=W(e=>e.customFontFamily);return(0,S.jsx)(Lq,{id:e.control,value:t,placeholder:`"Fira Code", monospace`,describedBy:e.description,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:256,wrapperClassName:`w-60 max-md:w-full`,onCommit:e=>(W.getState().setCustomFontFamily(e.trim()),null)})}function Gq({ids:e}){return(0,S.jsx)(zq,{value:W(e=>e.fontSize),min:6,max:24,onChange:W(e=>e.setFontSize),noun:`font size`,labelledBy:e.label,describedBy:e.description})}function Kq({ids:e}){let t=W(e=>e.lineHeight),n=W(e=>e.setLineHeight);return(0,S.jsx)(Bq,{id:e.control,value:t,min:1,max:2,step:.1,onChange:e=>n(Math.round(e*10)/10),format:e=>e.toFixed(1),labelledBy:e.label,describedBy:e.description})}function qq({ids:e}){let t=W(e=>e.letterSpacing),n=W(e=>e.setLetterSpacing);return(0,S.jsx)(Bq,{id:e.control,value:t,min:-3,max:3,step:1,onChange:e=>n(Math.round(e)),format:e=>`${e}px`,labelledBy:e.label,describedBy:e.description})}var Jq=[{id:`theme`,page:`appearance`,label:`Theme`,description:`Light, dark, or follow the system setting.`,keywords:[`dark mode`,`light mode`,`color`,`colour`,`system`],Control:Hq},{id:`font-family`,page:`appearance`,label:`Font family`,description:`Terminal typeface. Default JetBrains Mono.`,keywords:[`font`,`typeface`,`monospace`],tags:[`device`],Control:Uq},{id:`custom-font-family`,page:`appearance`,label:`Custom font family`,description:`A CSS font-family list. Empty falls back to JetBrains Mono.`,keywords:[`font`,`typeface`,`css`],tags:[`device`],layout:`wide`,visibleWhen:e=>e.fontOption===`custom`,Control:Wq},{id:`font-size`,page:`appearance`,label:`Font size`,description:`Terminal text size in pixels (6–24). Default 13.`,keywords:[`font`,`text`,`zoom`,`size`],tags:[`device`],Control:Gq},{id:`line-height`,page:`appearance`,label:`Line height`,description:`Vertical spacing, 1.0 compact to 2.0 spacious. Default 1.0.`,keywords:[`spacing`,`leading`,`line`],tags:[`device`],Control:Kq},{id:`letter-spacing`,page:`appearance`,label:`Letter spacing`,description:`Extra space between characters in pixels (−3 to 3). Default 0.`,keywords:[`spacing`,`tracking`,`kerning`],tags:[`device`],Control:qq}],Yq=1024,Xq=[{value:``,label:`Terminal`},{value:`claude`,label:`Claude`},{value:`codex`,label:`Codex`},{value:`pi`,label:`Pi`},{value:`devin`,label:`Devin`},{value:`grok`,label:`Grok`},{value:`omp`,label:`OMP`}];function Zq(e,t){let n=t.trim();return e===`label`?n?n.length>64?`Name is at most 64 characters`:null:`Name is required`:n?n.length>1024?`Command is at most ${Yq} characters`:null:`Command is required`}function Qq(e){return Zq(`label`,e.label)===null&&Zq(`command`,e.command)===null}function $q(e,t,n){return e.map(e=>e.id===t?rt({...e,...n}):e)}var eJ=`grid items-start gap-2 grid-cols-[56px_92px_minmax(0,0.8fr)_minmax(0,1.3fr)_auto] max-md:grid-cols-[minmax(0,1fr)_minmax(0,auto)_auto] max-md:gap-y-2`,tJ=4e3;function nJ({preset:e,index:t,isDefault:n,pending:r=!1,autoFocusName:i=!1,onSetDefault:a,onCommitField:o,onIconChange:s,onDelete:c}){let[l,u]=(0,C.useState)(!1),d=(0,C.useRef)(null),f=`settings-preset-${e.id}`,p=e.label.trim()||`preset ${t+1}`;return(0,C.useEffect)(()=>{i&&d.current?.focus()},[i]),(0,C.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>u(!1),tJ);return()=>clearTimeout(e)},[l]),(0,S.jsxs)(`div`,{role:`listitem`,"data-preset-id":e.id,className:l_(eJ,`py-2`),children:[(0,S.jsxs)(`label`,{className:l_(jq,`flex cursor-pointer items-center gap-2 md:justify-center`),children:[(0,S.jsx)(`input`,{type:`radio`,name:`settings-default-preset`,checked:n,disabled:r,onChange:a,"aria-label":`Default preset: ${p}`,className:`size-4 cursor-pointer accent-accent disabled:cursor-not-allowed`}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`text-[12px] text-secondary md:hidden`,children:`Default`})]}),e.isBuiltIn?(0,S.jsxs)(`div`,{className:l_(jq,`flex items-center gap-2 text-muted`),children:[(0,S.jsx)(Bh,{agentType:e.agentType,command:e.command,className:`size-4`}),(0,S.jsx)(`span`,{className:`text-[11px]`,children:`Built-in`})]}):(0,S.jsx)(`select`,{id:`${f}-icon`,value:e.agentType??``,"aria-label":`Icon for ${p}`,onChange:e=>s(e.target.value||void 0),className:l_(Fq,`w-full px-1`),children:Xq.map(e=>(0,S.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,S.jsx)(Lq,{ref:d,id:`${f}-label`,value:e.label,placeholder:`Name`,"aria-label":`Name of preset ${t+1}`,maxLength:64,onCommit:e=>o(`label`,e),wrapperClassName:`max-md:order-4 max-md:col-span-3`}),(0,S.jsx)(Lq,{id:`${f}-command`,value:e.command,placeholder:`command --flags`,"aria-label":`Command for ${p}`,maxLength:Yq,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,onCommit:e=>o(`command`,e),wrapperClassName:`max-md:order-5 max-md:col-span-3`}),e.isBuiltIn?(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`w-[32px] max-md:order-3 max-md:w-[44px]`}):(0,S.jsx)(`button`,{type:`button`,onClick:()=>{if(r||l){c();return}u(!0)},onPointerDown:r?e=>e.preventDefault():void 0,onBlur:()=>u(!1),"aria-label":l?`Confirm delete ${p}`:r?`Discard new preset`:`Delete ${p}`,title:l?`Click again to delete`:void 0,className:l_(Mq,`max-md:order-3`,l?`border-danger bg-danger/10 px-2 text-danger hover:bg-danger/20`:`w-[32px] border-border bg-surface text-secondary hover:bg-hover hover:text-danger max-md:w-[44px]`),children:l?`Delete?`:(0,S.jsx)(R,{width:G.default,height:G.default})})]})}function rJ({ids:e}){let t=W(e=>e.commandPresets),n=W(e=>e.defaultPresetId),[r,i]=(0,C.useState)(null),a=(0,C.useRef)(null),o=(0,C.useRef)(null),s=(0,C.useRef)(!1);(0,C.useEffect)(()=>{if(!s.current)return;s.current=!1;let e=o.current;if(e&&!e.disabled){e.focus();return}let t=a.current?.id;t&&typeof document<`u`&&document.getElementById(`settings-preset-${t}-label`)?.focus()});let c=e=>{a.current=e,i(e)},l=!r&&t.length<50,u=r?[...t,r]:t,d=(e,t,n)=>{let r=Zq(t,n);if(r)return r;let{commandPresets:i,setCommandPresets:a}=W.getState();return a($q(i,e,{[t]:n})),null},f=(e,t)=>{let n=a.current;if(!n)return null;let r={...n,[e]:t},{commandPresets:i,setCommandPresets:o}=W.getState();return Qq(r)&&i.length<50?(o([...i,rt(r)]),c(null)):c(r),null},p=(e,t)=>{if(r?.id===e){c({...r,agentType:t});return}let{commandPresets:n,setCommandPresets:i}=W.getState();i($q(n,e,{agentType:t}))},m=()=>{l&&c({id:at(new Set(t.map(e=>e.id))),label:``,command:``,isBuiltIn:!1})},h=e=>{s.current=!0,a.current?.id===e?c(null):W.getState().removePreset(e)};return(0,S.jsxs)(`div`,{className:`w-full min-w-0`,children:[(0,S.jsxs)(`div`,{"aria-hidden":`true`,className:l_(eJ,`border-b border-border pb-1 text-[11px] uppercase tracking-wide text-muted max-md:hidden`),children:[(0,S.jsx)(`span`,{className:`text-center`,children:`Default`}),(0,S.jsx)(`span`,{children:`Icon`}),(0,S.jsx)(`span`,{children:`Name`}),(0,S.jsx)(`span`,{children:`Command`}),(0,S.jsx)(`span`,{className:`w-[32px]`})]}),(0,S.jsx)(`div`,{role:`list`,"aria-labelledby":e.label,"aria-describedby":e.description,className:`divide-y divide-border-subtle`,children:u.map((e,t)=>{let i=e.id===r?.id;return(0,S.jsx)(nJ,{preset:e,index:t,isDefault:e.id===n,pending:i,autoFocusName:i,onSetDefault:()=>W.getState().setDefaultPresetId(e.id),onCommitField:(t,n)=>i?f(t,n):d(e.id,t,n),onIconChange:t=>p(e.id,t),onDelete:()=>h(e.id)},e.id)})}),r&&(0,S.jsx)(`p`,{className:l_(`text-[12px] leading-snug text-muted`,`pb-2`),role:`status`,children:`Enter a name and a command to add the preset.`}),(0,S.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,S.jsxs)(`button`,{ref:o,type:`button`,className:Nq,onClick:m,disabled:!l,children:[(0,S.jsx)(ke,{width:G.default,height:G.default,className:`mr-1.5`}),`Add preset`]}),t.length>=50&&(0,S.jsxs)(`span`,{className:`text-[12px] leading-snug text-muted`,children:[`Maximum of `,50,` presets.`]})]})]})}function iJ({ids:e}){let t=W(e=>e.defaultProjectDir);return(0,S.jsx)(Lq,{id:e.control,value:t,placeholder:Xe,describedBy:e.description,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,maxLength:4096,wrapperClassName:`w-72 max-md:w-full`,onCommit:e=>(W.getState().setDefaultProjectDir(e.trim()||`~/Documents/GitHub`),null)})}var aJ=[{id:`default-project-dir`,page:`new-sessions`,label:`Default project directory`,description:`Folder the new session dialog starts in. Default ${Xe}.`,keywords:[`path`,`folder`,`cwd`,`directory`],layout:`wide`,Control:iJ},{id:`command-presets`,page:`new-sessions`,label:`Command presets`,description:`Commands offered when creating a session. The default preset is pre-selected.`,keywords:[`preset`,`command`,`agent`,`claude`,`codex`,`default`,`icon`],layout:`block`,Control:rJ}],oJ=null,sJ=!1,cJ={},lJ=500;function uJ(){if(typeof window>`u`)return null;if(oJ?.state===`closed`&&(oJ=null),!oJ){let e=window.AudioContext??window.webkitAudioContext;if(!e)return null;oJ=new e}return oJ}function dJ(){oJ&&=(oJ.close().catch(()=>{}),null),uJ()}function fJ(){return sJ}function pJ(){oJ&&(dJ(),sJ=!0)}if(typeof window<`u`){window.addEventListener(`pageshow`,e=>{e.persisted&&pJ()}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&pJ()});let e=Date.now();setInterval(()=>{let t=Date.now();t-e>15e3&&pJ(),e=t},5e3)}async function mJ(){let e=uJ();e&&e.state===`suspended`&&await e.resume().catch(()=>{}),sJ=!1}async function hJ(e){e.state===`suspended`&&await e.resume().catch(()=>{})}async function gJ(e){let t=uJ();if(!t||(await hJ(t),t.state!==`running`))return;let{frequencies:n,durationMs:r,attackMs:i,peakGain:a,type:o=`sine`}=e,s=t.currentTime,c=r/1e3,l=i/1e3,u=t.createGain();u.connect(t.destination);let d=s+c*.7;u.gain.setValueAtTime(0,s),u.gain.linearRampToValueAtTime(a,s+l),u.gain.setValueAtTime(a,d),u.gain.linearRampToValueAtTime(0,s+c);let f=n.map(e=>{let n=t.createOscillator();return n.type=o,n.frequency.setValueAtTime(e,s),n.connect(u),n});for(let e of f)e.start(s),e.stop(s+c);let p=f[f.length-1];p.onended=()=>{for(let e of f)e.disconnect();u.disconnect()}}async function _J(){let e=Date.now();if(!(e-(cJ.permission||0)<lJ)){cJ.permission=e;try{await gJ({frequencies:[880],durationMs:150,attackMs:5,peakGain:.15,type:`sine`})}catch{}}}async function vJ(){let e=Date.now();if(!(e-(cJ.idle||0)<lJ)){cJ.idle=e;try{await gJ({frequencies:[440,550],durationMs:300,attackMs:10,peakGain:.08,type:`sine`})}catch{}}}function yJ({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=C.useRef(e!==void 0),[a,o]=C.useState(t);return[i?e:a,C.useCallback(e=>{i||o(e)},[])]}var bJ={};function xJ(e,t){let n=C.useRef(bJ);return n.current===bJ&&(n.current=e(t)),n}var SJ=C[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],CJ=SJ&&SJ!==C.useLayoutEffect?SJ:e=>e();function wJ(e){let t=xJ(TJ).current;return t.next=e,CJ(t.effect),t.trampoline}function TJ(){let e={next:void 0,callback:EJ,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function EJ(){}function DJ(e,t,n,r){let i=xJ(kJ).current;return AJ(i,e,t,n,r)&&MJ(i,[e,t,n,r]),i.callback}function OJ(e){let t=xJ(kJ).current;return jJ(t,e)&&MJ(t,e),t.callback}function kJ(){return{callback:null,cleanup:null,refs:[]}}function AJ(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function jJ(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function MJ(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var NJ=typeof document<`u`?C.useLayoutEffect:()=>{},PJ={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},FJ={...PJ,position:`fixed`,top:0,left:0},IJ={...PJ,position:`absolute`};function LJ(){}Object.freeze([]);var RJ=Object.freeze({});function zJ(e,...t){let n=new URL(`https://base-ui.com/production-error`);return n.searchParams.set(`code`,e.toString()),t.forEach(e=>n.searchParams.append(`args[]`,e)),`Base UI error #${e}; visit ${n} for the full message.`}var BJ=18;function VJ(e){return BJ>=e}function HJ(e){if(!C.isValidElement(e))return null;let t=e,n=t.props;return(VJ(19)?n?.ref:t.ref)??null}function UJ(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function WJ(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function GJ(e,t){return typeof e==`function`?e(t):e}function KJ(e,t){return typeof e==`function`?e(t):e}var qJ={};function JJ(e,t,n,r,i){let a={...eY(e,qJ)};return t&&(a=XJ(a,t)),n&&(a=XJ(a,n)),r&&(a=XJ(a,r)),i&&(a=XJ(a,i)),a}function YJ(e){if(e.length===0)return qJ;if(e.length===1)return eY(e[0],qJ);let t={...eY(e[0],qJ)};for(let n=1;n<e.length;n+=1)t=XJ(t,e[n]);return t}function XJ(e,t){return $J(t)?t(e):ZJ(e,t)}function ZJ(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=UJ(e.style,r);break;case`className`:e[n]=rY(e.className,r);break;default:QJ(n,r)?e[n]=tY(e[n],r):e[n]=r}}return e}function QJ(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function $J(e){return typeof e==`function`}function eY(e,t){return $J(e)?e(t):e??qJ}function tY(e,t){return t?e?n=>{if(iY(n)){let r=n;nY(r);let i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}let r=t(n);return e?.(n),r}:t:e}function nY(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function rY(e,t){return t?e?t+` `+e:t:e}function iY(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function aY(e,t,n={}){let r=t.render,i=oY(t,n);return n.enabled===!1?null:cY(e,r,i,n.state??RJ)}function oY(e,t={}){let{className:n,style:r,render:i}=e,{state:a=RJ,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?GJ(n,a):void 0,d=l?KJ(r,a):void 0,f=l?WJ(a,c):RJ,p=l?UJ(f,Array.isArray(s)?YJ(s):s)??RJ:RJ;return typeof document<`u`&&(l?Array.isArray(o)?p.ref=OJ([p.ref,HJ(i),...o]):p.ref=DJ(p.ref,HJ(i),o):DJ(null,null)),l?(u!==void 0&&(p.className=rY(p.className,u)),d!==void 0&&(p.style=UJ(p.style,d)),p):RJ}var sY=Symbol.for(`react.lazy`);function cY(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=JJ(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===sY&&(i=C.Children.toArray(t)[0]),C.cloneElement(i,e)}if(e&&typeof e==`string`)return lY(e,n);throw Error(zJ(8))}function lY(e,t){return e===`button`?(0,C.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,C.createElement)(`img`,{alt:``,...t,key:t.key}):C.createElement(e,t)}var uY={...C},dY=0;function fY(e,t=`mui`){let[n,r]=C.useState(e),i=e||n;return C.useEffect(()=>{n??(dY+=1,r(`${t}-${dY}`))},[n,t]),i}var pY=uY.useId;function mY(e,t){if(pY!==void 0){let n=pY();return e??(t?`${t}-${n}`:n)}return fY(e,t)}function hY(e){return mY(e,`base-ui`)}function gY(){return typeof window<`u`}function _Y(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function vY(e){return gY()?e instanceof Element||e instanceof _Y(e).Element:!1}function yY(e){return gY()?e instanceof HTMLElement||e instanceof _Y(e).HTMLElement:!1}function bY(e){return!gY()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof _Y(e).ShadowRoot}var xY=C.createContext(void 0);function SY(e=!1){let t=C.useContext(xY);if(t===void 0&&!e)throw Error(zJ(16));return t}function CY(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:C.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function wY(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=e,a=C.useRef(null),o=SY(!0)!==void 0,s=wJ(()=>{let e=a.current;return!!(e?.tagName===`A`&&e?.href)}),{props:c}=CY({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:r,isNativeButton:i}),l=C.useCallback(()=>{let e=a.current;TY(e)&&o&&t&&c.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,c.disabled,o]);return NJ(l,[l]),{getButtonProps:C.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:l,...u}=e;return JJ({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(nY(e),o?.(e)),e.baseUIHandlerPrevented)return;let r=e.target===e.currentTarget&&!i&&!s()&&!t,a=e.key===`Enter`,c=e.key===` `;r&&((c||a)&&e.preventDefault(),a&&n?.(e))},onKeyUp(e){t||(nY(e),a?.(e)),!e.baseUIHandlerPrevented&&e.target===e.currentTarget&&!i&&!t&&e.key===` `&&n?.(e)},onPointerDown(e){if(t){e.preventDefault();return}l?.(e)}},i?void 0:{role:`button`},c,u)},[t,c,i,s]),buttonRef:wJ(e=>{a.current=e,l()})}}function TY(e){return yY(e)&&e.tagName===`BUTTON`}var EY=C.createContext(void 0);function DY(){let e=C.useContext(EY);if(e===void 0)throw Error(zJ(63));return e}var OY=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}({}),kY={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},AY={valid(e){return e===null?null:e?{[OY.valid]:``}:{[OY.invalid]:``}}},jY=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}({}),MY={...AY,checked(e){return e?{[jY.checked]:``}:{[jY.unchecked]:``}}};function NY(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}var PY=C.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:LJ,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function FY(){return C.useContext(PY)}var IY=C.createContext({invalid:void 0,name:void 0,validityData:{state:kY,errors:[],error:``,value:``,initialValue:null},setValidityData:LJ,disabled:void 0,touched:!1,setTouched:LJ,dirty:!1,setDirty:LJ,filled:!1,setFilled:LJ,focused:!1,setFocused:LJ,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=RJ)=>e,getInputValidationProps:(e=RJ)=>e,inputRef:{current:null},commit:async()=>{}}});function LY(e=!0){let t=C.useContext(IY);if(t.setValidityData===LJ&&!e)throw Error(zJ(28));return t}function RY(e){let{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:o}=e,{formRef:s}=FY(),{invalid:c,markedDirtyRef:l,validityData:u,setValidityData:d}=LY(),f=wJ(e.getValue);NJ(()=>{if(!t)return;let e=n;e===void 0&&(e=f()),u.initialValue===null&&e!==null&&d(t=>({...t,initialValue:e}))},[t,d,n,u.initialValue,f]),NJ(()=>{!t||!r||s.current.fields.set(r,{getValue:f,name:i,controlRef:a,validityData:NY(u,c),validate(e=!0){let t=n;t===void 0&&(t=f()),l.current=!0,e?Vd.flushSync(()=>o(t)):o(t)}})},[o,a,t,s,f,r,c,l,i,u,n]),NJ(()=>{let e=s.current.fields;return()=>{r&&e.delete(r)}},[s,r])}var zY=C.createContext({controlId:void 0,registerControlId:LJ,labelId:void 0,setLabelId:LJ,messageIds:[],setMessageIds:LJ,getDescriptionProps:e=>e});function BY(){return C.useContext(zY)}function VY(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=BY(),o=hY(t),s=n?i:void 0,c=xJ(()=>Symbol(`labelable-control`)),l=C.useRef(!1),u=C.useRef(t!=null),d=wJ(()=>{!l.current||a===LJ||(l.current=!1,a(c.current,void 0))});return NJ(()=>{if(a===LJ)return;let e;if(n){let n=r?.current;e=vY(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),C.useEffect(()=>d,[d]),i??o}var HY=`none`;function UY(e,t,n,r){let i=!1,a=!1,o=r??RJ;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}function WY(e,t){let n=C.useRef(e),r=wJ(t);NJ(()=>{n.current!==e&&r(n.current)},[e,r]),NJ(()=>{n.current=e},[e])}var GY=C.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,id:a,inputRef:o,name:s,nativeButton:c=!1,onCheckedChange:l,readOnly:u=!1,required:d=!1,disabled:f=!1,render:p,uncheckedValue:m,value:h,...g}=e,{clearErrors:_}=FY(),{state:v,setTouched:y,setDirty:b,validityData:x,setFilled:w,setFocused:T,shouldValidateOnChange:E,validationMode:D,disabled:O,name:k,validation:A}=LY(),{labelId:j}=BY(),M=O||f,N=k??s,P=wJ(l),F=C.useRef(null),I=DJ(F,o,A.inputRef),L=C.useRef(null),ee=hY(),R=VY({id:a,implicit:!1,controlRef:L}),z=c?void 0:R,[B,te]=yJ({controlled:n,default:!!i,name:`Switch`,state:`checked`});RY({id:ee,commit:A.commit,value:B,controlRef:L,name:N,getValue:()=>B}),NJ(()=>{F.current&&w(F.current.checked)},[F,w]),WY(B,()=>{_(N),b(B!==x.initialValue),w(B),E()?A.commit(B):A.commit(B,!0)});let{getButtonProps:V,buttonRef:H}=wY({disabled:M,native:c}),ne={id:c?R:ee,role:`switch`,"aria-checked":B,"aria-readonly":u||void 0,"aria-required":d||void 0,"aria-labelledby":j,onFocus(){M||T(!0)},onBlur(){let e=F.current;!e||M||(y(!0),T(!1),D===`onBlur`&&A.commit(e.checked))},onClick(e){u||M||(e.preventDefault(),F.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},re=C.useMemo(()=>JJ({checked:B,disabled:M,id:z,name:N,required:d,style:N?IJ:FJ,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:I,onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.target.checked,n=UY(HY,e.nativeEvent);P?.(t,n),!n.isCanceled&&te(t)},onFocus(){L.current?.focus()}},A.getInputValidationProps,h===void 0?RJ:{value:h}),[B,M,I,z,N,P,d,te,A,h]),ie=C.useMemo(()=>({...v,checked:B,disabled:M,readOnly:u,required:d}),[v,B,M,u,d]),U=aY(`span`,e,{state:ie,ref:[t,L,H],props:[ne,A.getValidationProps,g,V],stateAttributesMapping:MY});return(0,S.jsxs)(EY.Provider,{value:ie,children:[U,!B&&N&&m!==void 0&&(0,S.jsx)(`input`,{type:`hidden`,name:N,value:m}),(0,S.jsx)(`input`,{...re})]})}),KY=C.forwardRef(function(e,t){let{render:n,className:r,...i}=e,{state:a}=LY(),o=DY();return aY(`span`,e,{state:{...a,...o},ref:t,stateAttributesMapping:MY,props:i})});function qY({checked:e,onCheckedChange:t,disabled:n,className:r,ariaLabel:i,id:a,ariaLabelledBy:o,ariaDescribedBy:s}){return(0,S.jsx)(GY,{checked:e,onCheckedChange:t,disabled:n,"aria-label":i,id:a,"aria-labelledby":o,"aria-describedby":s,className:l_(`group relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center rounded-full transition-colors`,`bg-border data-[checked]:bg-accent`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-bg-base`,`disabled:cursor-not-allowed disabled:opacity-50`,r),children:(0,S.jsx)(KY,{className:l_(`pointer-events-none block size-4 rounded-full bg-white shadow-sm transition-transform`,`translate-x-1 group-data-[checked]:translate-x-5`)})})}function JY(e,t,n,r){return function({ids:i}){let a=W(t=>t[e]),o=W(e=>e[t]);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,className:Nq,"aria-label":`Test ${r}`,onClick:()=>void n(),children:`Test`}),(0,S.jsx)(qY,{className:St,id:i.control,checked:a,onCheckedChange:e=>{o(e),e&&mJ()},ariaLabelledBy:i.label,ariaDescribedBy:i.description})]})}}var YY=[{id:`sound-permission`,page:`notifications`,label:`Permission sound`,description:`Play a ping when any session needs permission.`,keywords:[`sound`,`audio`,`alert`,`ping`,`approval`],Control:JY(`soundOnPermission`,`setSoundOnPermission`,_J,`permission sound`)},{id:`sound-idle`,page:`notifications`,label:`Idle sound`,description:`Play a chime when a session finishes working.`,keywords:[`sound`,`audio`,`alert`,`chime`,`done`,`finished`],Control:JY(`soundOnIdle`,`setSoundOnIdle`,vJ,`idle sound`)}];function XY(e,t,n){let r=`/api/settings/${e}`,[i,a]=(0,C.useState)(n),[o,s]=(0,C.useState)(!0),[c,l]=(0,C.useState)(!1),u=(0,C.useRef)(n),d=(0,C.useRef)(Promise.resolve()),f=(0,C.useRef)(0),p=(0,C.useRef)(!0),m=(0,C.useRef)(!1);return(0,C.useEffect)(()=>{p.current=!0;let e=!0;return fetch(r).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(n=>{if(!e)return;let r=n[t];f.current===0&&!m.current&&(u.current=r),m.current||a(r)}).catch(()=>{}).finally(()=>{e&&(l(!0),f.current===0&&s(!1))}),()=>{e=!1,p.current=!1}},[r,t]),{value:i,loading:o,loaded:c,set:(0,C.useCallback)(e=>{m.current=!0,f.current+=1,a(e),s(!0),d.current=d.current.then(()=>fetch(r,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[t]:e})}).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status}`);u.current=e}).catch(()=>{p.current&&f.current===1&&a(u.current)}).finally(()=>{--f.current,p.current&&f.current===0&&s(!1)}))},[r,t])}}function ZY(e,t){return function({ids:n}){let r=W(t=>t[e]),i=W(e=>e[t]);return(0,S.jsx)(qY,{className:St,id:n.control,checked:r,onCheckedChange:i,ariaLabelledBy:n.label,ariaDescribedBy:n.description})}}function QY({ids:e}){return(0,S.jsx)(Vq,{options:[{value:`created`,label:`Created`},{value:`status`,label:`Status`},{value:`manual`,label:`Manual`}],value:W(e=>e.sessionSortMode),onChange:W(e=>e.setSessionSortMode),labelledBy:e.label,describedBy:e.description})}function $Y(){let e=W(e=>e.sessionSortMode);return e===`status`?(0,S.jsx)(S.Fragment,{children:`Sessions re-sort by status: waiting, working, unknown.`}):e===`manual`?(0,S.jsx)(S.Fragment,{children:`Drag sessions in the sidebar to reorder them.`}):(0,S.jsx)(S.Fragment,{children:`Sessions stay in the order they were created.`})}function eX({ids:e}){return(0,S.jsx)(Vq,{options:[{value:`desc`,label:`Newest first`},{value:`asc`,label:`Oldest first`}],value:W(e=>e.sessionSortDirection),onChange:W(e=>e.setSessionSortDirection),labelledBy:e.label,describedBy:e.description})}function tX({ids:e}){return(0,S.jsx)(Vq,{options:[{value:`top`,label:`Top`},{value:`bottom`,label:`Bottom`}],value:W(e=>e.sidebarAnchor),onChange:W(e=>e.setSidebarAnchor),labelledBy:e.label,describedBy:e.description})}function nX(){return W(e=>e.sidebarAnchor)===`bottom`?(0,S.jsx)(S.Fragment,{children:`The sidebar is mirrored: the first session sits at the bottom, next to the prompt.`}):(0,S.jsx)(S.Fragment,{children:`The first session sits at the top of the sidebar.`})}function rX({ids:e}){let{value:t,loaded:n,set:r}=XY(`history-max-age-hours`,`hours`,24);return(0,S.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,S.jsx)(Lq,{id:e.control,type:`text`,inputMode:`numeric`,value:String(t),disabled:!n,describedBy:e.description,wrapperClassName:`w-20`,className:`text-center tabular-nums`,onCommit:e=>{let n=Rq(e,1,168);return n===null?`Enter 1–168`:(n!==t&&r(n),null)}}),(0,S.jsx)(`span`,{className:`flex h-[32px] items-center text-[12px] text-muted max-md:h-[44px]`,children:`hours`})]})}function iX({ids:e}){let{value:t,loaded:n,set:r}=XY(`prefer-window-name`,`enabled`,!1);return(0,S.jsx)(qY,{className:St,id:e.control,checked:t,onCheckedChange:r,disabled:!n,ariaLabelledBy:e.label,ariaDescribedBy:e.description})}var aX=[{id:`sort-order`,page:`session-list`,label:`Sort order`,description:`Created keeps creation order, Status re-sorts by status, Manual lets you drag.`,keywords:[`sort`,`order`,`created`,`status`,`manual`,`drag`],layout:`wide`,Description:$Y,Control:QY},{id:`sort-direction`,page:`session-list`,label:`Sort direction`,description:`Newest or oldest sessions first.`,keywords:[`sort`,`newest`,`oldest`,`ascending`,`descending`],layout:`wide`,visibleWhen:e=>e.sessionSortMode===`created`,Control:eX},{id:`sidebar-anchor`,page:`session-list`,label:`Sidebar anchor`,description:`Top lists the first session at the top; Bottom mirrors the sidebar.`,keywords:[`sidebar`,`mirror`,`top`,`bottom`],tags:[`desktop`],Description:nX,Control:tX},{id:`show-project-name`,page:`session-list`,label:`Project name`,description:`Show the project folder name under each session.`,keywords:[`folder`,`details`],Control:ZY(`showProjectName`,`setShowProjectName`)},{id:`show-last-user-message`,page:`session-list`,label:`Last user message`,description:`Show the most recent prompt next to the project name.`,keywords:[`prompt`,`input`,`details`],Control:ZY(`showLastUserMessage`,`setShowLastUserMessage`)},{id:`show-session-id-prefix`,page:`session-list`,label:`Session ID prefix`,description:`Show the first 5 characters of the agent session ID.`,keywords:[`id`,`uuid`,`details`],Control:ZY(`showSessionIdPrefix`,`setShowSessionIdPrefix`)},{id:`history-lookback`,page:`session-list`,label:`History lookback`,description:`Show history sessions from the last N hours (1–168). Default 24.`,keywords:[`history`,`hours`,`age`,`inactive`,`past`],Control:rX},{id:`prefer-window-name`,page:`session-list`,label:`Prefer window names`,description:`Label discovered sessions with their tmux window name instead of the session name.`,keywords:[`tmux`,`window`,`name`,`title`],Control:iX}],oX=`1-9 [ ] N X ,`;function sX({ids:e}){let t=W(e=>e.useWebGL),n=W(e=>e.setUseWebGL);return(0,S.jsx)(qY,{className:St,id:e.control,checked:t,onCheckedChange:n,ariaLabelledBy:e.label,ariaDescribedBy:e.description})}function cX(e,t){return function({ids:n}){let{value:r,loaded:i,set:a}=XY(e,`enabled`,t);return(0,S.jsx)(qY,{className:St,id:n.control,checked:r,onCheckedChange:a,disabled:!i,ariaLabelledBy:n.label,ariaDescribedBy:n.description})}}var lX=[`auto`,`ctrl-option`,`ctrl-shift`,`cmd-option`,`cmd-shift`];function uX({ids:e}){let t=W(e=>e.shortcutModifier),n=W(e=>e.setShortcutModifier);return(0,S.jsx)(Vq,{options:lX.map(e=>({value:e,label:e===`auto`?`Auto`:pt(e)})),value:t,onChange:n,labelledBy:e.label,describedBy:e.description})}function dX(){return(0,S.jsxs)(S.Fragment,{children:[`Shortcuts: `,pt(dt(W(e=>e.shortcutModifier))),` + `,oX,` (sessions, navigate, new, kill, settings).`]})}var fX=[{id:`webgl`,page:`terminal`,label:`WebGL acceleration`,description:`GPU rendering for better performance. Turn off if text looks fuzzy or flickers (common in Safari).`,keywords:[`gpu`,`renderer`,`canvas`,`blurry`,`performance`],tags:[`device`],Control:sX},{id:`mouse-mode`,page:`terminal`,label:`Mouse mode`,description:`tmux mouse mode for trackpad and scroll wheel support.`,keywords:[`tmux`,`scroll`,`trackpad`,`mouse`],Control:cX(`tmux-mouse-mode`,!0)},{id:`terminal-colors`,page:`terminal`,label:`Terminal colors`,description:`Preserve ANSI colors in terminal output. Hibernate then Wake running agents after changing this.`,keywords:[`ansi`,`color`,`colour`],Control:cX(`terminal-colors`,!0)},{id:`shortcut-modifier`,page:`terminal`,label:`Keyboard shortcut modifier`,description:`Modifier keys for the app shortcuts. Auto picks ⌃⌥ on macOS, ⌃⇧ elsewhere.`,keywords:[`keyboard`,`shortcut`,`hotkey`,`ctrl`,`cmd`,`option`,`shift`],tags:[`desktop`,`device`],layout:`wide`,Description:dX,Control:uX}],pX=[...aJ,...aX,...Jq,...fX,...YY];function mX(e,t=pX){return t.filter(t=>t.page===e)}function hX(e){return[e.label,e.description,...e.keywords??[]].join(` `).toLowerCase()}function gX(e,t=pX){let n=e.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?[]:t.filter(e=>{let t=hX(e);return n.every(e=>t.includes(e))})}function _X(e){return wq.map(t=>({page:t.id,label:t.label,rows:e.filter(e=>e.page===t.id)})).filter(e=>e.rows.length>0)}var vX={desktop:`Desktop`,device:`This device`},yX={desktop:`Only affects the desktop layout`,device:`Stored in this browser only; not synced to other devices`};function bX({tag:e}){return(0,S.jsx)(`span`,{title:yX[e],className:`shrink-0 border border-border px-1 py-px text-[10px] uppercase leading-none tracking-wide text-muted`,children:vX[e]})}function xX(e){let t=`settings-${e}`;return{control:`${t}-control`,label:`${t}-label`,description:`${t}-desc`}}function SX({row:e}){let t=xX(e.id),n=e.layout??`inline`,{Control:r,Description:i}=e;return(0,S.jsxs)(`div`,{"data-setting-row":e.id,className:l_(`flex gap-x-6 gap-y-3 py-4`,n===`block`&&`flex-col`,n===`wide`&&`items-center max-md:flex-col max-md:items-stretch`,n===`inline`&&`items-center`),children:[(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,S.jsx)(`label`,{id:t.label,htmlFor:t.control,className:`text-[14px] leading-snug text-primary`,children:e.label}),e.tags?.map(e=>(0,S.jsx)(bX,{tag:e},e))]}),(0,S.jsx)(`div`,{id:t.description,className:`mt-1 text-[12px] leading-snug text-muted text-pretty`,children:i?(0,S.jsx)(i,{}):e.description})]}),(0,S.jsx)(`div`,{className:l_(`flex min-w-0 items-center gap-2`,n===`inline`?`shrink-0`:`max-w-full`),children:(0,S.jsx)(r,{ids:t})})]})}function CX(e,t){return e.visibleWhen?e.visibleWhen(t):!0}function wX({rows:e}){let t=W(t=>e.map(e=>CX(e,t)?`1`:`0`).join(``));return(0,S.jsx)(`div`,{className:`divide-y divide-border`,children:e.filter((e,n)=>t[n]===`1`).map(e=>(0,S.jsx)(SX,{row:e},e.id))})}function TX({page:e,showTitle:t}){let n=(0,C.useMemo)(()=>mX(e),[e]);return(0,S.jsxs)(`section`,{"aria-labelledby":t?`settings-page-${e}-title`:void 0,children:[t&&(0,S.jsx)(`h3`,{id:`settings-page-${e}-title`,className:`pb-1 text-[18px] font-semibold leading-tight text-primary`,children:Eq(e)}),(0,S.jsx)(wX,{rows:n})]})}function EX({query:e}){let t=(0,C.useMemo)(()=>gX(e),[e]),n=W(e=>t.some(t=>CX(t,e))),r=(0,C.useMemo)(()=>_X(t),[t]);return n?(0,S.jsx)(`div`,{className:`flex flex-col gap-6`,children:r.map(e=>(0,S.jsx)(DX,{label:e.label,rows:e.rows},e.page))}):(0,S.jsxs)(`div`,{role:`status`,className:`flex flex-col items-center gap-1 py-16 text-center`,children:[(0,S.jsxs)(`p`,{className:`text-[14px] text-primary`,children:[`No settings match “`,e.trim(),`”`]}),(0,S.jsx)(`p`,{className:`text-[12px] text-muted`,children:`Try a different word, like “font” or “sound”.`})]})}function DX({label:e,rows:t}){return W(e=>t.some(t=>CX(t,e)))?(0,S.jsxs)(`section`,{"aria-label":e,children:[(0,S.jsx)(`h3`,{className:`border-b border-border pb-1 text-[11px] font-medium uppercase tracking-wider text-muted`,children:e}),(0,S.jsx)(wX,{rows:t})]}):null}function OX(e){return`settings-tab-${e}`}function kX(e,t,n){return e===`ArrowDown`?(t+1)%n:e===`ArrowUp`?(t-1+n)%n:e===`Home`?0:e===`End`?n-1:null}function AX({variant:e,current:t,onSelect:n,panelId:r}){let i=(0,C.useRef)([]),a=Math.max(0,wq.findIndex(e=>e.id===t)),o=(t,r)=>{let a=kX(t.key,r,wq.length);a!==null&&(t.preventDefault(),i.current[a]?.focus(),e===`tabs`&&n(wq[a].id))};return e===`list`?(0,S.jsx)(`nav`,{"aria-label":`Settings pages`,children:(0,S.jsx)(`ul`,{className:`divide-y divide-border border-y border-border`,children:wq.map((e,t)=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{ref:e=>{i.current[t]=e},type:`button`,"data-page-id":e.id,onClick:()=>n(e.id),onKeyDown:e=>o(e,t),className:`flex min-h-[52px] w-full items-center justify-between gap-3 px-4 text-left text-[15px] text-primary active:bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,children:[e.label,(0,S.jsx)(j,{width:G.primary,height:G.primary,className:`text-muted`,"aria-hidden":`true`})]})},e.id))})}):(0,S.jsx)(`div`,{role:`tablist`,"aria-orientation":`vertical`,"aria-label":`Settings pages`,className:`flex flex-col gap-px`,children:wq.map((e,s)=>{let c=e.id===t;return(0,S.jsx)(`button`,{ref:e=>{i.current[s]=e},id:OX(e.id),type:`button`,role:`tab`,"aria-selected":c,"aria-controls":r,tabIndex:s===a?0:-1,onClick:()=>n(e.id),onKeyDown:e=>o(e,s),className:l_(`flex h-[32px] w-full items-center border-l-2 px-3 text-left text-[13px] transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,c?`border-primary bg-hover font-medium text-primary`:`border-transparent text-secondary hover:text-primary`),children:e.label},e.id)})})}var jX=(0,C.forwardRef)(function({value:e,onChange:t,className:n},r){return(0,S.jsxs)(`div`,{className:n,children:[(0,S.jsx)(`label`,{htmlFor:`settings-search`,className:`sr-only`,children:`Search settings`}),(0,S.jsx)(`input`,{ref:r,id:`settings-search`,type:`search`,value:e,placeholder:`Search settings`,autoComplete:`off`,spellCheck:!1,onChange:e=>t(e.target.value),onKeyDown:n=>{n.key===`Escape`&&e&&(n.preventDefault(),t(``))},className:`input h-[32px] px-2 py-0 text-[13px] max-md:h-[44px] max-md:text-[16px] focus-visible:ring-2 focus-visible:ring-accent/40`})]})}),MX=[`a[href]`,`button:not([disabled])`,`input:not([disabled]):not([type="hidden"])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function NX(e){return Array.from(e.querySelectorAll(MX)).filter(e=>e.getAttribute(`aria-hidden`)!==`true`&&e.tabIndex!==-1)}function PX(e,t,n){if(e.length===0)return null;let r=e[0],i=e[e.length-1],a=t===null?-1:e.indexOf(t);return a===-1?n?i:r:n&&a===0?i:!n&&a===e.length-1?r:null}var FX=`.xterm-helper-textarea`,IX=300,LX=`[data-suspends-terminal]`,RX=null;function zX(e){return!e||typeof document>`u`||e===document.body?null:typeof e.focus==`function`?e:null}function BX(e,t){if(e.isConnected)return e;if(!t)return null;let n=t.replace(/["\\]/g,`\\$&`);return document.querySelector(`button[aria-label="${n}"]`)}function VX(){(0,C.useEffect)(()=>{if(typeof document>`u`||typeof document.querySelector!=`function`)return;RX&&=(clearTimeout(RX),null);let e=zX(document.activeElement),t=document.querySelector(FX);t&&(t.blur(),t.setAttribute(`disabled`,`true`));let n=e?.getAttribute?.(`aria-label`)??null;return()=>{RX=setTimeout(()=>{if(RX=null,document.querySelector(LX))return;let r=document.querySelector(FX);if(r){r.removeAttribute(`disabled`),r.focus();return}(e&&e!==t?BX(e,n):null)?.focus()},IX)}},[])}function HX(e,t){let n=(0,C.useRef)(t);n.current=t,(0,C.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let t=t=>{if(t.key===`Escape`){if(t.defaultPrevented)return;t.preventDefault(),t.stopPropagation(),n.current();return}if(t.key!==`Tab`)return;let r=e.current;if(!r)return;let i=document.activeElement,a=PX(NX(r),i,t.shiftKey);a&&(t.preventDefault(),a.focus())},r=t=>{let n=e.current,r=t.target;n&&r&&!n.contains(r)&&n.focus()};return document.addEventListener(`keydown`,t),document.addEventListener(`focusin`,r),()=>{document.removeEventListener(`keydown`,t),document.removeEventListener(`focusin`,r)}},[e])}function UX({isOpen:e,onClose:t}){return e?(0,S.jsx)(KX,{onClose:t}):null}var WX=`settings-panel`,GX=`flex shrink-0 items-center justify-center text-secondary transition-colors hover:bg-hover hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`;function KX({onClose:e}){let t=PG(),[n,r]=(0,C.useState)(()=>t?null:kq()),[i,a]=(0,C.useState)(``),o=(0,C.useRef)(null),s=(0,C.useRef)(null),c=(0,C.useRef)(null),l=(0,C.useRef)(!1),u=(0,C.useRef)(null);VX(),HX(o,e),(0,C.useEffect)(()=>{t?o.current?.focus():s.current?.focus()},[]),(0,C.useEffect)(()=>{if(t){if(n)c.current?.focus();else if(u.current){let e=o.current?.querySelector(`[data-page-id="${u.current}"]`);u.current=null,e?.focus()}}},[t,n]);let d=e=>{r(e),Aq(e),a(``)},f=i.trim().length>0,p=(0,S.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Close settings`,className:l_(GX,`size-[32px] max-md:size-[44px]`),children:(0,S.jsx)(Fe,{width:G.primary,height:G.primary})});if(t)return(0,S.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,"data-suspends-terminal":``,tabIndex:-1,className:`fixed inset-0 z-50 flex flex-col bg-elevated outline-none`,style:{paddingTop:`env(safe-area-inset-top)`,paddingLeft:`env(safe-area-inset-left)`,paddingRight:`env(safe-area-inset-right)`},children:[(0,S.jsxs)(`header`,{className:`flex h-[52px] shrink-0 items-center gap-1 border-b border-border px-1`,children:[n?(0,S.jsx)(`button`,{ref:c,type:`button`,onClick:()=>{u.current=n,r(null)},"aria-label":`Back to settings`,className:l_(GX,`size-[44px]`),children:(0,S.jsx)(j,{width:G.primary,height:G.primary,className:`rotate-180`})}):(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`size-[44px] shrink-0`}),(0,S.jsx)(`h2`,{id:`settings-title`,className:`min-w-0 flex-1 truncate text-center text-[16px] font-semibold text-primary`,children:n?Eq(n):`Settings`}),p]}),(0,S.jsx)(`div`,{id:WX,className:`min-h-0 flex-1 overflow-y-auto overflow-x-hidden overscroll-contain px-4`,style:{paddingBottom:`calc(24px + env(safe-area-inset-bottom))`},children:n?(0,S.jsx)(TX,{page:n,showTitle:!1}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(jX,{ref:s,value:i,onChange:a,className:`py-3`}),f?(0,S.jsx)(EX,{query:i}):(0,S.jsx)(`div`,{className:`-mx-4`,children:(0,S.jsx)(AX,{variant:`list`,current:null,onSelect:d})})]})})]});let m=n??kq();return(0,S.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/30 p-4`,onMouseDown:e=>{l.current=e.target===e.currentTarget},onClick:t=>{l.current&&t.target===t.currentTarget&&e(),l.current=!1},children:(0,S.jsxs)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,"data-suspends-terminal":``,tabIndex:-1,className:`flex h-[600px] max-h-full w-[760px] max-w-full flex-col border border-border bg-elevated shadow-2xl outline-none`,children:[(0,S.jsxs)(`header`,{className:`flex h-[48px] shrink-0 items-center justify-between border-b border-border pl-5 pr-2`,children:[(0,S.jsx)(`h2`,{id:`settings-title`,className:`text-[13px] font-semibold uppercase tracking-wider text-primary`,children:`Settings`}),p]}),(0,S.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex w-[192px] shrink-0 flex-col gap-3 border-r border-border p-3`,children:[(0,S.jsx)(jX,{ref:s,value:i,onChange:a}),(0,S.jsx)(AX,{variant:`tabs`,current:f?null:m,onSelect:d,panelId:WX})]}),(0,S.jsx)(`div`,{id:WX,role:f?`region`:`tabpanel`,"aria-label":f?`Search results`:void 0,"aria-labelledby":f?void 0:OX(m),className:`min-w-0 flex-1 overflow-y-auto overflow-x-hidden px-6 py-5`,children:f?(0,S.jsx)(EX,{query:i}):(0,S.jsx)(TX,{page:m,showTitle:!0})})]})]})})}var qX=[];function JX(e){C.useEffect(e,qX)}var YX=C.createContext(void 0);function XX(){let e=C.useContext(YX);if(!e)throw Error(zJ(73));return e}var ZX=Symbol(`NOT_FOUND`);function QX(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function $X(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!=`object`)throw TypeError(t)}function eZ(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var tZ=e=>Array.isArray(e)?e:[e];function nZ(e){let t=Array.isArray(e[0])?e[0]:e;return eZ(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function rZ(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}function iZ(e){let t;return{get(n){return t&&e(t.key,n)?t.value:ZX},put(e,n){t={key:e,value:n}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function aZ(e,t){let n=[];function r(e){let r=n.findIndex(n=>t(e,n.key));if(r>-1){let e=n[r];return r>0&&(n.splice(r,1),n.unshift(e)),e.value}return ZX}function i(t,i){r(t)===ZX&&(n.unshift({key:t,value:i}),n.length>e&&n.pop())}function a(){return n}function o(){n=[]}return{get:r,put:i,getEntries:a,clear:o}}var oZ=(e,t)=>e===t;function sZ(e){return function(t,n){if(t===null||n===null||t.length!==n.length)return!1;let{length:r}=t;for(let i=0;i<r;i++)if(!e(t[i],n[i]))return!1;return!0}}function cZ(e,t){let{equalityCheck:n=oZ,maxSize:r=1,resultEqualityCheck:i}=typeof t==`object`?t:{equalityCheck:t},a=sZ(n),o=0,s=r<=1?iZ(a):aZ(r,a);function c(){let t=s.get(arguments);if(t===ZX){if(t=e.apply(null,arguments),o++,i){let e=s.getEntries().find(e=>i(e.value,t));e&&(t=e.value,o!==0&&o--)}s.put(arguments,t)}return t}return c.clearCache=()=>{s.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var lZ=class{constructor(e){this.value=e}deref(){return this.value}},uZ=typeof WeakRef<`u`?WeakRef:lZ,dZ=0,fZ=1;function pZ(){return{s:dZ,v:void 0,o:null,p:null}}function mZ(e,t={}){let n=pZ(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=pZ(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=pZ(),e.set(n,t)):t=r}}let s=t,c;if(t.s===fZ)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=i?.deref?.()??i;e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new uZ(c):c}return s.s=fZ,s.v=c,c}return o.clearCache=()=>{n=pZ(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function hZ(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),QX(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=mZ,argsMemoizeOptions:u=[],devModeChecks:d={}}={...n,...a},f=tZ(c),p=tZ(u),m=nZ(e),h=s(function(){return t++,o.apply(null,arguments)},...f),g=l(function(){r++;let e=rZ(m,arguments);return i=h.apply(null,e),i},...p);return Object.assign(g,{resultFunc:o,memoizedResultFunc:h,dependencies:m,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var gZ=hZ(mZ),_Z=Object.assign((e,t=gZ)=>{$X(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);let n=Object.keys(e);return t(n.map(t=>e[t]),(...e)=>e.reduce((e,t,r)=>(e[n[r]]=t,e),{}))},{withTypes:()=>_Z}),vZ=hZ({memoize:cZ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}}),yZ=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(zJ(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},bZ=(...e)=>{let t=new WeakMap,n=1,r=e[e.length-1],i=e.length-1||1,a=r.length-i;if(a>3)throw Error(zJ(2));return(i,o,s,c)=>{let l=i.__cacheKey__;l||(l={id:n},i.__cacheKey__=l,n+=1);let u=t.get(l);if(!u){let n=e,i=[void 0,void 0,void 0];switch(a){case 0:break;case 1:n=[...e.slice(0,-1),()=>i[0],r];break;case 2:n=[...e.slice(0,-1),()=>i[0],()=>i[1],r];break;case 3:n=[...e.slice(0,-1),()=>i[0],()=>i[1],()=>i[2],r];break;default:throw Error(zJ(2))}u=vZ(...n),u.selectorArgs=i,t.set(l,u)}switch(u.selectorArgs[0]=o,u.selectorArgs[1]=s,u.selectorArgs[2]=c,a){case 0:return u(i);case 1:return u(i,o);case 2:return u(i,o,s);case 3:return u(i,o,s,c);default:throw Error(`unreachable`)}}},xZ=s((e=>{var t=p();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),SZ=s(((e,t)=>{t.exports=xZ()})),CZ=s((e=>{var t=p(),n=SZ();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),wZ=s(((e,t)=>{t.exports=CZ()})),TZ=[],EZ=void 0;function DZ(){return EZ}function OZ(e){TZ.push(e)}var kZ=SZ(),AZ=wZ(),jZ=VJ(19)?PZ:FZ;function MZ(e,t,n,r,i){return jZ(e,t,n,r,i)}function NZ(e,t,n,r,i){let a=C.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,kZ.useSyncExternalStore)(e.subscribe,a,a)}OZ({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,kZ.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function PZ(e,t,n,r,i){let a=DZ();if(!a)return NZ(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function FZ(e,t,n,r,i){return(0,AZ.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var IZ=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return MZ(this,e,t,n,r)}},LZ=class extends IZ{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){C.useDebugValue(e),NJ(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;NJ(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;NJ(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){C.useDebugValue(e);let n=t!==void 0;NJ(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return C.useDebugValue(e),MZ(this,this.selectors[e],t,n,r)}useContextCallback(e,t){C.useDebugValue(e);let n=wJ(t??LJ);this.context[e]=n}useStateSetter(e){let t=C.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},RZ=null;globalThis.requestAnimationFrame;var zZ=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},BZ=class e{static create(){return new e}static request(e){return zZ.request(e)}static cancel(e){return zZ.cancel(e)}currentId=RZ;request(e){this.cancel(),this.currentId=zZ.request(()=>{this.currentId=RZ,e()})}cancel=()=>{this.currentId!==RZ&&(zZ.cancel(this.currentId),this.currentId=RZ)};disposeEffect=()=>this.cancel};function VZ(){let e=xJ(BZ.create).current;return JX(e.disposeEffect),e}var HZ=0,UZ=class e{static create(){return new e}currentId=HZ;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=HZ,t()},e)}isStarted(){return this.currentId!==HZ}clear=()=>{this.currentId!==HZ&&(clearTimeout(this.currentId),this.currentId=HZ)};disposeEffect=()=>this.clear};function WZ(){let e=xJ(UZ.create).current;return JX(e.disposeEffect),e}var GZ=0;function KZ(e){return GZ+=1,`${e}-${Math.random().toString(36).slice(2,6)}-${GZ}`}function qZ(e){return e?.ownerDocument||document}function JZ(e,t){if(typeof e==`string`)return{description:e};if(typeof e==`function`){let n=e(t);return typeof n==`string`?{description:n}:n}return e}var YZ=typeof navigator<`u`,XZ=tQ(),ZZ=rQ(),QZ=nQ();typeof CSS>`u`||!CSS.supports||CSS.supports(`-webkit-backdrop-filter:none`),XZ.platform===`MacIntel`&&XZ.maxTouchPoints>1||/iP(hone|ad|od)|iOS/.test(XZ.platform),YZ&&/firefox/i.test(QZ);var $Z=YZ&&/apple/i.test(navigator.vendor);YZ&&/Edg/i.test(QZ),YZ&&/android/i.test(ZZ)||/android/i.test(QZ),YZ&&ZZ.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var eQ=QZ.includes(`jsdom/`);function tQ(){if(!YZ)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function nQ(){if(!YZ)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function rQ(){if(!YZ)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function iQ(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function aQ(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&bY(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function oQ(e){return`composedPath`in e?e.composedPath()[0]:e.target}function sQ(e){if(!e||eQ)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}var cQ=bZ(e=>e.toasts,e=>{let t=new Map,n=0,r=0;return e.forEach((e,i)=>{let a=e.transitionStatus===`ending`;t.set(e.id,{value:e,domIndex:i,visibleIndex:a?-1:n,offsetY:r}),r+=e.height||0,a||(n+=1)}),t}),lQ={toasts:yZ(e=>e.toasts),isEmpty:yZ(e=>e.toasts.length===0),toast:yZ(cQ,(e,t)=>e.get(t)?.value),toastIndex:yZ(cQ,(e,t)=>e.get(t)?.domIndex??-1),toastOffsetY:yZ(cQ,(e,t)=>e.get(t)?.offsetY??0),toastVisibleIndex:yZ(cQ,(e,t)=>e.get(t)?.visibleIndex??-1),hovering:yZ(e=>e.hovering),focused:yZ(e=>e.focused),expanded:yZ(e=>e.hovering||e.focused),expandedOrOutOfFocus:yZ(e=>e.hovering||e.focused||!e.isWindowFocused),prevFocusElement:yZ(e=>e.prevFocusElement)},uQ=class extends LZ{timers=new Map;areTimersPaused=!1;constructor(e){super(e,{},lQ)}setFocused(e){this.set(`focused`,e)}setHovering(e){this.set(`hovering`,e)}setIsWindowFocused(e){this.set(`isWindowFocused`,e)}setPrevFocusElement(e){this.set(`prevFocusElement`,e)}setViewport=e=>{this.set(`viewport`,e)};disposeEffect=()=>()=>{this.timers.forEach(e=>{e.timeout?.clear()}),this.timers.clear()};removeToast(e){let t=lQ.toastIndex(this.state,e);if(t===-1)return;this.state.toasts[t]?.onRemove?.();let n=[...this.state.toasts];n.splice(t,1),this.setToasts(n)}addToast=e=>{let{toasts:t,timeout:n,limit:r}=this.state,i=e.id||KZ(`toast`),a={...e,id:i,transitionStatus:`starting`},o=[a,...t],s=o.filter(e=>e.transitionStatus!==`ending`);if(s.length>r){let e=s.length-r,t=s.slice(-e),n=new Set(t.map(e=>e.id));this.setToasts(o.map(e=>{let t=n.has(e.id);return e.limited===t?e:{...e,limited:t}}))}else this.setToasts(o.map(e=>e.limited?{...e,limited:!1}:e));let c=a.timeout??n;return a.type!==`loading`&&c>0&&this.scheduleTimer(i,c,()=>this.closeToast(i)),lQ.expandedOrOutOfFocus(this.state)&&this.pauseTimers(),i};updateToast=(e,t)=>{this.updateToastInternal(e,t)};updateToastInternal=(e,t)=>{let{timeout:n,toasts:r}=this.state,i=lQ.toast(this.state,e)??null;if(!i||i.transitionStatus===`ending`)return;let a={...i,...t};this.setToasts(r.map(n=>n.id===e?{...n,...t}:n));let o=a.timeout??n,s=i?.timeout??n,c=Object.hasOwn(t,`timeout`),l=a.transitionStatus!==`ending`&&a.type!==`loading`&&o>0,u=this.timers.has(e),d=s!==o,f=i?.type===`loading`;if(!l&&u){this.timers.get(e)?.timeout?.clear(),this.timers.delete(e);return}if(l&&(!u||d||c||f)){let t=this.timers.get(e);t&&(t.timeout?.clear(),this.timers.delete(e)),this.scheduleTimer(e,o,()=>this.closeToast(e)),lQ.expandedOrOutOfFocus(this.state)&&this.pauseTimers()}};closeToast=e=>{lQ.toast(this.state,e)?.onClose?.();let{limit:t,toasts:n}=this.state,r=0,i=n.map(n=>{if(n.id===e)return{...n,transitionStatus:`ending`,height:0};if(n.transitionStatus===`ending`)return n;let i=r>=t;return r+=1,n.limited===i?n:{...n,limited:i}}),a=this.timers.get(e);a&&a.timeout&&(a.timeout.clear(),this.timers.delete(e)),this.handleFocusManagement(e),this.setToasts(i)};promiseToast=(e,t)=>{let n=JZ(t.loading),r=this.addToast({...n,type:`loading`}),i=e.then(e=>{let n=JZ(t.success,e);return this.updateToast(r,{...n,type:`success`,timeout:n.timeout}),e}).catch(e=>{let n=JZ(t.error,e);return this.updateToast(r,{...n,type:`error`,timeout:n.timeout}),Promise.reject(e)});return{}.hasOwnProperty.call(t,`setPromise`)&&t.setPromise(i),i};pauseTimers(){this.areTimersPaused||(this.areTimersPaused=!0,this.timers.forEach(e=>{if(e.timeout){e.timeout.clear();let t=Date.now()-e.start,n=e.delay-t;e.remaining=n>0?n:0}}))}resumeTimers(){this.areTimersPaused&&(this.areTimersPaused=!1,this.timers.forEach((e,t)=>{e.remaining=e.remaining>0?e.remaining:e.delay,e.timeout??=UZ.create(),e.timeout.start(e.remaining,()=>{this.timers.delete(t),e.callback()}),e.start=Date.now()}))}restoreFocusToPrevElement(){this.state.prevFocusElement?.focus({preventScroll:!0})}handleDocumentPointerDown=e=>{if(e.pointerType!==`touch`)return;let t=oQ(e);aQ(this.state.viewport,t)||(this.resumeTimers(),this.update({hovering:!1,focused:!1}))};scheduleTimer(e,t,n){let r=Date.now(),i=!lQ.expandedOrOutOfFocus(this.state),a=i?UZ.create():void 0;a?.start(t,()=>{this.timers.delete(e),n()}),this.timers.set(e,{timeout:a,start:i?r:0,delay:t,remaining:t,callback:n})}setToasts(e){let t={toasts:e};e.length===0&&(t.hovering=!1,t.focused=!1),this.update(t)}handleFocusManagement(e){let t=iQ(qZ(this.state.viewport));if(!this.state.viewport||!aQ(this.state.viewport,t)||!sQ(t))return;let n=lQ.toasts(this.state),r=lQ.toastIndex(this.state,e),i=null,a=r+1;for(;a<n.length;){if(n[a].transitionStatus!==`ending`){i=n[a];break}a+=1}if(!i)for(a=r-1;a>=0;){if(n[a].transitionStatus!==`ending`){i=n[a];break}--a}i?i.ref?.current?.focus():this.restoreFocusToPrevElement()}},dQ=function(e){let{children:t,timeout:n=5e3,limit:r=3,toastManager:i}=e,a=xJ(()=>new uQ({timeout:n,limit:r,viewport:null,toasts:[],hovering:!1,focused:!1,isWindowFocused:!0,prevFocusElement:null})).current;return JX(a.disposeEffect),C.useEffect(function(){if(i)return i[` subscribe`](({action:e,options:t})=>{let n=t.id;e===`promise`&&t.promise?a.promiseToast(t.promise,t):e===`update`&&n?a.updateToast(n,t):e===`close`&&n?a.closeToast(n):a.addToast(t)})},[a,n,i]),a.useSyncedValues({timeout:n,limit:r}),(0,S.jsx)(YX.Provider,{value:a,children:t})},fQ=C.forwardRef(function(e,t){let[n,r]=C.useState();NJ(()=>{$Z&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,S.jsx)(`span`,{...e,ref:t,style:FJ,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),pQ=function(e){return e.frontmostHeight=`--toast-frontmost-height`,e}({}),mQ=C.forwardRef(function(e,t){let{render:n,className:r,children:i,...a}=e,o=XX(),s=WZ(),c=C.useRef(!1),l=C.useRef(!1),u=o.useState(`isEmpty`),d=o.useState(`toasts`),f=o.useState(`focused`),p=o.useState(`expanded`),m=o.useState(`prevFocusElement`),h=d[0]?.height??0,g=C.useMemo(()=>d.some(e=>e.transitionStatus===`ending`),[d]);C.useEffect(()=>{let e=o.state.viewport;if(!e)return;function t(t){u||t.key===`F6`&&t.target!==e&&(t.preventDefault(),o.setPrevFocusElement(iQ(qZ(e))),e?.focus({preventScroll:!0}),o.pauseTimers(),o.setFocused(!0))}let n=_Y(e);return n.addEventListener(`keydown`,t),()=>{n.removeEventListener(`keydown`,t)}},[o,u]),C.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=_Y(e);function n(e){e.target===t&&(o.setIsWindowFocused(!1),o.pauseTimers())}function r(n){if(n.relatedTarget||n.target===t)return;let r=oQ(n),i=iQ(qZ(e));(!aQ(e,r)||!sQ(i))&&o.resumeTimers(),s.start(0,()=>o.setIsWindowFocused(!0))}return t.addEventListener(`blur`,n,!0),t.addEventListener(`focus`,r,!0),()=>{t.removeEventListener(`blur`,n,!0),t.removeEventListener(`focus`,r,!0)}},[o,s,u]),C.useEffect(()=>{let e=o.state.viewport;if(!e||u)return;let t=qZ(e);return t.addEventListener(`pointerdown`,o.handleDocumentPointerDown,!0),()=>{t.removeEventListener(`pointerdown`,o.handleDocumentPointerDown,!0)}},[u,o]);function _(e){let t=o.state.viewport;t&&(c.current=!0,e.relatedTarget===t?d[0]?.ref?.current?.focus():o.restoreFocusToPrevElement())}function v(e){e.key===`Tab`&&e.shiftKey&&e.target===o.state.viewport&&(e.preventDefault(),o.restoreFocusToPrevElement(),o.resumeTimers())}C.useEffect(()=>{!o.state.isWindowFocused||g||!l.current||(o.resumeTimers(),o.setHovering(!1),l.current=!1)},[g,o]);function y(){o.pauseTimers(),o.setHovering(!0),l.current=!1}function b(){g?l.current=!0:(o.resumeTimers(),o.setHovering(!1))}function x(){if(c.current){c.current=!1;return}f||sQ(qZ(o.state.viewport).activeElement)&&(o.setFocused(!0),o.pauseTimers())}function w(e){!f||aQ(o.state.viewport,e.relatedTarget)||(o.setFocused(!1),o.resumeTimers())}let T={tabIndex:-1,role:`region`,"aria-live":`polite`,"aria-atomic":!1,"aria-relevant":`additions text`,"aria-label":`Notifications`,onMouseEnter:y,onMouseMove:y,onMouseLeave:b,onFocus:x,onBlur:w,onKeyDown:v,onClick:x},E={expanded:p},D=aY(`div`,e,{ref:[t,o.setViewport],state:E,props:[T,{style:{[pQ.frontmostHeight]:h?`${h}px`:void 0}},a,{children:(0,S.jsxs)(C.Fragment,{children:[!u&&m&&(0,S.jsx)(fQ,{onFocus:_}),i,!u&&m&&(0,S.jsx)(fQ,{onFocus:_})]})}]}),O=C.useMemo(()=>d.filter(e=>e.priority===`high`),[d]);return(0,S.jsxs)(C.Fragment,{children:[!u&&m&&(0,S.jsx)(fQ,{onFocus:_}),D,!f&&O.length>0&&(0,S.jsx)(`div`,{style:FJ,children:O.map(e=>(0,S.jsxs)(`div`,{role:`alert`,"aria-atomic":!0,children:[(0,S.jsx)(`div`,{children:e.title}),(0,S.jsx)(`div`,{children:e.description})]},e.id))})]})});function hQ(e){return VJ(19)?e:e?`true`:void 0}var gQ=C.createContext(void 0);function _Q(){let e=C.useContext(gQ);if(!e)throw Error(zJ(66));return e}var vQ=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),yQ={[vQ.startingStyle]:``},bQ={[vQ.endingStyle]:``},xQ={transitionStatus(e){return e===`starting`?yQ:e===`ending`?bQ:null}};function SQ(e){return e==null?e:`current`in e?e.current:e}function CQ(e,t=!1,n=!0){let r=VZ();return wJ((i,a=null)=>{r.cancel();function o(){Vd.flushSync(i)}let s=SQ(e);if(s==null)return;let c=s;if(typeof c.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{function e(){let e=vQ.startingStyle;if(!c.hasAttribute(e)){r.request(i);return}let t=new MutationObserver(()=>{c.hasAttribute(e)||(t.disconnect(),i())});t.observe(c,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0})}function i(){Promise.all(c.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||o()}).catch(()=>{let e=c.getAnimations();if(n){if(a?.aborted)return;o()}else e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&i()})}if(t){e();return}r.request(i)}})}function wQ(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=wJ(i),o=CQ(r,n,!1);C.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var TQ=function(e){return e.index=`--toast-index`,e.offsetY=`--toast-offset-y`,e.height=`--toast-height`,e.swipeMovementX=`--toast-swipe-movement-x`,e.swipeMovementY=`--toast-swipe-movement-y`,e}({}),EQ={...xQ,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},DQ=40,OQ=10,kQ=.5,AQ=1;function jQ(e,t,n){switch(e){case`up`:return-n;case`down`:return n;case`left`:return-t;case`right`:return t;default:return 0}}function MQ(e){let t=window.getComputedStyle(e).transform,n=0,r=0,i=1;if(t&&t!==`none`){let e=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(e){let t=e[1].split(`, `).map(parseFloat);t.length===6?(n=t[4],r=t[5],i=Math.sqrt(t[0]*t[0]+t[1]*t[1])):t.length===16&&(n=t[12],r=t[13],i=t[0])}}return{x:n,y:r,scale:i}}var NQ=C.forwardRef(function(e,t){let{toast:n,render:r,className:i,swipeDirection:a=[`down`,`right`],...o}=e,s=n.positionerProps?.anchor!==void 0,c=[];s||(c=Array.isArray(a)?a:[a]);let l=c.length>0,u=XX(),[d,f]=C.useState(void 0),[p,m]=C.useState(!1),[h,g]=C.useState(!1),[_,v]=C.useState(!1),[y,b]=C.useState({x:0,y:0}),[x,w]=C.useState({x:0,y:0,scale:1}),[T,E]=C.useState(),[D,O]=C.useState(),[k,A]=C.useState(null),j=C.useRef(null),M=C.useRef({x:0,y:0}),N=C.useRef({x:0,y:0,scale:1}),P=C.useRef(void 0),F=C.useRef(0),I=C.useRef(!1),L=C.useRef({x:0,y:0}),ee=C.useRef(!1),R=u.useState(`toastIndex`,n.id),z=u.useState(`toastVisibleIndex`,n.id),B=u.useState(`toastOffsetY`,n.id),te=u.useState(`focused`),V=u.useState(`expanded`);wQ({open:n.transitionStatus!==`ending`,ref:j,onComplete(){n.transitionStatus===`ending`&&u.removeToast(n.id)}});let H=wJ((e=!1)=>{let t=j.current;if(!t)return;let r=t.style.height;t.style.height=`auto`;let i=t.offsetHeight;t.style.height=r;function a(){u.updateToastInternal(n.id,{ref:j,height:i,...n.transitionStatus===`starting`?{transitionStatus:void 0}:{}})}e?Vd.flushSync(a):a()});NJ(H,[H]);function ne(e,t){let n=e,r=t;return!c.includes(`left`)&&!c.includes(`right`)?n=e>0?e**kQ:-(Math.abs(e)**kQ):(!c.includes(`right`)&&e>0&&(n=e**kQ),!c.includes(`left`)&&e<0&&(n=-(Math.abs(e)**kQ))),!c.includes(`up`)&&!c.includes(`down`)?r=t>0?t**kQ:-(Math.abs(t)**kQ):(!c.includes(`down`)&&t>0&&(r=t**kQ),!c.includes(`up`)&&t<0&&(r=-(Math.abs(t)**kQ))),{x:n,y:r}}function re(e){if(e.button!==0)return;e.pointerType===`touch`&&u.pauseTimers();let t=oQ(e.nativeEvent);if(!(t&&t.closest(`button,a,input,textarea,[role="button"],[data-swipe-ignore]`))){if(I.current=!1,P.current=void 0,F.current=0,M.current={x:e.clientX,y:e.clientY},L.current=M.current,j.current){let e=MQ(j.current);N.current=e,w(e),b({x:e.x,y:e.y})}u.setHovering(!0),m(!0),g(!1),A(null),ee.current=!0,j.current?.setPointerCapture(e.pointerId)}}function ie(e){if(!p)return;e.preventDefault(),ee.current&&=(M.current={x:e.clientX,y:e.clientY},!1);let{clientY:t,clientX:n,movementX:r,movementY:i}=e;(i<0&&t>L.current.y||i>0&&t<L.current.y)&&(L.current={x:L.current.x,y:t}),(r<0&&n>L.current.x||r>0&&n<L.current.x)&&(L.current={x:n,y:L.current.y});let a=n-M.current.x,o=t-M.current.y,s=t-L.current.y,l=n-L.current.x;if(!h&&Math.sqrt(a*a+o*o)>=AQ&&(g(!0),k===null)){let e=c.includes(`left`)||c.includes(`right`),t=c.includes(`up`)||c.includes(`down`);e&&t&&A(Math.abs(a)>Math.abs(o)?`horizontal`:`vertical`)}let u;if(!P.current)k===`vertical`?o>0?u=`down`:o<0&&(u=`up`):k===`horizontal`?a>0?u=`right`:a<0&&(u=`left`):u=Math.abs(a)>=Math.abs(o)?a>0?`right`:`left`:o>0?`down`:`up`,u&&c.includes(u)&&(P.current=u,F.current=jQ(u,a,o),f(u));else{let e=P.current,t=jQ(e,l,s);t>DQ?(I.current=!1,f(e)):!(c.includes(`left`)&&c.includes(`right`))&&!(c.includes(`up`)&&c.includes(`down`))&&F.current-t>=OQ&&(I.current=!0)}let d=ne(a,o),m=N.current.x,_=N.current.y;k===`horizontal`?(c.includes(`left`)||c.includes(`right`))&&(m+=d.x):(k===`vertical`||(c.includes(`left`)||c.includes(`right`))&&(m+=d.x),(c.includes(`up`)||c.includes(`down`))&&(_+=d.y)),b({x:m,y:_})}function U(e){if(!p)return;if(m(!1),g(!1),A(null),j.current?.releasePointerCapture(e.pointerId),I.current){b({x:x.x,y:x.y}),f(void 0);return}let t=!1,r=y.x-x.x,i=y.y-x.y,a;for(let e of c){switch(e){case`right`:r>DQ&&(t=!0,a=`right`);break;case`left`:r<-DQ&&(t=!0,a=`left`);break;case`down`:i>DQ&&(t=!0,a=`down`);break;case`up`:i<-DQ&&(t=!0,a=`up`);break;default:break}if(t)break}t?(f(a),v(!0),u.closeToast(n.id)):(b({x:x.x,y:x.y}),f(void 0))}function ae(e){if(e.key===`Escape`){if(!j.current||!aQ(j.current,iQ(qZ(j.current))))return;u.closeToast(n.id)}}C.useEffect(()=>{if(!l)return;let e=j.current;if(!e)return;function t(t){aQ(e,t.target)&&t.preventDefault()}return e.addEventListener(`touchmove`,t,{passive:!1}),()=>{e.removeEventListener(`touchmove`,t)}},[l]);function oe(){if(!p&&y.x===x.x&&y.y===x.y&&!_)return{[TQ.swipeMovementX]:`0px`,[TQ.swipeMovementY]:`0px`};let e=y.x-x.x,t=y.y-x.y;return{transition:p?`none`:void 0,transform:p?`translateX(${y.x}px) translateY(${y.y}px) scale(${x.scale})`:void 0,[TQ.swipeMovementX]:`${e}px`,[TQ.swipeMovementY]:`${t}px`}}let se=n.priority===`high`,ce={role:se?`alertdialog`:`dialog`,tabIndex:0,"aria-modal":!1,"aria-labelledby":T,"aria-describedby":D,"aria-hidden":se&&!te?!0:void 0,onPointerDown:l?re:void 0,onPointerMove:l?ie:void 0,onPointerUp:l?U:void 0,onKeyDown:ae,inert:hQ(n.limited),style:{...oe(),[TQ.index]:n.transitionStatus===`ending`?R:z,[TQ.offsetY]:`${B}px`,[TQ.height]:n.height?`${n.height}px`:void 0}},le=C.useMemo(()=>({rootRef:j,toast:n,titleId:T,setTitleId:E,descriptionId:D,setDescriptionId:O,swiping:p,swipeDirection:d,recalculateHeight:H,index:R,visibleIndex:z,expanded:V}),[n,T,D,p,d,H,R,z,V]),ue={transitionStatus:n.transitionStatus,expanded:V,limited:n.limited||!1,type:n.type,swiping:le.swiping,swipeDirection:le.swipeDirection},de=aY(`div`,e,{ref:[t,le.rootRef],state:ue,stateAttributesMapping:EQ,props:[ce,o]});return(0,S.jsx)(gQ.Provider,{value:le,children:de})}),PQ=C.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setDescriptionId:c}=_Q(),l=a??s.description,u=!!l,d=mY(i);NJ(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=aY(`p`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),FQ=C.forwardRef(function(e,t){let{render:n,className:r,id:i,children:a,...o}=e,{toast:s,setTitleId:c}=_Q(),l=a??s.title,u=!!l,d=mY(i);NJ(()=>{if(u)return c(d),()=>{c(void 0)}},[u,d,c]);let f=aY(`h2`,e,{ref:t,state:{type:s.type},props:{...o,id:d,children:l}});return u?f:null}),IQ=C.forwardRef(function(e,t){let{render:n,className:r,disabled:i,nativeButton:a=!0,...o}=e,s=XX(),{toast:c}=_Q(),l=s.useState(`expanded`),[u,d]=C.useState(!1),{getButtonProps:f,buttonRef:p}=wY({disabled:i,native:a}),m={type:c.type};return aY(`button`,e,{ref:[t,p],state:m,props:[{"aria-hidden":!l&&!u,onClick(){s.closeToast(c.id)},onFocus(){d(!0)},onBlur(){d(!1)}},o,f]})});function LQ(){let e=C.useContext(YX);if(!e)throw Error(zJ(73));let t=e.useState(`toasts`);return C.useMemo(()=>({toasts:t,add:e.addToast,close:e.closeToast,update:e.updateToast,promise:e.promiseToast}),[t,e])}function RQ(){let e=new Set;function t(t){e.forEach(e=>e(t))}return{" subscribe":function(t){return e.add(t),()=>{e.delete(t)}},add(e){let n=e.id||KZ(`toast`);return t({action:`add`,options:{...e,id:n,transitionStatus:`starting`}}),n},close(e){t({action:`close`,options:{id:e}})},update(e,n){t({action:`update`,options:{...n,id:e}})},promise(e,n){let r=e;return t({action:`promise`,options:{...n,promise:e,setPromise(e){r=e}}}),r}}}var zQ=5e3,BQ=RQ();function VQ({toast:e}){return(0,S.jsxs)(NQ,{toast:e,className:l_(`relative flex w-80 items-start gap-3 border bg-elevated p-4 shadow-lg`,`data-[swipe=move]:translate-x-[var(--toast-swipe-move-x)]`,`data-[ending-style]:translate-x-[var(--toast-swipe-end-x)]`,`data-[ending-style]:opacity-0`,`data-[starting-style]:translate-y-2 data-[starting-style]:opacity-0`,`transition-all duration-200`,e.type===`error`&&`border-danger/50`,e.type===`success`&&`border-approval/50`,(!e.type||e.type===`info`)&&`border-border`),children:[(0,S.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,S.jsx)(FQ,{className:l_(`text-sm font-medium`,e.type===`error`&&`text-danger`,e.type===`success`&&`text-approval`,(!e.type||e.type===`info`)&&`text-primary`),children:e.title}),e.description&&(0,S.jsx)(PQ,{className:`mt-1 text-xs text-muted line-clamp-2`,children:e.description})]}),(0,S.jsx)(IQ,{className:`shrink-0 text-muted hover:text-primary transition-colors`,"aria-label":`Close`,children:(0,S.jsx)(Fe,{width:G.default,height:G.default})})]})}function HQ(){let{toasts:e}=LQ();return(0,S.jsx)(S.Fragment,{children:e.map(e=>(0,S.jsx)(VQ,{toast:e},e.id))})}function UQ(){return(0,S.jsxs)(dQ,{timeout:zQ,toastManager:BQ,children:[(0,S.jsx)(HQ,{}),(0,S.jsx)(mQ,{className:`fixed bottom-4 right-4 z-[100] flex flex-col gap-2`})]})}var WQ=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],GQ=3e3,KQ=8e3,qQ=15e3,JQ=5e3,YQ=2e4,XQ=1e4,ZQ=1500,QQ=5e3,$Q=750,e$=4,t$=5e3,n$=new class{constructor(){this.ws=null,this.listeners=new Set,this.statusListeners=new Set,this.status=`connecting`,this.error=null,this.reconnectAttempts=0,this.reconnectTimer=null,this.connectTimer=null,this.manualClose=!1,this.lastTick=Date.now(),this.wakeCheckInterval=null,this.lifecycleStarted=!1,this.heartbeatTimer=null,this.pongTimer=null,this.lastForceReconnectTs=0,this.lastConnectTs=0,this.pingSeq=0,this.connectionEpoch=0,this.consecutiveFailures=0,this.stallCount=0,this.isResumeAttempt=!1,this.leakedSockets=new Set,this.verifyTimer=null,this.onVisibilityChange=()=>{if(KO(`ws_visibility`,{state:document.visibilityState,...this.wsSnap()},`info`),document.visibilityState===`visible`){let e=Date.now(),t=e-this.lastTick;this.lastTick=e,KO(`ws_resume`,{gapMs:t,...this.wsSnap()},`info`),this.ws?.readyState===WebSocket.OPEN?this.verifyConnection():this.forceReconnect(`visibilitychange`,!0)}else this.stopHeartbeat(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null)},this.onPageShow=e=>{KO(`ws_pageshow`,{persisted:e.persisted,...this.wsSnap()},`info`),e.persisted&&(this.lastTick=Date.now(),this.forceReconnect(`pageshow`,!0))}}wsSnap(){return{status:this.status,ws:this.ws?WQ[this.ws.readyState]:null,attempt:this.reconnectAttempts,failures:this.consecutiveFailures,stalls:this.stallCount,leaked:this.leakedSockets.size,online:typeof navigator<`u`?navigator.onLine:void 0,verifying:this.verifyTimer!==null,buffered:this.ws?this.ws.bufferedAmount:void 0}}connect(){if(this.ws){let e=this.ws.readyState===WebSocket.OPEN;if(e&&this.status===`connected`){KO(`ws_connect_skip`,{reason:`already_open`,...this.wsSnap()});return}let t=Date.now();if(this.ws.readyState===WebSocket.CONNECTING&&t-this.lastConnectTs<200){KO(`ws_connect_skip`,{reason:`already_connecting`,...this.wsSnap()});return}KO(`ws_connect_destroy_zombie`,{reason:e?`open_desynced`:`not_open`,...this.wsSnap()}),this.destroySocket()}this.manualClose=!1,this.clearConnectTimer(),this.setStatus(`connecting`);let e=`${window.location.protocol===`https:`?`wss`:`ws`}://${window.location.host}/ws`;KO(`ws_connect`,{url:e,resume:this.isResumeAttempt,...this.wsSnap()},`info`);let t=new WebSocket(e);this.ws=t,this.lastConnectTs=Date.now(),this.leakedSockets.add(t);let n=this.isResumeAttempt?KQ:GQ;this.isResumeAttempt=!1,this.connectTimer=window.setTimeout(()=>{this.ws===t&&(this.connectTimer=null,t.readyState===WebSocket.OPEN&&this.status===`connected`||(KO(`ws_connect_timeout`,{wsState:WQ[t.readyState],managerStatus:this.status,timeoutMs:n,...this.wsSnap()},`info`),this.consecutiveFailures+=1,this.destroySocket(),this.scheduleReconnect()))},n),t.onopen=()=>{if(this.ws!==t){KO(`ws_onopen_stale`,this.wsSnap(),`info`);return}KO(`ws_onopen`,this.wsSnap(),`info`),this.clearConnectTimer(),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.connectionEpoch+=1,this.leakedSockets.delete(t),this.setStatus(`connected`),this.startHeartbeat()},t.onmessage=e=>{try{let t=e.data,n=performance.now(),r=JSON.parse(t),i=performance.now()-n,a=r;if(a._parseMs=Math.round(i),a._rawLength=t.length,r.type===`pong`){r.seq===this.pingSeq&&(this.clearPongTimer(),this.verifyTimer!==null&&(this.cancelVerify(),KO(`ws_verify_ok`,this.wsSnap(),`info`),this.startHeartbeat(QQ)));return}this.listeners.forEach(e=>e(r))}catch{}},t.onerror=()=>{this.ws===t&&(KO(`ws_onerror`,this.wsSnap(),`info`),this.clearConnectTimer())},t.onclose=e=>{if(this.ws!==t){KO(`ws_onclose_stale`,{code:e.code,...this.wsSnap()},`info`);return}KO(`ws_onclose`,{code:e.code,reason:e.reason,clean:e.wasClean,...this.wsSnap()},`info`),this.clearConnectTimer(),this.cancelVerify(),this.consecutiveFailures+=1,this.ws=null,this.manualClose?this.setStatus(`disconnected`):this.scheduleReconnect()}}disconnect(){this.manualClose=!0,this.clearConnectTimer(),this.cancelVerify(),this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),this.setStatus(`disconnected`)}startLifecycleListeners(){this.lifecycleStarted||typeof document>`u`||typeof window>`u`||(this.lifecycleStarted=!0,document.addEventListener(`visibilitychange`,this.onVisibilityChange),window.addEventListener(`pageshow`,this.onPageShow),this.lastTick=Date.now(),this.wakeCheckInterval=window.setInterval(()=>{let e=Date.now(),t=e-this.lastTick;this.isHidden()||(t>qQ&&(KO(`ws_time_jump`,{gapMs:t,...this.wsSnap()},`info`),this.forceReconnect(`time_jump`,!0)),this.lastTick=e)},JQ))}stopLifecycleListeners(){this.lifecycleStarted&&(this.lifecycleStarted=!1,document.removeEventListener(`visibilitychange`,this.onVisibilityChange),window.removeEventListener(`pageshow`,this.onPageShow),this.wakeCheckInterval!==null&&(window.clearInterval(this.wakeCheckInterval),this.wakeCheckInterval=null))}send(e){if(this.ws?.readyState!==WebSocket.OPEN)return!1;try{return this.ws.send(JSON.stringify(e)),!0}catch(t){return KO(`ws_send_error`,{messageType:e.type,error:t instanceof Error?t.message:String(t),...this.wsSnap()},`info`),this.destroySocket(),this.scheduleReconnect(),!1}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}subscribeStatus(e){return this.statusListeners.add(e),e(this.status,this.error,this.connectionEpoch),()=>this.statusListeners.delete(e)}getStatus(){return this.status}getConnectionEpoch(){return this.connectionEpoch}verifyConnection(){this.cancelVerify(),this.stopHeartbeat(),this.pingSeq+=1;let e=this.pingSeq,t=this.ws;if(KO(`ws_verify`,{seq:e,...this.wsSnap()},`info`),!this.send({type:`ping`,seq:e})){KO(`ws_verify_send_fail`,this.wsSnap(),`info`),this.forceReconnect(`verify_send_fail`,!0);return}this.verifyTimer=window.setTimeout(()=>{this.verifyTimer=null,this.ws===t&&(KO(`ws_verify_timeout`,this.wsSnap(),`info`),this.forceReconnect(`verify_timeout`,!0))},ZQ)}cancelVerify(){this.verifyTimer!==null&&(window.clearTimeout(this.verifyTimer),this.verifyTimer=null)}forceReconnect(e=`unknown`,t=!1){if(this.manualClose){KO(`ws_force_skip`,{trigger:e,reason:`manual_close`});return}let n=Date.now(),r=t?200:500;if(n-this.lastForceReconnectTs<r){KO(`ws_force_skip`,{trigger:e,reason:`debounce`,force:t});return}if(!t&&this.ws?.readyState===WebSocket.OPEN&&this.status===`connected`){KO(`ws_force_skip`,{trigger:e,reason:`already_connected`});return}this.lastForceReconnectTs=n,KO(`ws_force_reconnect`,{trigger:e,force:t,...this.wsSnap()},`info`),this.reconnectAttempts=0,this.consecutiveFailures=0,this.stallCount=0,this.reconnectTimer&&=(window.clearTimeout(this.reconnectTimer),null),this.destroySocket(),t?(this.purgeLeakedSockets(),this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},$Q)):this.connect()}startHeartbeat(e){this.stopHeartbeat();let t=()=>{this.ws?.readyState===WebSocket.OPEN&&(this.pingSeq+=1,this.send({type:`ping`,seq:this.pingSeq})&&(this.clearPongTimer(),this.pongTimer=window.setTimeout(()=>{this.pongTimer=null,KO(`ws_pong_timeout`,this.wsSnap(),`info`),this.destroySocket(),this.scheduleReconnect()},XQ)))};e!==void 0&&e<YQ?this.heartbeatTimer=window.setTimeout(()=>{t(),this.heartbeatTimer=window.setInterval(t,YQ)},e):this.heartbeatTimer=window.setInterval(t,YQ)}stopHeartbeat(){this.heartbeatTimer!==null&&(window.clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null),this.clearPongTimer()}clearPongTimer(){this.pongTimer!==null&&(window.clearTimeout(this.pongTimer),this.pongTimer=null)}setStatus(e,t=null){this.status=e,this.error=t,this.statusListeners.forEach(n=>n(e,t,this.connectionEpoch))}scheduleReconnect(){if(this.stopHeartbeat(),this.isHidden()){KO(`ws_schedule_skip`,{reason:`hidden`,...this.wsSnap()}),this.setStatus(`reconnecting`);return}if(this.consecutiveFailures>=e$){KO(`ws_stall_detected`,this.wsSnap(),`info`),this.purgeLeakedSockets();let e=Math.min(t$*2**this.stallCount,3e4);this.stallCount+=1,this.consecutiveFailures=0,this.reconnectAttempts=0,this.isResumeAttempt=!0,this.setStatus(`reconnecting`),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e);return}this.reconnectAttempts+=1;let e=Math.min(1e3*2**(this.reconnectAttempts-1),3e4);KO(`ws_schedule_reconnect`,{delay:e,...this.wsSnap()}),this.setStatus(`reconnecting`),this.reconnectTimer&&window.clearTimeout(this.reconnectTimer),this.reconnectTimer=window.setTimeout(()=>{this.reconnectTimer=null,this.connect()},e)}isHidden(){return typeof document<`u`&&document.visibilityState===`hidden`}clearConnectTimer(){this.connectTimer&&=(window.clearTimeout(this.connectTimer),null)}destroySocket(){if(this.clearConnectTimer(),this.stopHeartbeat(),this.cancelVerify(),!this.ws)return;let e=this.ws;this.ws=null,this.leakedSockets.add(e),e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}purgeLeakedSockets(){if(this.leakedSockets.size!==0){KO(`ws_purge_leaked`,{count:this.leakedSockets.size},`info`);for(let e of this.leakedSockets)try{e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null,e.close()}catch{}this.leakedSockets.clear()}}};function r$(){let e=Sh(e=>e.setConnectionState);return(0,C.useEffect)(()=>{n$.connect(),n$.startLifecycleListeners();let t=n$.subscribeStatus((t,n,r)=>{e(t,n,r)});return()=>{t(),n$.stopLifecycleListeners()}},[e]),{sendMessage:(0,C.useMemo)(()=>e=>{n$.send(e)},[]),subscribe:(0,C.useMemo)(()=>n$.subscribe.bind(n$),[]),getConnectionEpoch:(0,C.useMemo)(()=>()=>n$.getConnectionEpoch(),[])}}var i$=100;function a$({viewport:e,win:t,doc:n}){if(!e)return!1;let r=Math.max(0,e.offsetTop||0),i=Math.max(0,e.offsetLeft||0),a=t.innerHeight-(e.height+r),o=Math.max(0,a),s=Math.max(0,e.height||0),c=Math.max(0,e.width||0);return n.documentElement.style.setProperty(`--keyboard-inset`,`${o}px`),n.documentElement.style.setProperty(`--viewport-offset-top`,`${r}px`),n.documentElement.style.setProperty(`--viewport-offset-left`,`${i}px`),n.documentElement.style.setProperty(`--visual-viewport-height`,`${s}px`),n.documentElement.style.setProperty(`--visual-viewport-width`,`${c}px`),o>i$?n.documentElement.classList.add(`keyboard-visible`):n.documentElement.classList.remove(`keyboard-visible`),!0}function o$(e){e.documentElement.style.removeProperty(`--keyboard-inset`),e.documentElement.style.removeProperty(`--viewport-offset-top`),e.documentElement.style.removeProperty(`--viewport-offset-left`),e.documentElement.style.removeProperty(`--visual-viewport-height`),e.documentElement.style.removeProperty(`--visual-viewport-width`),e.documentElement.classList.remove(`keyboard-visible`)}function s$(){(0,C.useEffect)(()=>{let e=window.visualViewport;if(!e)return;let t=null,n=null,r=()=>{let e=document.activeElement;if(!e)return!1;let t=e.tagName?.toLowerCase();return t===`input`||t===`textarea`?!0:!!e.isContentEditable},i=()=>{a$({viewport:e,win:window,doc:document})},a=()=>{if(typeof window.requestAnimationFrame!=`function`){i();return}t!==null&&window.cancelAnimationFrame(t);let e=performance.now(),n=()=>{i(),t=performance.now()-e<1500?window.requestAnimationFrame(n):null};t=window.requestAnimationFrame(n)},o=()=>{if(!r()){c();return}i()},s=()=>{n!==null||typeof window.setInterval!=`function`||(n=window.setInterval(o,250),o())},c=()=>{n===null||typeof window.clearInterval!=`function`||(window.clearInterval(n),n=null)},l=()=>{r()?(a(),s(),i()):c()},u=()=>{l()},d=()=>{l()},f=()=>{a()};return i(),l(),e.addEventListener(`resize`,i),e.addEventListener(`scroll`,i),typeof window.addEventListener==`function`&&(window.addEventListener(`resize`,i),window.addEventListener(`orientationchange`,f)),typeof document.addEventListener==`function`&&(document.addEventListener(`focusin`,u),document.addEventListener(`focusout`,d),document.addEventListener(`focus`,u,!0),document.addEventListener(`blur`,d,!0)),()=>{e.removeEventListener(`resize`,i),e.removeEventListener(`scroll`,i),typeof window.removeEventListener==`function`&&(window.removeEventListener(`resize`,i),window.removeEventListener(`orientationchange`,f)),typeof document.removeEventListener==`function`&&(document.removeEventListener(`focusin`,u),document.removeEventListener(`focusout`,d),document.removeEventListener(`focus`,u,!0),document.removeEventListener(`blur`,d,!0)),t!==null&&typeof window.cancelAnimationFrame==`function`&&window.cancelAnimationFrame(t),c(),o$(document)}},[])}var c$=[`theme`,`commandPresets`,`defaultPresetId`,`defaultProjectDir`,`lastProjectPath`,`recentPaths`,`sessionSortMode`,`sessionSortDirection`,`manualSessionOrder`,`sidebarAnchor`,`projectFilters`,`hostFilters`,`showProjectName`,`showLastUserMessage`,`showSessionIdPrefix`,`soundOnPermission`,`soundOnIdle`],l$=[`claude`,`claude-rp`,`codex`,`pi`,`devin`,`grok`,`omp`];function u$(e){return typeof e==`boolean`}function d$(e,t){return Array.isArray(e)&&e.length<=t&&e.every(e=>typeof e==`string`)}function f$(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.id==`string`&&t.id.length>=1&&t.id.length<=128&&typeof t.label==`string`&&t.label.trim().length>=1&&t.label.length<=64&&typeof t.command==`string`&&t.command.trim().length>=1&&t.command.length<=1024&&typeof t.isBuiltIn==`boolean`&&(t.agentType===void 0||l$.includes(t.agentType))}var p$={theme:e=>e===`dark`||e===`light`||e===`system`,commandPresets:e=>Array.isArray(e)&&e.length<=50&&e.every(f$),defaultPresetId:e=>typeof e==`string`&&e.length<=128,defaultProjectDir:e=>typeof e==`string`&&e.length<=4096,lastProjectPath:e=>e===null||typeof e==`string`&&e.length<=4096,recentPaths:e=>d$(e,50),sessionSortMode:e=>e===`status`||e===`created`||e===`manual`,sessionSortDirection:e=>e===`asc`||e===`desc`,manualSessionOrder:e=>d$(e,1e3),sidebarAnchor:e=>e===`top`||e===`bottom`,projectFilters:e=>d$(e,500),hostFilters:e=>d$(e,500),showProjectName:u$,showLastUserMessage:u$,showSessionIdPrefix:u$,soundOnPermission:u$,soundOnIdle:u$};function m$(e){return c$.includes(e)}function h$(e,t){return p$[e](t)}var g$=`agentboard-theme`,_$=`agentboard-settings`,v$=200,y$=new Map,b$=new Set,x$=null,S$=!1;function C$(e){return e===`theme`?VG.getState().theme:W.getState()[e]}function w$(e){let t=e===`theme`?g$:_$;return Je.getItem(t)!==null}function T$(){if(x$=null,b$.size===0)return;let e={};for(let t of b$){let n=C$(t);e[t]=n,y$.set(t,JSON.stringify(n))}b$.clear();try{fetch(`/api/settings/synced`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({settings:e})}).then(e=>{e.ok||KO(`synced_settings_push_rejected`,{status:e.status},`warn`)}).catch(e=>{KO(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)})}catch(e){KO(`synced_settings_push_failed`,{message:e instanceof Error?e.message:String(e)},`warn`)}}function E$(e){b$.add(e),!x$&&(x$=setTimeout(T$,v$))}function D$(e){let t=new Map;for(let e of c$)t.set(e,w$(e));let n={},r;for(let[t,i]of Object.entries(e))!m$(t)||!h$(t,i)||(y$.set(t,JSON.stringify(i)),t===`theme`?r=i:n[t]=i);r!==void 0&&VG.setState({theme:r}),Object.keys(n).length>0&&W.setState(n);for(let n of c$){if(n in e||!t.get(n))continue;let r=C$(n);h$(n,r)&&y$.get(n)!==JSON.stringify(r)&&E$(n)}}function O$(){if(S$)return()=>{};S$=!0;let e=W.subscribe((e,t)=>{let n=e,r=t;for(let e of c$)e!==`theme`&&n[e]!==r[e]&&y$.get(e)!==JSON.stringify(n[e])&&E$(e)}),t=VG.subscribe((e,t)=>{e.theme!==t.theme&&y$.get(`theme`)!==JSON.stringify(e.theme)&&E$(`theme`)});return()=>{e(),t(),S$=!1,x$&&=(clearTimeout(x$),null),b$.clear(),y$.clear()}}function k$(e,t,n){let r=e;return t.length>0&&(r=r.filter(e=>t.includes(e.projectPath))),n.length>0&&(r=r.filter(e=>n.includes(e.host??``))),r}function A$(){let[e,t]=(0,C.useState)(!1),[n,r]=(0,C.useState)(void 0),[i,a]=(0,C.useState)(void 0),[o,s]=(0,C.useState)(void 0),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(null),[f,p]=(0,C.useState)(null),[m,h]=(0,C.useState)(null),g=Sh(e=>e.sessions),_=Sh(e=>e.agentSessions),v=Sh(e=>e.agentSessionsEpoch),y=Sh(e=>e.selectedSessionId),b=Sh(e=>e.selectedHibernatingSessionId),x=Sh(e=>e.setSessions),w=Sh(e=>e.setAgentSessions),T=Sh(e=>e.setActiveAgentSessions),E=Sh(e=>e.setHostStatuses),D=Sh(e=>e.updateSession),O=Sh(e=>e.setSelectedSessionId),k=Sh(e=>e.setSelectedHibernatingSessionId),A=Sh(e=>e.hasLoaded),j=Sh(e=>e.connectionStatus),M=Sh(e=>e.connectionError),N=Sh(e=>e.clearExitingSession),P=Sh(e=>e.markSessionExiting),F=Sh(e=>e.setRemoteAllowControl),I=Sh(e=>e.setRemoteAllowAttach),L=Sh(e=>e.setHostLabel),ee=Sh(e=>e.setPreferWindowName),R=Sh(e=>e.hostStatuses),z=Sh(e=>e.remoteAllowControl),B=Sh(e=>e.hostLabel),te=HG(),V=st(),H=W(e=>e.defaultProjectDir),ne=W(e=>e.commandPresets),re=W(e=>e.defaultPresetId),ie=W(e=>e.lastProjectPath),U=W(e=>e.setLastProjectPath),ae=W(e=>e.addRecentPath),oe=W(e=>e.shortcutModifier),se=W(e=>e.sidebarWidth),ce=W(e=>e.sidebarAnchor),le=W(e=>e.setSidebarWidth),ue=W(e=>e.projectFilters),de=W(e=>e.hostFilters),fe=W(e=>e.soundOnPermission),pe=W(e=>e.soundOnIdle),me=Sh(e=>e.connectionEpoch),{sendMessage:he,subscribe:ge,getConnectionEpoch:_e}=r$();(0,C.useEffect)(()=>O$(),[]),s$(),(0,C.useEffect)(()=>{if(typeof document>`u`||!fe&&!pe)return;let e=!1,t=()=>{e&&!fJ()||(e=!0,mJ())};return document.addEventListener(`click`,t,{passive:!0}),document.addEventListener(`keydown`,t,{passive:!0}),document.addEventListener(`touchstart`,t,{passive:!0}),()=>{document.removeEventListener(`click`,t),document.removeEventListener(`keydown`,t),document.removeEventListener(`touchstart`,t)}},[fe,pe]);let ve=(0,C.useRef)(!1),ye=(0,C.useCallback)(e=>{e.preventDefault(),ve.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},[]);(0,C.useEffect)(()=>{if(typeof document>`u`||typeof document.addEventListener!=`function`)return;let e=e=>{if(!ve.current)return;let t=e.clientX;le(Math.max(180,Math.min(400,t)))},t=()=>{ve.current&&(ve.current=!1,document.body.style.cursor=``,document.body.style.userSelect=``)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[le]),(0,C.useEffect)(()=>{let e=ge(e=>{if(e.type!==`terminal-output`){if(e.type===`sessions`){let t=Sh.getState().sessions,{soundOnPermission:n,soundOnIdle:r}=W.getState();if(n||r)for(let i of e.sessions){let e=t.find(e=>e.id===i.id);e&&e.status!==i.status&&(e.status!==`permission`&&i.status===`permission`&&n&&_J(),e.status===`working`&&i.status===`waiting`&&r&&vJ())}if(Fe.current.size>0){let e=_e();for(let[t,n]of Fe.current)n.epoch!==e&&Fe.current.delete(t)}let i=Fe.current.size>0?e.sessions.filter(e=>!Fe.current.has(e.id)):e.sessions,{selectedSessionId:a,selectedHibernatingSessionId:o}=Sh.getState(),s=a!==null&&o===null&&!i.some(e=>e.id===a)?t.find(e=>e.id===a)?.agentSessionId?.trim()??null:null;s&&(je.current=s),x(i);let c=Me.current,{selectedSessionId:l,selectedHibernatingSessionId:u}=Sh.getState(),{projectFilters:d,hostFilters:f}=W.getState();if(c&&l===null&&u===null){let e=i.find(e=>!(e.agentSessionId?.trim()!==c||d.length>0&&!d.includes(e.projectPath)||f.length>0&&!f.includes(e.host??``)));e&&(Me.current=null,O(e.id))}}if(e.type===`host-status`&&E(e.hosts),e.type===`server-config`&&(F(e.remoteAllowControl),I(e.remoteAllowAttach),L(e.hostLabel),ee(e.preferWindowName),e.clientLogLevel&&GO(e.clientLogLevel)),e.type===`synced-settings`&&D$(e.settings),e.type===`session-update`){let t=Sh.getState().sessions.find(t=>t.id===e.session.id)?.status,n=e.session.status;if(D(e.session),t){let{soundOnPermission:e,soundOnIdle:r}=W.getState();t!==`permission`&&n===`permission`&&e&&_J(),t===`working`&&n===`waiting`&&r&&vJ()}}if(e.type===`session-created`){let t=Sh.getState().sessions;t.some(t=>t.id===e.session.id)||x([e.session,...t]),O(e.session.id),ae(e.session.projectPath);let{projectFilters:n,setProjectFilters:r}=W.getState();n.length>0&&!n.includes(e.session.projectPath)&&r([...n,e.session.projectPath])}if(e.type===`session-removed`){aG(e.sessionId);let t=Sh.getState().sessions,n=t.filter(t=>t.id!==e.sessionId);n.length!==t.length&&x(n)}if(e.type===`agent-sessions`){let t=Array.isArray(e.active)?e.active:[],n=Array.isArray(e.hibernating)?e.hibernating:[],r=Array.isArray(e.history)?e.history:[],{selectedHibernatingSessionId:i}=Sh.getState(),a=je.current;i&&!n.some(e=>e.sessionId===i)&&(Me.current=i),w(t,n,r),h(e=>e&&n.some(t=>t.sessionId===e.sessionId)?null:e),a&&n.some(e=>e.sessionId===a)?(je.current=null,k(a)):a&&(je.current=null)}if(e.type===`agent-sessions-active`&&T(Array.isArray(e.active)?e.active:[]),e.type===`session-orphaned`&&!e.supersededBy){let t=Sh.getState().sessions,n=t.filter(t=>t.agentSessionId?.trim()!==e.session.sessionId);n.length!==t.length&&x(n)}if(e.type===`session-activated`){let t=Sh.getState().sessions.find(t=>t.tmuxWindow===e.window);t&&D({...t,agentSessionId:e.session.sessionId,agentSessionName:e.session.displayName,logFilePath:e.session.logFilePath,isHibernating:e.session.isHibernating,lastUserMessage:e.session.lastUserMessage??t.lastUserMessage})}if(e.type===`session-wake-result`)if(e.ok&&e.session){h(t=>t?.sessionId===e.sessionId?null:t);let t=Sh.getState().sessions;t.some(t=>t.id===e.session.id)||x([e.session,...t]),O(e.session.id)}else e.ok||(d(`${e.error?.code}: ${e.error?.message}`),window.setTimeout(()=>d(null),6e3));if(e.type===`session-hibernate-result`&&(e.ok?(e.session&&h(e.session),k(e.sessionId)):(d(e.error??`Failed to hibernate session`),window.setTimeout(()=>d(null),6e3))),e.type===`terminal-error`&&(!e.sessionId||e.sessionId===y)&&(d(`${e.code}: ${e.message}`),window.setTimeout(()=>d(null),6e3)),e.type===`terminal-ready`&&e.sessionId===y&&d(null),e.type===`error`&&(d(e.message),window.setTimeout(()=>d(null),6e3)),e.type===`kill-failed`){let t=Fe.current.get(e.sessionId);if(t){let n=Sh.getState().sessions;n.some(t=>t.id===e.sessionId)||x([t.session,...n]),t.wasSelected&&O(e.sessionId),Fe.current.delete(e.sessionId)}N(e.sessionId),d(e.message),window.setTimeout(()=>d(null),6e3)}e.type===`session-move-to-history-result`&&!e.ok&&e.error&&(d(e.error),window.setTimeout(()=>d(null),6e3))}});return()=>{e()}},[y,b,ae,N,he,O,k,h,x,w,T,E,F,I,L,ee,ge,D]);let be=(0,C.useMemo)(()=>g.find(e=>e.id===y)||null,[y,g]),xe=_.hibernating??[],Se=_.history??[],Ce=(0,C.useMemo)(()=>k$(xe,ue,de),[xe,ue,de]),we=(0,C.useMemo)(()=>Ce.find(e=>e.sessionId===b)||(m?.sessionId===b?m:null),[Ce,m,b]);(0,C.useEffect)(()=>{be?.projectPath&&!be.remote&&U(be.projectPath)},[be?.projectPath,be?.remote,U]);let Te=W(e=>e.sessionSortMode),Ee=W(e=>e.sessionSortDirection),De=W(e=>e.manualSessionOrder),Oe=(0,C.useMemo)(()=>oh(g,{mode:Te,direction:Ee,manualOrder:De}),[g,Te,Ee,De]),ke=(0,C.useMemo)(()=>{let e=Oe;return ue.length>0&&(e=e.filter(e=>ue.includes(e.projectPath))),de.length>0&&(e=e.filter(e=>de.includes(e.host??``))),e},[Oe,ue,de]),Ae=(0,C.useRef)(b),je=(0,C.useRef)(null),Me=(0,C.useRef)(null),Ne=(0,C.useRef)(me),Pe=(0,C.useCallback)(()=>ke.length>0?(O(ke[0].id),!0):Ce.length>0?(k(Ce[0].sessionId),!0):!1,[ke,Ce,O,k]);(0,C.useEffect)(()=>{let e=Ae.current;e&&b===null&&!xe.some(t=>t.sessionId===e)?Me.current=e:b!==null&&(Me.current=null),Ae.current=b},[xe,b]),(0,C.useEffect)(()=>{m&&b!==m.sessionId&&h(null)},[m,b]),(0,C.useEffect)(()=>{Ne.current!==me&&(Ne.current=me,je.current=null,Me.current=null,h(null))},[me]),(0,C.useEffect)(()=>{A&&(b||y&&(ke.some(e=>e.id===y)||Pe()||O(null)))},[A,y,b,Pe,O]),(0,C.useEffect)(()=>{if(!b||m?.sessionId===b||v!==me||Ce.some(e=>e.sessionId===b))return;let e=ke.find(e=>e.agentSessionId?.trim()===b);if(e){O(e.id);return}Pe()||k(null)},[Ce,ke,v,m,b,Pe,O,k,me]),(0,C.useEffect)(()=>{let e=Me.current;if(!e)return;if(b!==null){Me.current=null;return}let t=ke.find(t=>t.agentSessionId?.trim()===e);if(t){Me.current=null,O(t.id);return}if(y!==null){Me.current=null;return}Pe()&&(Me.current=null)},[ke,y,b,Pe,O]),(0,C.useEffect)(()=>{window.matchMedia(`(max-width: 767px)`).matches&&A&&y===null&&b===null&&(ke.length>0||Ce.length>0)&&Pe()},[Ce.length,ke.length,A,Pe,y,b]);let Fe=(0,C.useRef)(new Map),Ie=(0,C.useCallback)((e,t=`unknown`)=>{aG(e);let{sessions:n,selectedSessionId:r}=Sh.getState(),i=n.find(t=>t.id===e);i&&Fe.current.set(e,{session:i,wasSelected:r===e,epoch:_e()}),(0,Vd.flushSync)(()=>{P(e),x(n.filter(t=>t.id!==e))}),he({type:`session-kill`,sessionId:e,source:t})},[P,x,he]);(0,C.useEffect)(()=>{let n=dt(oe),r=r=>{if(r.defaultPrevented)return;let i=r.code,a=mt(r,n);if(a&&(i===`BracketLeft`||i===`BracketRight`)){r.preventDefault();let e=ce===`bottom`&&!window.matchMedia(`(max-width: 767px)`).matches,t=(i===`BracketLeft`?-1:1)*(e?-1:1),n=ke;if(n.length===0){let e=Ce;if(e.length===0)return;let n=e.findIndex(e=>e.sessionId===b);if(n===-1){k(e[0].sessionId);return}k(e[(n+t+e.length)%e.length].sessionId);return}let a=n.findIndex(e=>e.id===y);if(a===-1){O(n[0].id);return}O(n[(a+t+n.length)%n.length].id);return}if(a&&/^Digit[1-9]$/.test(i)){let e=Number(i.slice(5))-1;if(ke.length>0){let t=ke[e];if(!t)return;r.preventDefault(),O(t.id);return}let t=Ce[e];if(!t)return;r.preventDefault(),k(t.sessionId);return}if(a&&i===`KeyN`){r.preventDefault(),!e&&!c&&V&&t(!0);return}if(a&&i===`Comma`){r.preventDefault(),l(t=>t?!1:!e);return}if(a&&i===`KeyX`){r.preventDefault(),y&&!e&&!c&&Ie(y,`keyboard_shortcut`);return}};return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,c,y,b,O,k,ke,Ce,Ie,ce,oe,V]);let Le=()=>V?(r(void 0),a(void 0),s(void 0),t(!0),!0):!1,Re=()=>l(!0),ze=(e,t,n,r)=>{he({type:`session-create`,projectPath:e,name:t,command:n,host:r}),r||U(e)},Be=e=>{he({type:`session-wake`,sessionId:e})},Ve=(0,C.useCallback)(e=>{he({type:`session-hibernate`,sessionId:e})},[he]),He=(e,t)=>{he({type:`session-rename`,sessionId:e,newName:t})},Ue=(0,C.useCallback)(e=>{let t=g.find(t=>t.id===e);t&&he({type:`session-create`,projectPath:t.projectPath,command:t.command||void 0,host:t.remote&&t.host?t.host:void 0})},[g,he]),We=(0,C.useCallback)(e=>{he({type:`session-move-to-history`,sessionId:e})},[he]);(0,C.useEffect)(()=>UG(),[]),(0,C.useEffect)(()=>{document.documentElement.setAttribute(`data-theme`,te)},[te]),(0,C.useEffect)(()=>{fetch(`/api/server-info`).then(e=>e.json()).then(e=>p(e)).catch(()=>{})},[]);let Ge=(0,C.useMemo)(()=>B?R.filter(e=>e.host!==B):R,[R,B]);return(0,S.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[(0,S.jsx)(`div`,{className:`hidden h-full flex-col md:flex md:shrink-0`,style:{width:se},children:(0,S.jsx)(BO,{sessions:g,hibernatingSessions:xe,historySessions:Se,selectedSessionId:y,selectedHibernatingSessionId:b,onSelect:O,onSelectHibernating:k,onRename:He,onResume:Be,onHibernate:Ve,onKill:Ie,onDuplicate:Ue,onMoveToHistory:We,onNewSession:Le,loading:!A,error:M||u,anchor:ce,filterBarControls:(0,S.jsx)(Et,{connectionStatus:j,onNewSession:Le,onOpenSettings:Re,tailscaleIp:f?.tailscaleIp??null,placement:ce===`bottom`?`up`:`down`})})}),(0,S.jsx)(`div`,{className:`hidden md:block w-1 shrink-0 cursor-col-resize bg-transparent transition-colors hover:bg-white/10 active:bg-white/20`,onMouseDown:ye}),(0,S.jsx)(iq,{session:be,sessions:ke,drawerSessions:g,hibernatingSession:we,hibernatingSessions:xe,connectionStatus:j,connectionEpoch:me,sendMessage:he,subscribe:ge,onClose:()=>O(null),onSelectSession:O,onSelectHibernatingSession:k,onNewSession:Le,onKillSession:Ie,onRenameSession:He,onDuplicateSession:Ue,onOpenSettings:Re,onResumeSession:Be,onHibernateSession:Ve,onMoveToHistory:We,historySessions:Se,loading:!A,error:M||u}),(0,S.jsx)(Cq,{isOpen:e,onClose:()=>t(!1),onCreate:ze,defaultProjectDir:H,commandPresets:ne,defaultPresetId:re,lastProjectPath:ie,activeProjectPath:be&&!be.remote?be.projectPath:void 0,remoteHosts:Ge,remoteAllowControl:z,initialHost:n,initialPath:i,initialCommand:o}),(0,S.jsx)(UX,{isOpen:c,onClose:()=>l(!1)}),(0,S.jsx)(UQ,{})]})}var j$=`modulepreload`,M$=function(e){return`/`+e},N$={},P$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=M$(t,n),t in N$)return;N$[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:j$,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},F$=`true`,I$=`false`,L$=F$===`true`,R$=I$===`true`;function z$(e={}){let{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:i,onRegisteredSW:a,onRegisterError:o}=e,s,c,l,u=async(e=!0)=>{await c,L$||l?.()};async function d(){if(`serviceWorker`in navigator){if(s=await P$(async()=>{let{Workbox:e}=await import(`./workbox-window.prod.es5-Bq4GJJid.js`);return{Workbox:e}},[]).then(({Workbox:e})=>new e(`/sw.js`,{scope:`/`,type:`classic`})).catch(e=>{o?.(e)}),!s)return;if(l=()=>{s?.messageSkipWaiting()},!R$)if(L$)s.addEventListener(`activated`,e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),s.addEventListener(`installed`,e=>{e.isUpdate||r?.()});else{let e=!1,t=()=>{e=!0,s?.addEventListener(`controlling`,e=>{e.isUpdate&&window.location.reload()}),n?.()};s.addEventListener(`installed`,n=>{n.isUpdate===void 0?n.isExternal===void 0?!e&&r?.():n.isExternal?t():!e&&r?.():n.isUpdate||r?.()}),s.addEventListener(`waiting`,t)}s.register({immediate:t}).then(e=>{a?a(`/sw.js`,e):i?.(e)}).catch(e=>{o?.(e)})}}return c=d(),u}ct()&&document.documentElement.classList.add(`ios`),lt()&&document.documentElement.classList.add(`ios-pwa`),z$({immediate:!0,onRegisteredSW(e,t){t&&(setInterval(()=>{t.update()},300*1e3),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&t.update()}))}});var B$=document.getElementById(`root`);if(!B$)throw Error(`Root element not found`);(0,x.createRoot)(B$).render((0,S.jsx)(C.StrictMode,{children:(0,S.jsx)(A$,{})}));
|