repoburg 1.3.281 → 1.3.282
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-pane/frontend/dist/assets/{index-BVm0gJhP.js → index-BVPEUX5n.js} +62 -62
- package/agent-pane/frontend/dist/assets/index-CmMk0lVb.css +1 -0
- package/agent-pane/frontend/dist/index.html +2 -2
- package/daemon/tsconfig.json +1 -0
- package/package.json +1 -1
- package/tabtape/extension/dist/build-info.json +3 -3
- package/tabtape/extension/dist/manifest.json +1 -1
- package/tabtape/ui/dist/build-info.json +3 -3
- package/agent-pane/frontend/dist/assets/index-BD6rEkyH.css +0 -1
|
@@ -37,36 +37,36 @@ var gx=Object.defineProperty;var vx=(t,s,r)=>s in t?gx(t,s,{enumerable:!0,config
|
|
|
37
37
|
`+d[y].replace(" at new "," at ");return e.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",e.displayName)),D}while(1<=y&&0<=N);break}}}finally{ne=!1,Error.prepareStackTrace=i}return(e=e?e.displayName||e.name:"")?P(e):""}function X(e){switch(e.tag){case 5:return P(e.type);case 16:return P("Lazy");case 13:return P("Suspense");case 19:return P("SuspenseList");case 0:case 2:case 15:return e=de(e.type,!1),e;case 11:return e=de(e.type.render,!1),e;case 1:return e=de(e.type,!0),e;default:return""}}function fe(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case K:return"Fragment";case Y:return"Portal";case re:return"Profiler";case F:return"StrictMode";case Se:return"Suspense";case Pe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case G:return(e.displayName||"Context")+".Consumer";case he:return(e._context.displayName||"Context")+".Provider";case Ne:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case te:return n=e.displayName||null,n!==null?n:fe(e.type)||"Memo";case oe:n=e._payload,e=e._init;try{return fe(e(n))}catch{}}return null}function be(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return fe(n);case 8:return n===F?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Ee(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Re(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ce(e){var n=Re(e)?"checked":"value",i=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),c=""+e[n];if(!e.hasOwnProperty(n)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var d=i.get,h=i.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return d.call(this)},set:function(y){c=""+y,h.call(this,y)}}),Object.defineProperty(e,n,{enumerable:i.enumerable}),{getValue:function(){return c},setValue:function(y){c=""+y},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function at(e){e._valueTracker||(e._valueTracker=Ce(e))}function De(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var i=n.getValue(),c="";return e&&(c=Re(e)?e.checked?"true":"false":e.value),e=c,e!==i?(n.setValue(e),!0):!1}function lt(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function $e(e,n){var i=n.checked;return U({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:i??e._wrapperState.initialChecked})}function en(e,n){var i=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;i=Ee(n.value!=null?n.value:i),e._wrapperState={initialChecked:c,initialValue:i,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Fe(e,n){n=n.checked,n!=null&&B(e,"checked",n,!1)}function Ht(e,n){Fe(e,n);var i=Ee(n.value),c=n.type;if(i!=null)c==="number"?(i===0&&e.value===""||e.value!=i)&&(e.value=""+i):e.value!==""+i&&(e.value=""+i);else if(c==="submit"||c==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?wt(e,n.type,i):n.hasOwnProperty("defaultValue")&&wt(e,n.type,Ee(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function tn(e,n,i){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,i||n===e.value||(e.value=n),e.defaultValue=n}i=e.name,i!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,i!==""&&(e.name=i)}function wt(e,n,i){(n!=="number"||lt(e.ownerDocument)!==e)&&(i==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+i&&(e.defaultValue=""+i))}var jt=Array.isArray;function $t(e,n,i,c){if(e=e.options,n){n={};for(var d=0;d<i.length;d++)n["$"+i[d]]=!0;for(i=0;i<e.length;i++)d=n.hasOwnProperty("$"+e[i].value),e[i].selected!==d&&(e[i].selected=d),d&&c&&(e[i].defaultSelected=!0)}else{for(i=""+Ee(i),n=null,d=0;d<e.length;d++){if(e[d].value===i){e[d].selected=!0,c&&(e[d].defaultSelected=!0);return}n!==null||e[d].disabled||(n=e[d])}n!==null&&(n.selected=!0)}}function Mt(e,n){if(n.dangerouslySetInnerHTML!=null)throw Error(r(91));return U({},n,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function q(e,n){var i=n.value;if(i==null){if(i=n.children,n=n.defaultValue,i!=null){if(n!=null)throw Error(r(92));if(jt(i)){if(1<i.length)throw Error(r(93));i=i[0]}n=i}n==null&&(n=""),i=n}e._wrapperState={initialValue:Ee(i)}}function pe(e,n){var i=Ee(n.value),c=Ee(n.defaultValue);i!=null&&(i=""+i,i!==e.value&&(e.value=i),n.defaultValue==null&&e.defaultValue!==i&&(e.defaultValue=i)),c!=null&&(e.defaultValue=""+c)}function Ue(e){var n=e.textContent;n===e._wrapperState.initialValue&&n!==""&&n!==null&&(e.value=n)}function tt(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function mt(e,n){return e==null||e==="http://www.w3.org/1999/xhtml"?tt(n):e==="http://www.w3.org/2000/svg"&&n==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var gt,Ct=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(n,i,c,d){MSApp.execUnsafeLocalFunction(function(){return e(n,i,c,d)})}:e})(function(e,n){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=n;else{for(gt=gt||document.createElement("div"),gt.innerHTML="<svg>"+n.valueOf().toString()+"</svg>",n=gt.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function an(e,n){if(n){var i=e.firstChild;if(i&&i===e.lastChild&&i.nodeType===3){i.nodeValue=n;return}}e.textContent=n}var dt={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Dn=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(e){Dn.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),dt[n]=dt[e]})});function Mn(e,n,i){return n==null||typeof n=="boolean"||n===""?"":i||typeof n!="number"||n===0||dt.hasOwnProperty(e)&&dt[e]?(""+n).trim():n+"px"}function ps(e,n){e=e.style;for(var i in n)if(n.hasOwnProperty(i)){var c=i.indexOf("--")===0,d=Mn(i,n[i],c);i==="float"&&(i="cssFloat"),c?e.setProperty(i,d):e[i]=d}}var hs=U({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 ts(e,n){if(n){if(hs[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(r(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(r(61))}if(n.style!=null&&typeof n.style!="object")throw Error(r(62))}}function Ln(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var vn=null;function ln(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Vt=null,yn=null,Xe=null;function Et(e){if(e=Hi(e)){if(typeof Vt!="function")throw Error(r(280));var n=e.stateNode;n&&(n=Jo(n),Vt(e.stateNode,e.type,n))}}function ft(e){yn?Xe?Xe.push(e):Xe=[e]:yn=e}function Gt(){if(yn){var e=yn,n=Xe;if(Xe=yn=null,Et(e),n)for(e=0;e<n.length;e++)Et(n[e])}}function vt(e,n){return e(n)}function yt(){}var it=!1;function qt(e,n,i){if(it)return e(n,i);it=!0;try{return vt(e,n,i)}finally{it=!1,(yn!==null||Xe!==null)&&(yt(),Gt())}}function st(e,n){var i=e.stateNode;if(i===null)return null;var c=Jo(i);if(c===null)return null;i=c[n];e:switch(n){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(e=e.type,c=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!c;break e;default:e=!1}if(e)return null;if(i&&typeof i!="function")throw Error(r(231,n,typeof i));return i}var Lt=!1;if(p)try{var R={};Object.defineProperty(R,"passive",{get:function(){Lt=!0}}),window.addEventListener("test",R,R),window.removeEventListener("test",R,R)}catch{Lt=!1}function ue(e,n,i,c,d,h,y,N,D){var V=Array.prototype.slice.call(arguments,3);try{n.apply(i,V)}catch(ee){this.onError(ee)}}var ie=!1,ve=null,Me=!1,Ge=null,Le={onError:function(e){ie=!0,ve=e}};function zt(e,n,i,c,d,h,y,N,D){ie=!1,ve=null,ue.apply(Le,arguments)}function Pn(e,n,i,c,d,h,y,N,D){if(zt.apply(this,arguments),ie){if(ie){var V=ve;ie=!1,ve=null}else throw Error(r(198));Me||(Me=!0,Ge=V)}}function Be(e){var n=e,i=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(i=n.return),e=n.return;while(e)}return n.tag===3?i:null}function xn(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function js(e){if(Be(e)!==e)throw Error(r(188))}function Us(e){var n=e.alternate;if(!n){if(n=Be(e),n===null)throw Error(r(188));return n!==e?null:e}for(var i=e,c=n;;){var d=i.return;if(d===null)break;var h=d.alternate;if(h===null){if(c=d.return,c!==null){i=c;continue}break}if(d.child===h.child){for(h=d.child;h;){if(h===i)return js(d),e;if(h===c)return js(d),n;h=h.sibling}throw Error(r(188))}if(i.return!==c.return)i=d,c=h;else{for(var y=!1,N=d.child;N;){if(N===i){y=!0,i=d,c=h;break}if(N===c){y=!0,c=d,i=h;break}N=N.sibling}if(!y){for(N=h.child;N;){if(N===i){y=!0,i=h,c=d;break}if(N===c){y=!0,c=h,i=d;break}N=N.sibling}if(!y)throw Error(r(189))}}if(i.alternate!==c)throw Error(r(190))}if(i.tag!==3)throw Error(r(188));return i.stateNode.current===i?e:n}function On(e){return e=Us(e),e!==null?ms(e):null}function ms(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var n=ms(e);if(n!==null)return n;e=e.sibling}return null}var Qe=s.unstable_scheduleCallback,_t=s.unstable_cancelCallback,gs=s.unstable_shouldYield,$l=s.unstable_requestPaint,kt=s.unstable_now,vs=s.unstable_getCurrentPriorityLevel,Bs=s.unstable_ImmediatePriority,ys=s.unstable_UserBlockingPriority,zr=s.unstable_NormalPriority,mr=s.unstable_LowPriority,Lo=s.unstable_IdlePriority,gr=null,$n=null;function Fr(e){if($n&&typeof $n.onCommitFiberRoot=="function")try{$n.onCommitFiberRoot(gr,e,void 0,(e.current.flags&128)===128)}catch{}}var wn=Math.clz32?Math.clz32:vr,Ur=Math.log,Ws=Math.LN2;function vr(e){return e>>>=0,e===0?32:31-(Ur(e)/Ws|0)|0}var kn=64,Br=4194304;function yr(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 xr(e,n){var i=e.pendingLanes;if(i===0)return 0;var c=0,d=e.suspendedLanes,h=e.pingedLanes,y=i&268435455;if(y!==0){var N=y&~d;N!==0?c=yr(N):(h&=y,h!==0&&(c=yr(h)))}else y=i&~d,y!==0?c=yr(y):h!==0&&(c=yr(h));if(c===0)return 0;if(n!==0&&n!==c&&(n&d)===0&&(d=c&-c,h=n&-n,d>=h||d===16&&(h&4194240)!==0))return n;if((c&4)!==0&&(c|=i&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=c;0<n;)i=31-wn(n),d=1<<i,c|=e[i],n&=~d;return c}function Po(e,n){switch(e){case 1:case 2:case 4:return n+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Oo(e,n){for(var i=e.suspendedLanes,c=e.pingedLanes,d=e.expirationTimes,h=e.pendingLanes;0<h;){var y=31-wn(h),N=1<<y,D=d[y];D===-1?((N&i)===0||(N&c)!==0)&&(d[y]=Po(N,n)):D<=n&&(e.expiredLanes|=N),h&=~N}}function Ci(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Ei(){var e=kn;return kn<<=1,(kn&4194240)===0&&(kn=64),e}function _i(e){for(var n=[],i=0;31>i;i++)n.push(e);return n}function wr(e,n,i){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-wn(n),e[n]=i}function $o(e,n){var i=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var c=e.eventTimes;for(e=e.expirationTimes;0<i;){var d=31-wn(i),h=1<<d;n[d]=0,c[d]=-1,e[d]=-1,i&=~h}}function Hs(e,n){var i=e.entangledLanes|=n;for(e=e.entanglements;i;){var c=31-wn(i),d=1<<c;d&n|e[c]&n&&(e[c]|=n),i&=~d}}var qe=0;function le(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var b,$,Z,we,je,ze=!1,Ke=[],Ze=null,St=null,bt=null,Cs=new Map,At=new Map,Vs=[],$v="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 zd(e,n){switch(e){case"focusin":case"focusout":Ze=null;break;case"dragenter":case"dragleave":St=null;break;case"mouseover":case"mouseout":bt=null;break;case"pointerover":case"pointerout":Cs.delete(n.pointerId);break;case"gotpointercapture":case"lostpointercapture":At.delete(n.pointerId)}}function Ri(e,n,i,c,d,h){return e===null||e.nativeEvent!==h?(e={blockedOn:n,domEventName:i,eventSystemFlags:c,nativeEvent:h,targetContainers:[d]},n!==null&&(n=Hi(n),n!==null&&$(n)),e):(e.eventSystemFlags|=c,n=e.targetContainers,d!==null&&n.indexOf(d)===-1&&n.push(d),e)}function zv(e,n,i,c,d){switch(n){case"focusin":return Ze=Ri(Ze,e,n,i,c,d),!0;case"dragenter":return St=Ri(St,e,n,i,c,d),!0;case"mouseover":return bt=Ri(bt,e,n,i,c,d),!0;case"pointerover":var h=d.pointerId;return Cs.set(h,Ri(Cs.get(h)||null,e,n,i,c,d)),!0;case"gotpointercapture":return h=d.pointerId,At.set(h,Ri(At.get(h)||null,e,n,i,c,d)),!0}return!1}function Fd(e){var n=kr(e.target);if(n!==null){var i=Be(n);if(i!==null){if(n=i.tag,n===13){if(n=xn(i),n!==null){e.blockedOn=n,je(e.priority,function(){Z(i)});return}}else if(n===3&&i.stateNode.current.memoizedState.isDehydrated){e.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}e.blockedOn=null}function zo(e){if(e.blockedOn!==null)return!1;for(var n=e.targetContainers;0<n.length;){var i=Fl(e.domEventName,e.eventSystemFlags,n[0],e.nativeEvent);if(i===null){i=e.nativeEvent;var c=new i.constructor(i.type,i);vn=c,i.target.dispatchEvent(c),vn=null}else return n=Hi(i),n!==null&&$(n),e.blockedOn=i,!1;n.shift()}return!0}function Ud(e,n,i){zo(e)&&i.delete(n)}function Fv(){ze=!1,Ze!==null&&zo(Ze)&&(Ze=null),St!==null&&zo(St)&&(St=null),bt!==null&&zo(bt)&&(bt=null),Cs.forEach(Ud),At.forEach(Ud)}function Ai(e,n){e.blockedOn===n&&(e.blockedOn=null,ze||(ze=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,Fv)))}function Ii(e){function n(d){return Ai(d,e)}if(0<Ke.length){Ai(Ke[0],e);for(var i=1;i<Ke.length;i++){var c=Ke[i];c.blockedOn===e&&(c.blockedOn=null)}}for(Ze!==null&&Ai(Ze,e),St!==null&&Ai(St,e),bt!==null&&Ai(bt,e),Cs.forEach(n),At.forEach(n),i=0;i<Vs.length;i++)c=Vs[i],c.blockedOn===e&&(c.blockedOn=null);for(;0<Vs.length&&(i=Vs[0],i.blockedOn===null);)Fd(i),i.blockedOn===null&&Vs.shift()}var Wr=I.ReactCurrentBatchConfig,Fo=!0;function Uv(e,n,i,c){var d=qe,h=Wr.transition;Wr.transition=null;try{qe=1,zl(e,n,i,c)}finally{qe=d,Wr.transition=h}}function Bv(e,n,i,c){var d=qe,h=Wr.transition;Wr.transition=null;try{qe=4,zl(e,n,i,c)}finally{qe=d,Wr.transition=h}}function zl(e,n,i,c){if(Fo){var d=Fl(e,n,i,c);if(d===null)sc(e,n,c,Uo,i),zd(e,c);else if(zv(d,e,n,i,c))c.stopPropagation();else if(zd(e,c),n&4&&-1<$v.indexOf(e)){for(;d!==null;){var h=Hi(d);if(h!==null&&b(h),h=Fl(e,n,i,c),h===null&&sc(e,n,c,Uo,i),h===d)break;d=h}d!==null&&c.stopPropagation()}else sc(e,n,c,null,i)}}var Uo=null;function Fl(e,n,i,c){if(Uo=null,e=ln(c),e=kr(e),e!==null)if(n=Be(e),n===null)e=null;else if(i=n.tag,i===13){if(e=xn(n),e!==null)return e;e=null}else if(i===3){if(n.stateNode.current.memoizedState.isDehydrated)return n.tag===3?n.stateNode.containerInfo:null;e=null}else n!==e&&(e=null);return Uo=e,null}function Bd(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(vs()){case Bs:return 1;case ys:return 4;case zr:case mr:return 16;case Lo:return 536870912;default:return 16}default:return 16}}var Gs=null,Ul=null,Bo=null;function Wd(){if(Bo)return Bo;var e,n=Ul,i=n.length,c,d="value"in Gs?Gs.value:Gs.textContent,h=d.length;for(e=0;e<i&&n[e]===d[e];e++);var y=i-e;for(c=1;c<=y&&n[i-c]===d[h-c];c++);return Bo=d.slice(e,1<c?1-c:void 0)}function Wo(e){var n=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&n===13&&(e=13)):e=n,e===10&&(e=13),32<=e||e===13?e:0}function Ho(){return!0}function Hd(){return!1}function zn(e){function n(i,c,d,h,y){this._reactName=i,this._targetInst=d,this.type=c,this.nativeEvent=h,this.target=y,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(i=e[N],this[N]=i?i(h):h[N]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?Ho:Hd,this.isPropagationStopped=Hd,this}return U(n.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Ho)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Ho)},persist:function(){},isPersistent:Ho}),n}var Hr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bl=zn(Hr),Di=U({},Hr,{view:0,detail:0}),Wv=zn(Di),Wl,Hl,Mi,Vo=U({},Di,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gl,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!==Mi&&(Mi&&e.type==="mousemove"?(Wl=e.screenX-Mi.screenX,Hl=e.screenY-Mi.screenY):Hl=Wl=0,Mi=e),Wl)},movementY:function(e){return"movementY"in e?e.movementY:Hl}}),Vd=zn(Vo),Hv=U({},Vo,{dataTransfer:0}),Vv=zn(Hv),Gv=U({},Di,{relatedTarget:0}),Vl=zn(Gv),qv=U({},Hr,{animationName:0,elapsedTime:0,pseudoElement:0}),Kv=zn(qv),Yv=U({},Hr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Xv=zn(Yv),Qv=U({},Hr,{data:0}),Gd=zn(Qv),Zv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Jv={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"},ey={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ty(e){var n=this.nativeEvent;return n.getModifierState?n.getModifierState(e):(e=ey[e])?!!n[e]:!1}function Gl(){return ty}var ny=U({},Di,{key:function(e){if(e.key){var n=Zv[e.key]||e.key;if(n!=="Unidentified")return n}return e.type==="keypress"?(e=Wo(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Jv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gl,charCode:function(e){return e.type==="keypress"?Wo(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Wo(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),sy=zn(ny),ry=U({},Vo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),qd=zn(ry),iy=U({},Di,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gl}),oy=zn(iy),ay=U({},Hr,{propertyName:0,elapsedTime:0,pseudoElement:0}),ly=zn(ay),cy=U({},Vo,{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}),uy=zn(cy),dy=[9,13,27,32],ql=p&&"CompositionEvent"in window,Li=null;p&&"documentMode"in document&&(Li=document.documentMode);var fy=p&&"TextEvent"in window&&!Li,Kd=p&&(!ql||Li&&8<Li&&11>=Li),Yd=" ",Xd=!1;function Qd(e,n){switch(e){case"keyup":return dy.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Zd(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Vr=!1;function py(e,n){switch(e){case"compositionend":return Zd(n);case"keypress":return n.which!==32?null:(Xd=!0,Yd);case"textInput":return e=n.data,e===Yd&&Xd?null:e;default:return null}}function hy(e,n){if(Vr)return e==="compositionend"||!ql&&Qd(e,n)?(e=Wd(),Bo=Ul=Gs=null,Vr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1<n.char.length)return n.char;if(n.which)return String.fromCharCode(n.which)}return null;case"compositionend":return Kd&&n.locale!=="ko"?null:n.data;default:return null}}var my={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 Jd(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n==="input"?!!my[e.type]:n==="textarea"}function ef(e,n,i,c){ft(c),n=Xo(n,"onChange"),0<n.length&&(i=new Bl("onChange","change",null,i,c),e.push({event:i,listeners:n}))}var Pi=null,Oi=null;function gy(e){xf(e,0)}function Go(e){var n=Xr(e);if(De(n))return e}function vy(e,n){if(e==="change")return n}var tf=!1;if(p){var Kl;if(p){var Yl="oninput"in document;if(!Yl){var nf=document.createElement("div");nf.setAttribute("oninput","return;"),Yl=typeof nf.oninput=="function"}Kl=Yl}else Kl=!1;tf=Kl&&(!document.documentMode||9<document.documentMode)}function sf(){Pi&&(Pi.detachEvent("onpropertychange",rf),Oi=Pi=null)}function rf(e){if(e.propertyName==="value"&&Go(Oi)){var n=[];ef(n,Oi,e,ln(e)),qt(gy,n)}}function yy(e,n,i){e==="focusin"?(sf(),Pi=n,Oi=i,Pi.attachEvent("onpropertychange",rf)):e==="focusout"&&sf()}function xy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Go(Oi)}function wy(e,n){if(e==="click")return Go(n)}function ky(e,n){if(e==="input"||e==="change")return Go(n)}function Sy(e,n){return e===n&&(e!==0||1/e===1/n)||e!==e&&n!==n}var ns=typeof Object.is=="function"?Object.is:Sy;function $i(e,n){if(ns(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;var i=Object.keys(e),c=Object.keys(n);if(i.length!==c.length)return!1;for(c=0;c<i.length;c++){var d=i[c];if(!g.call(n,d)||!ns(e[d],n[d]))return!1}return!0}function of(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function af(e,n){var i=of(e);e=0;for(var c;i;){if(i.nodeType===3){if(c=e+i.textContent.length,e<=n&&c>=n)return{node:i,offset:n-e};e=c}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=of(i)}}function lf(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?lf(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function cf(){for(var e=window,n=lt();n instanceof e.HTMLIFrameElement;){try{var i=typeof n.contentWindow.location.href=="string"}catch{i=!1}if(i)e=n.contentWindow;else break;n=lt(e.document)}return n}function Xl(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function by(e){var n=cf(),i=e.focusedElem,c=e.selectionRange;if(n!==i&&i&&i.ownerDocument&&lf(i.ownerDocument.documentElement,i)){if(c!==null&&Xl(i)){if(n=c.start,e=c.end,e===void 0&&(e=n),"selectionStart"in i)i.selectionStart=n,i.selectionEnd=Math.min(e,i.value.length);else if(e=(n=i.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var d=i.textContent.length,h=Math.min(c.start,d);c=c.end===void 0?h:Math.min(c.end,d),!e.extend&&h>c&&(d=c,c=h,h=d),d=af(i,h);var y=af(i,c);d&&y&&(e.rangeCount!==1||e.anchorNode!==d.node||e.anchorOffset!==d.offset||e.focusNode!==y.node||e.focusOffset!==y.offset)&&(n=n.createRange(),n.setStart(d.node,d.offset),e.removeAllRanges(),h>c?(e.addRange(n),e.extend(y.node,y.offset)):(n.setEnd(y.node,y.offset),e.addRange(n)))}}for(n=[],e=i;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof i.focus=="function"&&i.focus(),i=0;i<n.length;i++)e=n[i],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Ty=p&&"documentMode"in document&&11>=document.documentMode,Gr=null,Ql=null,zi=null,Zl=!1;function uf(e,n,i){var c=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Zl||Gr==null||Gr!==lt(c)||(c=Gr,"selectionStart"in c&&Xl(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),zi&&$i(zi,c)||(zi=c,c=Xo(Ql,"onSelect"),0<c.length&&(n=new Bl("onSelect","select",null,n,i),e.push({event:n,listeners:c}),n.target=Gr)))}function qo(e,n){var i={};return i[e.toLowerCase()]=n.toLowerCase(),i["Webkit"+e]="webkit"+n,i["Moz"+e]="moz"+n,i}var qr={animationend:qo("Animation","AnimationEnd"),animationiteration:qo("Animation","AnimationIteration"),animationstart:qo("Animation","AnimationStart"),transitionend:qo("Transition","TransitionEnd")},Jl={},df={};p&&(df=document.createElement("div").style,"AnimationEvent"in window||(delete qr.animationend.animation,delete qr.animationiteration.animation,delete qr.animationstart.animation),"TransitionEvent"in window||delete qr.transitionend.transition);function Ko(e){if(Jl[e])return Jl[e];if(!qr[e])return e;var n=qr[e],i;for(i in n)if(n.hasOwnProperty(i)&&i in df)return Jl[e]=n[i];return e}var ff=Ko("animationend"),pf=Ko("animationiteration"),hf=Ko("animationstart"),mf=Ko("transitionend"),gf=new Map,vf="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function qs(e,n){gf.set(e,n),u(n,[e])}for(var ec=0;ec<vf.length;ec++){var tc=vf[ec],Ny=tc.toLowerCase(),jy=tc[0].toUpperCase()+tc.slice(1);qs(Ny,"on"+jy)}qs(ff,"onAnimationEnd"),qs(pf,"onAnimationIteration"),qs(hf,"onAnimationStart"),qs("dblclick","onDoubleClick"),qs("focusin","onFocus"),qs("focusout","onBlur"),qs(mf,"onTransitionEnd"),f("onMouseEnter",["mouseout","mouseover"]),f("onMouseLeave",["mouseout","mouseover"]),f("onPointerEnter",["pointerout","pointerover"]),f("onPointerLeave",["pointerout","pointerover"]),u("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),u("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),u("onBeforeInput",["compositionend","keypress","textInput","paste"]),u("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Cy=new Set("cancel close invalid load scroll toggle".split(" ").concat(Fi));function yf(e,n,i){var c=e.type||"unknown-event";e.currentTarget=i,Pn(c,n,void 0,e),e.currentTarget=null}function xf(e,n){n=(n&4)!==0;for(var i=0;i<e.length;i++){var c=e[i],d=c.event;c=c.listeners;e:{var h=void 0;if(n)for(var y=c.length-1;0<=y;y--){var N=c[y],D=N.instance,V=N.currentTarget;if(N=N.listener,D!==h&&d.isPropagationStopped())break e;yf(d,N,V),h=D}else for(y=0;y<c.length;y++){if(N=c[y],D=N.instance,V=N.currentTarget,N=N.listener,D!==h&&d.isPropagationStopped())break e;yf(d,N,V),h=D}}}if(Me)throw e=Ge,Me=!1,Ge=null,e}function pt(e,n){var i=n[cc];i===void 0&&(i=n[cc]=new Set);var c=e+"__bubble";i.has(c)||(wf(n,e,2,!1),i.add(c))}function nc(e,n,i){var c=0;n&&(c|=4),wf(i,e,c,n)}var Yo="_reactListening"+Math.random().toString(36).slice(2);function Ui(e){if(!e[Yo]){e[Yo]=!0,o.forEach(function(i){i!=="selectionchange"&&(Cy.has(i)||nc(i,!1,e),nc(i,!0,e))});var n=e.nodeType===9?e:e.ownerDocument;n===null||n[Yo]||(n[Yo]=!0,nc("selectionchange",!1,n))}}function wf(e,n,i,c){switch(Bd(n)){case 1:var d=Uv;break;case 4:d=Bv;break;default:d=zl}i=d.bind(null,n,i,e),d=void 0,!Lt||n!=="touchstart"&&n!=="touchmove"&&n!=="wheel"||(d=!0),c?d!==void 0?e.addEventListener(n,i,{capture:!0,passive:d}):e.addEventListener(n,i,!0):d!==void 0?e.addEventListener(n,i,{passive:d}):e.addEventListener(n,i,!1)}function sc(e,n,i,c,d){var h=c;if((n&1)===0&&(n&2)===0&&c!==null)e:for(;;){if(c===null)return;var y=c.tag;if(y===3||y===4){var N=c.stateNode.containerInfo;if(N===d||N.nodeType===8&&N.parentNode===d)break;if(y===4)for(y=c.return;y!==null;){var D=y.tag;if((D===3||D===4)&&(D=y.stateNode.containerInfo,D===d||D.nodeType===8&&D.parentNode===d))return;y=y.return}for(;N!==null;){if(y=kr(N),y===null)return;if(D=y.tag,D===5||D===6){c=h=y;continue e}N=N.parentNode}}c=c.return}qt(function(){var V=h,ee=ln(i),se=[];e:{var J=gf.get(e);if(J!==void 0){var me=Bl,xe=e;switch(e){case"keypress":if(Wo(i)===0)break e;case"keydown":case"keyup":me=sy;break;case"focusin":xe="focus",me=Vl;break;case"focusout":xe="blur",me=Vl;break;case"beforeblur":case"afterblur":me=Vl;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":me=Vd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":me=Vv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":me=oy;break;case ff:case pf:case hf:me=Kv;break;case mf:me=ly;break;case"scroll":me=Wv;break;case"wheel":me=uy;break;case"copy":case"cut":case"paste":me=Xv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":me=qd}var ke=(n&4)!==0,It=!ke&&e==="scroll",z=ke?J!==null?J+"Capture":null:J;ke=[];for(var L=V,H;L!==null;){H=L;var ce=H.stateNode;if(H.tag===5&&ce!==null&&(H=ce,z!==null&&(ce=st(L,z),ce!=null&&ke.push(Bi(L,ce,H)))),It)break;L=L.return}0<ke.length&&(J=new me(J,xe,null,i,ee),se.push({event:J,listeners:ke}))}}if((n&7)===0){e:{if(J=e==="mouseover"||e==="pointerover",me=e==="mouseout"||e==="pointerout",J&&i!==vn&&(xe=i.relatedTarget||i.fromElement)&&(kr(xe)||xe[Es]))break e;if((me||J)&&(J=ee.window===ee?ee:(J=ee.ownerDocument)?J.defaultView||J.parentWindow:window,me?(xe=i.relatedTarget||i.toElement,me=V,xe=xe?kr(xe):null,xe!==null&&(It=Be(xe),xe!==It||xe.tag!==5&&xe.tag!==6)&&(xe=null)):(me=null,xe=V),me!==xe)){if(ke=Vd,ce="onMouseLeave",z="onMouseEnter",L="mouse",(e==="pointerout"||e==="pointerover")&&(ke=qd,ce="onPointerLeave",z="onPointerEnter",L="pointer"),It=me==null?J:Xr(me),H=xe==null?J:Xr(xe),J=new ke(ce,L+"leave",me,i,ee),J.target=It,J.relatedTarget=H,ce=null,kr(ee)===V&&(ke=new ke(z,L+"enter",xe,i,ee),ke.target=H,ke.relatedTarget=It,ce=ke),It=ce,me&&xe)t:{for(ke=me,z=xe,L=0,H=ke;H;H=Kr(H))L++;for(H=0,ce=z;ce;ce=Kr(ce))H++;for(;0<L-H;)ke=Kr(ke),L--;for(;0<H-L;)z=Kr(z),H--;for(;L--;){if(ke===z||z!==null&&ke===z.alternate)break t;ke=Kr(ke),z=Kr(z)}ke=null}else ke=null;me!==null&&kf(se,J,me,ke,!1),xe!==null&&It!==null&&kf(se,It,xe,ke,!0)}}e:{if(J=V?Xr(V):window,me=J.nodeName&&J.nodeName.toLowerCase(),me==="select"||me==="input"&&J.type==="file")var Te=vy;else if(Jd(J))if(tf)Te=ky;else{Te=xy;var Ae=yy}else(me=J.nodeName)&&me.toLowerCase()==="input"&&(J.type==="checkbox"||J.type==="radio")&&(Te=wy);if(Te&&(Te=Te(e,V))){ef(se,Te,i,ee);break e}Ae&&Ae(e,J,V),e==="focusout"&&(Ae=J._wrapperState)&&Ae.controlled&&J.type==="number"&&wt(J,"number",J.value)}switch(Ae=V?Xr(V):window,e){case"focusin":(Jd(Ae)||Ae.contentEditable==="true")&&(Gr=Ae,Ql=V,zi=null);break;case"focusout":zi=Ql=Gr=null;break;case"mousedown":Zl=!0;break;case"contextmenu":case"mouseup":case"dragend":Zl=!1,uf(se,i,ee);break;case"selectionchange":if(Ty)break;case"keydown":case"keyup":uf(se,i,ee)}var Ie;if(ql)e:{switch(e){case"compositionstart":var Oe="onCompositionStart";break e;case"compositionend":Oe="onCompositionEnd";break e;case"compositionupdate":Oe="onCompositionUpdate";break e}Oe=void 0}else Vr?Qd(e,i)&&(Oe="onCompositionEnd"):e==="keydown"&&i.keyCode===229&&(Oe="onCompositionStart");Oe&&(Kd&&i.locale!=="ko"&&(Vr||Oe!=="onCompositionStart"?Oe==="onCompositionEnd"&&Vr&&(Ie=Wd()):(Gs=ee,Ul="value"in Gs?Gs.value:Gs.textContent,Vr=!0)),Ae=Xo(V,Oe),0<Ae.length&&(Oe=new Gd(Oe,e,null,i,ee),se.push({event:Oe,listeners:Ae}),Ie?Oe.data=Ie:(Ie=Zd(i),Ie!==null&&(Oe.data=Ie)))),(Ie=fy?py(e,i):hy(e,i))&&(V=Xo(V,"onBeforeInput"),0<V.length&&(ee=new Gd("onBeforeInput","beforeinput",null,i,ee),se.push({event:ee,listeners:V}),ee.data=Ie))}xf(se,n)})}function Bi(e,n,i){return{instance:e,listener:n,currentTarget:i}}function Xo(e,n){for(var i=n+"Capture",c=[];e!==null;){var d=e,h=d.stateNode;d.tag===5&&h!==null&&(d=h,h=st(e,i),h!=null&&c.unshift(Bi(e,h,d)),h=st(e,n),h!=null&&c.push(Bi(e,h,d))),e=e.return}return c}function Kr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function kf(e,n,i,c,d){for(var h=n._reactName,y=[];i!==null&&i!==c;){var N=i,D=N.alternate,V=N.stateNode;if(D!==null&&D===c)break;N.tag===5&&V!==null&&(N=V,d?(D=st(i,h),D!=null&&y.unshift(Bi(i,D,N))):d||(D=st(i,h),D!=null&&y.push(Bi(i,D,N)))),i=i.return}y.length!==0&&e.push({event:n,listeners:y})}var Ey=/\r\n?/g,_y=/\u0000|\uFFFD/g;function Sf(e){return(typeof e=="string"?e:""+e).replace(Ey,`
|
|
38
38
|
`).replace(_y,"")}function Qo(e,n,i){if(n=Sf(n),Sf(e)!==n&&i)throw Error(r(425))}function Zo(){}var rc=null,ic=null;function oc(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var ac=typeof setTimeout=="function"?setTimeout:void 0,Ry=typeof clearTimeout=="function"?clearTimeout:void 0,bf=typeof Promise=="function"?Promise:void 0,Ay=typeof queueMicrotask=="function"?queueMicrotask:typeof bf<"u"?function(e){return bf.resolve(null).then(e).catch(Iy)}:ac;function Iy(e){setTimeout(function(){throw e})}function lc(e,n){var i=n,c=0;do{var d=i.nextSibling;if(e.removeChild(i),d&&d.nodeType===8)if(i=d.data,i==="/$"){if(c===0){e.removeChild(d),Ii(n);return}c--}else i!=="$"&&i!=="$?"&&i!=="$!"||c++;i=d}while(i);Ii(n)}function Ks(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function Tf(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="$"||i==="$!"||i==="$?"){if(n===0)return e;n--}else i==="/$"&&n++}e=e.previousSibling}return null}var Yr=Math.random().toString(36).slice(2),xs="__reactFiber$"+Yr,Wi="__reactProps$"+Yr,Es="__reactContainer$"+Yr,cc="__reactEvents$"+Yr,Dy="__reactListeners$"+Yr,My="__reactHandles$"+Yr;function kr(e){var n=e[xs];if(n)return n;for(var i=e.parentNode;i;){if(n=i[Es]||i[xs]){if(i=n.alternate,n.child!==null||i!==null&&i.child!==null)for(e=Tf(e);e!==null;){if(i=e[xs])return i;e=Tf(e)}return n}e=i,i=e.parentNode}return null}function Hi(e){return e=e[xs]||e[Es],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Xr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Jo(e){return e[Wi]||null}var uc=[],Qr=-1;function Ys(e){return{current:e}}function ht(e){0>Qr||(e.current=uc[Qr],uc[Qr]=null,Qr--)}function ct(e,n){Qr++,uc[Qr]=e.current,e.current=n}var Xs={},cn=Ys(Xs),jn=Ys(!1),Sr=Xs;function Zr(e,n){var i=e.type.contextTypes;if(!i)return Xs;var c=e.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var d={},h;for(h in i)d[h]=n[h];return c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=d),d}function Cn(e){return e=e.childContextTypes,e!=null}function ea(){ht(jn),ht(cn)}function Nf(e,n,i){if(cn.current!==Xs)throw Error(r(168));ct(cn,n),ct(jn,i)}function jf(e,n,i){var c=e.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return i;c=c.getChildContext();for(var d in c)if(!(d in n))throw Error(r(108,be(e)||"Unknown",d));return U({},i,c)}function ta(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xs,Sr=cn.current,ct(cn,e),ct(jn,jn.current),!0}function Cf(e,n,i){var c=e.stateNode;if(!c)throw Error(r(169));i?(e=jf(e,n,Sr),c.__reactInternalMemoizedMergedChildContext=e,ht(jn),ht(cn),ct(cn,e)):ht(jn),ct(jn,i)}var _s=null,na=!1,dc=!1;function Ef(e){_s===null?_s=[e]:_s.push(e)}function Ly(e){na=!0,Ef(e)}function Qs(){if(!dc&&_s!==null){dc=!0;var e=0,n=qe;try{var i=_s;for(qe=1;e<i.length;e++){var c=i[e];do c=c(!0);while(c!==null)}_s=null,na=!1}catch(d){throw _s!==null&&(_s=_s.slice(e+1)),Qe(Bs,Qs),d}finally{qe=n,dc=!1}}return null}var Jr=[],ei=0,sa=null,ra=0,Gn=[],qn=0,br=null,Rs=1,As="";function Tr(e,n){Jr[ei++]=ra,Jr[ei++]=sa,sa=e,ra=n}function _f(e,n,i){Gn[qn++]=Rs,Gn[qn++]=As,Gn[qn++]=br,br=e;var c=Rs;e=As;var d=32-wn(c)-1;c&=~(1<<d),i+=1;var h=32-wn(n)+d;if(30<h){var y=d-d%5;h=(c&(1<<y)-1).toString(32),c>>=y,d-=y,Rs=1<<32-wn(n)+d|i<<d|c,As=h+e}else Rs=1<<h|i<<d|c,As=e}function fc(e){e.return!==null&&(Tr(e,1),_f(e,1,0))}function pc(e){for(;e===sa;)sa=Jr[--ei],Jr[ei]=null,ra=Jr[--ei],Jr[ei]=null;for(;e===br;)br=Gn[--qn],Gn[qn]=null,As=Gn[--qn],Gn[qn]=null,Rs=Gn[--qn],Gn[qn]=null}var Fn=null,Un=null,xt=!1,ss=null;function Rf(e,n){var i=Qn(5,null,null,0);i.elementType="DELETED",i.stateNode=n,i.return=e,n=e.deletions,n===null?(e.deletions=[i],e.flags|=16):n.push(i)}function Af(e,n){switch(e.tag){case 5:var i=e.type;return n=n.nodeType!==1||i.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,Fn=e,Un=Ks(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,Fn=e,Un=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(i=br!==null?{id:Rs,overflow:As}:null,e.memoizedState={dehydrated:n,treeContext:i,retryLane:1073741824},i=Qn(18,null,null,0),i.stateNode=n,i.return=e,e.child=i,Fn=e,Un=null,!0):!1;default:return!1}}function hc(e){return(e.mode&1)!==0&&(e.flags&128)===0}function mc(e){if(xt){var n=Un;if(n){var i=n;if(!Af(e,n)){if(hc(e))throw Error(r(418));n=Ks(i.nextSibling);var c=Fn;n&&Af(e,n)?Rf(c,i):(e.flags=e.flags&-4097|2,xt=!1,Fn=e)}}else{if(hc(e))throw Error(r(418));e.flags=e.flags&-4097|2,xt=!1,Fn=e}}}function If(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Fn=e}function ia(e){if(e!==Fn)return!1;if(!xt)return If(e),xt=!0,!1;var n;if((n=e.tag!==3)&&!(n=e.tag!==5)&&(n=e.type,n=n!=="head"&&n!=="body"&&!oc(e.type,e.memoizedProps)),n&&(n=Un)){if(hc(e))throw Df(),Error(r(418));for(;n;)Rf(e,n),n=Ks(n.nextSibling)}if(If(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(r(317));e:{for(e=e.nextSibling,n=0;e;){if(e.nodeType===8){var i=e.data;if(i==="/$"){if(n===0){Un=Ks(e.nextSibling);break e}n--}else i!=="$"&&i!=="$!"&&i!=="$?"||n++}e=e.nextSibling}Un=null}}else Un=Fn?Ks(e.stateNode.nextSibling):null;return!0}function Df(){for(var e=Un;e;)e=Ks(e.nextSibling)}function ti(){Un=Fn=null,xt=!1}function gc(e){ss===null?ss=[e]:ss.push(e)}var Py=I.ReactCurrentBatchConfig;function Vi(e,n,i){if(e=i.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(i._owner){if(i=i._owner,i){if(i.tag!==1)throw Error(r(309));var c=i.stateNode}if(!c)throw Error(r(147,e));var d=c,h=""+e;return n!==null&&n.ref!==null&&typeof n.ref=="function"&&n.ref._stringRef===h?n.ref:(n=function(y){var N=d.refs;y===null?delete N[h]:N[h]=y},n._stringRef=h,n)}if(typeof e!="string")throw Error(r(284));if(!i._owner)throw Error(r(290,e))}return e}function oa(e,n){throw e=Object.prototype.toString.call(n),Error(r(31,e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e))}function Mf(e){var n=e._init;return n(e._payload)}function Lf(e){function n(z,L){if(e){var H=z.deletions;H===null?(z.deletions=[L],z.flags|=16):H.push(L)}}function i(z,L){if(!e)return null;for(;L!==null;)n(z,L),L=L.sibling;return null}function c(z,L){for(z=new Map;L!==null;)L.key!==null?z.set(L.key,L):z.set(L.index,L),L=L.sibling;return z}function d(z,L){return z=ir(z,L),z.index=0,z.sibling=null,z}function h(z,L,H){return z.index=H,e?(H=z.alternate,H!==null?(H=H.index,H<L?(z.flags|=2,L):H):(z.flags|=2,L)):(z.flags|=1048576,L)}function y(z){return e&&z.alternate===null&&(z.flags|=2),z}function N(z,L,H,ce){return L===null||L.tag!==6?(L=au(H,z.mode,ce),L.return=z,L):(L=d(L,H),L.return=z,L)}function D(z,L,H,ce){var Te=H.type;return Te===K?ee(z,L,H.props.children,ce,H.key):L!==null&&(L.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===oe&&Mf(Te)===L.type)?(ce=d(L,H.props),ce.ref=Vi(z,L,H),ce.return=z,ce):(ce=Ra(H.type,H.key,H.props,null,z.mode,ce),ce.ref=Vi(z,L,H),ce.return=z,ce)}function V(z,L,H,ce){return L===null||L.tag!==4||L.stateNode.containerInfo!==H.containerInfo||L.stateNode.implementation!==H.implementation?(L=lu(H,z.mode,ce),L.return=z,L):(L=d(L,H.children||[]),L.return=z,L)}function ee(z,L,H,ce,Te){return L===null||L.tag!==7?(L=Ir(H,z.mode,ce,Te),L.return=z,L):(L=d(L,H),L.return=z,L)}function se(z,L,H){if(typeof L=="string"&&L!==""||typeof L=="number")return L=au(""+L,z.mode,H),L.return=z,L;if(typeof L=="object"&&L!==null){switch(L.$$typeof){case W:return H=Ra(L.type,L.key,L.props,null,z.mode,H),H.ref=Vi(z,null,L),H.return=z,H;case Y:return L=lu(L,z.mode,H),L.return=z,L;case oe:var ce=L._init;return se(z,ce(L._payload),H)}if(jt(L)||Q(L))return L=Ir(L,z.mode,H,null),L.return=z,L;oa(z,L)}return null}function J(z,L,H,ce){var Te=L!==null?L.key:null;if(typeof H=="string"&&H!==""||typeof H=="number")return Te!==null?null:N(z,L,""+H,ce);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case W:return H.key===Te?D(z,L,H,ce):null;case Y:return H.key===Te?V(z,L,H,ce):null;case oe:return Te=H._init,J(z,L,Te(H._payload),ce)}if(jt(H)||Q(H))return Te!==null?null:ee(z,L,H,ce,null);oa(z,H)}return null}function me(z,L,H,ce,Te){if(typeof ce=="string"&&ce!==""||typeof ce=="number")return z=z.get(H)||null,N(L,z,""+ce,Te);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case W:return z=z.get(ce.key===null?H:ce.key)||null,D(L,z,ce,Te);case Y:return z=z.get(ce.key===null?H:ce.key)||null,V(L,z,ce,Te);case oe:var Ae=ce._init;return me(z,L,H,Ae(ce._payload),Te)}if(jt(ce)||Q(ce))return z=z.get(H)||null,ee(L,z,ce,Te,null);oa(L,ce)}return null}function xe(z,L,H,ce){for(var Te=null,Ae=null,Ie=L,Oe=L=0,Xt=null;Ie!==null&&Oe<H.length;Oe++){Ie.index>Oe?(Xt=Ie,Ie=null):Xt=Ie.sibling;var Je=J(z,Ie,H[Oe],ce);if(Je===null){Ie===null&&(Ie=Xt);break}e&&Ie&&Je.alternate===null&&n(z,Ie),L=h(Je,L,Oe),Ae===null?Te=Je:Ae.sibling=Je,Ae=Je,Ie=Xt}if(Oe===H.length)return i(z,Ie),xt&&Tr(z,Oe),Te;if(Ie===null){for(;Oe<H.length;Oe++)Ie=se(z,H[Oe],ce),Ie!==null&&(L=h(Ie,L,Oe),Ae===null?Te=Ie:Ae.sibling=Ie,Ae=Ie);return xt&&Tr(z,Oe),Te}for(Ie=c(z,Ie);Oe<H.length;Oe++)Xt=me(Ie,z,Oe,H[Oe],ce),Xt!==null&&(e&&Xt.alternate!==null&&Ie.delete(Xt.key===null?Oe:Xt.key),L=h(Xt,L,Oe),Ae===null?Te=Xt:Ae.sibling=Xt,Ae=Xt);return e&&Ie.forEach(function(or){return n(z,or)}),xt&&Tr(z,Oe),Te}function ke(z,L,H,ce){var Te=Q(H);if(typeof Te!="function")throw Error(r(150));if(H=Te.call(H),H==null)throw Error(r(151));for(var Ae=Te=null,Ie=L,Oe=L=0,Xt=null,Je=H.next();Ie!==null&&!Je.done;Oe++,Je=H.next()){Ie.index>Oe?(Xt=Ie,Ie=null):Xt=Ie.sibling;var or=J(z,Ie,Je.value,ce);if(or===null){Ie===null&&(Ie=Xt);break}e&&Ie&&or.alternate===null&&n(z,Ie),L=h(or,L,Oe),Ae===null?Te=or:Ae.sibling=or,Ae=or,Ie=Xt}if(Je.done)return i(z,Ie),xt&&Tr(z,Oe),Te;if(Ie===null){for(;!Je.done;Oe++,Je=H.next())Je=se(z,Je.value,ce),Je!==null&&(L=h(Je,L,Oe),Ae===null?Te=Je:Ae.sibling=Je,Ae=Je);return xt&&Tr(z,Oe),Te}for(Ie=c(z,Ie);!Je.done;Oe++,Je=H.next())Je=me(Ie,z,Oe,Je.value,ce),Je!==null&&(e&&Je.alternate!==null&&Ie.delete(Je.key===null?Oe:Je.key),L=h(Je,L,Oe),Ae===null?Te=Je:Ae.sibling=Je,Ae=Je);return e&&Ie.forEach(function(mx){return n(z,mx)}),xt&&Tr(z,Oe),Te}function It(z,L,H,ce){if(typeof H=="object"&&H!==null&&H.type===K&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case W:e:{for(var Te=H.key,Ae=L;Ae!==null;){if(Ae.key===Te){if(Te=H.type,Te===K){if(Ae.tag===7){i(z,Ae.sibling),L=d(Ae,H.props.children),L.return=z,z=L;break e}}else if(Ae.elementType===Te||typeof Te=="object"&&Te!==null&&Te.$$typeof===oe&&Mf(Te)===Ae.type){i(z,Ae.sibling),L=d(Ae,H.props),L.ref=Vi(z,Ae,H),L.return=z,z=L;break e}i(z,Ae);break}else n(z,Ae);Ae=Ae.sibling}H.type===K?(L=Ir(H.props.children,z.mode,ce,H.key),L.return=z,z=L):(ce=Ra(H.type,H.key,H.props,null,z.mode,ce),ce.ref=Vi(z,L,H),ce.return=z,z=ce)}return y(z);case Y:e:{for(Ae=H.key;L!==null;){if(L.key===Ae)if(L.tag===4&&L.stateNode.containerInfo===H.containerInfo&&L.stateNode.implementation===H.implementation){i(z,L.sibling),L=d(L,H.children||[]),L.return=z,z=L;break e}else{i(z,L);break}else n(z,L);L=L.sibling}L=lu(H,z.mode,ce),L.return=z,z=L}return y(z);case oe:return Ae=H._init,It(z,L,Ae(H._payload),ce)}if(jt(H))return xe(z,L,H,ce);if(Q(H))return ke(z,L,H,ce);oa(z,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,L!==null&&L.tag===6?(i(z,L.sibling),L=d(L,H),L.return=z,z=L):(i(z,L),L=au(H,z.mode,ce),L.return=z,z=L),y(z)):i(z,L)}return It}var ni=Lf(!0),Pf=Lf(!1),aa=Ys(null),la=null,si=null,vc=null;function yc(){vc=si=la=null}function xc(e){var n=aa.current;ht(aa),e._currentValue=n}function wc(e,n,i){for(;e!==null;){var c=e.alternate;if((e.childLanes&n)!==n?(e.childLanes|=n,c!==null&&(c.childLanes|=n)):c!==null&&(c.childLanes&n)!==n&&(c.childLanes|=n),e===i)break;e=e.return}}function ri(e,n){la=e,vc=si=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&n)!==0&&(En=!0),e.firstContext=null)}function Kn(e){var n=e._currentValue;if(vc!==e)if(e={context:e,memoizedValue:n,next:null},si===null){if(la===null)throw Error(r(308));si=e,la.dependencies={lanes:0,firstContext:e}}else si=si.next=e;return n}var Nr=null;function kc(e){Nr===null?Nr=[e]:Nr.push(e)}function Of(e,n,i,c){var d=n.interleaved;return d===null?(i.next=i,kc(n)):(i.next=d.next,d.next=i),n.interleaved=i,Is(e,c)}function Is(e,n){e.lanes|=n;var i=e.alternate;for(i!==null&&(i.lanes|=n),i=e,e=e.return;e!==null;)e.childLanes|=n,i=e.alternate,i!==null&&(i.childLanes|=n),i=e,e=e.return;return i.tag===3?i.stateNode:null}var Zs=!1;function Sc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $f(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ds(e,n){return{eventTime:e,lane:n,tag:0,payload:null,callback:null,next:null}}function Js(e,n,i){var c=e.updateQueue;if(c===null)return null;if(c=c.shared,(Ye&2)!==0){var d=c.pending;return d===null?n.next=n:(n.next=d.next,d.next=n),c.pending=n,Is(e,i)}return d=c.interleaved,d===null?(n.next=n,kc(c)):(n.next=d.next,d.next=n),c.interleaved=n,Is(e,i)}function ca(e,n,i){if(n=n.updateQueue,n!==null&&(n=n.shared,(i&4194240)!==0)){var c=n.lanes;c&=e.pendingLanes,i|=c,n.lanes=i,Hs(e,i)}}function zf(e,n){var i=e.updateQueue,c=e.alternate;if(c!==null&&(c=c.updateQueue,i===c)){var d=null,h=null;if(i=i.firstBaseUpdate,i!==null){do{var y={eventTime:i.eventTime,lane:i.lane,tag:i.tag,payload:i.payload,callback:i.callback,next:null};h===null?d=h=y:h=h.next=y,i=i.next}while(i!==null);h===null?d=h=n:h=h.next=n}else d=h=n;i={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:h,shared:c.shared,effects:c.effects},e.updateQueue=i;return}e=i.lastBaseUpdate,e===null?i.firstBaseUpdate=n:e.next=n,i.lastBaseUpdate=n}function ua(e,n,i,c){var d=e.updateQueue;Zs=!1;var h=d.firstBaseUpdate,y=d.lastBaseUpdate,N=d.shared.pending;if(N!==null){d.shared.pending=null;var D=N,V=D.next;D.next=null,y===null?h=V:y.next=V,y=D;var ee=e.alternate;ee!==null&&(ee=ee.updateQueue,N=ee.lastBaseUpdate,N!==y&&(N===null?ee.firstBaseUpdate=V:N.next=V,ee.lastBaseUpdate=D))}if(h!==null){var se=d.baseState;y=0,ee=V=D=null,N=h;do{var J=N.lane,me=N.eventTime;if((c&J)===J){ee!==null&&(ee=ee.next={eventTime:me,lane:0,tag:N.tag,payload:N.payload,callback:N.callback,next:null});e:{var xe=e,ke=N;switch(J=n,me=i,ke.tag){case 1:if(xe=ke.payload,typeof xe=="function"){se=xe.call(me,se,J);break e}se=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=ke.payload,J=typeof xe=="function"?xe.call(me,se,J):xe,J==null)break e;se=U({},se,J);break e;case 2:Zs=!0}}N.callback!==null&&N.lane!==0&&(e.flags|=64,J=d.effects,J===null?d.effects=[N]:J.push(N))}else me={eventTime:me,lane:J,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ee===null?(V=ee=me,D=se):ee=ee.next=me,y|=J;if(N=N.next,N===null){if(N=d.shared.pending,N===null)break;J=N,N=J.next,J.next=null,d.lastBaseUpdate=J,d.shared.pending=null}}while(!0);if(ee===null&&(D=se),d.baseState=D,d.firstBaseUpdate=V,d.lastBaseUpdate=ee,n=d.shared.interleaved,n!==null){d=n;do y|=d.lane,d=d.next;while(d!==n)}else h===null&&(d.shared.lanes=0);Er|=y,e.lanes=y,e.memoizedState=se}}function Ff(e,n,i){if(e=n.effects,n.effects=null,e!==null)for(n=0;n<e.length;n++){var c=e[n],d=c.callback;if(d!==null){if(c.callback=null,c=i,typeof d!="function")throw Error(r(191,d));d.call(c)}}}var Gi={},ws=Ys(Gi),qi=Ys(Gi),Ki=Ys(Gi);function jr(e){if(e===Gi)throw Error(r(174));return e}function bc(e,n){switch(ct(Ki,n),ct(qi,e),ct(ws,Gi),e=n.nodeType,e){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:mt(null,"");break;default:e=e===8?n.parentNode:n,n=e.namespaceURI||null,e=e.tagName,n=mt(n,e)}ht(ws),ct(ws,n)}function ii(){ht(ws),ht(qi),ht(Ki)}function Uf(e){jr(Ki.current);var n=jr(ws.current),i=mt(n,e.type);n!==i&&(ct(qi,e),ct(ws,i))}function Tc(e){qi.current===e&&(ht(ws),ht(qi))}var Tt=Ys(0);function da(e){for(var n=e;n!==null;){if(n.tag===13){var i=n.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||i.data==="$?"||i.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if((n.flags&128)!==0)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Nc=[];function jc(){for(var e=0;e<Nc.length;e++)Nc[e]._workInProgressVersionPrimary=null;Nc.length=0}var fa=I.ReactCurrentDispatcher,Cc=I.ReactCurrentBatchConfig,Cr=0,Nt=null,Ft=null,Kt=null,pa=!1,Yi=!1,Xi=0,Oy=0;function un(){throw Error(r(321))}function Ec(e,n){if(n===null)return!1;for(var i=0;i<n.length&&i<e.length;i++)if(!ns(e[i],n[i]))return!1;return!0}function _c(e,n,i,c,d,h){if(Cr=h,Nt=n,n.memoizedState=null,n.updateQueue=null,n.lanes=0,fa.current=e===null||e.memoizedState===null?Uy:By,e=i(c,d),Yi){h=0;do{if(Yi=!1,Xi=0,25<=h)throw Error(r(301));h+=1,Kt=Ft=null,n.updateQueue=null,fa.current=Wy,e=i(c,d)}while(Yi)}if(fa.current=ga,n=Ft!==null&&Ft.next!==null,Cr=0,Kt=Ft=Nt=null,pa=!1,n)throw Error(r(300));return e}function Rc(){var e=Xi!==0;return Xi=0,e}function ks(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kt===null?Nt.memoizedState=Kt=e:Kt=Kt.next=e,Kt}function Yn(){if(Ft===null){var e=Nt.alternate;e=e!==null?e.memoizedState:null}else e=Ft.next;var n=Kt===null?Nt.memoizedState:Kt.next;if(n!==null)Kt=n,Ft=e;else{if(e===null)throw Error(r(310));Ft=e,e={memoizedState:Ft.memoizedState,baseState:Ft.baseState,baseQueue:Ft.baseQueue,queue:Ft.queue,next:null},Kt===null?Nt.memoizedState=Kt=e:Kt=Kt.next=e}return Kt}function Qi(e,n){return typeof n=="function"?n(e):n}function Ac(e){var n=Yn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var c=Ft,d=c.baseQueue,h=i.pending;if(h!==null){if(d!==null){var y=d.next;d.next=h.next,h.next=y}c.baseQueue=d=h,i.pending=null}if(d!==null){h=d.next,c=c.baseState;var N=y=null,D=null,V=h;do{var ee=V.lane;if((Cr&ee)===ee)D!==null&&(D=D.next={lane:0,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null}),c=V.hasEagerState?V.eagerState:e(c,V.action);else{var se={lane:ee,action:V.action,hasEagerState:V.hasEagerState,eagerState:V.eagerState,next:null};D===null?(N=D=se,y=c):D=D.next=se,Nt.lanes|=ee,Er|=ee}V=V.next}while(V!==null&&V!==h);D===null?y=c:D.next=N,ns(c,n.memoizedState)||(En=!0),n.memoizedState=c,n.baseState=y,n.baseQueue=D,i.lastRenderedState=c}if(e=i.interleaved,e!==null){d=e;do h=d.lane,Nt.lanes|=h,Er|=h,d=d.next;while(d!==e)}else d===null&&(i.lanes=0);return[n.memoizedState,i.dispatch]}function Ic(e){var n=Yn(),i=n.queue;if(i===null)throw Error(r(311));i.lastRenderedReducer=e;var c=i.dispatch,d=i.pending,h=n.memoizedState;if(d!==null){i.pending=null;var y=d=d.next;do h=e(h,y.action),y=y.next;while(y!==d);ns(h,n.memoizedState)||(En=!0),n.memoizedState=h,n.baseQueue===null&&(n.baseState=h),i.lastRenderedState=h}return[h,c]}function Bf(){}function Wf(e,n){var i=Nt,c=Yn(),d=n(),h=!ns(c.memoizedState,d);if(h&&(c.memoizedState=d,En=!0),c=c.queue,Dc(Gf.bind(null,i,c,e),[e]),c.getSnapshot!==n||h||Kt!==null&&Kt.memoizedState.tag&1){if(i.flags|=2048,Zi(9,Vf.bind(null,i,c,d,n),void 0,null),Yt===null)throw Error(r(349));(Cr&30)!==0||Hf(i,n,d)}return d}function Hf(e,n,i){e.flags|=16384,e={getSnapshot:n,value:i},n=Nt.updateQueue,n===null?(n={lastEffect:null,stores:null},Nt.updateQueue=n,n.stores=[e]):(i=n.stores,i===null?n.stores=[e]:i.push(e))}function Vf(e,n,i,c){n.value=i,n.getSnapshot=c,qf(n)&&Kf(e)}function Gf(e,n,i){return i(function(){qf(n)&&Kf(e)})}function qf(e){var n=e.getSnapshot;e=e.value;try{var i=n();return!ns(e,i)}catch{return!0}}function Kf(e){var n=Is(e,1);n!==null&&as(n,e,1,-1)}function Yf(e){var n=ks();return typeof e=="function"&&(e=e()),n.memoizedState=n.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Qi,lastRenderedState:e},n.queue=e,e=e.dispatch=Fy.bind(null,Nt,e),[n.memoizedState,e]}function Zi(e,n,i,c){return e={tag:e,create:n,destroy:i,deps:c,next:null},n=Nt.updateQueue,n===null?(n={lastEffect:null,stores:null},Nt.updateQueue=n,n.lastEffect=e.next=e):(i=n.lastEffect,i===null?n.lastEffect=e.next=e:(c=i.next,i.next=e,e.next=c,n.lastEffect=e)),e}function Xf(){return Yn().memoizedState}function ha(e,n,i,c){var d=ks();Nt.flags|=e,d.memoizedState=Zi(1|n,i,void 0,c===void 0?null:c)}function ma(e,n,i,c){var d=Yn();c=c===void 0?null:c;var h=void 0;if(Ft!==null){var y=Ft.memoizedState;if(h=y.destroy,c!==null&&Ec(c,y.deps)){d.memoizedState=Zi(n,i,h,c);return}}Nt.flags|=e,d.memoizedState=Zi(1|n,i,h,c)}function Qf(e,n){return ha(8390656,8,e,n)}function Dc(e,n){return ma(2048,8,e,n)}function Zf(e,n){return ma(4,2,e,n)}function Jf(e,n){return ma(4,4,e,n)}function ep(e,n){if(typeof n=="function")return e=e(),n(e),function(){n(null)};if(n!=null)return e=e(),n.current=e,function(){n.current=null}}function tp(e,n,i){return i=i!=null?i.concat([e]):null,ma(4,4,ep.bind(null,n,e),i)}function Mc(){}function np(e,n){var i=Yn();n=n===void 0?null:n;var c=i.memoizedState;return c!==null&&n!==null&&Ec(n,c[1])?c[0]:(i.memoizedState=[e,n],e)}function sp(e,n){var i=Yn();n=n===void 0?null:n;var c=i.memoizedState;return c!==null&&n!==null&&Ec(n,c[1])?c[0]:(e=e(),i.memoizedState=[e,n],e)}function rp(e,n,i){return(Cr&21)===0?(e.baseState&&(e.baseState=!1,En=!0),e.memoizedState=i):(ns(i,n)||(i=Ei(),Nt.lanes|=i,Er|=i,e.baseState=!0),n)}function $y(e,n){var i=qe;qe=i!==0&&4>i?i:4,e(!0);var c=Cc.transition;Cc.transition={};try{e(!1),n()}finally{qe=i,Cc.transition=c}}function ip(){return Yn().memoizedState}function zy(e,n,i){var c=sr(e);if(i={lane:c,action:i,hasEagerState:!1,eagerState:null,next:null},op(e))ap(n,i);else if(i=Of(e,n,i,c),i!==null){var d=bn();as(i,e,c,d),lp(i,n,c)}}function Fy(e,n,i){var c=sr(e),d={lane:c,action:i,hasEagerState:!1,eagerState:null,next:null};if(op(e))ap(n,d);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=n.lastRenderedReducer,h!==null))try{var y=n.lastRenderedState,N=h(y,i);if(d.hasEagerState=!0,d.eagerState=N,ns(N,y)){var D=n.interleaved;D===null?(d.next=d,kc(n)):(d.next=D.next,D.next=d),n.interleaved=d;return}}catch{}finally{}i=Of(e,n,d,c),i!==null&&(d=bn(),as(i,e,c,d),lp(i,n,c))}}function op(e){var n=e.alternate;return e===Nt||n!==null&&n===Nt}function ap(e,n){Yi=pa=!0;var i=e.pending;i===null?n.next=n:(n.next=i.next,i.next=n),e.pending=n}function lp(e,n,i){if((i&4194240)!==0){var c=n.lanes;c&=e.pendingLanes,i|=c,n.lanes=i,Hs(e,i)}}var ga={readContext:Kn,useCallback:un,useContext:un,useEffect:un,useImperativeHandle:un,useInsertionEffect:un,useLayoutEffect:un,useMemo:un,useReducer:un,useRef:un,useState:un,useDebugValue:un,useDeferredValue:un,useTransition:un,useMutableSource:un,useSyncExternalStore:un,useId:un,unstable_isNewReconciler:!1},Uy={readContext:Kn,useCallback:function(e,n){return ks().memoizedState=[e,n===void 0?null:n],e},useContext:Kn,useEffect:Qf,useImperativeHandle:function(e,n,i){return i=i!=null?i.concat([e]):null,ha(4194308,4,ep.bind(null,n,e),i)},useLayoutEffect:function(e,n){return ha(4194308,4,e,n)},useInsertionEffect:function(e,n){return ha(4,2,e,n)},useMemo:function(e,n){var i=ks();return n=n===void 0?null:n,e=e(),i.memoizedState=[e,n],e},useReducer:function(e,n,i){var c=ks();return n=i!==void 0?i(n):n,c.memoizedState=c.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},c.queue=e,e=e.dispatch=zy.bind(null,Nt,e),[c.memoizedState,e]},useRef:function(e){var n=ks();return e={current:e},n.memoizedState=e},useState:Yf,useDebugValue:Mc,useDeferredValue:function(e){return ks().memoizedState=e},useTransition:function(){var e=Yf(!1),n=e[0];return e=$y.bind(null,e[1]),ks().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,i){var c=Nt,d=ks();if(xt){if(i===void 0)throw Error(r(407));i=i()}else{if(i=n(),Yt===null)throw Error(r(349));(Cr&30)!==0||Hf(c,n,i)}d.memoizedState=i;var h={value:i,getSnapshot:n};return d.queue=h,Qf(Gf.bind(null,c,h,e),[e]),c.flags|=2048,Zi(9,Vf.bind(null,c,h,i,n),void 0,null),i},useId:function(){var e=ks(),n=Yt.identifierPrefix;if(xt){var i=As,c=Rs;i=(c&~(1<<32-wn(c)-1)).toString(32)+i,n=":"+n+"R"+i,i=Xi++,0<i&&(n+="H"+i.toString(32)),n+=":"}else i=Oy++,n=":"+n+"r"+i.toString(32)+":";return e.memoizedState=n},unstable_isNewReconciler:!1},By={readContext:Kn,useCallback:np,useContext:Kn,useEffect:Dc,useImperativeHandle:tp,useInsertionEffect:Zf,useLayoutEffect:Jf,useMemo:sp,useReducer:Ac,useRef:Xf,useState:function(){return Ac(Qi)},useDebugValue:Mc,useDeferredValue:function(e){var n=Yn();return rp(n,Ft.memoizedState,e)},useTransition:function(){var e=Ac(Qi)[0],n=Yn().memoizedState;return[e,n]},useMutableSource:Bf,useSyncExternalStore:Wf,useId:ip,unstable_isNewReconciler:!1},Wy={readContext:Kn,useCallback:np,useContext:Kn,useEffect:Dc,useImperativeHandle:tp,useInsertionEffect:Zf,useLayoutEffect:Jf,useMemo:sp,useReducer:Ic,useRef:Xf,useState:function(){return Ic(Qi)},useDebugValue:Mc,useDeferredValue:function(e){var n=Yn();return Ft===null?n.memoizedState=e:rp(n,Ft.memoizedState,e)},useTransition:function(){var e=Ic(Qi)[0],n=Yn().memoizedState;return[e,n]},useMutableSource:Bf,useSyncExternalStore:Wf,useId:ip,unstable_isNewReconciler:!1};function rs(e,n){if(e&&e.defaultProps){n=U({},n),e=e.defaultProps;for(var i in e)n[i]===void 0&&(n[i]=e[i]);return n}return n}function Lc(e,n,i,c){n=e.memoizedState,i=i(c,n),i=i==null?n:U({},n,i),e.memoizedState=i,e.lanes===0&&(e.updateQueue.baseState=i)}var va={isMounted:function(e){return(e=e._reactInternals)?Be(e)===e:!1},enqueueSetState:function(e,n,i){e=e._reactInternals;var c=bn(),d=sr(e),h=Ds(c,d);h.payload=n,i!=null&&(h.callback=i),n=Js(e,h,d),n!==null&&(as(n,e,d,c),ca(n,e,d))},enqueueReplaceState:function(e,n,i){e=e._reactInternals;var c=bn(),d=sr(e),h=Ds(c,d);h.tag=1,h.payload=n,i!=null&&(h.callback=i),n=Js(e,h,d),n!==null&&(as(n,e,d,c),ca(n,e,d))},enqueueForceUpdate:function(e,n){e=e._reactInternals;var i=bn(),c=sr(e),d=Ds(i,c);d.tag=2,n!=null&&(d.callback=n),n=Js(e,d,c),n!==null&&(as(n,e,c,i),ca(n,e,c))}};function cp(e,n,i,c,d,h,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(c,h,y):n.prototype&&n.prototype.isPureReactComponent?!$i(i,c)||!$i(d,h):!0}function up(e,n,i){var c=!1,d=Xs,h=n.contextType;return typeof h=="object"&&h!==null?h=Kn(h):(d=Cn(n)?Sr:cn.current,c=n.contextTypes,h=(c=c!=null)?Zr(e,d):Xs),n=new n(i,h),e.memoizedState=n.state!==null&&n.state!==void 0?n.state:null,n.updater=va,e.stateNode=n,n._reactInternals=e,c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=d,e.__reactInternalMemoizedMaskedChildContext=h),n}function dp(e,n,i,c){e=n.state,typeof n.componentWillReceiveProps=="function"&&n.componentWillReceiveProps(i,c),typeof n.UNSAFE_componentWillReceiveProps=="function"&&n.UNSAFE_componentWillReceiveProps(i,c),n.state!==e&&va.enqueueReplaceState(n,n.state,null)}function Pc(e,n,i,c){var d=e.stateNode;d.props=i,d.state=e.memoizedState,d.refs={},Sc(e);var h=n.contextType;typeof h=="object"&&h!==null?d.context=Kn(h):(h=Cn(n)?Sr:cn.current,d.context=Zr(e,h)),d.state=e.memoizedState,h=n.getDerivedStateFromProps,typeof h=="function"&&(Lc(e,n,h,i),d.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(n=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),n!==d.state&&va.enqueueReplaceState(d,d.state,null),ua(e,i,d,c),d.state=e.memoizedState),typeof d.componentDidMount=="function"&&(e.flags|=4194308)}function oi(e,n){try{var i="",c=n;do i+=X(c),c=c.return;while(c);var d=i}catch(h){d=`
|
|
39
39
|
Error generating stack: `+h.message+`
|
|
40
|
-
`+h.stack}return{value:e,source:n,stack:d,digest:null}}function Oc(e,n,i){return{value:e,source:null,stack:i??null,digest:n??null}}function $c(e,n){try{console.error(n.value)}catch(i){setTimeout(function(){throw i})}}var Hy=typeof WeakMap=="function"?WeakMap:Map;function fp(e,n,i){i=Ds(-1,i),i.tag=3,i.payload={element:null};var c=n.value;return i.callback=function(){Ta||(Ta=!0,Jc=c),$c(e,n)},i}function pp(e,n,i){i=Ds(-1,i),i.tag=3;var c=e.type.getDerivedStateFromError;if(typeof c=="function"){var d=n.value;i.payload=function(){return c(d)},i.callback=function(){$c(e,n)}}var h=e.stateNode;return h!==null&&typeof h.componentDidCatch=="function"&&(i.callback=function(){$c(e,n),typeof c!="function"&&(tr===null?tr=new Set([this]):tr.add(this));var y=n.stack;this.componentDidCatch(n.value,{componentStack:y!==null?y:""})}),i}function hp(e,n,i){var c=e.pingCache;if(c===null){c=e.pingCache=new Hy;var d=new Set;c.set(n,d)}else d=c.get(n),d===void 0&&(d=new Set,c.set(n,d));d.has(i)||(d.add(i),e=rx.bind(null,e,n,i),n.then(e,e))}function mp(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function gp(e,n,i,c,d){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(n=Ds(-1,1),n.tag=2,Js(i,n,1))),i.lanes|=1),e):(e.flags|=65536,e.lanes=d,e)}var Vy=I.ReactCurrentOwner,En=!1;function Sn(e,n,i,c){n.child=e===null?Pf(n,null,i,c):ni(n,e.child,i,c)}function vp(e,n,i,c,d){i=i.render;var h=n.ref;return ri(n,d),c=_c(e,n,i,c,h,d),i=Rc(),e!==null&&!En?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~d,Ms(e,n,d)):(xt&&i&&fc(n),n.flags|=1,Sn(e,n,c,d),n.child)}function yp(e,n,i,c,d){if(e===null){var h=i.type;return typeof h=="function"&&!ou(h)&&h.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(n.tag=15,n.type=h,xp(e,n,h,c,d)):(e=Ra(i.type,null,c,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,(e.lanes&d)===0){var y=h.memoizedProps;if(i=i.compare,i=i!==null?i:$i,i(y,c)&&e.ref===n.ref)return Ms(e,n,d)}return n.flags|=1,e=ir(h,c),e.ref=n.ref,e.return=n,n.child=e}function xp(e,n,i,c,d){if(e!==null){var h=e.memoizedProps;if($i(h,c)&&e.ref===n.ref)if(En=!1,n.pendingProps=c=h,(e.lanes&d)!==0)(e.flags&131072)!==0&&(En=!0);else return n.lanes=e.lanes,Ms(e,n,d)}return zc(e,n,i,c,d)}function wp(e,n,i){var c=n.pendingProps,d=c.children,h=e!==null?e.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},ct(li,Bn),Bn|=i;else{if((i&1073741824)===0)return e=h!==null?h.baseLanes|i:i,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,ct(li,Bn),Bn|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=h!==null?h.baseLanes:i,ct(li,Bn),Bn|=c}else h!==null?(c=h.baseLanes|i,n.memoizedState=null):c=i,ct(li,Bn),Bn|=c;return Sn(e,n,d,i),n.child}function kp(e,n){var i=n.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(n.flags|=512,n.flags|=2097152)}function zc(e,n,i,c,d){var h=Cn(i)?Sr:cn.current;return h=Zr(n,h),ri(n,d),i=_c(e,n,i,c,h,d),c=Rc(),e!==null&&!En?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~d,Ms(e,n,d)):(xt&&c&&fc(n),n.flags|=1,Sn(e,n,i,d),n.child)}function Sp(e,n,i,c,d){if(Cn(i)){var h=!0;ta(n)}else h=!1;if(ri(n,d),n.stateNode===null)xa(e,n),up(n,i,c),Pc(n,i,c,d),c=!0;else if(e===null){var y=n.stateNode,N=n.memoizedProps;y.props=N;var D=y.context,V=i.contextType;typeof V=="object"&&V!==null?V=Kn(V):(V=Cn(i)?Sr:cn.current,V=Zr(n,V));var ee=i.getDerivedStateFromProps,se=typeof ee=="function"||typeof y.getSnapshotBeforeUpdate=="function";se||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N!==c||D!==V)&&dp(n,y,c,V),Zs=!1;var J=n.memoizedState;y.state=J,ua(n,c,y,d),D=n.memoizedState,N!==c||J!==D||jn.current||Zs?(typeof ee=="function"&&(Lc(n,i,ee,c),D=n.memoizedState),(N=Zs||cp(n,i,N,c,J,D,V))?(se||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(n.flags|=4194308)):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=D),y.props=c,y.state=D,y.context=V,c=N):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{y=n.stateNode,$f(e,n),N=n.memoizedProps,V=n.type===n.elementType?N:rs(n.type,N),y.props=V,se=n.pendingProps,J=y.context,D=i.contextType,typeof D=="object"&&D!==null?D=Kn(D):(D=Cn(i)?Sr:cn.current,D=Zr(n,D));var me=i.getDerivedStateFromProps;(ee=typeof me=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N!==se||J!==D)&&dp(n,y,c,D),Zs=!1,J=n.memoizedState,y.state=J,ua(n,c,y,d);var xe=n.memoizedState;N!==se||J!==xe||jn.current||Zs?(typeof me=="function"&&(Lc(n,i,me,c),xe=n.memoizedState),(V=Zs||cp(n,i,V,c,J,xe,D)||!1)?(ee||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,xe,D),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,xe,D)),typeof y.componentDidUpdate=="function"&&(n.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof y.componentDidUpdate!="function"||N===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=xe),y.props=c,y.state=xe,y.context=D,c=V):(typeof y.componentDidUpdate!="function"||N===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),c=!1)}return Fc(e,n,i,c,h,d)}function Fc(e,n,i,c,d,h){kp(e,n);var y=(n.flags&128)!==0;if(!c&&!y)return d&&Cf(n,i,!1),Ms(e,n,h);c=n.stateNode,Vy.current=n;var N=y&&typeof i.getDerivedStateFromError!="function"?null:c.render();return n.flags|=1,e!==null&&y?(n.child=ni(n,e.child,null,h),n.child=ni(n,null,N,h)):Sn(e,n,N,h),n.memoizedState=c.state,d&&Cf(n,i,!0),n.child}function bp(e){var n=e.stateNode;n.pendingContext?Nf(e,n.pendingContext,n.pendingContext!==n.context):n.context&&Nf(e,n.context,!1),bc(e,n.containerInfo)}function Tp(e,n,i,c,d){return ti(),gc(d),n.flags|=256,Sn(e,n,i,c),n.child}var Uc={dehydrated:null,treeContext:null,retryLane:0};function Bc(e){return{baseLanes:e,cachePool:null,transitions:null}}function Np(e,n,i){var c=n.pendingProps,d=Tt.current,h=!1,y=(n.flags&128)!==0,N;if((N=y)||(N=e!==null&&e.memoizedState===null?!1:(d&2)!==0),N?(h=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(d|=1),ct(Tt,d&1),e===null)return mc(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((n.mode&1)===0?n.lanes=1:e.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(y=c.children,e=c.fallback,h?(c=n.mode,h=n.child,y={mode:"hidden",children:y},(c&1)===0&&h!==null?(h.childLanes=0,h.pendingProps=y):h=Aa(y,c,0,null),e=Ir(e,c,i,null),h.return=n,e.return=n,h.sibling=e,n.child=h,n.child.memoizedState=Bc(i),n.memoizedState=Uc,e):Wc(n,y));if(d=e.memoizedState,d!==null&&(N=d.dehydrated,N!==null))return Gy(e,n,y,c,N,d,i);if(h){h=c.fallback,y=n.mode,d=e.child,N=d.sibling;var D={mode:"hidden",children:c.children};return(y&1)===0&&n.child!==d?(c=n.child,c.childLanes=0,c.pendingProps=D,n.deletions=null):(c=ir(d,D),c.subtreeFlags=d.subtreeFlags&14680064),N!==null?h=ir(N,h):(h=Ir(h,y,i,null),h.flags|=2),h.return=n,c.return=n,c.sibling=h,n.child=c,c=h,h=n.child,y=e.child.memoizedState,y=y===null?Bc(i):{baseLanes:y.baseLanes|i,cachePool:null,transitions:y.transitions},h.memoizedState=y,h.childLanes=e.childLanes&~i,n.memoizedState=Uc,c}return h=e.child,e=h.sibling,c=ir(h,{mode:"visible",children:c.children}),(n.mode&1)===0&&(c.lanes=i),c.return=n,c.sibling=null,e!==null&&(i=n.deletions,i===null?(n.deletions=[e],n.flags|=16):i.push(e)),n.child=c,n.memoizedState=null,c}function Wc(e,n){return n=Aa({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function ya(e,n,i,c){return c!==null&&gc(c),ni(n,e.child,null,i),e=Wc(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Gy(e,n,i,c,d,h,y){if(i)return n.flags&256?(n.flags&=-257,c=Oc(Error(r(422))),ya(e,n,y,c)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(h=c.fallback,d=n.mode,c=Aa({mode:"visible",children:c.children},d,0,null),h=Ir(h,d,y,null),h.flags|=2,c.return=n,h.return=n,c.sibling=h,n.child=c,(n.mode&1)!==0&&ni(n,e.child,null,y),n.child.memoizedState=Bc(y),n.memoizedState=Uc,h);if((n.mode&1)===0)return ya(e,n,y,null);if(d.data==="$!"){if(c=d.nextSibling&&d.nextSibling.dataset,c)var N=c.dgst;return c=N,h=Error(r(419)),c=Oc(h,c,void 0),ya(e,n,y,c)}if(N=(y&e.childLanes)!==0,En||N){if(c=Yt,c!==null){switch(y&-y){case 4:d=2;break;case 16:d=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:d=32;break;case 536870912:d=268435456;break;default:d=0}d=(d&(c.suspendedLanes|y))!==0?0:d,d!==0&&d!==h.retryLane&&(h.retryLane=d,Is(e,d),as(c,e,d,-1))}return iu(),c=Oc(Error(r(421))),ya(e,n,y,c)}return d.data==="$?"?(n.flags|=128,n.child=e.child,n=ix.bind(null,e),d._reactRetry=n,null):(e=h.treeContext,Un=Ks(d.nextSibling),Fn=n,xt=!0,ss=null,e!==null&&(Gn[qn++]=Rs,Gn[qn++]=As,Gn[qn++]=br,Rs=e.id,As=e.overflow,br=n),n=Wc(n,c.children),n.flags|=4096,n)}function jp(e,n,i){e.lanes|=n;var c=e.alternate;c!==null&&(c.lanes|=n),wc(e.return,n,i)}function Hc(e,n,i,c,d){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:d}:(h.isBackwards=n,h.rendering=null,h.renderingStartTime=0,h.last=c,h.tail=i,h.tailMode=d)}function Cp(e,n,i){var c=n.pendingProps,d=c.revealOrder,h=c.tail;if(Sn(e,n,c.children,i),c=Tt.current,(c&2)!==0)c=c&1|2,n.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jp(e,i,n);else if(e.tag===19)jp(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}c&=1}if(ct(Tt,c),(n.mode&1)===0)n.memoizedState=null;else switch(d){case"forwards":for(i=n.child,d=null;i!==null;)e=i.alternate,e!==null&&da(e)===null&&(d=i),i=i.sibling;i=d,i===null?(d=n.child,n.child=null):(d=i.sibling,i.sibling=null),Hc(n,!1,d,i,h);break;case"backwards":for(i=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&da(e)===null){n.child=d;break}e=d.sibling,d.sibling=i,i=d,d=e}Hc(n,!0,i,null,h);break;case"together":Hc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function xa(e,n){(n.mode&1)===0&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Ms(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Er|=n.lanes,(i&n.childLanes)===0)return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=ir(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=ir(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function qy(e,n,i){switch(n.tag){case 3:bp(n),ti();break;case 5:Uf(n);break;case 1:Cn(n.type)&&ta(n);break;case 4:bc(n,n.stateNode.containerInfo);break;case 10:var c=n.type._context,d=n.memoizedProps.value;ct(aa,c._currentValue),c._currentValue=d;break;case 13:if(c=n.memoizedState,c!==null)return c.dehydrated!==null?(ct(Tt,Tt.current&1),n.flags|=128,null):(i&n.child.childLanes)!==0?Np(e,n,i):(ct(Tt,Tt.current&1),e=Ms(e,n,i),e!==null?e.sibling:null);ct(Tt,Tt.current&1);break;case 19:if(c=(i&n.childLanes)!==0,(e.flags&128)!==0){if(c)return Cp(e,n,i);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ct(Tt,Tt.current),c)break;return null;case 22:case 23:return n.lanes=0,wp(e,n,i)}return Ms(e,n,i)}var Ep,Vc,_p,Rp;Ep=function(e,n){for(var i=n.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},Vc=function(){},_p=function(e,n,i,c){var d=e.memoizedProps;if(d!==c){e=n.stateNode,jr(ws.current);var h=null;switch(i){case"input":d=$e(e,d),c=$e(e,c),h=[];break;case"select":d=U({},d,{value:void 0}),c=U({},c,{value:void 0}),h=[];break;case"textarea":d=Mt(e,d),c=Mt(e,c),h=[];break;default:typeof d.onClick!="function"&&typeof c.onClick=="function"&&(e.onclick=Zo)}ts(i,c);var y;i=null;for(V in d)if(!c.hasOwnProperty(V)&&d.hasOwnProperty(V)&&d[V]!=null)if(V==="style"){var N=d[V];for(y in N)N.hasOwnProperty(y)&&(i||(i={}),i[y]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(l.hasOwnProperty(V)?h||(h=[]):(h=h||[]).push(V,null));for(V in c){var D=c[V];if(N=d!=null?d[V]:void 0,c.hasOwnProperty(V)&&D!==N&&(D!=null||N!=null))if(V==="style")if(N){for(y in N)!N.hasOwnProperty(y)||D&&D.hasOwnProperty(y)||(i||(i={}),i[y]="");for(y in D)D.hasOwnProperty(y)&&N[y]!==D[y]&&(i||(i={}),i[y]=D[y])}else i||(h||(h=[]),h.push(V,i)),i=D;else V==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,N=N?N.__html:void 0,D!=null&&N!==D&&(h=h||[]).push(V,D)):V==="children"?typeof D!="string"&&typeof D!="number"||(h=h||[]).push(V,""+D):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(l.hasOwnProperty(V)?(D!=null&&V==="onScroll"&&pt("scroll",e),h||N===D||(h=[])):(h=h||[]).push(V,D))}i&&(h=h||[]).push("style",i);var V=h;(n.updateQueue=V)&&(n.flags|=4)}},Rp=function(e,n,i,c){i!==c&&(n.flags|=4)};function Ji(e,n){if(!xt)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:c.sibling=null}}function dn(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,c=0;if(n)for(var d=e.child;d!==null;)i|=d.lanes|d.childLanes,c|=d.subtreeFlags&14680064,c|=d.flags&14680064,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)i|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=c,e.childLanes=i,n}function Ky(e,n,i){var c=n.pendingProps;switch(pc(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(n),null;case 1:return Cn(n.type)&&ea(),dn(n),null;case 3:return c=n.stateNode,ii(),ht(jn),ht(cn),jc(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(e===null||e.child===null)&&(ia(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,ss!==null&&(nu(ss),ss=null))),Vc(e,n),dn(n),null;case 5:Tc(n);var d=jr(Ki.current);if(i=n.type,e!==null&&n.stateNode!=null)_p(e,n,i,c,d),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!c){if(n.stateNode===null)throw Error(r(166));return dn(n),null}if(e=jr(ws.current),ia(n)){c=n.stateNode,i=n.type;var h=n.memoizedProps;switch(c[xs]=n,c[Wi]=h,e=(n.mode&1)!==0,i){case"dialog":pt("cancel",c),pt("close",c);break;case"iframe":case"object":case"embed":pt("load",c);break;case"video":case"audio":for(d=0;d<Fi.length;d++)pt(Fi[d],c);break;case"source":pt("error",c);break;case"img":case"image":case"link":pt("error",c),pt("load",c);break;case"details":pt("toggle",c);break;case"input":en(c,h),pt("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!h.multiple},pt("invalid",c);break;case"textarea":q(c,h),pt("invalid",c)}ts(i,h),d=null;for(var y in h)if(h.hasOwnProperty(y)){var N=h[y];y==="children"?typeof N=="string"?c.textContent!==N&&(h.suppressHydrationWarning!==!0&&Qo(c.textContent,N,e),d=["children",N]):typeof N=="number"&&c.textContent!==""+N&&(h.suppressHydrationWarning!==!0&&Qo(c.textContent,N,e),d=["children",""+N]):l.hasOwnProperty(y)&&N!=null&&y==="onScroll"&&pt("scroll",c)}switch(i){case"input":at(c),tn(c,h,!0);break;case"textarea":at(c),Ue(c);break;case"select":case"option":break;default:typeof h.onClick=="function"&&(c.onclick=Zo)}c=d,n.updateQueue=c,c!==null&&(n.flags|=4)}else{y=d.nodeType===9?d:d.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=tt(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=y.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof c.is=="string"?e=y.createElement(i,{is:c.is}):(e=y.createElement(i),i==="select"&&(y=e,c.multiple?y.multiple=!0:c.size&&(y.size=c.size))):e=y.createElementNS(e,i),e[xs]=n,e[Wi]=c,Ep(e,n,!1,!1),n.stateNode=e;e:{switch(y=Ln(i,c),i){case"dialog":pt("cancel",e),pt("close",e),d=c;break;case"iframe":case"object":case"embed":pt("load",e),d=c;break;case"video":case"audio":for(d=0;d<Fi.length;d++)pt(Fi[d],e);d=c;break;case"source":pt("error",e),d=c;break;case"img":case"image":case"link":pt("error",e),pt("load",e),d=c;break;case"details":pt("toggle",e),d=c;break;case"input":en(e,c),d=$e(e,c),pt("invalid",e);break;case"option":d=c;break;case"select":e._wrapperState={wasMultiple:!!c.multiple},d=U({},c,{value:void 0}),pt("invalid",e);break;case"textarea":q(e,c),d=Mt(e,c),pt("invalid",e);break;default:d=c}ts(i,d),N=d;for(h in N)if(N.hasOwnProperty(h)){var D=N[h];h==="style"?ps(e,D):h==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&Ct(e,D)):h==="children"?typeof D=="string"?(i!=="textarea"||D!=="")&&an(e,D):typeof D=="number"&&an(e,""+D):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(l.hasOwnProperty(h)?D!=null&&h==="onScroll"&&pt("scroll",e):D!=null&&B(e,h,D,y))}switch(i){case"input":at(e),tn(e,c,!1);break;case"textarea":at(e),Ue(e);break;case"option":c.value!=null&&e.setAttribute("value",""+Ee(c.value));break;case"select":e.multiple=!!c.multiple,h=c.value,h!=null?$t(e,!!c.multiple,h,!1):c.defaultValue!=null&&$t(e,!!c.multiple,c.defaultValue,!0);break;default:typeof d.onClick=="function"&&(e.onclick=Zo)}switch(i){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return dn(n),null;case 6:if(e&&n.stateNode!=null)Rp(e,n,e.memoizedProps,c);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(i=jr(Ki.current),jr(ws.current),ia(n)){if(c=n.stateNode,i=n.memoizedProps,c[xs]=n,(h=c.nodeValue!==i)&&(e=Fn,e!==null))switch(e.tag){case 3:Qo(c.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Qo(c.nodeValue,i,(e.mode&1)!==0)}h&&(n.flags|=4)}else c=(i.nodeType===9?i:i.ownerDocument).createTextNode(c),c[xs]=n,n.stateNode=c}return dn(n),null;case 13:if(ht(Tt),c=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(xt&&Un!==null&&(n.mode&1)!==0&&(n.flags&128)===0)Df(),ti(),n.flags|=98560,h=!1;else if(h=ia(n),c!==null&&c.dehydrated!==null){if(e===null){if(!h)throw Error(r(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));h[xs]=n}else ti(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;dn(n),h=!1}else ss!==null&&(nu(ss),ss=null),h=!0;if(!h)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=i,n):(c=c!==null,c!==(e!==null&&e.memoizedState!==null)&&c&&(n.child.flags|=8192,(n.mode&1)!==0&&(e===null||(Tt.current&1)!==0?Ut===0&&(Ut=3):iu())),n.updateQueue!==null&&(n.flags|=4),dn(n),null);case 4:return ii(),Vc(e,n),e===null&&Ui(n.stateNode.containerInfo),dn(n),null;case 10:return xc(n.type._context),dn(n),null;case 17:return Cn(n.type)&&ea(),dn(n),null;case 19:if(ht(Tt),h=n.memoizedState,h===null)return dn(n),null;if(c=(n.flags&128)!==0,y=h.rendering,y===null)if(c)Ji(h,!1);else{if(Ut!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(y=da(e),y!==null){for(n.flags|=128,Ji(h,!1),c=y.updateQueue,c!==null&&(n.updateQueue=c,n.flags|=4),n.subtreeFlags=0,c=i,i=n.child;i!==null;)h=i,e=c,h.flags&=14680066,y=h.alternate,y===null?(h.childLanes=0,h.lanes=e,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=y.childLanes,h.lanes=y.lanes,h.child=y.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=y.memoizedProps,h.memoizedState=y.memoizedState,h.updateQueue=y.updateQueue,h.type=y.type,e=y.dependencies,h.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return ct(Tt,Tt.current&1|2),n.child}e=e.sibling}h.tail!==null&&kt()>ci&&(n.flags|=128,c=!0,Ji(h,!1),n.lanes=4194304)}else{if(!c)if(e=da(y),e!==null){if(n.flags|=128,c=!0,i=e.updateQueue,i!==null&&(n.updateQueue=i,n.flags|=4),Ji(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!xt)return dn(n),null}else 2*kt()-h.renderingStartTime>ci&&i!==1073741824&&(n.flags|=128,c=!0,Ji(h,!1),n.lanes=4194304);h.isBackwards?(y.sibling=n.child,n.child=y):(i=h.last,i!==null?i.sibling=y:n.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=kt(),n.sibling=null,i=Tt.current,ct(Tt,c?i&1|2:i&1),n):(dn(n),null);case 22:case 23:return ru(),c=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==c&&(n.flags|=8192),c&&(n.mode&1)!==0?(Bn&1073741824)!==0&&(dn(n),n.subtreeFlags&6&&(n.flags|=8192)):dn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Yy(e,n){switch(pc(n),n.tag){case 1:return Cn(n.type)&&ea(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ii(),ht(jn),ht(cn),jc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Tc(n),null;case 13:if(ht(Tt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ti()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ht(Tt),null;case 4:return ii(),null;case 10:return xc(n.type._context),null;case 22:case 23:return ru(),null;case 24:return null;default:return null}}var wa=!1,fn=!1,Xy=typeof WeakSet=="function"?WeakSet:Set,ye=null;function ai(e,n){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(c){Rt(e,n,c)}else i.current=null}function Gc(e,n,i){try{i()}catch(c){Rt(e,n,c)}}var Ap=!1;function Qy(e,n){if(rc=Fo,e=cf(),Xl(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var d=c.anchorOffset,h=c.focusNode;c=c.focusOffset;try{i.nodeType,h.nodeType}catch{i=null;break e}var y=0,N=-1,D=-1,V=0,ee=0,se=e,J=null;t:for(;;){for(var me;se!==i||d!==0&&se.nodeType!==3||(N=y+d),se!==h||c!==0&&se.nodeType!==3||(D=y+c),se.nodeType===3&&(y+=se.nodeValue.length),(me=se.firstChild)!==null;)J=se,se=me;for(;;){if(se===e)break t;if(J===i&&++V===d&&(N=y),J===h&&++ee===c&&(D=y),(me=se.nextSibling)!==null)break;se=J,J=se.parentNode}se=me}i=N===-1||D===-1?null:{start:N,end:D}}else i=null}i=i||{start:0,end:0}}else i=null;for(ic={focusedElem:e,selectionRange:i},Fo=!1,ye=n;ye!==null;)if(n=ye,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ye=e;else for(;ye!==null;){n=ye;try{var xe=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var ke=xe.memoizedProps,It=xe.memoizedState,z=n.stateNode,L=z.getSnapshotBeforeUpdate(n.elementType===n.type?ke:rs(n.type,ke),It);z.__reactInternalSnapshotBeforeUpdate=L}break;case 3:var H=n.stateNode.containerInfo;H.nodeType===1?H.textContent="":H.nodeType===9&&H.documentElement&&H.removeChild(H.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ce){Rt(n,n.return,ce)}if(e=n.sibling,e!==null){e.return=n.return,ye=e;break}ye=n.return}return xe=Ap,Ap=!1,xe}function eo(e,n,i){var c=n.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var d=c=c.next;do{if((d.tag&e)===e){var h=d.destroy;d.destroy=void 0,h!==void 0&&Gc(n,i,h)}d=d.next}while(d!==c)}}function ka(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var c=i.create;i.destroy=c()}i=i.next}while(i!==n)}}function qc(e){var n=e.ref;if(n!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof n=="function"?n(e):n.current=e}}function Ip(e){var n=e.alternate;n!==null&&(e.alternate=null,Ip(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[xs],delete n[Wi],delete n[cc],delete n[Dy],delete n[My])),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 Dp(e){return e.tag===5||e.tag===3||e.tag===4}function Mp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Dp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Kc(e,n,i){var c=e.tag;if(c===5||c===6)e=e.stateNode,n?i.nodeType===8?i.parentNode.insertBefore(e,n):i.insertBefore(e,n):(i.nodeType===8?(n=i.parentNode,n.insertBefore(e,i)):(n=i,n.appendChild(e)),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Zo));else if(c!==4&&(e=e.child,e!==null))for(Kc(e,n,i),e=e.sibling;e!==null;)Kc(e,n,i),e=e.sibling}function Yc(e,n,i){var c=e.tag;if(c===5||c===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(c!==4&&(e=e.child,e!==null))for(Yc(e,n,i),e=e.sibling;e!==null;)Yc(e,n,i),e=e.sibling}var nn=null,is=!1;function er(e,n,i){for(i=i.child;i!==null;)Lp(e,n,i),i=i.sibling}function Lp(e,n,i){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(gr,i)}catch{}switch(i.tag){case 5:fn||ai(i,n);case 6:var c=nn,d=is;nn=null,er(e,n,i),nn=c,is=d,nn!==null&&(is?(e=nn,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):nn.removeChild(i.stateNode));break;case 18:nn!==null&&(is?(e=nn,i=i.stateNode,e.nodeType===8?lc(e.parentNode,i):e.nodeType===1&&lc(e,i),Ii(e)):lc(nn,i.stateNode));break;case 4:c=nn,d=is,nn=i.stateNode.containerInfo,is=!0,er(e,n,i),nn=c,is=d;break;case 0:case 11:case 14:case 15:if(!fn&&(c=i.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){d=c=c.next;do{var h=d,y=h.destroy;h=h.tag,y!==void 0&&((h&2)!==0||(h&4)!==0)&&Gc(i,n,y),d=d.next}while(d!==c)}er(e,n,i);break;case 1:if(!fn&&(ai(i,n),c=i.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=i.memoizedProps,c.state=i.memoizedState,c.componentWillUnmount()}catch(N){Rt(i,n,N)}er(e,n,i);break;case 21:er(e,n,i);break;case 22:i.mode&1?(fn=(c=fn)||i.memoizedState!==null,er(e,n,i),fn=c):er(e,n,i);break;default:er(e,n,i)}}function Pp(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new Xy),n.forEach(function(c){var d=ox.bind(null,e,c);i.has(c)||(i.add(c),c.then(d,d))})}}function os(e,n){var i=n.deletions;if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];try{var h=e,y=n,N=y;e:for(;N!==null;){switch(N.tag){case 5:nn=N.stateNode,is=!1;break e;case 3:nn=N.stateNode.containerInfo,is=!0;break e;case 4:nn=N.stateNode.containerInfo,is=!0;break e}N=N.return}if(nn===null)throw Error(r(160));Lp(h,y,d),nn=null,is=!1;var D=d.alternate;D!==null&&(D.return=null),d.return=null}catch(V){Rt(d,n,V)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)Op(n,e),n=n.sibling}function Op(e,n){var i=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(os(n,e),Ss(e),c&4){try{eo(3,e,e.return),ka(3,e)}catch(ke){Rt(e,e.return,ke)}try{eo(5,e,e.return)}catch(ke){Rt(e,e.return,ke)}}break;case 1:os(n,e),Ss(e),c&512&&i!==null&&ai(i,i.return);break;case 5:if(os(n,e),Ss(e),c&512&&i!==null&&ai(i,i.return),e.flags&32){var d=e.stateNode;try{an(d,"")}catch(ke){Rt(e,e.return,ke)}}if(c&4&&(d=e.stateNode,d!=null)){var h=e.memoizedProps,y=i!==null?i.memoizedProps:h,N=e.type,D=e.updateQueue;if(e.updateQueue=null,D!==null)try{N==="input"&&h.type==="radio"&&h.name!=null&&Fe(d,h),Ln(N,y);var V=Ln(N,h);for(y=0;y<D.length;y+=2){var ee=D[y],se=D[y+1];ee==="style"?ps(d,se):ee==="dangerouslySetInnerHTML"?Ct(d,se):ee==="children"?an(d,se):B(d,ee,se,V)}switch(N){case"input":Ht(d,h);break;case"textarea":pe(d,h);break;case"select":var J=d._wrapperState.wasMultiple;d._wrapperState.wasMultiple=!!h.multiple;var me=h.value;me!=null?$t(d,!!h.multiple,me,!1):J!==!!h.multiple&&(h.defaultValue!=null?$t(d,!!h.multiple,h.defaultValue,!0):$t(d,!!h.multiple,h.multiple?[]:"",!1))}d[Wi]=h}catch(ke){Rt(e,e.return,ke)}}break;case 6:if(os(n,e),Ss(e),c&4){if(e.stateNode===null)throw Error(r(162));d=e.stateNode,h=e.memoizedProps;try{d.nodeValue=h}catch(ke){Rt(e,e.return,ke)}}break;case 3:if(os(n,e),Ss(e),c&4&&i!==null&&i.memoizedState.isDehydrated)try{Ii(n.containerInfo)}catch(ke){Rt(e,e.return,ke)}break;case 4:os(n,e),Ss(e);break;case 13:os(n,e),Ss(e),d=e.child,d.flags&8192&&(h=d.memoizedState!==null,d.stateNode.isHidden=h,!h||d.alternate!==null&&d.alternate.memoizedState!==null||(Zc=kt())),c&4&&Pp(e);break;case 22:if(ee=i!==null&&i.memoizedState!==null,e.mode&1?(fn=(V=fn)||ee,os(n,e),fn=V):os(n,e),Ss(e),c&8192){if(V=e.memoizedState!==null,(e.stateNode.isHidden=V)&&!ee&&(e.mode&1)!==0)for(ye=e,ee=e.child;ee!==null;){for(se=ye=ee;ye!==null;){switch(J=ye,me=J.child,J.tag){case 0:case 11:case 14:case 15:eo(4,J,J.return);break;case 1:ai(J,J.return);var xe=J.stateNode;if(typeof xe.componentWillUnmount=="function"){c=J,i=J.return;try{n=c,xe.props=n.memoizedProps,xe.state=n.memoizedState,xe.componentWillUnmount()}catch(ke){Rt(c,i,ke)}}break;case 5:ai(J,J.return);break;case 22:if(J.memoizedState!==null){Fp(se);continue}}me!==null?(me.return=J,ye=me):Fp(se)}ee=ee.sibling}e:for(ee=null,se=e;;){if(se.tag===5){if(ee===null){ee=se;try{d=se.stateNode,V?(h=d.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none"):(N=se.stateNode,D=se.memoizedProps.style,y=D!=null&&D.hasOwnProperty("display")?D.display:null,N.style.display=Mn("display",y))}catch(ke){Rt(e,e.return,ke)}}}else if(se.tag===6){if(ee===null)try{se.stateNode.nodeValue=V?"":se.memoizedProps}catch(ke){Rt(e,e.return,ke)}}else if((se.tag!==22&&se.tag!==23||se.memoizedState===null||se===e)&&se.child!==null){se.child.return=se,se=se.child;continue}if(se===e)break e;for(;se.sibling===null;){if(se.return===null||se.return===e)break e;ee===se&&(ee=null),se=se.return}ee===se&&(ee=null),se.sibling.return=se.return,se=se.sibling}}break;case 19:os(n,e),Ss(e),c&4&&Pp(e);break;case 21:break;default:os(n,e),Ss(e)}}function Ss(e){var n=e.flags;if(n&2){try{e:{for(var i=e.return;i!==null;){if(Dp(i)){var c=i;break e}i=i.return}throw Error(r(160))}switch(c.tag){case 5:var d=c.stateNode;c.flags&32&&(an(d,""),c.flags&=-33);var h=Mp(e);Yc(e,h,d);break;case 3:case 4:var y=c.stateNode.containerInfo,N=Mp(e);Kc(e,N,y);break;default:throw Error(r(161))}}catch(D){Rt(e,e.return,D)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Zy(e,n,i){ye=e,$p(e)}function $p(e,n,i){for(var c=(e.mode&1)!==0;ye!==null;){var d=ye,h=d.child;if(d.tag===22&&c){var y=d.memoizedState!==null||wa;if(!y){var N=d.alternate,D=N!==null&&N.memoizedState!==null||fn;N=wa;var V=fn;if(wa=y,(fn=D)&&!V)for(ye=d;ye!==null;)y=ye,D=y.child,y.tag===22&&y.memoizedState!==null?Up(d):D!==null?(D.return=y,ye=D):Up(d);for(;h!==null;)ye=h,$p(h),h=h.sibling;ye=d,wa=N,fn=V}zp(e)}else(d.subtreeFlags&8772)!==0&&h!==null?(h.return=d,ye=h):zp(e)}}function zp(e){for(;ye!==null;){var n=ye;if((n.flags&8772)!==0){var i=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:fn||ka(5,n);break;case 1:var c=n.stateNode;if(n.flags&4&&!fn)if(i===null)c.componentDidMount();else{var d=n.elementType===n.type?i.memoizedProps:rs(n.type,i.memoizedProps);c.componentDidUpdate(d,i.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var h=n.updateQueue;h!==null&&Ff(n,h,c);break;case 3:var y=n.updateQueue;if(y!==null){if(i=null,n.child!==null)switch(n.child.tag){case 5:i=n.child.stateNode;break;case 1:i=n.child.stateNode}Ff(n,y,i)}break;case 5:var N=n.stateNode;if(i===null&&n.flags&4){i=N;var D=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&i.focus();break;case"img":D.src&&(i.src=D.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var V=n.alternate;if(V!==null){var ee=V.memoizedState;if(ee!==null){var se=ee.dehydrated;se!==null&&Ii(se)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fn||n.flags&512&&qc(n)}catch(J){Rt(n,n.return,J)}}if(n===e){ye=null;break}if(i=n.sibling,i!==null){i.return=n.return,ye=i;break}ye=n.return}}function Fp(e){for(;ye!==null;){var n=ye;if(n===e){ye=null;break}var i=n.sibling;if(i!==null){i.return=n.return,ye=i;break}ye=n.return}}function Up(e){for(;ye!==null;){var n=ye;try{switch(n.tag){case 0:case 11:case 15:var i=n.return;try{ka(4,n)}catch(D){Rt(n,i,D)}break;case 1:var c=n.stateNode;if(typeof c.componentDidMount=="function"){var d=n.return;try{c.componentDidMount()}catch(D){Rt(n,d,D)}}var h=n.return;try{qc(n)}catch(D){Rt(n,h,D)}break;case 5:var y=n.return;try{qc(n)}catch(D){Rt(n,y,D)}}}catch(D){Rt(n,n.return,D)}if(n===e){ye=null;break}var N=n.sibling;if(N!==null){N.return=n.return,ye=N;break}ye=n.return}}var Jy=Math.ceil,Sa=I.ReactCurrentDispatcher,Xc=I.ReactCurrentOwner,Xn=I.ReactCurrentBatchConfig,Ye=0,Yt=null,Pt=null,sn=0,Bn=0,li=Ys(0),Ut=0,to=null,Er=0,ba=0,Qc=0,no=null,_n=null,Zc=0,ci=1/0,Ls=null,Ta=!1,Jc=null,tr=null,Na=!1,nr=null,ja=0,so=0,eu=null,Ca=-1,Ea=0;function bn(){return(Ye&6)!==0?kt():Ca!==-1?Ca:Ca=kt()}function sr(e){return(e.mode&1)===0?1:(Ye&2)!==0&&sn!==0?sn&-sn:Py.transition!==null?(Ea===0&&(Ea=Ei()),Ea):(e=qe,e!==0||(e=window.event,e=e===void 0?16:Bd(e.type)),e)}function as(e,n,i,c){if(50<so)throw so=0,eu=null,Error(r(185));wr(e,i,c),((Ye&2)===0||e!==Yt)&&(e===Yt&&((Ye&2)===0&&(ba|=i),Ut===4&&rr(e,sn)),Rn(e,c),i===1&&Ye===0&&(n.mode&1)===0&&(ci=kt()+500,na&&Qs()))}function Rn(e,n){var i=e.callbackNode;Oo(e,n);var c=xr(e,e===Yt?sn:0);if(c===0)i!==null&&_t(i),e.callbackNode=null,e.callbackPriority=0;else if(n=c&-c,e.callbackPriority!==n){if(i!=null&&_t(i),n===1)e.tag===0?Ly(Wp.bind(null,e)):Ef(Wp.bind(null,e)),Ay(function(){(Ye&6)===0&&Qs()}),i=null;else{switch(le(c)){case 1:i=Bs;break;case 4:i=ys;break;case 16:i=zr;break;case 536870912:i=Lo;break;default:i=zr}i=Qp(i,Bp.bind(null,e))}e.callbackPriority=n,e.callbackNode=i}}function Bp(e,n){if(Ca=-1,Ea=0,(Ye&6)!==0)throw Error(r(327));var i=e.callbackNode;if(ui()&&e.callbackNode!==i)return null;var c=xr(e,e===Yt?sn:0);if(c===0)return null;if((c&30)!==0||(c&e.expiredLanes)!==0||n)n=_a(e,c);else{n=c;var d=Ye;Ye|=2;var h=Vp();(Yt!==e||sn!==n)&&(Ls=null,ci=kt()+500,Rr(e,n));do try{nx();break}catch(N){Hp(e,N)}while(!0);yc(),Sa.current=h,Ye=d,Pt!==null?n=0:(Yt=null,sn=0,n=Ut)}if(n!==0){if(n===2&&(d=Ci(e),d!==0&&(c=d,n=tu(e,d))),n===1)throw i=to,Rr(e,0),rr(e,c),Rn(e,kt()),i;if(n===6)rr(e,c);else{if(d=e.current.alternate,(c&30)===0&&!ex(d)&&(n=_a(e,c),n===2&&(h=Ci(e),h!==0&&(c=h,n=tu(e,h))),n===1))throw i=to,Rr(e,0),rr(e,c),Rn(e,kt()),i;switch(e.finishedWork=d,e.finishedLanes=c,n){case 0:case 1:throw Error(r(345));case 2:Ar(e,_n,Ls);break;case 3:if(rr(e,c),(c&130023424)===c&&(n=Zc+500-kt(),10<n)){if(xr(e,0)!==0)break;if(d=e.suspendedLanes,(d&c)!==c){bn(),e.pingedLanes|=e.suspendedLanes&d;break}e.timeoutHandle=ac(Ar.bind(null,e,_n,Ls),n);break}Ar(e,_n,Ls);break;case 4:if(rr(e,c),(c&4194240)===c)break;for(n=e.eventTimes,d=-1;0<c;){var y=31-wn(c);h=1<<y,y=n[y],y>d&&(d=y),c&=~h}if(c=d,c=kt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*Jy(c/1960))-c,10<c){e.timeoutHandle=ac(Ar.bind(null,e,_n,Ls),c);break}Ar(e,_n,Ls);break;case 5:Ar(e,_n,Ls);break;default:throw Error(r(329))}}}return Rn(e,kt()),e.callbackNode===i?Bp.bind(null,e):null}function tu(e,n){var i=no;return e.current.memoizedState.isDehydrated&&(Rr(e,n).flags|=256),e=_a(e,n),e!==2&&(n=_n,_n=i,n!==null&&nu(n)),e}function nu(e){_n===null?_n=e:_n.push.apply(_n,e)}function ex(e){for(var n=e;;){if(n.flags&16384){var i=n.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var c=0;c<i.length;c++){var d=i[c],h=d.getSnapshot;d=d.value;try{if(!ns(h(),d))return!1}catch{return!1}}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function rr(e,n){for(n&=~Qc,n&=~ba,e.suspendedLanes|=n,e.pingedLanes&=~n,e=e.expirationTimes;0<n;){var i=31-wn(n),c=1<<i;e[i]=-1,n&=~c}}function Wp(e){if((Ye&6)!==0)throw Error(r(327));ui();var n=xr(e,0);if((n&1)===0)return Rn(e,kt()),null;var i=_a(e,n);if(e.tag!==0&&i===2){var c=Ci(e);c!==0&&(n=c,i=tu(e,c))}if(i===1)throw i=to,Rr(e,0),rr(e,n),Rn(e,kt()),i;if(i===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=n,Ar(e,_n,Ls),Rn(e,kt()),null}function su(e,n){var i=Ye;Ye|=1;try{return e(n)}finally{Ye=i,Ye===0&&(ci=kt()+500,na&&Qs())}}function _r(e){nr!==null&&nr.tag===0&&(Ye&6)===0&&ui();var n=Ye;Ye|=1;var i=Xn.transition,c=qe;try{if(Xn.transition=null,qe=1,e)return e()}finally{qe=c,Xn.transition=i,Ye=n,(Ye&6)===0&&Qs()}}function ru(){Bn=li.current,ht(li)}function Rr(e,n){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,Ry(i)),Pt!==null)for(i=Pt.return;i!==null;){var c=i;switch(pc(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&ea();break;case 3:ii(),ht(jn),ht(cn),jc();break;case 5:Tc(c);break;case 4:ii();break;case 13:ht(Tt);break;case 19:ht(Tt);break;case 10:xc(c.type._context);break;case 22:case 23:ru()}i=i.return}if(Yt=e,Pt=e=ir(e.current,null),sn=Bn=n,Ut=0,to=null,Qc=ba=Er=0,_n=no=null,Nr!==null){for(n=0;n<Nr.length;n++)if(i=Nr[n],c=i.interleaved,c!==null){i.interleaved=null;var d=c.next,h=i.pending;if(h!==null){var y=h.next;h.next=d,c.next=y}i.pending=c}Nr=null}return e}function Hp(e,n){do{var i=Pt;try{if(yc(),fa.current=ga,pa){for(var c=Nt.memoizedState;c!==null;){var d=c.queue;d!==null&&(d.pending=null),c=c.next}pa=!1}if(Cr=0,Kt=Ft=Nt=null,Yi=!1,Xi=0,Xc.current=null,i===null||i.return===null){Ut=1,to=n,Pt=null;break}e:{var h=e,y=i.return,N=i,D=n;if(n=sn,N.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var V=D,ee=N,se=ee.tag;if((ee.mode&1)===0&&(se===0||se===11||se===15)){var J=ee.alternate;J?(ee.updateQueue=J.updateQueue,ee.memoizedState=J.memoizedState,ee.lanes=J.lanes):(ee.updateQueue=null,ee.memoizedState=null)}var me=mp(y);if(me!==null){me.flags&=-257,gp(me,y,N,h,n),me.mode&1&&hp(h,V,n),n=me,D=V;var xe=n.updateQueue;if(xe===null){var ke=new Set;ke.add(D),n.updateQueue=ke}else xe.add(D);break e}else{if((n&1)===0){hp(h,V,n),iu();break e}D=Error(r(426))}}else if(xt&&N.mode&1){var It=mp(y);if(It!==null){(It.flags&65536)===0&&(It.flags|=256),gp(It,y,N,h,n),gc(oi(D,N));break e}}h=D=oi(D,N),Ut!==4&&(Ut=2),no===null?no=[h]:no.push(h),h=y;do{switch(h.tag){case 3:h.flags|=65536,n&=-n,h.lanes|=n;var z=fp(h,D,n);zf(h,z);break e;case 1:N=D;var L=h.type,H=h.stateNode;if((h.flags&128)===0&&(typeof L.getDerivedStateFromError=="function"||H!==null&&typeof H.componentDidCatch=="function"&&(tr===null||!tr.has(H)))){h.flags|=65536,n&=-n,h.lanes|=n;var ce=pp(h,N,n);zf(h,ce);break e}}h=h.return}while(h!==null)}qp(i)}catch(Te){n=Te,Pt===i&&i!==null&&(Pt=i=i.return);continue}break}while(!0)}function Vp(){var e=Sa.current;return Sa.current=ga,e===null?ga:e}function iu(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),Yt===null||(Er&268435455)===0&&(ba&268435455)===0||rr(Yt,sn)}function _a(e,n){var i=Ye;Ye|=2;var c=Vp();(Yt!==e||sn!==n)&&(Ls=null,Rr(e,n));do try{tx();break}catch(d){Hp(e,d)}while(!0);if(yc(),Ye=i,Sa.current=c,Pt!==null)throw Error(r(261));return Yt=null,sn=0,Ut}function tx(){for(;Pt!==null;)Gp(Pt)}function nx(){for(;Pt!==null&&!gs();)Gp(Pt)}function Gp(e){var n=Xp(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,n===null?qp(e):Pt=n,Xc.current=null}function qp(e){var n=e;do{var i=n.alternate;if(e=n.return,(n.flags&32768)===0){if(i=Ky(i,n,Bn),i!==null){Pt=i;return}}else{if(i=Yy(i,n),i!==null){i.flags&=32767,Pt=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ut=6,Pt=null;return}}if(n=n.sibling,n!==null){Pt=n;return}Pt=n=e}while(n!==null);Ut===0&&(Ut=5)}function Ar(e,n,i){var c=qe,d=Xn.transition;try{Xn.transition=null,qe=1,sx(e,n,i,c)}finally{Xn.transition=d,qe=c}return null}function sx(e,n,i,c){do ui();while(nr!==null);if((Ye&6)!==0)throw Error(r(327));i=e.finishedWork;var d=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var h=i.lanes|i.childLanes;if($o(e,h),e===Yt&&(Pt=Yt=null,sn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Na||(Na=!0,Qp(zr,function(){return ui(),null})),h=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||h){h=Xn.transition,Xn.transition=null;var y=qe;qe=1;var N=Ye;Ye|=4,Xc.current=null,Qy(e,i),Op(i,e),by(ic),Fo=!!rc,ic=rc=null,e.current=i,Zy(i),$l(),Ye=N,qe=y,Xn.transition=h}else e.current=i;if(Na&&(Na=!1,nr=e,ja=d),h=e.pendingLanes,h===0&&(tr=null),Fr(i.stateNode),Rn(e,kt()),n!==null)for(c=e.onRecoverableError,i=0;i<n.length;i++)d=n[i],c(d.value,{componentStack:d.stack,digest:d.digest});if(Ta)throw Ta=!1,e=Jc,Jc=null,e;return(ja&1)!==0&&e.tag!==0&&ui(),h=e.pendingLanes,(h&1)!==0?e===eu?so++:(so=0,eu=e):so=0,Qs(),null}function ui(){if(nr!==null){var e=le(ja),n=Xn.transition,i=qe;try{if(Xn.transition=null,qe=16>e?16:e,nr===null)var c=!1;else{if(e=nr,nr=null,ja=0,(Ye&6)!==0)throw Error(r(331));var d=Ye;for(Ye|=4,ye=e.current;ye!==null;){var h=ye,y=h.child;if((ye.flags&16)!==0){var N=h.deletions;if(N!==null){for(var D=0;D<N.length;D++){var V=N[D];for(ye=V;ye!==null;){var ee=ye;switch(ee.tag){case 0:case 11:case 15:eo(8,ee,h)}var se=ee.child;if(se!==null)se.return=ee,ye=se;else for(;ye!==null;){ee=ye;var J=ee.sibling,me=ee.return;if(Ip(ee),ee===V){ye=null;break}if(J!==null){J.return=me,ye=J;break}ye=me}}}var xe=h.alternate;if(xe!==null){var ke=xe.child;if(ke!==null){xe.child=null;do{var It=ke.sibling;ke.sibling=null,ke=It}while(ke!==null)}}ye=h}}if((h.subtreeFlags&2064)!==0&&y!==null)y.return=h,ye=y;else e:for(;ye!==null;){if(h=ye,(h.flags&2048)!==0)switch(h.tag){case 0:case 11:case 15:eo(9,h,h.return)}var z=h.sibling;if(z!==null){z.return=h.return,ye=z;break e}ye=h.return}}var L=e.current;for(ye=L;ye!==null;){y=ye;var H=y.child;if((y.subtreeFlags&2064)!==0&&H!==null)H.return=y,ye=H;else e:for(y=L;ye!==null;){if(N=ye,(N.flags&2048)!==0)try{switch(N.tag){case 0:case 11:case 15:ka(9,N)}}catch(Te){Rt(N,N.return,Te)}if(N===y){ye=null;break e}var ce=N.sibling;if(ce!==null){ce.return=N.return,ye=ce;break e}ye=N.return}}if(Ye=d,Qs(),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(gr,e)}catch{}c=!0}return c}finally{qe=i,Xn.transition=n}}return!1}function Kp(e,n,i){n=oi(i,n),n=fp(e,n,1),e=Js(e,n,1),n=bn(),e!==null&&(wr(e,1,n),Rn(e,n))}function Rt(e,n,i){if(e.tag===3)Kp(e,e,i);else for(;n!==null;){if(n.tag===3){Kp(n,e,i);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(tr===null||!tr.has(c))){e=oi(i,e),e=pp(n,e,1),n=Js(n,e,1),e=bn(),n!==null&&(wr(n,1,e),Rn(n,e));break}}n=n.return}}function rx(e,n,i){var c=e.pingCache;c!==null&&c.delete(n),n=bn(),e.pingedLanes|=e.suspendedLanes&i,Yt===e&&(sn&i)===i&&(Ut===4||Ut===3&&(sn&130023424)===sn&&500>kt()-Zc?Rr(e,0):Qc|=i),Rn(e,n)}function Yp(e,n){n===0&&((e.mode&1)===0?n=1:(n=Br,Br<<=1,(Br&130023424)===0&&(Br=4194304)));var i=bn();e=Is(e,n),e!==null&&(wr(e,n,i),Rn(e,i))}function ix(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),Yp(e,i)}function ox(e,n){var i=0;switch(e.tag){case 13:var c=e.stateNode,d=e.memoizedState;d!==null&&(i=d.retryLane);break;case 19:c=e.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(n),Yp(e,i)}var Xp;Xp=function(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps||jn.current)En=!0;else{if((e.lanes&i)===0&&(n.flags&128)===0)return En=!1,qy(e,n,i);En=(e.flags&131072)!==0}else En=!1,xt&&(n.flags&1048576)!==0&&_f(n,ra,n.index);switch(n.lanes=0,n.tag){case 2:var c=n.type;xa(e,n),e=n.pendingProps;var d=Zr(n,cn.current);ri(n,i),d=_c(null,n,c,e,d,i);var h=Rc();return n.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Cn(c)?(h=!0,ta(n)):h=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,Sc(n),d.updater=va,n.stateNode=d,d._reactInternals=n,Pc(n,c,e,i),n=Fc(null,n,c,!0,h,i)):(n.tag=0,xt&&h&&fc(n),Sn(null,n,d,i),n=n.child),n;case 16:c=n.elementType;e:{switch(xa(e,n),e=n.pendingProps,d=c._init,c=d(c._payload),n.type=c,d=n.tag=lx(c),e=rs(c,e),d){case 0:n=zc(null,n,c,e,i);break e;case 1:n=Sp(null,n,c,e,i);break e;case 11:n=vp(null,n,c,e,i);break e;case 14:n=yp(null,n,c,rs(c.type,e),i);break e}throw Error(r(306,c,""))}return n;case 0:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:rs(c,d),zc(e,n,c,d,i);case 1:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:rs(c,d),Sp(e,n,c,d,i);case 3:e:{if(bp(n),e===null)throw Error(r(387));c=n.pendingProps,h=n.memoizedState,d=h.element,$f(e,n),ua(n,c,null,i);var y=n.memoizedState;if(c=y.element,h.isDehydrated)if(h={element:c,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){d=oi(Error(r(423)),n),n=Tp(e,n,c,i,d);break e}else if(c!==d){d=oi(Error(r(424)),n),n=Tp(e,n,c,i,d);break e}else for(Un=Ks(n.stateNode.containerInfo.firstChild),Fn=n,xt=!0,ss=null,i=Pf(n,null,c,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(ti(),c===d){n=Ms(e,n,i);break e}Sn(e,n,c,i)}n=n.child}return n;case 5:return Uf(n),e===null&&mc(n),c=n.type,d=n.pendingProps,h=e!==null?e.memoizedProps:null,y=d.children,oc(c,d)?y=null:h!==null&&oc(c,h)&&(n.flags|=32),kp(e,n),Sn(e,n,y,i),n.child;case 6:return e===null&&mc(n),null;case 13:return Np(e,n,i);case 4:return bc(n,n.stateNode.containerInfo),c=n.pendingProps,e===null?n.child=ni(n,null,c,i):Sn(e,n,c,i),n.child;case 11:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:rs(c,d),vp(e,n,c,d,i);case 7:return Sn(e,n,n.pendingProps,i),n.child;case 8:return Sn(e,n,n.pendingProps.children,i),n.child;case 12:return Sn(e,n,n.pendingProps.children,i),n.child;case 10:e:{if(c=n.type._context,d=n.pendingProps,h=n.memoizedProps,y=d.value,ct(aa,c._currentValue),c._currentValue=y,h!==null)if(ns(h.value,y)){if(h.children===d.children&&!jn.current){n=Ms(e,n,i);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var N=h.dependencies;if(N!==null){y=h.child;for(var D=N.firstContext;D!==null;){if(D.context===c){if(h.tag===1){D=Ds(-1,i&-i),D.tag=2;var V=h.updateQueue;if(V!==null){V=V.shared;var ee=V.pending;ee===null?D.next=D:(D.next=ee.next,ee.next=D),V.pending=D}}h.lanes|=i,D=h.alternate,D!==null&&(D.lanes|=i),wc(h.return,i,n),N.lanes|=i;break}D=D.next}}else if(h.tag===10)y=h.type===n.type?null:h.child;else if(h.tag===18){if(y=h.return,y===null)throw Error(r(341));y.lanes|=i,N=y.alternate,N!==null&&(N.lanes|=i),wc(y,i,n),y=h.sibling}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===n){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}Sn(e,n,d.children,i),n=n.child}return n;case 9:return d=n.type,c=n.pendingProps.children,ri(n,i),d=Kn(d),c=c(d),n.flags|=1,Sn(e,n,c,i),n.child;case 14:return c=n.type,d=rs(c,n.pendingProps),d=rs(c.type,d),yp(e,n,c,d,i);case 15:return xp(e,n,n.type,n.pendingProps,i);case 17:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:rs(c,d),xa(e,n),n.tag=1,Cn(c)?(e=!0,ta(n)):e=!1,ri(n,i),up(n,c,d),Pc(n,c,d,i),Fc(null,n,c,!0,e,i);case 19:return Cp(e,n,i);case 22:return wp(e,n,i)}throw Error(r(156,n.tag))};function Qp(e,n){return Qe(e,n)}function ax(e,n,i,c){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(e,n,i,c){return new ax(e,n,i,c)}function ou(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lx(e){if(typeof e=="function")return ou(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ne)return 11;if(e===te)return 14}return 2}function ir(e,n){var i=e.alternate;return i===null?(i=Qn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Ra(e,n,i,c,d,h){var y=2;if(c=e,typeof e=="function")ou(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case K:return Ir(i.children,d,h,n);case F:y=8,d|=8;break;case re:return e=Qn(12,i,n,d|2),e.elementType=re,e.lanes=h,e;case Se:return e=Qn(13,i,n,d),e.elementType=Se,e.lanes=h,e;case Pe:return e=Qn(19,i,n,d),e.elementType=Pe,e.lanes=h,e;case ae:return Aa(i,d,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case he:y=10;break e;case G:y=9;break e;case Ne:y=11;break e;case te:y=14;break e;case oe:y=16,c=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Qn(y,i,n,d),n.elementType=e,n.type=c,n.lanes=h,n}function Ir(e,n,i,c){return e=Qn(7,e,c,n),e.lanes=i,e}function Aa(e,n,i,c){return e=Qn(22,e,c,n),e.elementType=ae,e.lanes=i,e.stateNode={isHidden:!1},e}function au(e,n,i){return e=Qn(6,e,null,n),e.lanes=i,e}function lu(e,n,i){return n=Qn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function cx(e,n,i,c,d){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_i(0),this.expirationTimes=_i(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_i(0),this.identifierPrefix=c,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function cu(e,n,i,c,d,h,y,N,D){return e=new cx(e,n,i,N,D),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Qn(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:c,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sc(h),e}function ux(e,n,i){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Y,key:c==null?null:""+c,children:e,containerInfo:n,implementation:i}}function Zp(e){if(!e)return Xs;e=e._reactInternals;e:{if(Be(e)!==e||e.tag!==1)throw Error(r(170));var n=e;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Cn(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(e.tag===1){var i=e.type;if(Cn(i))return jf(e,i,n)}return n}function Jp(e,n,i,c,d,h,y,N,D){return e=cu(i,c,!0,e,d,h,y,N,D),e.context=Zp(null),i=e.current,c=bn(),d=sr(i),h=Ds(c,d),h.callback=n??null,Js(i,h,d),e.current.lanes=d,wr(e,d,c),Rn(e,c),e}function Ia(e,n,i,c){var d=n.current,h=bn(),y=sr(d);return i=Zp(i),n.context===null?n.context=i:n.pendingContext=i,n=Ds(h,y),n.payload={element:e},c=c===void 0?null:c,c!==null&&(n.callback=c),e=Js(d,n,y),e!==null&&(as(e,d,y,h),ca(e,d,y)),y}function Da(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 eh(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function uu(e,n){eh(e,n),(e=e.alternate)&&eh(e,n)}function dx(){return null}var th=typeof reportError=="function"?reportError:function(e){console.error(e)};function du(e){this._internalRoot=e}Ma.prototype.render=du.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));Ia(e,n,null,null)},Ma.prototype.unmount=du.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;_r(function(){Ia(null,e,null,null)}),n[Es]=null}};function Ma(e){this._internalRoot=e}Ma.prototype.unstable_scheduleHydration=function(e){if(e){var n=we();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Vs.length&&n!==0&&n<Vs[i].priority;i++);Vs.splice(i,0,e),i===0&&Fd(e)}};function fu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function La(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function nh(){}function fx(e,n,i,c,d){if(d){if(typeof c=="function"){var h=c;c=function(){var V=Da(y);h.call(V)}}var y=Jp(n,c,e,0,null,!1,!1,"",nh);return e._reactRootContainer=y,e[Es]=y.current,Ui(e.nodeType===8?e.parentNode:e),_r(),y}for(;d=e.lastChild;)e.removeChild(d);if(typeof c=="function"){var N=c;c=function(){var V=Da(D);N.call(V)}}var D=cu(e,0,!1,null,null,!1,!1,"",nh);return e._reactRootContainer=D,e[Es]=D.current,Ui(e.nodeType===8?e.parentNode:e),_r(function(){Ia(n,D,i,c)}),D}function Pa(e,n,i,c,d){var h=i._reactRootContainer;if(h){var y=h;if(typeof d=="function"){var N=d;d=function(){var D=Da(y);N.call(D)}}Ia(n,y,e,d)}else y=fx(i,n,e,d,c);return Da(y)}b=function(e){switch(e.tag){case 3:var n=e.stateNode;if(n.current.memoizedState.isDehydrated){var i=yr(n.pendingLanes);i!==0&&(Hs(n,i|1),Rn(n,kt()),(Ye&6)===0&&(ci=kt()+500,Qs()))}break;case 13:_r(function(){var c=Is(e,1);if(c!==null){var d=bn();as(c,e,1,d)}}),uu(e,1)}},$=function(e){if(e.tag===13){var n=Is(e,134217728);if(n!==null){var i=bn();as(n,e,134217728,i)}uu(e,134217728)}},Z=function(e){if(e.tag===13){var n=sr(e),i=Is(e,n);if(i!==null){var c=bn();as(i,e,n,c)}uu(e,n)}},we=function(){return qe},je=function(e,n){var i=qe;try{return qe=e,n()}finally{qe=i}},Vt=function(e,n,i){switch(n){case"input":if(Ht(e,i),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<i.length;n++){var c=i[n];if(c!==e&&c.form===e.form){var d=Jo(c);if(!d)throw Error(r(90));De(c),Ht(c,d)}}}break;case"textarea":pe(e,i);break;case"select":n=i.value,n!=null&&$t(e,!!i.multiple,n,!1)}},vt=su,yt=_r;var px={usingClientEntryPoint:!1,Events:[Hi,Xr,Jo,ft,Gt,su]},ro={findFiberByHostInstance:kr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hx={bundleType:ro.bundleType,version:ro.version,rendererPackageName:ro.rendererPackageName,rendererConfig:ro.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:I.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=On(e),e===null?null:e.stateNode},findFiberByHostInstance:ro.findFiberByHostInstance||dx,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 Oa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oa.isDisabled&&Oa.supportsFiber)try{gr=Oa.inject(hx),$n=Oa}catch{}}return An.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=px,An.createPortal=function(e,n){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!fu(n))throw Error(r(200));return ux(e,n,null,i)},An.createRoot=function(e,n){if(!fu(e))throw Error(r(299));var i=!1,c="",d=th;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onRecoverableError!==void 0&&(d=n.onRecoverableError)),n=cu(e,1,!1,null,null,i,!1,c,d),e[Es]=n.current,Ui(e.nodeType===8?e.parentNode:e),new du(n)},An.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=On(n),e=e===null?null:e.stateNode,e},An.flushSync=function(e){return _r(e)},An.hydrate=function(e,n,i){if(!La(n))throw Error(r(200));return Pa(null,e,n,!0,i)},An.hydrateRoot=function(e,n,i){if(!fu(e))throw Error(r(405));var c=i!=null&&i.hydratedSources||null,d=!1,h="",y=th;if(i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onRecoverableError!==void 0&&(y=i.onRecoverableError)),n=Jp(n,null,e,1,i??null,d,!1,h,y),e[Es]=n.current,Ui(e),c)for(e=0;e<c.length;e++)i=c[e],d=i._getVersion,d=d(i._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[i,d]:n.mutableSourceEagerHydrationData.push(i,d);return new Ma(n)},An.render=function(e,n,i){if(!La(n))throw Error(r(200));return Pa(null,e,n,!1,i)},An.unmountComponentAtNode=function(e){if(!La(e))throw Error(r(40));return e._reactRootContainer?(_r(function(){Pa(null,null,e,!1,function(){e._reactRootContainer=null,e[Es]=null})}),!0):!1},An.unstable_batchedUpdates=su,An.unstable_renderSubtreeIntoContainer=function(e,n,i,c){if(!La(i))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Pa(e,n,i,!1,c)},An.version="18.3.1-next-f1338f8080-20240426",An}var uh;function eg(){if(uh)return mu.exports;uh=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),mu.exports=bx(),mu.exports}var dh;function Tx(){if(dh)return $a;dh=1;var t=eg();return $a.createRoot=t.createRoot,$a.hydrateRoot=t.hydrateRoot,$a}var Nx=Tx();const jx=Jm(Nx),fh=t=>{let s;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(s):m;if(!Object.is(k,s)){const w=s;s=v??(typeof k!="object"||k===null)?k:Object.assign({},s,k),r.forEach(S=>S(s,w))}},l=()=>s,p={setState:o,getState:l,getInitialState:()=>g,subscribe:m=>(r.add(m),()=>r.delete(m))},g=s=t(o,l,p);return p},Cx=(t=>t?fh(t):fh),Ex=t=>t;function _x(t,s=Ex){const r=ot.useSyncExternalStore(t.subscribe,ot.useCallback(()=>s(t.getState()),[t,s]),ot.useCallback(()=>s(t.getInitialState()),[t,s]));return ot.useDebugValue(r),r}const Rx=t=>{const s=Cx(t),r=o=>_x(s,o);return Object.assign(r,s),r},Ax=(t=>Rx),tg="agentpane:machines",ng="agentpane:active-machine";function Ix(t){return/^[a-z][a-z0-9-]{1,30}$/.test(t)}function sg(t){return`${t}.repoburg.com`}function rg(t){const s=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(t);return s?s[1]:null}function ig(t,s){try{const r=localStorage.getItem(t);return r==null?s:JSON.parse(r)}catch{return s}}function og(t,s){try{localStorage.setItem(t,JSON.stringify(s))}catch{}}function ag(){return ig(tg,[]).filter(s=>Ix(s.mahlas)&&s.hostname===sg(s.mahlas))}function Dx(t){const s={mahlas:t,hostname:sg(t),lastConnectedAt:new Date().toISOString()},r=ag(),o=[s,...r.filter(l=>l.mahlas!==t)];return og(tg,o),s}function Mx(){const t=ig(ng,null);return t?ag().find(s=>s.mahlas===t)??null:null}function Lx(t){og(ng,t)}function Px(){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search).get("host");if(!t)return;const s=rg(t);s&&(Dx(s),Lx(s))}const ph="http://localhost:9998",Ox=["agent.repoburg.com"];function mn(){if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search),s=t.get("bport");if(s)return`http://localhost:${s}`;const r=t.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if(Ox.includes(o))return ph;if(rg(o))return"";const l=Mx();return l?`https://${l.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":ph}const $x="/api";class ld extends Error{constructor(r,o,l){super(r);rt(this,"status");rt(this,"body");this.name="ApiError",this.status=o,this.body=l}}function vi(t){var s;if(t instanceof ld){const r=(s=t.body)==null?void 0:s.error;if(typeof r=="string"&&r)return r}return t instanceof Error?t.message:String(t)}async function Co(t,s,r){const o=await fetch(`${mn()}${$x}${s}`,{method:t,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let l=`${o.status} ${o.statusText}`,u=null;try{u=await o.json();const f=u==null?void 0:u.error;typeof f=="string"&&f&&(l=`${l} — ${f}`)}catch{}throw new ld(`${t} ${s} failed: ${l}`,o.status,u)}return o.json()}function Wt(t){return Co("GET",t)}function ut(t,s){return Co("POST",t,s)}function Tl(t){return Co("DELETE",t)}function Ns(t,s){return Co("PATCH",t,s)}function zx(t,s){return Co("PUT",t,s)}function Fx(){return Wt("/sessions")}function oo(t){return Wt(`/sessions/${t}`)}function cd(t){return ut("/sessions",t)}function hh(t){return Tl(`/sessions/${t}`)}function lg(t,s,r,o){return ut(`/sessions/${t}/turns`,{user_prompt:s,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function Ux(t){return ut(`/sessions/${t}/cancel`)}function Bx(t,s){return ut(`/sessions/${t}/turns/${s}/resume`)}function Wx(t,s){return Ns(`/sessions/${t}`,{title:s})}function mh(t){return Ns(`/sessions/${t}`,{lifecycle:"finished"})}function gh(t){return Ns(`/sessions/${t}`,{lifecycle:"working"})}function Hx(t,s){return Ns(`/sessions/${t}`,{starred:s})}function vh(t){return Ns(`/sessions/${t}`,{has_unreviewed:0})}function Vx(t,s,r,o){const l={model:s,model_reasoning_effort:r};return o!==void 0&&(l.runtime_type=o),Ns(`/sessions/${t}`,l)}function Gx(t,s){return Ns(`/sessions/${t}`,{runtime_config:s})}function qx(t,s){return ut(`/sessions/${t}/rewind`,{turn_id:s})}function Kx(t){return ut(`/sessions/${t}/restore`,{})}function Yx(t,s,r){return ut(`/sessions/${t}/branch`,{turn_id:s,title:r})}function cg(){return Wt("/workspaces")}function Xx(t,s){return ut("/workspaces",{path:t,label:s})}function Qx(t){return ut("/workspaces/hide",{path:t})}function Zx(){return Wt("/workspaces/picker")}function yh(t){return Wt(t?`/workspaces/browse?path=${encodeURIComponent(t)}`:"/workspaces/browse")}async function Jx(){const t=await fetch(`${mn()}/api/pick-directory`);if(t.status===204)return{cancelled:!0};if(!t.ok)throw new Error(`GET /api/pick-directory failed: ${t.status} ${t.statusText}`);return t.json()}function ug(){return Wt("/folders")}function e0(t,s){return ut("/folders",{workspace_path:t,name:s})}function xh(t,s){return Ns(`/folders/${t}`,s)}function t0(t){return Tl(`/folders/${t}`)}function n0(t){return ut("/sessions/reorder",{moves:t})}function pr(t){return t.status==="pending"||t.status==="running"}function dg(t){return!!(t!=null&&t.turns.some(pr))}function Nl(t){return t?t.turns.some(pr)||(t.threads??[]).some(s=>(s.turns??[]).some(pr)):!1}const fg=1;function pg(){let t="";try{t=mn()}catch{}return`agentpane:tabs:${t||window.location.origin}`}function wh(t){return Array.isArray(t)&&t.every(s=>typeof s=="string")}function kh(t){return t===null||typeof t=="string"}function s0(t){if(t==null)return null;let s;try{s=JSON.parse(t)}catch{return null}if(typeof s!="object"||s===null)return null;const r=s;return r.v!==fg||!wh(r.openTabs)||!kh(r.activeSessionId)||!wh(r.openAppTabs)||!kh(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId}}const hg=[()=>window.sessionStorage,()=>window.localStorage];function r0(){const t=pg();for(const s of hg)try{const r=s0(s().getItem(t));if(r)return r}catch{}return null}function i0(t){const s=pg(),r=JSON.stringify({v:fg,openTabs:t.openTabs,activeSessionId:t.activeSessionId,openAppTabs:t.openAppTabs,activeAppTabId:t.activeAppTabId});for(const o of hg)try{o().setItem(s,r)}catch{}}function o0(t){return t.subscribe((s,r)=>{(s.openTabs!==r.openTabs||s.activeSessionId!==r.activeSessionId||s.openAppTabs!==r.openAppTabs||s.activeAppTabId!==r.activeAppTabId)&&i0(s)})}function el(t){return[...new Set(t)]}function a0(t,s,r,o){const l=m=>r===null||r.has(m),u=el(((t==null?void 0:t.openTabs)??[]).filter(m=>s.has(m))),f=el(((t==null?void 0:t.openAppTabs)??[]).filter(l));let p=(t==null?void 0:t.activeSessionId)??null;p!==null&&!s.has(p)&&(p=null),p!==null&&!u.includes(p)&&u.push(p),p??(p=u.at(-1)??null);let g=(t==null?void 0:t.activeAppTabId)??null;return g!==null&&!l(g)&&(g=null),g!==null&&!f.includes(g)&&f.push(g),o!==null&&s.has(o)&&(u.includes(o)||u.push(o),p=o,g=null),{openTabs:u,activeSessionId:p,openAppTabs:f,activeAppTabId:g}}function l0(){const t=new URLSearchParams(window.location.search);return{session:t.get("session"),thread:t.get("thread")}}function c0(){const t=new URL(window.location.href);!t.searchParams.has("session")&&!t.searchParams.has("thread")||(t.searchParams.delete("session"),t.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",t))}let yu=0;function Sh(t){return t==="sidecar"?"sidecar":"turns"}async function u0(t,s){const r=await Promise.allSettled(t.map(u=>s(u))),o=new Map;let l=null;return r.forEach((u,f)=>{var p;u.status==="fulfilled"?o.set(t[f],u.value):l===null&&(l=((p=u.reason)==null?void 0:p.message)??"Request failed")}),{updated:o,firstError:l}}function bh(t,s){const r={...t.sessionDetails};s.forEach(p=>delete r[p]);const o={...t.backgroundTasks};s.forEach(p=>delete o[p]);const l=t.openTabs.filter(p=>!s.has(p));let u=t.activeSessionId,f=t.activeTurnIndex;if(u&&s.has(u)){u=l.length>0?l[l.length-1]:null;const p=u?r[u]:null;f=p&&p.turns.length>0?p.turns.length-1:0}return{sessions:t.sessions.filter(p=>!s.has(p.id)),sessionDetails:r,backgroundTasks:o,openTabs:l,activeSessionId:u,activeTurnIndex:f}}function d0(t){const s={...t};return delete s.turns,delete s.threads,delete s.contextUsage,s}async function Th(t,s,r,o,l){if(r.length===0)return;t({error:null});const{updated:u,firstError:f}=await u0(r,o);u.size>0&&t(g=>({sessions:g.sessions.map(m=>u.get(m.id)??m)}));const p=r.length-u.size;if(p===0)s().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{t({error:f});const g=l[0].toUpperCase()+l.slice(1);s().addToast(p===r.length?"error":"warn",`${g} ${u.size} of ${r.length} — ${p} failed`)}}const f0=(t,s)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=l0(),o=r0();try{const l=localStorage.getItem("agentpane:last-model-config");l&&t({lastModelConfig:JSON.parse(l)})}catch{}t({loading:!0,error:null});try{const l=s().loadApps(),[u,f,p]=await Promise.all([Fx(),cg(),ug()]);t({sessions:u,workspaces:f,folders:p,loading:!1}),c0();const g=await l,m=a0(o,new Set(u.map(v=>v.id)),g?new Set(s().apps.map(v=>v.id)):null,r.session);t(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:el([...m.openTabs,...v.openTabs]),openAppTabs:el([...m.openAppTabs,...v.openAppTabs]),activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!s().activeSessionId&&await s().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(t({deepLinkThreadId:r.thread}),s().switchRightTab("threads"))}catch(l){t({loading:!1,error:l.message})}},selectSession:async(r,o)=>{const l=++yu,u=o!=null&&o.keepAppView?{}:{activeAppTabId:null},f=p=>p.includes(r)?p:[...p,r];if(s().sessionDetails[r]){const p=s().sessionDetails[r];t({activeSessionId:r,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:Sh(s().activeRightTab),...u,openTabs:f(s().openTabs)}),p.has_unreviewed===1&&(vh(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...p,has_unreviewed:0}}})));return}t({loading:!0,error:null});try{const p=await oo(r);if(l!==yu){t(g=>({sessionDetails:{...g.sessionDetails,[r]:p},openTabs:f(g.openTabs),loading:!1}));return}t(g=>({sessionDetails:{...g.sessionDetails,[r]:p},activeSessionId:r,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:Sh(g.activeRightTab),...u,openTabs:f(g.openTabs),loading:!1})),p.has_unreviewed===1&&(vh(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...p,has_unreviewed:0}}})))}catch(p){t(l===yu?{loading:!1,error:p.message}:{loading:!1})}},closeTab:r=>{t(o=>{const l=o.openTabs.filter(u=>u!==r);if(o.activeSessionId===r&&l.length>0){const u=l[l.length-1],f=o.sessionDetails[u];return{openTabs:l,activeSessionId:u,activeTurnIndex:f&&f.turns.length>0?f.turns.length-1:0}}return{openTabs:l,activeSessionId:o.activeSessionId===r?null:o.activeSessionId}})},updateModelConfig:async(r,o,l)=>{const u=s().activeSessionId;if(u){t({error:null});try{const f=await Vx(u,r,o,l),p={provider:f.runtime_type,model:f.model??"",reasoning:f.model_reasoning_effort??""};t({lastModelConfig:p}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(p)),t(g=>({sessions:g.sessions.map(m=>m.id===u?f:m),sessionDetails:g.sessionDetails[u]?{...g.sessionDetails,[u]:{...g.sessionDetails[u],model:f.model,model_reasoning_effort:f.model_reasoning_effort,external_thread_id:f.external_thread_id}}:g.sessionDetails})),await s().refreshActiveSession()}catch(f){t({error:f.message}),s().addToast("error",`Failed to update model — ${f.message}`)}}},createSession:async r=>{t({error:null});try{const o=await cd(r);t(u=>({sessions:[o,...u.sessions],showNewSessionDialog:!1}));const l={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};t({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await s().selectSession(o.id),s().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),s().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{t(o=>({sessions:o.sessions.some(l=>l.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=s().sessionDetails[r];if(!o){const l=await oo(r);t(u=>({sessionDetails:{...u.sessionDetails,[r]:l}})),o=l}s().sessions.some(l=>l.id===r)||s().addSession(d0(o)),await s().selectSession(r)},deleteSession:async r=>{var l;t({error:null});const o=(l=s().sessions.find(u=>u.id===r))==null?void 0:l.title;try{await hh(r),t(u=>bh(u,new Set([r]))),s().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),s().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(u){t({error:u.message}),s().addToast("error",`Failed to delete session — ${u.message}`)}},renameSession:async(r,o)=>{t({error:null});try{const l=await Wx(r,o.trim());t(u=>({sessions:u.sessions.map(f=>f.id===r?l:f),sessionDetails:u.sessionDetails[r]?{...u.sessionDetails,[r]:{...u.sessionDetails[r],title:l.title}}:u.sessionDetails}))}catch(l){t({error:l.message}),s().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{t({error:null});try{const o=await mh(r);t(l=>({sessions:l.sessions.map(u=>u.id===r?o:u)})),s().addToast("info","Session marked as finished")}catch(o){t({error:o.message}),s().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await Th(t,s,r,mh,"marked as finished")},toggleStar:async r=>{const o=s().sessions.find(l=>l.id===r);if(o){t({error:null});try{const l=await Hx(r,o.starred?0:1);t(u=>({sessions:u.sessions.map(f=>f.id===r?l:f),sessionDetails:u.sessionDetails[r]?{...u.sessionDetails,[r]:{...u.sessionDetails[r],starred:l.starred}}:u.sessionDetails}))}catch(l){t({error:l.message}),s().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{t({error:null});try{const o=await gh(r);t(l=>({sessions:l.sessions.map(u=>u.id===r?o:u)})),s().addToast("info","Session reopened")}catch(o){t({error:o.message}),s().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await Th(t,s,r,gh,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;t({error:null});const o=await Promise.allSettled(r.map(f=>hh(f))),l=new Set;if(o.forEach((f,p)=>{f.status==="fulfilled"&&l.add(r[p])}),l.size===0){t({error:"Failed to delete sessions"}),s().addToast("error","Failed to delete sessions");return}t(f=>bh(f,l)),s().addLogEntry("INFO",`${l.size} session${l.size===1?"":"s"} deleted`);const u=r.length-l.size;u===0?s().addToast("info",`${l.size} session${l.size===1?"":"s"} deleted`):(t({error:"One or more sessions failed to delete"}),s().addToast("warn",`Deleted ${l.size} of ${r.length} — ${u} failed`))},submitPrompt:async(r,o)=>{const l=s().activeSessionId;if(l){t({error:null,submittingPrompt:r}),t(u=>{const f=u.sessionDetails[l];return f?{sessionDetails:{...u.sessionDetails,[l]:{...f,is_running:1,status:"running"}},sessions:u.sessions.map(p=>p.id===l?{...p,is_running:1,status:"running"}:p)}:{}});try{const u=await lg(l,r,o);s().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),t(f=>{const p=f.sessionDetails[l];if(!p)return{submittingPrompt:null};const g=p.turns.findIndex(v=>v.id===u.id);if(g>=0)return{submittingPrompt:null,activeTurnIndex:g};const m={...u,items:[]};return{submittingPrompt:null,sessionDetails:{...f.sessionDetails,[l]:{...p,turns:[...p.turns,m]}},activeTurnIndex:p.turns.length}})}catch(u){t({submittingPrompt:null,error:u.message}),s().addLogEntry("ERROR",`Turn failed — ${u.message}`),s().addToast("error",`Failed to send prompt — ${u.message}`),t(f=>{const p=f.sessionDetails[l];if(!p)return{};const g=Nl(p)?1:0;return{sessionDetails:{...f.sessionDetails,[l]:{...p,is_running:g,status:g?"running":"active"}},sessions:f.sessions.map(m=>m.id===l?{...m,is_running:g,status:g?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=s().activeSessionId;if(r)try{await Ux(r)}catch(o){t({error:o.message})}},rewindToTurn:async(r,o)=>{t({error:null});try{const l=await qx(r,o),u=await oo(r);t(f=>({sessionDetails:{...f.sessionDetails,[r]:u},sessions:f.sessions.map(p=>p.id===r?{...p,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:p),activeTurnIndex:u.turns.length>0?u.turns.length-1:0})),s().addToast("info","Rewound to selected turn")}catch(l){t({error:l.message}),s().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{t({error:null});try{const o=await Kx(r),l=await oo(r);t(u=>({sessionDetails:{...u.sessionDetails,[r]:l},sessions:u.sessions.map(f=>f.id===r?{...f,external_thread_id:o.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:l.turns.length>0?l.turns.length-1:0})),s().addToast("info","Restored rewound session")}catch(o){t({error:o.message}),s().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,l)=>{t({error:null});try{const u=await Yx(r,o,l);t(f=>({sessions:[u,...f.sessions]})),await s().selectSession(u.id),s().addToast("success","Branched from selected turn")}catch(u){t({error:u.message}),s().addToast("error",`Failed to branch — ${u.message}`)}},updateRuntimeConfig:async r=>{const o=s().activeSessionId;if(o){t({error:null});try{const l=await Gx(o,JSON.stringify(r));t(u=>({sessions:u.sessions.map(f=>f.id===o?l:f),sessionDetails:u.sessionDetails[o]?{...u.sessionDetails,[o]:{...u.sessionDetails[o],runtime_config:l.runtime_config}}:u.sessionDetails}))}catch(l){t({error:l.message}),s().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=s().activeSessionId;if(r)try{const o=await oo(r);t(l=>({sessionDetails:{...l.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(l.activeTurnIndex,o.turns.length-1):0,sessions:l.sessions.map(u=>u.id===r?{...u,is_running:o.is_running,status:o.status}:u)}))}catch(o){t({error:o.message})}}});async function mg(t){const{sessions:s}=await Wt(`/claude-sessions?workspace=${encodeURIComponent(t)}`);return s}function p0(t,s){return ut(`/claude-sessions/${encodeURIComponent(t)}/import`,{workspace:s})}const Nh={available:!0,reason:null};let xu=null;const h0=(t,s)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=s().pickerSupport;return r?Promise.resolve(r):(xu??(xu=Zx().then(o=>typeof(o==null?void 0:o.available)!="boolean"?Nh:(t({pickerSupport:o}),o)).catch(()=>Nh).finally(()=>{xu=null})),xu)},createWorkspaceAt:async r=>{const o=await Xx(r.trim());return t(l=>({workspaces:[...l.workspaces.filter(u=>u.id!==o.id),o]})),o},addWorkspace:async r=>{t({error:null});try{const o=await s().createWorkspaceAt(r);return s().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return s().addToast("error",`Failed to add workspace — ${vi(o)}`),null}},removeWorkspace:async r=>{t({error:null});try{await Qx(r);const o=await cg();t({workspaces:o}),s().addToast("info","Workspace hidden")}catch(o){s().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{t({error:null});try{const o=s().lastModelConfig,l=await cd({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});t(u=>({sessions:[l,...u.sessions]})),await s().selectSession(l.id),s().addLogEntry("INFO",`Session created in ${r} — ${l.id.slice(0,8)}`),s().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await s().loadPickerSupport()).available){s().setShowAddWorkspaceDialog(!0);return}try{const o=await Jx();if(o.cancelled||!o.path)return;await s().addWorkspace(o.path)}catch(o){s().addToast("error",`Failed to pick directory — ${o.message}`)}},importClaudeSessions:async(r,o)=>{const l=[],u=[];for(const f of[...o].reverse())try{l.unshift(await p0(f,r))}catch(p){u.unshift({id:f,error:vi(p)})}return l.length>0&&(t(f=>({sessions:[...l,...f.sessions]})),await s().selectSession(l[0].id),s().addLogEntry("INFO",`Imported ${l.length} Claude Code session(s) into ${r}`),s().addToast("success",l.length===1?`Imported — ${l[0].title||"Claude Code session"}`:`Imported ${l.length} Claude Code sessions`)),{imported:l,failed:u}}}),Fs=new Map,ud=new Map,jl=new Map,dd=new Map,Cl=new Map;function m0(t,s,r=""){Fs.set(t,s),ud.set(t,r)}function g0(t){Fs.delete(t),ud.delete(t)}function wu(t,s){jl.set(t,s)}function jh(t,s,r){const o=jl.get(t);if(!o)return;const l=Fs.get(o);l&&l({source:"agentpane-host",event:s,payload:r})}function Ch(t,s){const r=jl.get(t);if(!r)return;const o=Fs.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:t,tasks:s}})}function v0(t,s,r,o,l){if(typeof l=="string"&&l!==ud.get(t))return;const u=Fs.get(t);u&&u({source:"agentpane-host",event:"tool_call",payload:{callId:s,tool:r,name:r,args:o}})}function y0(t,s,r,o){const l=jl.get(t);if(!l)return;const u=Fs.get(l);u&&u({source:"agentpane-host",event:"turn:delta",payload:{sessionId:t,turnId:s,itemId:r,delta:o}})}function x0(t,s){dd.set(t,s)}function w0(t){dd.delete(t)}function k0(t,s){Cl.set(t,s)}function S0(t){Cl.delete(t)}function gg(t,s={}){const r=Cl.get(t);if(r){r(s);return}const o=Fs.get(t);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function b0(){for(const t of new Set([...Fs.keys(),...Cl.keys()]))gg(t)}function T0(t){var r;const s=Fs.get(t);s&&s({source:"agentpane-host",event:"source:updated",payload:{}}),(r=dd.get(t))==null||r()}const N0=(t,s)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},setWsConnected:r=>t({wsConnected:r}),onTurnCreated:(r,o)=>{t(l=>{const u=l.sessionDetails[r];return!u||o.thread_id?{}:u.turns.some(f=>f.id===o.id)?{}:{sessionDetails:{...l.sessionDetails,[r]:{...u,turns:[...u.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{s().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),t(l=>{const u=ar(l.sessions,r,()=>({is_running:1,status:"running"})),f=l.sessionDetails[r];if(!f)return{sessions:u};const p=f.turns.findIndex(g=>g.id===o);return{sessionDetails:{...l.sessionDetails,[r]:{...Zn(f,o,g=>({...g,status:"running"})),is_running:1,status:"running"}},sessions:u,activeTurnIndex:l.activeSessionId===r&&p>=0?p:l.activeTurnIndex}})},onItemStarted:(r,o,l)=>{s().addLogEntry("DEBUG",`item:started — ${l.type}`),t(u=>{const f=Eh(l)?Dr(u.retryStates,o):u.retryStates,p=u.sessionDetails[r];return p?{sessionDetails:{...u.sessionDetails,[r]:Zn(p,o,g=>Su(g,l))},retryStates:f}:{retryStates:f}})},onItemUpdated:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:Zn(f,o,p=>Su(p,l))}}:{}})},onItemCompleted:(r,o,l)=>{if(s().addLogEntry("DEBUG",`item:completed — ${l.type}`),l.type==="background_task"&&(l.status==="completed"||l.status==="failed")){const u=l.data||{},f=u.task_type||"unknown",p=u.description||"background task",m=f==="local_agent"?"Subagent":f==="local_bash"?"Monitor":"Task";l.status==="completed"?s().addToast("success",`${m} completed: ${p}`):u.status!=="stopped"&&s().addToast("error",`${m} failed: ${p}`)}t(u=>{const f=Eh(l)?Dr(u.retryStates,o):u.retryStates,p=u.sessionDetails[r];return p?{retryStates:f,sessionDetails:{...u.sessionDetails,[r]:Zn(p,o,g=>{var v,k;let m=Su(g,l);if(l.type==="agent_message"&&((v=l.data)!=null&&v.text)&&(m={...m,agent_response:l.data.text}),l.type==="reasoning"&&((k=l.data)!=null&&k.text)){const w=m.thoughts?m.thoughts+`
|
|
41
|
-
`+l.data.text:l.data.text;m={...m,thoughts:w}}return m})}}:{retryStates:f}})},onItemDelta:(r,o,l,u)=>{y0(r,o,l,u),t(f=>{const p=Dr(f.retryStates,o),g=f.sessionDetails[r];return g?{sessionDetails:{...f.sessionDetails,[r]:Zn(g,o,m=>C0(m,l,u))},retryStates:p}:{retryStates:p}})},onTurnCompleted:(r,o,l,u,f)=>{const p=(l==null?void 0:l.input_tokens)??0,g=(l==null?void 0:l.output_tokens)??0;s().addLogEntry("INFO",`turn:completed — ${p} in / ${g} out`),jh(r,"turn:completed",{turnId:o,response:f??null}),s().refreshApps(),t(m=>{const v=m.sessionDetails[r],k=v?Zn(v,o,T=>({...T,status:"completed",token_usage:l??T.token_usage??null,...f&&!T.agent_response?{agent_response:f}:{}})):null,w=ku(k),S=w&&k?za(k):"active",C=ar(m.sessions,r,T=>({is_running:w,status:S,has_unreviewed:u?1:T.has_unreviewed})),E=Dr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:w,status:S,has_unreviewed:u?1:k.has_unreviewed}},sessions:C,retryStates:E}:{sessions:C,retryStates:E}})},onTokenUsageUpdated:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:Zn(f,o,p=>({...p,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,o)=>{t(l=>{const u=l.sessionDetails[r];return u?{sessionDetails:{...l.sessionDetails,[r]:{...u,contextUsage:o}}}:{}})},onTurnFailed:(r,o,l,u)=>{s().addLogEntry("ERROR",`turn:failed — ${l}`),s().addToast("error",`Turn failed — ${l}`),jh(r,"turn:failed",{turnId:o,error:l}),t(f=>{const p=f.sessionDetails[r],g=l.includes("cancelled")||l.includes("aborted"),m=g?"aborted":"failed",v=p?Zn(p,o,E=>({...E,status:m,error:l,...u?{resume_state:u}:{},items:E.items.map(T=>T.status==="in_progress"?{...T,status:"failed"}:T)})):null,k=ku(v),w=k&&v?za(v):g?"active":"failed",S=ar(f.sessions,r,()=>({is_running:k,status:w})),C=Dr(f.retryStates,o);return v?{sessionDetails:{...f.sessionDetails,[r]:{...v,is_running:k,status:w}},sessions:S,retryStates:C}:{sessions:S,retryStates:C}})},onTurnCancelled:(r,o)=>{t(l=>{const u=l.sessionDetails[r],f=u?Zn(u,o,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(w=>w.status==="in_progress"?{...w,status:"completed"}:w)})):null,p=ku(f),g=p&&f?za(f):"active",m=ar(l.sessions,r,()=>({is_running:p,status:g})),v=Dr(l.retryStates,o);return f?{sessionDetails:{...l.sessionDetails,[r]:{...f,is_running:p,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,l)=>{s().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),s().addToast("warn",j0(l.reason)),t(u=>{const f=u.sessionDetails[r],p=f?Zn(f,o,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:l.reason,interrupted_at:l.interruptedAt,resume_attempts:l.attempts})):null,g=p?za(p):"interrupted",m=ar(u.sessions,r,()=>({is_running:1,status:g})),v=Dr(u.retryStates,o);return p?{sessionDetails:{...u.sessionDetails,[r]:{...p,is_running:1,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,l)=>{s().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${l})`),t(u=>{const f=ar(u.sessions,r,()=>({is_running:1,status:"running"})),p=u.sessionDetails[r];return p?{sessionDetails:{...u.sessionDetails,[r]:{...Zn(p,o,g=>({...g,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:f}:{sessions:f}})},onTurnResumed:(r,o)=>{s().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),s().addToast("success","Interrupted turn resumed"),t(l=>{const u=l.sessionDetails[r];return u?{sessionDetails:{...l.sessionDetails,[r]:Zn(u,o,f=>({...f,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,l)=>{s().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${o.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),t(u=>({retryStates:{...u.retryStates,[o]:l}}))},onSessionTitle:(r,o)=>{t(l=>({sessions:l.sessions.map(u=>u.id===r?{...u,title:o}:u),sessionDetails:l.sessionDetails[r]?{...l.sessionDetails,[r]:{...l.sessionDetails[r],title:o}}:l.sessionDetails}))},onSessionTouched:r=>{t(o=>{const l=o.sessionDetails[r];return{sessions:ar(o.sessions,r,()=>({user_touched:1})),sessionDetails:l?{...o.sessionDetails,[r]:{...l,user_touched:1}}:o.sessionDetails}})},onSessionUpdated:r=>{const o={...r};delete o.is_running,delete o.status,t(l=>{const u=l.sessionDetails[r.id];return{sessions:ar(l.sessions,r.id,()=>o),sessionDetails:u?{...l.sessionDetails,[r.id]:{...u,...o}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{Ch(r,o),t(l=>{if(o.length===0&&!l.backgroundTasks[r])return{};const u={...l.backgroundTasks};return o.length>0?u[r]=o:delete u[r],{backgroundTasks:u}})},onBackgroundTasksSnapshot:r=>{for(const[l,u]of Object.entries(r))Ch(l,u);const o={};for(const[l,u]of Object.entries(r))u.length>0&&(o[l]=u);t({backgroundTasks:o})}});function j0(t){switch(t){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";default:return"The agent host restarted — resuming the turn"}}function za(t){const s=[...t.turns,...(t.threads??[]).flatMap(r=>r.turns??[])].filter(pr);return s.length>0&&s.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function Eh(t){return t.type!=="background_task"&&t.type!=="error"&&t.type!=="interruption"}function Dr(t,s){if(!(s in t))return t;const r={...t};return delete r[s],r}function ku(t){return t&&(t.turns.some(pr)||(t.threads??[]).some(r=>(r.turns??[]).some(pr)))?1:0}function ar(t,s,r){return t.some(o=>o.id===s)?t.map(o=>o.id===s?{...o,...r(o)}:o):t}function Zn(t,s,r){const o=(t.threads??[]).map(l=>(l.turns??[]).some(u=>u.id===s)?{...l,turns:(l.turns??[]).map(u=>u.id===s?r(u):u)}:l);return{...t,turns:t.turns.map(l=>l.id===s?r(l):l),threads:o}}function vg(t,s){for(let r=t.length-1;r>=0;r--)if(t[r].external_item_id===s)return r;return-1}function Su(t,s){const r=vg(t.items,s.external_item_id);if(r>=0){const o=[...t.items];return o[r]=s,{...t,items:o}}if(s.type==="agent_message"){const o=t.items.filter(l=>!(l.type==="agent_message"&&l.id.startsWith("delta-")));return{...t,items:[...o,s]}}return{...t,items:[...t.items,s]}}function C0(t,s,r){var u;const o=vg(t.items,s);if(o>=0){const f=t.items[o],g=(((u=f.data)==null?void 0:u.text)??"")+r,m=[...t.items];return m[o]={...f,data:{...f.data,text:g}},{...t,items:m,agent_response:g}}const l={id:`delta-${s}`,turn_id:t.id,external_item_id:s,type:"agent_message",data:{text:r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...t,items:[...t.items,l],agent_response:r}}function E0(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return Wt(`/providers/${t}/models${r}`)}const _h="curl -fsSL https://repoburg.com/install.sh | bash",_0=2e3,yg="agentpane:daemon-seen";function R0(t=mn()){if(!t)return!1;try{const s=new URL(t);return s.protocol==="http:"&&(s.hostname==="localhost"||s.hostname==="127.0.0.1")}catch{return!1}}async function A0(t=mn()){try{return await fetch(`${t}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function I0(){try{return localStorage.getItem(yg)==="true"}catch{return!1}}function D0(){try{localStorage.setItem(yg,"true")}catch{}}function M0(t){let s=!1,r=!1,o=!1,l=null;function u(){l!==null&&(clearTimeout(l),l=null)}async function f(){if(s||r)return;u(),r=!0;const m=await A0();if(r=!1,!s){if(m){D0(),g(),t.onReady();return}o||(o=!0,t.onMissing()),l=setTimeout(()=>void f(),_0)}}function p(){document.visibilityState==="visible"&&f()}function g(){s=!0,u(),window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",p)}return window.addEventListener("focus",p),document.addEventListener("visibilitychange",p),f(),g}const Fu=160,Uu=480,L0=240,tl=220,P0=300,O0=600,$0=36;function nl(){return typeof window>"u"?O0:Math.max(tl,Math.round(window.innerWidth*.7))}const Rh="agentpane:sidebar-width",Ah="agentpane:right-panel-width",bu="agentpane:right-panel-collapsed";function Ih(t,s,r,o){try{const l=localStorage.getItem(t);if(l==null)return o;const u=Number(l);return Number.isFinite(u)?Math.min(r,Math.max(s,u)):o}catch{return o}}function z0(t){try{return localStorage.getItem(t)==="true"}catch{return!1}}function Dh(t,s){try{localStorage.setItem(t,String(s))}catch{}}const Mh=200,F0=(t,s)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:Ih(Rh,Fu,Uu,L0),rightPanelWidth:Ih(Ah,tl,nl(),P0),rightPanelCollapsed:z0(bu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,daemonStatus:R0()?"checking":"ready",setActiveTurnIndex:r=>t({activeTurnIndex:r}),switchRightTab:r=>{s().rightPanelCollapsed&&Dh(bu,!1),t({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>t({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>t({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>t({importSessionsWorkspace:r}),setShowRemoteModal:r=>t({showRemoteModal:r}),setShowCommandPalette:r=>t({showCommandPalette:r}),setShowModelSelector:r=>t({showModelSelector:r}),setDeepLinkThreadId:r=>t({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(Uu,Math.max(Fu,Math.round(r)));t({sidebarWidth:o});try{localStorage.setItem(Rh,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(nl(),Math.max(tl,Math.round(r)));t({rightPanelWidth:o});try{localStorage.setItem(Ah,String(o))}catch{}},setRightPanelCollapsed:r=>{t({rightPanelCollapsed:r}),Dh(bu,r)},toggleRightPanel:()=>s().setRightPanelCollapsed(!s().rightPanelCollapsed),toggleVscodeView:()=>{if(s().vscodeViewOpen){t({vscodeViewOpen:!1});return}t({vscodeViewOpen:!0,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,l)=>t({vscodeState:r,vscodeId:o,vscodeToken:l}),toggleUsageView:()=>t({usageViewOpen:!s().usageViewOpen}),setDaemonStatus:r=>t({daemonStatus:r}),addToast:(r,o,l,u)=>{const f=Math.random().toString(36).slice(2,9);t(p=>({toasts:[...p.toasts,{id:f,type:r,message:o,undoAction:l,undoLabel:u}]}))},removeToast:r=>{t(o=>({toasts:o.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,o)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});t(u=>{const f=[...u.eventLog,{time:l,level:r,message:o}];return f.length>Mh&&f.splice(0,f.length-Mh),{eventLog:f}})},loadModels:async(r,o)=>{if(!s().modelsLoading){t({modelsLoading:!0,models:[]});try{const l=await E0(r,o);t({models:l,modelsLoading:!1})}catch{t({modelsLoading:!1})}}}}),U0=(t,s)=>({createThread:async(r,o)=>{try{await ut(`/sessions/${r}/threads`,o),s().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(l){s().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,o,l)=>{try{await ut(`/sessions/${r}/threads/${o}/followup`,{message:l}),s().addLogEntry("INFO",`Thread follow-up — "${l.slice(0,40)}"`)}catch(u){s().addToast("error",`Failed to send follow-up — ${u.message}`)}},cancelThreadTurn:async(r,o)=>{try{await ut(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),s().addLogEntry("INFO","Thread turn cancelled")}catch(l){s().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,o)=>{try{await Ns(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(l){s().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,o)=>{try{await Ns(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(l){s().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,o,l)=>{try{const u=await ut(`/sessions/${r}/threads/${o}/summarize`,{directives:l}),f=`
|
|
40
|
+
`+h.stack}return{value:e,source:n,stack:d,digest:null}}function Oc(e,n,i){return{value:e,source:null,stack:i??null,digest:n??null}}function $c(e,n){try{console.error(n.value)}catch(i){setTimeout(function(){throw i})}}var Hy=typeof WeakMap=="function"?WeakMap:Map;function fp(e,n,i){i=Ds(-1,i),i.tag=3,i.payload={element:null};var c=n.value;return i.callback=function(){Ta||(Ta=!0,Jc=c),$c(e,n)},i}function pp(e,n,i){i=Ds(-1,i),i.tag=3;var c=e.type.getDerivedStateFromError;if(typeof c=="function"){var d=n.value;i.payload=function(){return c(d)},i.callback=function(){$c(e,n)}}var h=e.stateNode;return h!==null&&typeof h.componentDidCatch=="function"&&(i.callback=function(){$c(e,n),typeof c!="function"&&(tr===null?tr=new Set([this]):tr.add(this));var y=n.stack;this.componentDidCatch(n.value,{componentStack:y!==null?y:""})}),i}function hp(e,n,i){var c=e.pingCache;if(c===null){c=e.pingCache=new Hy;var d=new Set;c.set(n,d)}else d=c.get(n),d===void 0&&(d=new Set,c.set(n,d));d.has(i)||(d.add(i),e=rx.bind(null,e,n,i),n.then(e,e))}function mp(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function gp(e,n,i,c,d){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,i.flags|=131072,i.flags&=-52805,i.tag===1&&(i.alternate===null?i.tag=17:(n=Ds(-1,1),n.tag=2,Js(i,n,1))),i.lanes|=1),e):(e.flags|=65536,e.lanes=d,e)}var Vy=I.ReactCurrentOwner,En=!1;function Sn(e,n,i,c){n.child=e===null?Pf(n,null,i,c):ni(n,e.child,i,c)}function vp(e,n,i,c,d){i=i.render;var h=n.ref;return ri(n,d),c=_c(e,n,i,c,h,d),i=Rc(),e!==null&&!En?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~d,Ms(e,n,d)):(xt&&i&&fc(n),n.flags|=1,Sn(e,n,c,d),n.child)}function yp(e,n,i,c,d){if(e===null){var h=i.type;return typeof h=="function"&&!ou(h)&&h.defaultProps===void 0&&i.compare===null&&i.defaultProps===void 0?(n.tag=15,n.type=h,xp(e,n,h,c,d)):(e=Ra(i.type,null,c,n,n.mode,d),e.ref=n.ref,e.return=n,n.child=e)}if(h=e.child,(e.lanes&d)===0){var y=h.memoizedProps;if(i=i.compare,i=i!==null?i:$i,i(y,c)&&e.ref===n.ref)return Ms(e,n,d)}return n.flags|=1,e=ir(h,c),e.ref=n.ref,e.return=n,n.child=e}function xp(e,n,i,c,d){if(e!==null){var h=e.memoizedProps;if($i(h,c)&&e.ref===n.ref)if(En=!1,n.pendingProps=c=h,(e.lanes&d)!==0)(e.flags&131072)!==0&&(En=!0);else return n.lanes=e.lanes,Ms(e,n,d)}return zc(e,n,i,c,d)}function wp(e,n,i){var c=n.pendingProps,d=c.children,h=e!==null?e.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},ct(li,Bn),Bn|=i;else{if((i&1073741824)===0)return e=h!==null?h.baseLanes|i:i,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,ct(li,Bn),Bn|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=h!==null?h.baseLanes:i,ct(li,Bn),Bn|=c}else h!==null?(c=h.baseLanes|i,n.memoizedState=null):c=i,ct(li,Bn),Bn|=c;return Sn(e,n,d,i),n.child}function kp(e,n){var i=n.ref;(e===null&&i!==null||e!==null&&e.ref!==i)&&(n.flags|=512,n.flags|=2097152)}function zc(e,n,i,c,d){var h=Cn(i)?Sr:cn.current;return h=Zr(n,h),ri(n,d),i=_c(e,n,i,c,h,d),c=Rc(),e!==null&&!En?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~d,Ms(e,n,d)):(xt&&c&&fc(n),n.flags|=1,Sn(e,n,i,d),n.child)}function Sp(e,n,i,c,d){if(Cn(i)){var h=!0;ta(n)}else h=!1;if(ri(n,d),n.stateNode===null)xa(e,n),up(n,i,c),Pc(n,i,c,d),c=!0;else if(e===null){var y=n.stateNode,N=n.memoizedProps;y.props=N;var D=y.context,V=i.contextType;typeof V=="object"&&V!==null?V=Kn(V):(V=Cn(i)?Sr:cn.current,V=Zr(n,V));var ee=i.getDerivedStateFromProps,se=typeof ee=="function"||typeof y.getSnapshotBeforeUpdate=="function";se||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N!==c||D!==V)&&dp(n,y,c,V),Zs=!1;var J=n.memoizedState;y.state=J,ua(n,c,y,d),D=n.memoizedState,N!==c||J!==D||jn.current||Zs?(typeof ee=="function"&&(Lc(n,i,ee,c),D=n.memoizedState),(N=Zs||cp(n,i,N,c,J,D,V))?(se||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(n.flags|=4194308)):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=D),y.props=c,y.state=D,y.context=V,c=N):(typeof y.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{y=n.stateNode,$f(e,n),N=n.memoizedProps,V=n.type===n.elementType?N:rs(n.type,N),y.props=V,se=n.pendingProps,J=y.context,D=i.contextType,typeof D=="object"&&D!==null?D=Kn(D):(D=Cn(i)?Sr:cn.current,D=Zr(n,D));var me=i.getDerivedStateFromProps;(ee=typeof me=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N!==se||J!==D)&&dp(n,y,c,D),Zs=!1,J=n.memoizedState,y.state=J,ua(n,c,y,d);var xe=n.memoizedState;N!==se||J!==xe||jn.current||Zs?(typeof me=="function"&&(Lc(n,i,me,c),xe=n.memoizedState),(V=Zs||cp(n,i,V,c,J,xe,D)||!1)?(ee||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,xe,D),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,xe,D)),typeof y.componentDidUpdate=="function"&&(n.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(n.flags|=1024)):(typeof y.componentDidUpdate!="function"||N===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),n.memoizedProps=c,n.memoizedState=xe),y.props=c,y.state=xe,y.context=D,c=V):(typeof y.componentDidUpdate!="function"||N===e.memoizedProps&&J===e.memoizedState||(n.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||N===e.memoizedProps&&J===e.memoizedState||(n.flags|=1024),c=!1)}return Fc(e,n,i,c,h,d)}function Fc(e,n,i,c,d,h){kp(e,n);var y=(n.flags&128)!==0;if(!c&&!y)return d&&Cf(n,i,!1),Ms(e,n,h);c=n.stateNode,Vy.current=n;var N=y&&typeof i.getDerivedStateFromError!="function"?null:c.render();return n.flags|=1,e!==null&&y?(n.child=ni(n,e.child,null,h),n.child=ni(n,null,N,h)):Sn(e,n,N,h),n.memoizedState=c.state,d&&Cf(n,i,!0),n.child}function bp(e){var n=e.stateNode;n.pendingContext?Nf(e,n.pendingContext,n.pendingContext!==n.context):n.context&&Nf(e,n.context,!1),bc(e,n.containerInfo)}function Tp(e,n,i,c,d){return ti(),gc(d),n.flags|=256,Sn(e,n,i,c),n.child}var Uc={dehydrated:null,treeContext:null,retryLane:0};function Bc(e){return{baseLanes:e,cachePool:null,transitions:null}}function Np(e,n,i){var c=n.pendingProps,d=Tt.current,h=!1,y=(n.flags&128)!==0,N;if((N=y)||(N=e!==null&&e.memoizedState===null?!1:(d&2)!==0),N?(h=!0,n.flags&=-129):(e===null||e.memoizedState!==null)&&(d|=1),ct(Tt,d&1),e===null)return mc(n),e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((n.mode&1)===0?n.lanes=1:e.data==="$!"?n.lanes=8:n.lanes=1073741824,null):(y=c.children,e=c.fallback,h?(c=n.mode,h=n.child,y={mode:"hidden",children:y},(c&1)===0&&h!==null?(h.childLanes=0,h.pendingProps=y):h=Aa(y,c,0,null),e=Ir(e,c,i,null),h.return=n,e.return=n,h.sibling=e,n.child=h,n.child.memoizedState=Bc(i),n.memoizedState=Uc,e):Wc(n,y));if(d=e.memoizedState,d!==null&&(N=d.dehydrated,N!==null))return Gy(e,n,y,c,N,d,i);if(h){h=c.fallback,y=n.mode,d=e.child,N=d.sibling;var D={mode:"hidden",children:c.children};return(y&1)===0&&n.child!==d?(c=n.child,c.childLanes=0,c.pendingProps=D,n.deletions=null):(c=ir(d,D),c.subtreeFlags=d.subtreeFlags&14680064),N!==null?h=ir(N,h):(h=Ir(h,y,i,null),h.flags|=2),h.return=n,c.return=n,c.sibling=h,n.child=c,c=h,h=n.child,y=e.child.memoizedState,y=y===null?Bc(i):{baseLanes:y.baseLanes|i,cachePool:null,transitions:y.transitions},h.memoizedState=y,h.childLanes=e.childLanes&~i,n.memoizedState=Uc,c}return h=e.child,e=h.sibling,c=ir(h,{mode:"visible",children:c.children}),(n.mode&1)===0&&(c.lanes=i),c.return=n,c.sibling=null,e!==null&&(i=n.deletions,i===null?(n.deletions=[e],n.flags|=16):i.push(e)),n.child=c,n.memoizedState=null,c}function Wc(e,n){return n=Aa({mode:"visible",children:n},e.mode,0,null),n.return=e,e.child=n}function ya(e,n,i,c){return c!==null&&gc(c),ni(n,e.child,null,i),e=Wc(n,n.pendingProps.children),e.flags|=2,n.memoizedState=null,e}function Gy(e,n,i,c,d,h,y){if(i)return n.flags&256?(n.flags&=-257,c=Oc(Error(r(422))),ya(e,n,y,c)):n.memoizedState!==null?(n.child=e.child,n.flags|=128,null):(h=c.fallback,d=n.mode,c=Aa({mode:"visible",children:c.children},d,0,null),h=Ir(h,d,y,null),h.flags|=2,c.return=n,h.return=n,c.sibling=h,n.child=c,(n.mode&1)!==0&&ni(n,e.child,null,y),n.child.memoizedState=Bc(y),n.memoizedState=Uc,h);if((n.mode&1)===0)return ya(e,n,y,null);if(d.data==="$!"){if(c=d.nextSibling&&d.nextSibling.dataset,c)var N=c.dgst;return c=N,h=Error(r(419)),c=Oc(h,c,void 0),ya(e,n,y,c)}if(N=(y&e.childLanes)!==0,En||N){if(c=Yt,c!==null){switch(y&-y){case 4:d=2;break;case 16:d=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:d=32;break;case 536870912:d=268435456;break;default:d=0}d=(d&(c.suspendedLanes|y))!==0?0:d,d!==0&&d!==h.retryLane&&(h.retryLane=d,Is(e,d),as(c,e,d,-1))}return iu(),c=Oc(Error(r(421))),ya(e,n,y,c)}return d.data==="$?"?(n.flags|=128,n.child=e.child,n=ix.bind(null,e),d._reactRetry=n,null):(e=h.treeContext,Un=Ks(d.nextSibling),Fn=n,xt=!0,ss=null,e!==null&&(Gn[qn++]=Rs,Gn[qn++]=As,Gn[qn++]=br,Rs=e.id,As=e.overflow,br=n),n=Wc(n,c.children),n.flags|=4096,n)}function jp(e,n,i){e.lanes|=n;var c=e.alternate;c!==null&&(c.lanes|=n),wc(e.return,n,i)}function Hc(e,n,i,c,d){var h=e.memoizedState;h===null?e.memoizedState={isBackwards:n,rendering:null,renderingStartTime:0,last:c,tail:i,tailMode:d}:(h.isBackwards=n,h.rendering=null,h.renderingStartTime=0,h.last=c,h.tail=i,h.tailMode=d)}function Cp(e,n,i){var c=n.pendingProps,d=c.revealOrder,h=c.tail;if(Sn(e,n,c.children,i),c=Tt.current,(c&2)!==0)c=c&1|2,n.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=n.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&jp(e,i,n);else if(e.tag===19)jp(e,i,n);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break e;for(;e.sibling===null;){if(e.return===null||e.return===n)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}c&=1}if(ct(Tt,c),(n.mode&1)===0)n.memoizedState=null;else switch(d){case"forwards":for(i=n.child,d=null;i!==null;)e=i.alternate,e!==null&&da(e)===null&&(d=i),i=i.sibling;i=d,i===null?(d=n.child,n.child=null):(d=i.sibling,i.sibling=null),Hc(n,!1,d,i,h);break;case"backwards":for(i=null,d=n.child,n.child=null;d!==null;){if(e=d.alternate,e!==null&&da(e)===null){n.child=d;break}e=d.sibling,d.sibling=i,i=d,d=e}Hc(n,!0,i,null,h);break;case"together":Hc(n,!1,null,null,void 0);break;default:n.memoizedState=null}return n.child}function xa(e,n){(n.mode&1)===0&&e!==null&&(e.alternate=null,n.alternate=null,n.flags|=2)}function Ms(e,n,i){if(e!==null&&(n.dependencies=e.dependencies),Er|=n.lanes,(i&n.childLanes)===0)return null;if(e!==null&&n.child!==e.child)throw Error(r(153));if(n.child!==null){for(e=n.child,i=ir(e,e.pendingProps),n.child=i,i.return=n;e.sibling!==null;)e=e.sibling,i=i.sibling=ir(e,e.pendingProps),i.return=n;i.sibling=null}return n.child}function qy(e,n,i){switch(n.tag){case 3:bp(n),ti();break;case 5:Uf(n);break;case 1:Cn(n.type)&&ta(n);break;case 4:bc(n,n.stateNode.containerInfo);break;case 10:var c=n.type._context,d=n.memoizedProps.value;ct(aa,c._currentValue),c._currentValue=d;break;case 13:if(c=n.memoizedState,c!==null)return c.dehydrated!==null?(ct(Tt,Tt.current&1),n.flags|=128,null):(i&n.child.childLanes)!==0?Np(e,n,i):(ct(Tt,Tt.current&1),e=Ms(e,n,i),e!==null?e.sibling:null);ct(Tt,Tt.current&1);break;case 19:if(c=(i&n.childLanes)!==0,(e.flags&128)!==0){if(c)return Cp(e,n,i);n.flags|=128}if(d=n.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),ct(Tt,Tt.current),c)break;return null;case 22:case 23:return n.lanes=0,wp(e,n,i)}return Ms(e,n,i)}var Ep,Vc,_p,Rp;Ep=function(e,n){for(var i=n.child;i!==null;){if(i.tag===5||i.tag===6)e.appendChild(i.stateNode);else if(i.tag!==4&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===n)break;for(;i.sibling===null;){if(i.return===null||i.return===n)return;i=i.return}i.sibling.return=i.return,i=i.sibling}},Vc=function(){},_p=function(e,n,i,c){var d=e.memoizedProps;if(d!==c){e=n.stateNode,jr(ws.current);var h=null;switch(i){case"input":d=$e(e,d),c=$e(e,c),h=[];break;case"select":d=U({},d,{value:void 0}),c=U({},c,{value:void 0}),h=[];break;case"textarea":d=Mt(e,d),c=Mt(e,c),h=[];break;default:typeof d.onClick!="function"&&typeof c.onClick=="function"&&(e.onclick=Zo)}ts(i,c);var y;i=null;for(V in d)if(!c.hasOwnProperty(V)&&d.hasOwnProperty(V)&&d[V]!=null)if(V==="style"){var N=d[V];for(y in N)N.hasOwnProperty(y)&&(i||(i={}),i[y]="")}else V!=="dangerouslySetInnerHTML"&&V!=="children"&&V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&V!=="autoFocus"&&(l.hasOwnProperty(V)?h||(h=[]):(h=h||[]).push(V,null));for(V in c){var D=c[V];if(N=d!=null?d[V]:void 0,c.hasOwnProperty(V)&&D!==N&&(D!=null||N!=null))if(V==="style")if(N){for(y in N)!N.hasOwnProperty(y)||D&&D.hasOwnProperty(y)||(i||(i={}),i[y]="");for(y in D)D.hasOwnProperty(y)&&N[y]!==D[y]&&(i||(i={}),i[y]=D[y])}else i||(h||(h=[]),h.push(V,i)),i=D;else V==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,N=N?N.__html:void 0,D!=null&&N!==D&&(h=h||[]).push(V,D)):V==="children"?typeof D!="string"&&typeof D!="number"||(h=h||[]).push(V,""+D):V!=="suppressContentEditableWarning"&&V!=="suppressHydrationWarning"&&(l.hasOwnProperty(V)?(D!=null&&V==="onScroll"&&pt("scroll",e),h||N===D||(h=[])):(h=h||[]).push(V,D))}i&&(h=h||[]).push("style",i);var V=h;(n.updateQueue=V)&&(n.flags|=4)}},Rp=function(e,n,i,c){i!==c&&(n.flags|=4)};function Ji(e,n){if(!xt)switch(e.tailMode){case"hidden":n=e.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e.tail=null:i.sibling=null;break;case"collapsed":i=e.tail;for(var c=null;i!==null;)i.alternate!==null&&(c=i),i=i.sibling;c===null?n||e.tail===null?e.tail=null:e.tail.sibling=null:c.sibling=null}}function dn(e){var n=e.alternate!==null&&e.alternate.child===e.child,i=0,c=0;if(n)for(var d=e.child;d!==null;)i|=d.lanes|d.childLanes,c|=d.subtreeFlags&14680064,c|=d.flags&14680064,d.return=e,d=d.sibling;else for(d=e.child;d!==null;)i|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=e,d=d.sibling;return e.subtreeFlags|=c,e.childLanes=i,n}function Ky(e,n,i){var c=n.pendingProps;switch(pc(n),n.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dn(n),null;case 1:return Cn(n.type)&&ea(),dn(n),null;case 3:return c=n.stateNode,ii(),ht(jn),ht(cn),jc(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(e===null||e.child===null)&&(ia(n)?n.flags|=4:e===null||e.memoizedState.isDehydrated&&(n.flags&256)===0||(n.flags|=1024,ss!==null&&(nu(ss),ss=null))),Vc(e,n),dn(n),null;case 5:Tc(n);var d=jr(Ki.current);if(i=n.type,e!==null&&n.stateNode!=null)_p(e,n,i,c,d),e.ref!==n.ref&&(n.flags|=512,n.flags|=2097152);else{if(!c){if(n.stateNode===null)throw Error(r(166));return dn(n),null}if(e=jr(ws.current),ia(n)){c=n.stateNode,i=n.type;var h=n.memoizedProps;switch(c[xs]=n,c[Wi]=h,e=(n.mode&1)!==0,i){case"dialog":pt("cancel",c),pt("close",c);break;case"iframe":case"object":case"embed":pt("load",c);break;case"video":case"audio":for(d=0;d<Fi.length;d++)pt(Fi[d],c);break;case"source":pt("error",c);break;case"img":case"image":case"link":pt("error",c),pt("load",c);break;case"details":pt("toggle",c);break;case"input":en(c,h),pt("invalid",c);break;case"select":c._wrapperState={wasMultiple:!!h.multiple},pt("invalid",c);break;case"textarea":q(c,h),pt("invalid",c)}ts(i,h),d=null;for(var y in h)if(h.hasOwnProperty(y)){var N=h[y];y==="children"?typeof N=="string"?c.textContent!==N&&(h.suppressHydrationWarning!==!0&&Qo(c.textContent,N,e),d=["children",N]):typeof N=="number"&&c.textContent!==""+N&&(h.suppressHydrationWarning!==!0&&Qo(c.textContent,N,e),d=["children",""+N]):l.hasOwnProperty(y)&&N!=null&&y==="onScroll"&&pt("scroll",c)}switch(i){case"input":at(c),tn(c,h,!0);break;case"textarea":at(c),Ue(c);break;case"select":case"option":break;default:typeof h.onClick=="function"&&(c.onclick=Zo)}c=d,n.updateQueue=c,c!==null&&(n.flags|=4)}else{y=d.nodeType===9?d:d.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=tt(i)),e==="http://www.w3.org/1999/xhtml"?i==="script"?(e=y.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof c.is=="string"?e=y.createElement(i,{is:c.is}):(e=y.createElement(i),i==="select"&&(y=e,c.multiple?y.multiple=!0:c.size&&(y.size=c.size))):e=y.createElementNS(e,i),e[xs]=n,e[Wi]=c,Ep(e,n,!1,!1),n.stateNode=e;e:{switch(y=Ln(i,c),i){case"dialog":pt("cancel",e),pt("close",e),d=c;break;case"iframe":case"object":case"embed":pt("load",e),d=c;break;case"video":case"audio":for(d=0;d<Fi.length;d++)pt(Fi[d],e);d=c;break;case"source":pt("error",e),d=c;break;case"img":case"image":case"link":pt("error",e),pt("load",e),d=c;break;case"details":pt("toggle",e),d=c;break;case"input":en(e,c),d=$e(e,c),pt("invalid",e);break;case"option":d=c;break;case"select":e._wrapperState={wasMultiple:!!c.multiple},d=U({},c,{value:void 0}),pt("invalid",e);break;case"textarea":q(e,c),d=Mt(e,c),pt("invalid",e);break;default:d=c}ts(i,d),N=d;for(h in N)if(N.hasOwnProperty(h)){var D=N[h];h==="style"?ps(e,D):h==="dangerouslySetInnerHTML"?(D=D?D.__html:void 0,D!=null&&Ct(e,D)):h==="children"?typeof D=="string"?(i!=="textarea"||D!=="")&&an(e,D):typeof D=="number"&&an(e,""+D):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(l.hasOwnProperty(h)?D!=null&&h==="onScroll"&&pt("scroll",e):D!=null&&B(e,h,D,y))}switch(i){case"input":at(e),tn(e,c,!1);break;case"textarea":at(e),Ue(e);break;case"option":c.value!=null&&e.setAttribute("value",""+Ee(c.value));break;case"select":e.multiple=!!c.multiple,h=c.value,h!=null?$t(e,!!c.multiple,h,!1):c.defaultValue!=null&&$t(e,!!c.multiple,c.defaultValue,!0);break;default:typeof d.onClick=="function"&&(e.onclick=Zo)}switch(i){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}}c&&(n.flags|=4)}n.ref!==null&&(n.flags|=512,n.flags|=2097152)}return dn(n),null;case 6:if(e&&n.stateNode!=null)Rp(e,n,e.memoizedProps,c);else{if(typeof c!="string"&&n.stateNode===null)throw Error(r(166));if(i=jr(Ki.current),jr(ws.current),ia(n)){if(c=n.stateNode,i=n.memoizedProps,c[xs]=n,(h=c.nodeValue!==i)&&(e=Fn,e!==null))switch(e.tag){case 3:Qo(c.nodeValue,i,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Qo(c.nodeValue,i,(e.mode&1)!==0)}h&&(n.flags|=4)}else c=(i.nodeType===9?i:i.ownerDocument).createTextNode(c),c[xs]=n,n.stateNode=c}return dn(n),null;case 13:if(ht(Tt),c=n.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(xt&&Un!==null&&(n.mode&1)!==0&&(n.flags&128)===0)Df(),ti(),n.flags|=98560,h=!1;else if(h=ia(n),c!==null&&c.dehydrated!==null){if(e===null){if(!h)throw Error(r(318));if(h=n.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(r(317));h[xs]=n}else ti(),(n.flags&128)===0&&(n.memoizedState=null),n.flags|=4;dn(n),h=!1}else ss!==null&&(nu(ss),ss=null),h=!0;if(!h)return n.flags&65536?n:null}return(n.flags&128)!==0?(n.lanes=i,n):(c=c!==null,c!==(e!==null&&e.memoizedState!==null)&&c&&(n.child.flags|=8192,(n.mode&1)!==0&&(e===null||(Tt.current&1)!==0?Ut===0&&(Ut=3):iu())),n.updateQueue!==null&&(n.flags|=4),dn(n),null);case 4:return ii(),Vc(e,n),e===null&&Ui(n.stateNode.containerInfo),dn(n),null;case 10:return xc(n.type._context),dn(n),null;case 17:return Cn(n.type)&&ea(),dn(n),null;case 19:if(ht(Tt),h=n.memoizedState,h===null)return dn(n),null;if(c=(n.flags&128)!==0,y=h.rendering,y===null)if(c)Ji(h,!1);else{if(Ut!==0||e!==null&&(e.flags&128)!==0)for(e=n.child;e!==null;){if(y=da(e),y!==null){for(n.flags|=128,Ji(h,!1),c=y.updateQueue,c!==null&&(n.updateQueue=c,n.flags|=4),n.subtreeFlags=0,c=i,i=n.child;i!==null;)h=i,e=c,h.flags&=14680066,y=h.alternate,y===null?(h.childLanes=0,h.lanes=e,h.child=null,h.subtreeFlags=0,h.memoizedProps=null,h.memoizedState=null,h.updateQueue=null,h.dependencies=null,h.stateNode=null):(h.childLanes=y.childLanes,h.lanes=y.lanes,h.child=y.child,h.subtreeFlags=0,h.deletions=null,h.memoizedProps=y.memoizedProps,h.memoizedState=y.memoizedState,h.updateQueue=y.updateQueue,h.type=y.type,e=y.dependencies,h.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),i=i.sibling;return ct(Tt,Tt.current&1|2),n.child}e=e.sibling}h.tail!==null&&kt()>ci&&(n.flags|=128,c=!0,Ji(h,!1),n.lanes=4194304)}else{if(!c)if(e=da(y),e!==null){if(n.flags|=128,c=!0,i=e.updateQueue,i!==null&&(n.updateQueue=i,n.flags|=4),Ji(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!xt)return dn(n),null}else 2*kt()-h.renderingStartTime>ci&&i!==1073741824&&(n.flags|=128,c=!0,Ji(h,!1),n.lanes=4194304);h.isBackwards?(y.sibling=n.child,n.child=y):(i=h.last,i!==null?i.sibling=y:n.child=y,h.last=y)}return h.tail!==null?(n=h.tail,h.rendering=n,h.tail=n.sibling,h.renderingStartTime=kt(),n.sibling=null,i=Tt.current,ct(Tt,c?i&1|2:i&1),n):(dn(n),null);case 22:case 23:return ru(),c=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==c&&(n.flags|=8192),c&&(n.mode&1)!==0?(Bn&1073741824)!==0&&(dn(n),n.subtreeFlags&6&&(n.flags|=8192)):dn(n),null;case 24:return null;case 25:return null}throw Error(r(156,n.tag))}function Yy(e,n){switch(pc(n),n.tag){case 1:return Cn(n.type)&&ea(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return ii(),ht(jn),ht(cn),jc(),e=n.flags,(e&65536)!==0&&(e&128)===0?(n.flags=e&-65537|128,n):null;case 5:return Tc(n),null;case 13:if(ht(Tt),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(r(340));ti()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return ht(Tt),null;case 4:return ii(),null;case 10:return xc(n.type._context),null;case 22:case 23:return ru(),null;case 24:return null;default:return null}}var wa=!1,fn=!1,Xy=typeof WeakSet=="function"?WeakSet:Set,ye=null;function ai(e,n){var i=e.ref;if(i!==null)if(typeof i=="function")try{i(null)}catch(c){Rt(e,n,c)}else i.current=null}function Gc(e,n,i){try{i()}catch(c){Rt(e,n,c)}}var Ap=!1;function Qy(e,n){if(rc=Fo,e=cf(),Xl(e)){if("selectionStart"in e)var i={start:e.selectionStart,end:e.selectionEnd};else e:{i=(i=e.ownerDocument)&&i.defaultView||window;var c=i.getSelection&&i.getSelection();if(c&&c.rangeCount!==0){i=c.anchorNode;var d=c.anchorOffset,h=c.focusNode;c=c.focusOffset;try{i.nodeType,h.nodeType}catch{i=null;break e}var y=0,N=-1,D=-1,V=0,ee=0,se=e,J=null;t:for(;;){for(var me;se!==i||d!==0&&se.nodeType!==3||(N=y+d),se!==h||c!==0&&se.nodeType!==3||(D=y+c),se.nodeType===3&&(y+=se.nodeValue.length),(me=se.firstChild)!==null;)J=se,se=me;for(;;){if(se===e)break t;if(J===i&&++V===d&&(N=y),J===h&&++ee===c&&(D=y),(me=se.nextSibling)!==null)break;se=J,J=se.parentNode}se=me}i=N===-1||D===-1?null:{start:N,end:D}}else i=null}i=i||{start:0,end:0}}else i=null;for(ic={focusedElem:e,selectionRange:i},Fo=!1,ye=n;ye!==null;)if(n=ye,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,ye=e;else for(;ye!==null;){n=ye;try{var xe=n.alternate;if((n.flags&1024)!==0)switch(n.tag){case 0:case 11:case 15:break;case 1:if(xe!==null){var ke=xe.memoizedProps,It=xe.memoizedState,z=n.stateNode,L=z.getSnapshotBeforeUpdate(n.elementType===n.type?ke:rs(n.type,ke),It);z.__reactInternalSnapshotBeforeUpdate=L}break;case 3:var H=n.stateNode.containerInfo;H.nodeType===1?H.textContent="":H.nodeType===9&&H.documentElement&&H.removeChild(H.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(ce){Rt(n,n.return,ce)}if(e=n.sibling,e!==null){e.return=n.return,ye=e;break}ye=n.return}return xe=Ap,Ap=!1,xe}function eo(e,n,i){var c=n.updateQueue;if(c=c!==null?c.lastEffect:null,c!==null){var d=c=c.next;do{if((d.tag&e)===e){var h=d.destroy;d.destroy=void 0,h!==void 0&&Gc(n,i,h)}d=d.next}while(d!==c)}}function ka(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&e)===e){var c=i.create;i.destroy=c()}i=i.next}while(i!==n)}}function qc(e){var n=e.ref;if(n!==null){var i=e.stateNode;switch(e.tag){case 5:e=i;break;default:e=i}typeof n=="function"?n(e):n.current=e}}function Ip(e){var n=e.alternate;n!==null&&(e.alternate=null,Ip(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[xs],delete n[Wi],delete n[cc],delete n[Dy],delete n[My])),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 Dp(e){return e.tag===5||e.tag===3||e.tag===4}function Mp(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Dp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Kc(e,n,i){var c=e.tag;if(c===5||c===6)e=e.stateNode,n?i.nodeType===8?i.parentNode.insertBefore(e,n):i.insertBefore(e,n):(i.nodeType===8?(n=i.parentNode,n.insertBefore(e,i)):(n=i,n.appendChild(e)),i=i._reactRootContainer,i!=null||n.onclick!==null||(n.onclick=Zo));else if(c!==4&&(e=e.child,e!==null))for(Kc(e,n,i),e=e.sibling;e!==null;)Kc(e,n,i),e=e.sibling}function Yc(e,n,i){var c=e.tag;if(c===5||c===6)e=e.stateNode,n?i.insertBefore(e,n):i.appendChild(e);else if(c!==4&&(e=e.child,e!==null))for(Yc(e,n,i),e=e.sibling;e!==null;)Yc(e,n,i),e=e.sibling}var nn=null,is=!1;function er(e,n,i){for(i=i.child;i!==null;)Lp(e,n,i),i=i.sibling}function Lp(e,n,i){if($n&&typeof $n.onCommitFiberUnmount=="function")try{$n.onCommitFiberUnmount(gr,i)}catch{}switch(i.tag){case 5:fn||ai(i,n);case 6:var c=nn,d=is;nn=null,er(e,n,i),nn=c,is=d,nn!==null&&(is?(e=nn,i=i.stateNode,e.nodeType===8?e.parentNode.removeChild(i):e.removeChild(i)):nn.removeChild(i.stateNode));break;case 18:nn!==null&&(is?(e=nn,i=i.stateNode,e.nodeType===8?lc(e.parentNode,i):e.nodeType===1&&lc(e,i),Ii(e)):lc(nn,i.stateNode));break;case 4:c=nn,d=is,nn=i.stateNode.containerInfo,is=!0,er(e,n,i),nn=c,is=d;break;case 0:case 11:case 14:case 15:if(!fn&&(c=i.updateQueue,c!==null&&(c=c.lastEffect,c!==null))){d=c=c.next;do{var h=d,y=h.destroy;h=h.tag,y!==void 0&&((h&2)!==0||(h&4)!==0)&&Gc(i,n,y),d=d.next}while(d!==c)}er(e,n,i);break;case 1:if(!fn&&(ai(i,n),c=i.stateNode,typeof c.componentWillUnmount=="function"))try{c.props=i.memoizedProps,c.state=i.memoizedState,c.componentWillUnmount()}catch(N){Rt(i,n,N)}er(e,n,i);break;case 21:er(e,n,i);break;case 22:i.mode&1?(fn=(c=fn)||i.memoizedState!==null,er(e,n,i),fn=c):er(e,n,i);break;default:er(e,n,i)}}function Pp(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var i=e.stateNode;i===null&&(i=e.stateNode=new Xy),n.forEach(function(c){var d=ox.bind(null,e,c);i.has(c)||(i.add(c),c.then(d,d))})}}function os(e,n){var i=n.deletions;if(i!==null)for(var c=0;c<i.length;c++){var d=i[c];try{var h=e,y=n,N=y;e:for(;N!==null;){switch(N.tag){case 5:nn=N.stateNode,is=!1;break e;case 3:nn=N.stateNode.containerInfo,is=!0;break e;case 4:nn=N.stateNode.containerInfo,is=!0;break e}N=N.return}if(nn===null)throw Error(r(160));Lp(h,y,d),nn=null,is=!1;var D=d.alternate;D!==null&&(D.return=null),d.return=null}catch(V){Rt(d,n,V)}}if(n.subtreeFlags&12854)for(n=n.child;n!==null;)Op(n,e),n=n.sibling}function Op(e,n){var i=e.alternate,c=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(os(n,e),Ss(e),c&4){try{eo(3,e,e.return),ka(3,e)}catch(ke){Rt(e,e.return,ke)}try{eo(5,e,e.return)}catch(ke){Rt(e,e.return,ke)}}break;case 1:os(n,e),Ss(e),c&512&&i!==null&&ai(i,i.return);break;case 5:if(os(n,e),Ss(e),c&512&&i!==null&&ai(i,i.return),e.flags&32){var d=e.stateNode;try{an(d,"")}catch(ke){Rt(e,e.return,ke)}}if(c&4&&(d=e.stateNode,d!=null)){var h=e.memoizedProps,y=i!==null?i.memoizedProps:h,N=e.type,D=e.updateQueue;if(e.updateQueue=null,D!==null)try{N==="input"&&h.type==="radio"&&h.name!=null&&Fe(d,h),Ln(N,y);var V=Ln(N,h);for(y=0;y<D.length;y+=2){var ee=D[y],se=D[y+1];ee==="style"?ps(d,se):ee==="dangerouslySetInnerHTML"?Ct(d,se):ee==="children"?an(d,se):B(d,ee,se,V)}switch(N){case"input":Ht(d,h);break;case"textarea":pe(d,h);break;case"select":var J=d._wrapperState.wasMultiple;d._wrapperState.wasMultiple=!!h.multiple;var me=h.value;me!=null?$t(d,!!h.multiple,me,!1):J!==!!h.multiple&&(h.defaultValue!=null?$t(d,!!h.multiple,h.defaultValue,!0):$t(d,!!h.multiple,h.multiple?[]:"",!1))}d[Wi]=h}catch(ke){Rt(e,e.return,ke)}}break;case 6:if(os(n,e),Ss(e),c&4){if(e.stateNode===null)throw Error(r(162));d=e.stateNode,h=e.memoizedProps;try{d.nodeValue=h}catch(ke){Rt(e,e.return,ke)}}break;case 3:if(os(n,e),Ss(e),c&4&&i!==null&&i.memoizedState.isDehydrated)try{Ii(n.containerInfo)}catch(ke){Rt(e,e.return,ke)}break;case 4:os(n,e),Ss(e);break;case 13:os(n,e),Ss(e),d=e.child,d.flags&8192&&(h=d.memoizedState!==null,d.stateNode.isHidden=h,!h||d.alternate!==null&&d.alternate.memoizedState!==null||(Zc=kt())),c&4&&Pp(e);break;case 22:if(ee=i!==null&&i.memoizedState!==null,e.mode&1?(fn=(V=fn)||ee,os(n,e),fn=V):os(n,e),Ss(e),c&8192){if(V=e.memoizedState!==null,(e.stateNode.isHidden=V)&&!ee&&(e.mode&1)!==0)for(ye=e,ee=e.child;ee!==null;){for(se=ye=ee;ye!==null;){switch(J=ye,me=J.child,J.tag){case 0:case 11:case 14:case 15:eo(4,J,J.return);break;case 1:ai(J,J.return);var xe=J.stateNode;if(typeof xe.componentWillUnmount=="function"){c=J,i=J.return;try{n=c,xe.props=n.memoizedProps,xe.state=n.memoizedState,xe.componentWillUnmount()}catch(ke){Rt(c,i,ke)}}break;case 5:ai(J,J.return);break;case 22:if(J.memoizedState!==null){Fp(se);continue}}me!==null?(me.return=J,ye=me):Fp(se)}ee=ee.sibling}e:for(ee=null,se=e;;){if(se.tag===5){if(ee===null){ee=se;try{d=se.stateNode,V?(h=d.style,typeof h.setProperty=="function"?h.setProperty("display","none","important"):h.display="none"):(N=se.stateNode,D=se.memoizedProps.style,y=D!=null&&D.hasOwnProperty("display")?D.display:null,N.style.display=Mn("display",y))}catch(ke){Rt(e,e.return,ke)}}}else if(se.tag===6){if(ee===null)try{se.stateNode.nodeValue=V?"":se.memoizedProps}catch(ke){Rt(e,e.return,ke)}}else if((se.tag!==22&&se.tag!==23||se.memoizedState===null||se===e)&&se.child!==null){se.child.return=se,se=se.child;continue}if(se===e)break e;for(;se.sibling===null;){if(se.return===null||se.return===e)break e;ee===se&&(ee=null),se=se.return}ee===se&&(ee=null),se.sibling.return=se.return,se=se.sibling}}break;case 19:os(n,e),Ss(e),c&4&&Pp(e);break;case 21:break;default:os(n,e),Ss(e)}}function Ss(e){var n=e.flags;if(n&2){try{e:{for(var i=e.return;i!==null;){if(Dp(i)){var c=i;break e}i=i.return}throw Error(r(160))}switch(c.tag){case 5:var d=c.stateNode;c.flags&32&&(an(d,""),c.flags&=-33);var h=Mp(e);Yc(e,h,d);break;case 3:case 4:var y=c.stateNode.containerInfo,N=Mp(e);Kc(e,N,y);break;default:throw Error(r(161))}}catch(D){Rt(e,e.return,D)}e.flags&=-3}n&4096&&(e.flags&=-4097)}function Zy(e,n,i){ye=e,$p(e)}function $p(e,n,i){for(var c=(e.mode&1)!==0;ye!==null;){var d=ye,h=d.child;if(d.tag===22&&c){var y=d.memoizedState!==null||wa;if(!y){var N=d.alternate,D=N!==null&&N.memoizedState!==null||fn;N=wa;var V=fn;if(wa=y,(fn=D)&&!V)for(ye=d;ye!==null;)y=ye,D=y.child,y.tag===22&&y.memoizedState!==null?Up(d):D!==null?(D.return=y,ye=D):Up(d);for(;h!==null;)ye=h,$p(h),h=h.sibling;ye=d,wa=N,fn=V}zp(e)}else(d.subtreeFlags&8772)!==0&&h!==null?(h.return=d,ye=h):zp(e)}}function zp(e){for(;ye!==null;){var n=ye;if((n.flags&8772)!==0){var i=n.alternate;try{if((n.flags&8772)!==0)switch(n.tag){case 0:case 11:case 15:fn||ka(5,n);break;case 1:var c=n.stateNode;if(n.flags&4&&!fn)if(i===null)c.componentDidMount();else{var d=n.elementType===n.type?i.memoizedProps:rs(n.type,i.memoizedProps);c.componentDidUpdate(d,i.memoizedState,c.__reactInternalSnapshotBeforeUpdate)}var h=n.updateQueue;h!==null&&Ff(n,h,c);break;case 3:var y=n.updateQueue;if(y!==null){if(i=null,n.child!==null)switch(n.child.tag){case 5:i=n.child.stateNode;break;case 1:i=n.child.stateNode}Ff(n,y,i)}break;case 5:var N=n.stateNode;if(i===null&&n.flags&4){i=N;var D=n.memoizedProps;switch(n.type){case"button":case"input":case"select":case"textarea":D.autoFocus&&i.focus();break;case"img":D.src&&(i.src=D.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(n.memoizedState===null){var V=n.alternate;if(V!==null){var ee=V.memoizedState;if(ee!==null){var se=ee.dehydrated;se!==null&&Ii(se)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fn||n.flags&512&&qc(n)}catch(J){Rt(n,n.return,J)}}if(n===e){ye=null;break}if(i=n.sibling,i!==null){i.return=n.return,ye=i;break}ye=n.return}}function Fp(e){for(;ye!==null;){var n=ye;if(n===e){ye=null;break}var i=n.sibling;if(i!==null){i.return=n.return,ye=i;break}ye=n.return}}function Up(e){for(;ye!==null;){var n=ye;try{switch(n.tag){case 0:case 11:case 15:var i=n.return;try{ka(4,n)}catch(D){Rt(n,i,D)}break;case 1:var c=n.stateNode;if(typeof c.componentDidMount=="function"){var d=n.return;try{c.componentDidMount()}catch(D){Rt(n,d,D)}}var h=n.return;try{qc(n)}catch(D){Rt(n,h,D)}break;case 5:var y=n.return;try{qc(n)}catch(D){Rt(n,y,D)}}}catch(D){Rt(n,n.return,D)}if(n===e){ye=null;break}var N=n.sibling;if(N!==null){N.return=n.return,ye=N;break}ye=n.return}}var Jy=Math.ceil,Sa=I.ReactCurrentDispatcher,Xc=I.ReactCurrentOwner,Xn=I.ReactCurrentBatchConfig,Ye=0,Yt=null,Pt=null,sn=0,Bn=0,li=Ys(0),Ut=0,to=null,Er=0,ba=0,Qc=0,no=null,_n=null,Zc=0,ci=1/0,Ls=null,Ta=!1,Jc=null,tr=null,Na=!1,nr=null,ja=0,so=0,eu=null,Ca=-1,Ea=0;function bn(){return(Ye&6)!==0?kt():Ca!==-1?Ca:Ca=kt()}function sr(e){return(e.mode&1)===0?1:(Ye&2)!==0&&sn!==0?sn&-sn:Py.transition!==null?(Ea===0&&(Ea=Ei()),Ea):(e=qe,e!==0||(e=window.event,e=e===void 0?16:Bd(e.type)),e)}function as(e,n,i,c){if(50<so)throw so=0,eu=null,Error(r(185));wr(e,i,c),((Ye&2)===0||e!==Yt)&&(e===Yt&&((Ye&2)===0&&(ba|=i),Ut===4&&rr(e,sn)),Rn(e,c),i===1&&Ye===0&&(n.mode&1)===0&&(ci=kt()+500,na&&Qs()))}function Rn(e,n){var i=e.callbackNode;Oo(e,n);var c=xr(e,e===Yt?sn:0);if(c===0)i!==null&&_t(i),e.callbackNode=null,e.callbackPriority=0;else if(n=c&-c,e.callbackPriority!==n){if(i!=null&&_t(i),n===1)e.tag===0?Ly(Wp.bind(null,e)):Ef(Wp.bind(null,e)),Ay(function(){(Ye&6)===0&&Qs()}),i=null;else{switch(le(c)){case 1:i=Bs;break;case 4:i=ys;break;case 16:i=zr;break;case 536870912:i=Lo;break;default:i=zr}i=Qp(i,Bp.bind(null,e))}e.callbackPriority=n,e.callbackNode=i}}function Bp(e,n){if(Ca=-1,Ea=0,(Ye&6)!==0)throw Error(r(327));var i=e.callbackNode;if(ui()&&e.callbackNode!==i)return null;var c=xr(e,e===Yt?sn:0);if(c===0)return null;if((c&30)!==0||(c&e.expiredLanes)!==0||n)n=_a(e,c);else{n=c;var d=Ye;Ye|=2;var h=Vp();(Yt!==e||sn!==n)&&(Ls=null,ci=kt()+500,Rr(e,n));do try{nx();break}catch(N){Hp(e,N)}while(!0);yc(),Sa.current=h,Ye=d,Pt!==null?n=0:(Yt=null,sn=0,n=Ut)}if(n!==0){if(n===2&&(d=Ci(e),d!==0&&(c=d,n=tu(e,d))),n===1)throw i=to,Rr(e,0),rr(e,c),Rn(e,kt()),i;if(n===6)rr(e,c);else{if(d=e.current.alternate,(c&30)===0&&!ex(d)&&(n=_a(e,c),n===2&&(h=Ci(e),h!==0&&(c=h,n=tu(e,h))),n===1))throw i=to,Rr(e,0),rr(e,c),Rn(e,kt()),i;switch(e.finishedWork=d,e.finishedLanes=c,n){case 0:case 1:throw Error(r(345));case 2:Ar(e,_n,Ls);break;case 3:if(rr(e,c),(c&130023424)===c&&(n=Zc+500-kt(),10<n)){if(xr(e,0)!==0)break;if(d=e.suspendedLanes,(d&c)!==c){bn(),e.pingedLanes|=e.suspendedLanes&d;break}e.timeoutHandle=ac(Ar.bind(null,e,_n,Ls),n);break}Ar(e,_n,Ls);break;case 4:if(rr(e,c),(c&4194240)===c)break;for(n=e.eventTimes,d=-1;0<c;){var y=31-wn(c);h=1<<y,y=n[y],y>d&&(d=y),c&=~h}if(c=d,c=kt()-c,c=(120>c?120:480>c?480:1080>c?1080:1920>c?1920:3e3>c?3e3:4320>c?4320:1960*Jy(c/1960))-c,10<c){e.timeoutHandle=ac(Ar.bind(null,e,_n,Ls),c);break}Ar(e,_n,Ls);break;case 5:Ar(e,_n,Ls);break;default:throw Error(r(329))}}}return Rn(e,kt()),e.callbackNode===i?Bp.bind(null,e):null}function tu(e,n){var i=no;return e.current.memoizedState.isDehydrated&&(Rr(e,n).flags|=256),e=_a(e,n),e!==2&&(n=_n,_n=i,n!==null&&nu(n)),e}function nu(e){_n===null?_n=e:_n.push.apply(_n,e)}function ex(e){for(var n=e;;){if(n.flags&16384){var i=n.updateQueue;if(i!==null&&(i=i.stores,i!==null))for(var c=0;c<i.length;c++){var d=i[c],h=d.getSnapshot;d=d.value;try{if(!ns(h(),d))return!1}catch{return!1}}}if(i=n.child,n.subtreeFlags&16384&&i!==null)i.return=n,n=i;else{if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return!0;n=n.return}n.sibling.return=n.return,n=n.sibling}}return!0}function rr(e,n){for(n&=~Qc,n&=~ba,e.suspendedLanes|=n,e.pingedLanes&=~n,e=e.expirationTimes;0<n;){var i=31-wn(n),c=1<<i;e[i]=-1,n&=~c}}function Wp(e){if((Ye&6)!==0)throw Error(r(327));ui();var n=xr(e,0);if((n&1)===0)return Rn(e,kt()),null;var i=_a(e,n);if(e.tag!==0&&i===2){var c=Ci(e);c!==0&&(n=c,i=tu(e,c))}if(i===1)throw i=to,Rr(e,0),rr(e,n),Rn(e,kt()),i;if(i===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=n,Ar(e,_n,Ls),Rn(e,kt()),null}function su(e,n){var i=Ye;Ye|=1;try{return e(n)}finally{Ye=i,Ye===0&&(ci=kt()+500,na&&Qs())}}function _r(e){nr!==null&&nr.tag===0&&(Ye&6)===0&&ui();var n=Ye;Ye|=1;var i=Xn.transition,c=qe;try{if(Xn.transition=null,qe=1,e)return e()}finally{qe=c,Xn.transition=i,Ye=n,(Ye&6)===0&&Qs()}}function ru(){Bn=li.current,ht(li)}function Rr(e,n){e.finishedWork=null,e.finishedLanes=0;var i=e.timeoutHandle;if(i!==-1&&(e.timeoutHandle=-1,Ry(i)),Pt!==null)for(i=Pt.return;i!==null;){var c=i;switch(pc(c),c.tag){case 1:c=c.type.childContextTypes,c!=null&&ea();break;case 3:ii(),ht(jn),ht(cn),jc();break;case 5:Tc(c);break;case 4:ii();break;case 13:ht(Tt);break;case 19:ht(Tt);break;case 10:xc(c.type._context);break;case 22:case 23:ru()}i=i.return}if(Yt=e,Pt=e=ir(e.current,null),sn=Bn=n,Ut=0,to=null,Qc=ba=Er=0,_n=no=null,Nr!==null){for(n=0;n<Nr.length;n++)if(i=Nr[n],c=i.interleaved,c!==null){i.interleaved=null;var d=c.next,h=i.pending;if(h!==null){var y=h.next;h.next=d,c.next=y}i.pending=c}Nr=null}return e}function Hp(e,n){do{var i=Pt;try{if(yc(),fa.current=ga,pa){for(var c=Nt.memoizedState;c!==null;){var d=c.queue;d!==null&&(d.pending=null),c=c.next}pa=!1}if(Cr=0,Kt=Ft=Nt=null,Yi=!1,Xi=0,Xc.current=null,i===null||i.return===null){Ut=1,to=n,Pt=null;break}e:{var h=e,y=i.return,N=i,D=n;if(n=sn,N.flags|=32768,D!==null&&typeof D=="object"&&typeof D.then=="function"){var V=D,ee=N,se=ee.tag;if((ee.mode&1)===0&&(se===0||se===11||se===15)){var J=ee.alternate;J?(ee.updateQueue=J.updateQueue,ee.memoizedState=J.memoizedState,ee.lanes=J.lanes):(ee.updateQueue=null,ee.memoizedState=null)}var me=mp(y);if(me!==null){me.flags&=-257,gp(me,y,N,h,n),me.mode&1&&hp(h,V,n),n=me,D=V;var xe=n.updateQueue;if(xe===null){var ke=new Set;ke.add(D),n.updateQueue=ke}else xe.add(D);break e}else{if((n&1)===0){hp(h,V,n),iu();break e}D=Error(r(426))}}else if(xt&&N.mode&1){var It=mp(y);if(It!==null){(It.flags&65536)===0&&(It.flags|=256),gp(It,y,N,h,n),gc(oi(D,N));break e}}h=D=oi(D,N),Ut!==4&&(Ut=2),no===null?no=[h]:no.push(h),h=y;do{switch(h.tag){case 3:h.flags|=65536,n&=-n,h.lanes|=n;var z=fp(h,D,n);zf(h,z);break e;case 1:N=D;var L=h.type,H=h.stateNode;if((h.flags&128)===0&&(typeof L.getDerivedStateFromError=="function"||H!==null&&typeof H.componentDidCatch=="function"&&(tr===null||!tr.has(H)))){h.flags|=65536,n&=-n,h.lanes|=n;var ce=pp(h,N,n);zf(h,ce);break e}}h=h.return}while(h!==null)}qp(i)}catch(Te){n=Te,Pt===i&&i!==null&&(Pt=i=i.return);continue}break}while(!0)}function Vp(){var e=Sa.current;return Sa.current=ga,e===null?ga:e}function iu(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),Yt===null||(Er&268435455)===0&&(ba&268435455)===0||rr(Yt,sn)}function _a(e,n){var i=Ye;Ye|=2;var c=Vp();(Yt!==e||sn!==n)&&(Ls=null,Rr(e,n));do try{tx();break}catch(d){Hp(e,d)}while(!0);if(yc(),Ye=i,Sa.current=c,Pt!==null)throw Error(r(261));return Yt=null,sn=0,Ut}function tx(){for(;Pt!==null;)Gp(Pt)}function nx(){for(;Pt!==null&&!gs();)Gp(Pt)}function Gp(e){var n=Xp(e.alternate,e,Bn);e.memoizedProps=e.pendingProps,n===null?qp(e):Pt=n,Xc.current=null}function qp(e){var n=e;do{var i=n.alternate;if(e=n.return,(n.flags&32768)===0){if(i=Ky(i,n,Bn),i!==null){Pt=i;return}}else{if(i=Yy(i,n),i!==null){i.flags&=32767,Pt=i;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ut=6,Pt=null;return}}if(n=n.sibling,n!==null){Pt=n;return}Pt=n=e}while(n!==null);Ut===0&&(Ut=5)}function Ar(e,n,i){var c=qe,d=Xn.transition;try{Xn.transition=null,qe=1,sx(e,n,i,c)}finally{Xn.transition=d,qe=c}return null}function sx(e,n,i,c){do ui();while(nr!==null);if((Ye&6)!==0)throw Error(r(327));i=e.finishedWork;var d=e.finishedLanes;if(i===null)return null;if(e.finishedWork=null,e.finishedLanes=0,i===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var h=i.lanes|i.childLanes;if($o(e,h),e===Yt&&(Pt=Yt=null,sn=0),(i.subtreeFlags&2064)===0&&(i.flags&2064)===0||Na||(Na=!0,Qp(zr,function(){return ui(),null})),h=(i.flags&15990)!==0,(i.subtreeFlags&15990)!==0||h){h=Xn.transition,Xn.transition=null;var y=qe;qe=1;var N=Ye;Ye|=4,Xc.current=null,Qy(e,i),Op(i,e),by(ic),Fo=!!rc,ic=rc=null,e.current=i,Zy(i),$l(),Ye=N,qe=y,Xn.transition=h}else e.current=i;if(Na&&(Na=!1,nr=e,ja=d),h=e.pendingLanes,h===0&&(tr=null),Fr(i.stateNode),Rn(e,kt()),n!==null)for(c=e.onRecoverableError,i=0;i<n.length;i++)d=n[i],c(d.value,{componentStack:d.stack,digest:d.digest});if(Ta)throw Ta=!1,e=Jc,Jc=null,e;return(ja&1)!==0&&e.tag!==0&&ui(),h=e.pendingLanes,(h&1)!==0?e===eu?so++:(so=0,eu=e):so=0,Qs(),null}function ui(){if(nr!==null){var e=le(ja),n=Xn.transition,i=qe;try{if(Xn.transition=null,qe=16>e?16:e,nr===null)var c=!1;else{if(e=nr,nr=null,ja=0,(Ye&6)!==0)throw Error(r(331));var d=Ye;for(Ye|=4,ye=e.current;ye!==null;){var h=ye,y=h.child;if((ye.flags&16)!==0){var N=h.deletions;if(N!==null){for(var D=0;D<N.length;D++){var V=N[D];for(ye=V;ye!==null;){var ee=ye;switch(ee.tag){case 0:case 11:case 15:eo(8,ee,h)}var se=ee.child;if(se!==null)se.return=ee,ye=se;else for(;ye!==null;){ee=ye;var J=ee.sibling,me=ee.return;if(Ip(ee),ee===V){ye=null;break}if(J!==null){J.return=me,ye=J;break}ye=me}}}var xe=h.alternate;if(xe!==null){var ke=xe.child;if(ke!==null){xe.child=null;do{var It=ke.sibling;ke.sibling=null,ke=It}while(ke!==null)}}ye=h}}if((h.subtreeFlags&2064)!==0&&y!==null)y.return=h,ye=y;else e:for(;ye!==null;){if(h=ye,(h.flags&2048)!==0)switch(h.tag){case 0:case 11:case 15:eo(9,h,h.return)}var z=h.sibling;if(z!==null){z.return=h.return,ye=z;break e}ye=h.return}}var L=e.current;for(ye=L;ye!==null;){y=ye;var H=y.child;if((y.subtreeFlags&2064)!==0&&H!==null)H.return=y,ye=H;else e:for(y=L;ye!==null;){if(N=ye,(N.flags&2048)!==0)try{switch(N.tag){case 0:case 11:case 15:ka(9,N)}}catch(Te){Rt(N,N.return,Te)}if(N===y){ye=null;break e}var ce=N.sibling;if(ce!==null){ce.return=N.return,ye=ce;break e}ye=N.return}}if(Ye=d,Qs(),$n&&typeof $n.onPostCommitFiberRoot=="function")try{$n.onPostCommitFiberRoot(gr,e)}catch{}c=!0}return c}finally{qe=i,Xn.transition=n}}return!1}function Kp(e,n,i){n=oi(i,n),n=fp(e,n,1),e=Js(e,n,1),n=bn(),e!==null&&(wr(e,1,n),Rn(e,n))}function Rt(e,n,i){if(e.tag===3)Kp(e,e,i);else for(;n!==null;){if(n.tag===3){Kp(n,e,i);break}else if(n.tag===1){var c=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(tr===null||!tr.has(c))){e=oi(i,e),e=pp(n,e,1),n=Js(n,e,1),e=bn(),n!==null&&(wr(n,1,e),Rn(n,e));break}}n=n.return}}function rx(e,n,i){var c=e.pingCache;c!==null&&c.delete(n),n=bn(),e.pingedLanes|=e.suspendedLanes&i,Yt===e&&(sn&i)===i&&(Ut===4||Ut===3&&(sn&130023424)===sn&&500>kt()-Zc?Rr(e,0):Qc|=i),Rn(e,n)}function Yp(e,n){n===0&&((e.mode&1)===0?n=1:(n=Br,Br<<=1,(Br&130023424)===0&&(Br=4194304)));var i=bn();e=Is(e,n),e!==null&&(wr(e,n,i),Rn(e,i))}function ix(e){var n=e.memoizedState,i=0;n!==null&&(i=n.retryLane),Yp(e,i)}function ox(e,n){var i=0;switch(e.tag){case 13:var c=e.stateNode,d=e.memoizedState;d!==null&&(i=d.retryLane);break;case 19:c=e.stateNode;break;default:throw Error(r(314))}c!==null&&c.delete(n),Yp(e,i)}var Xp;Xp=function(e,n,i){if(e!==null)if(e.memoizedProps!==n.pendingProps||jn.current)En=!0;else{if((e.lanes&i)===0&&(n.flags&128)===0)return En=!1,qy(e,n,i);En=(e.flags&131072)!==0}else En=!1,xt&&(n.flags&1048576)!==0&&_f(n,ra,n.index);switch(n.lanes=0,n.tag){case 2:var c=n.type;xa(e,n),e=n.pendingProps;var d=Zr(n,cn.current);ri(n,i),d=_c(null,n,c,e,d,i);var h=Rc();return n.flags|=1,typeof d=="object"&&d!==null&&typeof d.render=="function"&&d.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,Cn(c)?(h=!0,ta(n)):h=!1,n.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,Sc(n),d.updater=va,n.stateNode=d,d._reactInternals=n,Pc(n,c,e,i),n=Fc(null,n,c,!0,h,i)):(n.tag=0,xt&&h&&fc(n),Sn(null,n,d,i),n=n.child),n;case 16:c=n.elementType;e:{switch(xa(e,n),e=n.pendingProps,d=c._init,c=d(c._payload),n.type=c,d=n.tag=lx(c),e=rs(c,e),d){case 0:n=zc(null,n,c,e,i);break e;case 1:n=Sp(null,n,c,e,i);break e;case 11:n=vp(null,n,c,e,i);break e;case 14:n=yp(null,n,c,rs(c.type,e),i);break e}throw Error(r(306,c,""))}return n;case 0:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:rs(c,d),zc(e,n,c,d,i);case 1:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:rs(c,d),Sp(e,n,c,d,i);case 3:e:{if(bp(n),e===null)throw Error(r(387));c=n.pendingProps,h=n.memoizedState,d=h.element,$f(e,n),ua(n,c,null,i);var y=n.memoizedState;if(c=y.element,h.isDehydrated)if(h={element:c,isDehydrated:!1,cache:y.cache,pendingSuspenseBoundaries:y.pendingSuspenseBoundaries,transitions:y.transitions},n.updateQueue.baseState=h,n.memoizedState=h,n.flags&256){d=oi(Error(r(423)),n),n=Tp(e,n,c,i,d);break e}else if(c!==d){d=oi(Error(r(424)),n),n=Tp(e,n,c,i,d);break e}else for(Un=Ks(n.stateNode.containerInfo.firstChild),Fn=n,xt=!0,ss=null,i=Pf(n,null,c,i),n.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(ti(),c===d){n=Ms(e,n,i);break e}Sn(e,n,c,i)}n=n.child}return n;case 5:return Uf(n),e===null&&mc(n),c=n.type,d=n.pendingProps,h=e!==null?e.memoizedProps:null,y=d.children,oc(c,d)?y=null:h!==null&&oc(c,h)&&(n.flags|=32),kp(e,n),Sn(e,n,y,i),n.child;case 6:return e===null&&mc(n),null;case 13:return Np(e,n,i);case 4:return bc(n,n.stateNode.containerInfo),c=n.pendingProps,e===null?n.child=ni(n,null,c,i):Sn(e,n,c,i),n.child;case 11:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:rs(c,d),vp(e,n,c,d,i);case 7:return Sn(e,n,n.pendingProps,i),n.child;case 8:return Sn(e,n,n.pendingProps.children,i),n.child;case 12:return Sn(e,n,n.pendingProps.children,i),n.child;case 10:e:{if(c=n.type._context,d=n.pendingProps,h=n.memoizedProps,y=d.value,ct(aa,c._currentValue),c._currentValue=y,h!==null)if(ns(h.value,y)){if(h.children===d.children&&!jn.current){n=Ms(e,n,i);break e}}else for(h=n.child,h!==null&&(h.return=n);h!==null;){var N=h.dependencies;if(N!==null){y=h.child;for(var D=N.firstContext;D!==null;){if(D.context===c){if(h.tag===1){D=Ds(-1,i&-i),D.tag=2;var V=h.updateQueue;if(V!==null){V=V.shared;var ee=V.pending;ee===null?D.next=D:(D.next=ee.next,ee.next=D),V.pending=D}}h.lanes|=i,D=h.alternate,D!==null&&(D.lanes|=i),wc(h.return,i,n),N.lanes|=i;break}D=D.next}}else if(h.tag===10)y=h.type===n.type?null:h.child;else if(h.tag===18){if(y=h.return,y===null)throw Error(r(341));y.lanes|=i,N=y.alternate,N!==null&&(N.lanes|=i),wc(y,i,n),y=h.sibling}else y=h.child;if(y!==null)y.return=h;else for(y=h;y!==null;){if(y===n){y=null;break}if(h=y.sibling,h!==null){h.return=y.return,y=h;break}y=y.return}h=y}Sn(e,n,d.children,i),n=n.child}return n;case 9:return d=n.type,c=n.pendingProps.children,ri(n,i),d=Kn(d),c=c(d),n.flags|=1,Sn(e,n,c,i),n.child;case 14:return c=n.type,d=rs(c,n.pendingProps),d=rs(c.type,d),yp(e,n,c,d,i);case 15:return xp(e,n,n.type,n.pendingProps,i);case 17:return c=n.type,d=n.pendingProps,d=n.elementType===c?d:rs(c,d),xa(e,n),n.tag=1,Cn(c)?(e=!0,ta(n)):e=!1,ri(n,i),up(n,c,d),Pc(n,c,d,i),Fc(null,n,c,!0,e,i);case 19:return Cp(e,n,i);case 22:return wp(e,n,i)}throw Error(r(156,n.tag))};function Qp(e,n){return Qe(e,n)}function ax(e,n,i,c){this.tag=e,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Qn(e,n,i,c){return new ax(e,n,i,c)}function ou(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lx(e){if(typeof e=="function")return ou(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ne)return 11;if(e===te)return 14}return 2}function ir(e,n){var i=e.alternate;return i===null?(i=Qn(e.tag,n,e.key,e.mode),i.elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=e.flags&14680064,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i}function Ra(e,n,i,c,d,h){var y=2;if(c=e,typeof e=="function")ou(e)&&(y=1);else if(typeof e=="string")y=5;else e:switch(e){case K:return Ir(i.children,d,h,n);case F:y=8,d|=8;break;case re:return e=Qn(12,i,n,d|2),e.elementType=re,e.lanes=h,e;case Se:return e=Qn(13,i,n,d),e.elementType=Se,e.lanes=h,e;case Pe:return e=Qn(19,i,n,d),e.elementType=Pe,e.lanes=h,e;case ae:return Aa(i,d,h,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case he:y=10;break e;case G:y=9;break e;case Ne:y=11;break e;case te:y=14;break e;case oe:y=16,c=null;break e}throw Error(r(130,e==null?e:typeof e,""))}return n=Qn(y,i,n,d),n.elementType=e,n.type=c,n.lanes=h,n}function Ir(e,n,i,c){return e=Qn(7,e,c,n),e.lanes=i,e}function Aa(e,n,i,c){return e=Qn(22,e,c,n),e.elementType=ae,e.lanes=i,e.stateNode={isHidden:!1},e}function au(e,n,i){return e=Qn(6,e,null,n),e.lanes=i,e}function lu(e,n,i){return n=Qn(4,e.children!==null?e.children:[],e.key,n),n.lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function cx(e,n,i,c,d){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_i(0),this.expirationTimes=_i(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_i(0),this.identifierPrefix=c,this.onRecoverableError=d,this.mutableSourceEagerHydrationData=null}function cu(e,n,i,c,d,h,y,N,D){return e=new cx(e,n,i,N,D),n===1?(n=1,h===!0&&(n|=8)):n=0,h=Qn(3,null,null,n),e.current=h,h.stateNode=e,h.memoizedState={element:c,isDehydrated:i,cache:null,transitions:null,pendingSuspenseBoundaries:null},Sc(h),e}function ux(e,n,i){var c=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Y,key:c==null?null:""+c,children:e,containerInfo:n,implementation:i}}function Zp(e){if(!e)return Xs;e=e._reactInternals;e:{if(Be(e)!==e||e.tag!==1)throw Error(r(170));var n=e;do{switch(n.tag){case 3:n=n.stateNode.context;break e;case 1:if(Cn(n.type)){n=n.stateNode.__reactInternalMemoizedMergedChildContext;break e}}n=n.return}while(n!==null);throw Error(r(171))}if(e.tag===1){var i=e.type;if(Cn(i))return jf(e,i,n)}return n}function Jp(e,n,i,c,d,h,y,N,D){return e=cu(i,c,!0,e,d,h,y,N,D),e.context=Zp(null),i=e.current,c=bn(),d=sr(i),h=Ds(c,d),h.callback=n??null,Js(i,h,d),e.current.lanes=d,wr(e,d,c),Rn(e,c),e}function Ia(e,n,i,c){var d=n.current,h=bn(),y=sr(d);return i=Zp(i),n.context===null?n.context=i:n.pendingContext=i,n=Ds(h,y),n.payload={element:e},c=c===void 0?null:c,c!==null&&(n.callback=c),e=Js(d,n,y),e!==null&&(as(e,d,y,h),ca(e,d,y)),y}function Da(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 eh(e,n){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var i=e.retryLane;e.retryLane=i!==0&&i<n?i:n}}function uu(e,n){eh(e,n),(e=e.alternate)&&eh(e,n)}function dx(){return null}var th=typeof reportError=="function"?reportError:function(e){console.error(e)};function du(e){this._internalRoot=e}Ma.prototype.render=du.prototype.render=function(e){var n=this._internalRoot;if(n===null)throw Error(r(409));Ia(e,n,null,null)},Ma.prototype.unmount=du.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var n=e.containerInfo;_r(function(){Ia(null,e,null,null)}),n[Es]=null}};function Ma(e){this._internalRoot=e}Ma.prototype.unstable_scheduleHydration=function(e){if(e){var n=we();e={blockedOn:null,target:e,priority:n};for(var i=0;i<Vs.length&&n!==0&&n<Vs[i].priority;i++);Vs.splice(i,0,e),i===0&&Fd(e)}};function fu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function La(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function nh(){}function fx(e,n,i,c,d){if(d){if(typeof c=="function"){var h=c;c=function(){var V=Da(y);h.call(V)}}var y=Jp(n,c,e,0,null,!1,!1,"",nh);return e._reactRootContainer=y,e[Es]=y.current,Ui(e.nodeType===8?e.parentNode:e),_r(),y}for(;d=e.lastChild;)e.removeChild(d);if(typeof c=="function"){var N=c;c=function(){var V=Da(D);N.call(V)}}var D=cu(e,0,!1,null,null,!1,!1,"",nh);return e._reactRootContainer=D,e[Es]=D.current,Ui(e.nodeType===8?e.parentNode:e),_r(function(){Ia(n,D,i,c)}),D}function Pa(e,n,i,c,d){var h=i._reactRootContainer;if(h){var y=h;if(typeof d=="function"){var N=d;d=function(){var D=Da(y);N.call(D)}}Ia(n,y,e,d)}else y=fx(i,n,e,d,c);return Da(y)}b=function(e){switch(e.tag){case 3:var n=e.stateNode;if(n.current.memoizedState.isDehydrated){var i=yr(n.pendingLanes);i!==0&&(Hs(n,i|1),Rn(n,kt()),(Ye&6)===0&&(ci=kt()+500,Qs()))}break;case 13:_r(function(){var c=Is(e,1);if(c!==null){var d=bn();as(c,e,1,d)}}),uu(e,1)}},$=function(e){if(e.tag===13){var n=Is(e,134217728);if(n!==null){var i=bn();as(n,e,134217728,i)}uu(e,134217728)}},Z=function(e){if(e.tag===13){var n=sr(e),i=Is(e,n);if(i!==null){var c=bn();as(i,e,n,c)}uu(e,n)}},we=function(){return qe},je=function(e,n){var i=qe;try{return qe=e,n()}finally{qe=i}},Vt=function(e,n,i){switch(n){case"input":if(Ht(e,i),n=i.name,i.type==="radio"&&n!=null){for(i=e;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll("input[name="+JSON.stringify(""+n)+'][type="radio"]'),n=0;n<i.length;n++){var c=i[n];if(c!==e&&c.form===e.form){var d=Jo(c);if(!d)throw Error(r(90));De(c),Ht(c,d)}}}break;case"textarea":pe(e,i);break;case"select":n=i.value,n!=null&&$t(e,!!i.multiple,n,!1)}},vt=su,yt=_r;var px={usingClientEntryPoint:!1,Events:[Hi,Xr,Jo,ft,Gt,su]},ro={findFiberByHostInstance:kr,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},hx={bundleType:ro.bundleType,version:ro.version,rendererPackageName:ro.rendererPackageName,rendererConfig:ro.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:I.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=On(e),e===null?null:e.stateNode},findFiberByHostInstance:ro.findFiberByHostInstance||dx,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 Oa=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Oa.isDisabled&&Oa.supportsFiber)try{gr=Oa.inject(hx),$n=Oa}catch{}}return An.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=px,An.createPortal=function(e,n){var i=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!fu(n))throw Error(r(200));return ux(e,n,null,i)},An.createRoot=function(e,n){if(!fu(e))throw Error(r(299));var i=!1,c="",d=th;return n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(c=n.identifierPrefix),n.onRecoverableError!==void 0&&(d=n.onRecoverableError)),n=cu(e,1,!1,null,null,i,!1,c,d),e[Es]=n.current,Ui(e.nodeType===8?e.parentNode:e),new du(n)},An.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var n=e._reactInternals;if(n===void 0)throw typeof e.render=="function"?Error(r(188)):(e=Object.keys(e).join(","),Error(r(268,e)));return e=On(n),e=e===null?null:e.stateNode,e},An.flushSync=function(e){return _r(e)},An.hydrate=function(e,n,i){if(!La(n))throw Error(r(200));return Pa(null,e,n,!0,i)},An.hydrateRoot=function(e,n,i){if(!fu(e))throw Error(r(405));var c=i!=null&&i.hydratedSources||null,d=!1,h="",y=th;if(i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(h=i.identifierPrefix),i.onRecoverableError!==void 0&&(y=i.onRecoverableError)),n=Jp(n,null,e,1,i??null,d,!1,h,y),e[Es]=n.current,Ui(e),c)for(e=0;e<c.length;e++)i=c[e],d=i._getVersion,d=d(i._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[i,d]:n.mutableSourceEagerHydrationData.push(i,d);return new Ma(n)},An.render=function(e,n,i){if(!La(n))throw Error(r(200));return Pa(null,e,n,!1,i)},An.unmountComponentAtNode=function(e){if(!La(e))throw Error(r(40));return e._reactRootContainer?(_r(function(){Pa(null,null,e,!1,function(){e._reactRootContainer=null,e[Es]=null})}),!0):!1},An.unstable_batchedUpdates=su,An.unstable_renderSubtreeIntoContainer=function(e,n,i,c){if(!La(i))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return Pa(e,n,i,!1,c)},An.version="18.3.1-next-f1338f8080-20240426",An}var uh;function eg(){if(uh)return mu.exports;uh=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(s){console.error(s)}}return t(),mu.exports=bx(),mu.exports}var dh;function Tx(){if(dh)return $a;dh=1;var t=eg();return $a.createRoot=t.createRoot,$a.hydrateRoot=t.hydrateRoot,$a}var Nx=Tx();const jx=Jm(Nx),fh=t=>{let s;const r=new Set,o=(m,v)=>{const k=typeof m=="function"?m(s):m;if(!Object.is(k,s)){const w=s;s=v??(typeof k!="object"||k===null)?k:Object.assign({},s,k),r.forEach(S=>S(s,w))}},l=()=>s,p={setState:o,getState:l,getInitialState:()=>g,subscribe:m=>(r.add(m),()=>r.delete(m))},g=s=t(o,l,p);return p},Cx=(t=>t?fh(t):fh),Ex=t=>t;function _x(t,s=Ex){const r=ot.useSyncExternalStore(t.subscribe,ot.useCallback(()=>s(t.getState()),[t,s]),ot.useCallback(()=>s(t.getInitialState()),[t,s]));return ot.useDebugValue(r),r}const Rx=t=>{const s=Cx(t),r=o=>_x(s,o);return Object.assign(r,s),r},Ax=(t=>Rx),tg="agentpane:machines",ng="agentpane:active-machine";function Ix(t){return/^[a-z][a-z0-9-]{1,30}$/.test(t)}function sg(t){return`${t}.repoburg.com`}function rg(t){const s=/^([a-z][a-z0-9-]{1,30})\.repoburg\.com$/.exec(t);return s?s[1]:null}function ig(t,s){try{const r=localStorage.getItem(t);return r==null?s:JSON.parse(r)}catch{return s}}function og(t,s){try{localStorage.setItem(t,JSON.stringify(s))}catch{}}function Dx(t){const{mahlas:s,hostname:r}=t??{};return typeof s=="string"&&Ix(s)&&r===sg(s)}function ag(){const t=ig(tg,[]);return Array.isArray(t)?t.filter(Dx):[]}function Mx(t){const s={mahlas:t,hostname:sg(t),lastConnectedAt:new Date().toISOString()},r=ag(),o=[s,...r.filter(l=>l.mahlas!==t)];return og(tg,o),s}function Lx(){const t=ig(ng,null);return t?ag().find(s=>s.mahlas===t)??null:null}function Px(t){og(ng,t)}function Ox(){if(typeof window>"u")return;const t=new URLSearchParams(window.location.search).get("host");if(!t)return;const s=rg(t);s&&(Mx(s),Px(s))}const ph="http://localhost:9998",$x=["agent.repoburg.com"];function mn(){if(typeof window>"u")return"";const t=new URLSearchParams(window.location.search),s=t.get("bport");if(s)return`http://localhost:${s}`;const r=t.get("host");if(r)return`https://${r}`;const o=window.location.hostname;if($x.includes(o))return ph;if(rg(o))return"";const l=Lx();return l?`https://${l.hostname}`:o==="localhost"||o==="127.0.0.1"||o==="0.0.0.0"?"":ph}const zx="/api";class ld extends Error{constructor(r,o,l){super(r);rt(this,"status");rt(this,"body");this.name="ApiError",this.status=o,this.body=l}}function vi(t){var s;if(t instanceof ld){const r=(s=t.body)==null?void 0:s.error;if(typeof r=="string"&&r)return r}return t instanceof Error?t.message:String(t)}async function Co(t,s,r){const o=await fetch(`${mn()}${zx}${s}`,{method:t,headers:r?{"Content-Type":"application/json"}:void 0,body:r?JSON.stringify(r):void 0});if(!o.ok){let l=`${o.status} ${o.statusText}`,u=null;try{u=await o.json();const f=u==null?void 0:u.error;typeof f=="string"&&f&&(l=`${l} — ${f}`)}catch{}throw new ld(`${t} ${s} failed: ${l}`,o.status,u)}return o.json()}function Wt(t){return Co("GET",t)}function ut(t,s){return Co("POST",t,s)}function Tl(t){return Co("DELETE",t)}function Ns(t,s){return Co("PATCH",t,s)}function Fx(t,s){return Co("PUT",t,s)}function Ux(){return Wt("/sessions")}function oo(t){return Wt(`/sessions/${t}`)}function cd(t){return ut("/sessions",t)}function hh(t){return Tl(`/sessions/${t}`)}function lg(t,s,r,o){return ut(`/sessions/${t}/turns`,{user_prompt:s,...r!=null&&r.length?{attachments:r}:{},...o!=null&&o.originAppId?{origin_app_id:o.originAppId}:{}})}function Bx(t){return ut(`/sessions/${t}/cancel`)}function Wx(t,s){return ut(`/sessions/${t}/turns/${s}/resume`)}function Hx(t,s){return Ns(`/sessions/${t}`,{title:s})}function mh(t){return Ns(`/sessions/${t}`,{lifecycle:"finished"})}function gh(t){return Ns(`/sessions/${t}`,{lifecycle:"working"})}function Vx(t,s){return Ns(`/sessions/${t}`,{starred:s})}function vh(t){return Ns(`/sessions/${t}`,{has_unreviewed:0})}function Gx(t,s,r,o){const l={model:s,model_reasoning_effort:r};return o!==void 0&&(l.runtime_type=o),Ns(`/sessions/${t}`,l)}function qx(t,s){return Ns(`/sessions/${t}`,{runtime_config:s})}function Kx(t,s){return ut(`/sessions/${t}/rewind`,{turn_id:s})}function Yx(t){return ut(`/sessions/${t}/restore`,{})}function Xx(t,s,r){return ut(`/sessions/${t}/branch`,{turn_id:s,title:r})}function cg(){return Wt("/workspaces")}function Qx(t,s){return ut("/workspaces",{path:t,label:s})}function Zx(t){return ut("/workspaces/hide",{path:t})}function Jx(){return Wt("/workspaces/picker")}function yh(t){return Wt(t?`/workspaces/browse?path=${encodeURIComponent(t)}`:"/workspaces/browse")}async function e0(){const t=await fetch(`${mn()}/api/pick-directory`);if(t.status===204)return{cancelled:!0};if(!t.ok)throw new Error(`GET /api/pick-directory failed: ${t.status} ${t.statusText}`);return t.json()}function ug(){return Wt("/folders")}function t0(t,s){return ut("/folders",{workspace_path:t,name:s})}function xh(t,s){return Ns(`/folders/${t}`,s)}function n0(t){return Tl(`/folders/${t}`)}function s0(t){return ut("/sessions/reorder",{moves:t})}function pr(t){return t.status==="pending"||t.status==="running"}function dg(t){return!!(t!=null&&t.turns.some(pr))}function Nl(t){return t?t.turns.some(pr)||(t.threads??[]).some(s=>(s.turns??[]).some(pr)):!1}const fg=1;function pg(){let t="";try{t=mn()}catch{}return`agentpane:tabs:${t||window.location.origin}`}function wh(t){return Array.isArray(t)&&t.every(s=>typeof s=="string")}function kh(t){return t===null||typeof t=="string"}function r0(t){if(t==null)return null;let s;try{s=JSON.parse(t)}catch{return null}if(typeof s!="object"||s===null)return null;const r=s;return r.v!==fg||!wh(r.openTabs)||!kh(r.activeSessionId)||!wh(r.openAppTabs)||!kh(r.activeAppTabId)?null:{openTabs:r.openTabs,activeSessionId:r.activeSessionId,openAppTabs:r.openAppTabs,activeAppTabId:r.activeAppTabId}}const hg=[()=>window.sessionStorage,()=>window.localStorage];function i0(){const t=pg();for(const s of hg)try{const r=r0(s().getItem(t));if(r)return r}catch{}return null}function o0(t){const s=pg(),r=JSON.stringify({v:fg,openTabs:t.openTabs,activeSessionId:t.activeSessionId,openAppTabs:t.openAppTabs,activeAppTabId:t.activeAppTabId});for(const o of hg)try{o().setItem(s,r)}catch{}}function a0(t){return t.subscribe((s,r)=>{(s.openTabs!==r.openTabs||s.activeSessionId!==r.activeSessionId||s.openAppTabs!==r.openAppTabs||s.activeAppTabId!==r.activeAppTabId)&&o0(s)})}function el(t){return[...new Set(t)]}function l0(t,s,r,o){const l=m=>r===null||r.has(m),u=el(((t==null?void 0:t.openTabs)??[]).filter(m=>s.has(m))),f=el(((t==null?void 0:t.openAppTabs)??[]).filter(l));let p=(t==null?void 0:t.activeSessionId)??null;p!==null&&!s.has(p)&&(p=null),p!==null&&!u.includes(p)&&u.push(p),p??(p=u.at(-1)??null);let g=(t==null?void 0:t.activeAppTabId)??null;return g!==null&&!l(g)&&(g=null),g!==null&&!f.includes(g)&&f.push(g),o!==null&&s.has(o)&&(u.includes(o)||u.push(o),p=o,g=null),{openTabs:u,activeSessionId:p,openAppTabs:f,activeAppTabId:g}}function c0(){const t=new URLSearchParams(window.location.search);return{session:t.get("session"),thread:t.get("thread")}}function u0(){const t=new URL(window.location.href);!t.searchParams.has("session")&&!t.searchParams.has("thread")||(t.searchParams.delete("session"),t.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",t))}let yu=0;function Sh(t){return t==="sidecar"?"sidecar":"turns"}async function d0(t,s){const r=await Promise.allSettled(t.map(u=>s(u))),o=new Map;let l=null;return r.forEach((u,f)=>{var p;u.status==="fulfilled"?o.set(t[f],u.value):l===null&&(l=((p=u.reason)==null?void 0:p.message)??"Request failed")}),{updated:o,firstError:l}}function bh(t,s){const r={...t.sessionDetails};s.forEach(p=>delete r[p]);const o={...t.backgroundTasks};s.forEach(p=>delete o[p]);const l=t.openTabs.filter(p=>!s.has(p));let u=t.activeSessionId,f=t.activeTurnIndex;if(u&&s.has(u)){u=l.length>0?l[l.length-1]:null;const p=u?r[u]:null;f=p&&p.turns.length>0?p.turns.length-1:0}return{sessions:t.sessions.filter(p=>!s.has(p.id)),sessionDetails:r,backgroundTasks:o,openTabs:l,activeSessionId:u,activeTurnIndex:f}}function f0(t){const s={...t};return delete s.turns,delete s.threads,delete s.contextUsage,s}async function Th(t,s,r,o,l){if(r.length===0)return;t({error:null});const{updated:u,firstError:f}=await d0(r,o);u.size>0&&t(g=>({sessions:g.sessions.map(m=>u.get(m.id)??m)}));const p=r.length-u.size;if(p===0)s().addToast("info",`${r.length} session${r.length===1?"":"s"} ${l}`);else{t({error:f});const g=l[0].toUpperCase()+l.slice(1);s().addToast(p===r.length?"error":"warn",`${g} ${u.size} of ${r.length} — ${p} failed`)}}const p0=(t,s)=>({sessions:[],sessionDetails:{},activeSessionId:null,openTabs:[],activeTurnIndex:0,submittingPrompt:null,quotedText:null,init:async()=>{const r=c0(),o=i0();try{const l=localStorage.getItem("agentpane:last-model-config");l&&t({lastModelConfig:JSON.parse(l)})}catch{}t({loading:!0,error:null});try{const l=s().loadApps(),[u,f,p]=await Promise.all([Ux(),cg(),ug()]);t({sessions:u,workspaces:f,folders:p,loading:!1}),u0();const g=await l,m=l0(o,new Set(u.map(v=>v.id)),g?new Set(s().apps.map(v=>v.id)):null,r.session);t(v=>{const k=v.activeSessionId!==null||v.activeAppTabId!==null;return{openTabs:el([...m.openTabs,...v.openTabs]),openAppTabs:el([...m.openAppTabs,...v.openAppTabs]),activeAppTabId:k?v.activeAppTabId:m.activeAppTabId}}),m.activeSessionId&&!s().activeSessionId&&await s().selectSession(m.activeSessionId,{keepAppView:!0}),r.thread&&(t({deepLinkThreadId:r.thread}),s().switchRightTab("threads"))}catch(l){t({loading:!1,error:l.message})}},selectSession:async(r,o)=>{const l=++yu,u=o!=null&&o.keepAppView?{}:{activeAppTabId:null},f=p=>p.includes(r)?p:[...p,r];if(s().sessionDetails[r]){const p=s().sessionDetails[r];t({activeSessionId:r,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:Sh(s().activeRightTab),...u,openTabs:f(s().openTabs)}),p.has_unreviewed===1&&(vh(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...p,has_unreviewed:0}}})));return}t({loading:!0,error:null});try{const p=await oo(r);if(l!==yu){t(g=>({sessionDetails:{...g.sessionDetails,[r]:p},openTabs:f(g.openTabs),loading:!1}));return}t(g=>({sessionDetails:{...g.sessionDetails,[r]:p},activeSessionId:r,activeTurnIndex:p.turns.length>0?p.turns.length-1:0,activeRightTab:Sh(g.activeRightTab),...u,openTabs:f(g.openTabs),loading:!1})),p.has_unreviewed===1&&(vh(r).catch(()=>{}),t(g=>({sessions:g.sessions.map(m=>m.id===r?{...m,has_unreviewed:0}:m),sessionDetails:{...g.sessionDetails,[r]:{...p,has_unreviewed:0}}})))}catch(p){t(l===yu?{loading:!1,error:p.message}:{loading:!1})}},closeTab:r=>{t(o=>{const l=o.openTabs.filter(u=>u!==r);if(o.activeSessionId===r&&l.length>0){const u=l[l.length-1],f=o.sessionDetails[u];return{openTabs:l,activeSessionId:u,activeTurnIndex:f&&f.turns.length>0?f.turns.length-1:0}}return{openTabs:l,activeSessionId:o.activeSessionId===r?null:o.activeSessionId}})},updateModelConfig:async(r,o,l)=>{const u=s().activeSessionId;if(u){t({error:null});try{const f=await Gx(u,r,o,l),p={provider:f.runtime_type,model:f.model??"",reasoning:f.model_reasoning_effort??""};t({lastModelConfig:p}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(p)),t(g=>({sessions:g.sessions.map(m=>m.id===u?f:m),sessionDetails:g.sessionDetails[u]?{...g.sessionDetails,[u]:{...g.sessionDetails[u],model:f.model,model_reasoning_effort:f.model_reasoning_effort,external_thread_id:f.external_thread_id}}:g.sessionDetails})),await s().refreshActiveSession()}catch(f){t({error:f.message}),s().addToast("error",`Failed to update model — ${f.message}`)}}},createSession:async r=>{t({error:null});try{const o=await cd(r);t(u=>({sessions:[o,...u.sessions],showNewSessionDialog:!1}));const l={provider:o.runtime_type,model:o.model??"",reasoning:o.model_reasoning_effort??""};t({lastModelConfig:l}),localStorage.setItem("agentpane:last-model-config",JSON.stringify(l)),await s().selectSession(o.id),s().addLogEntry("INFO",`Session created — ${o.id.slice(0,8)}`),s().addToast("success",`Session created — ${o.title||o.id.slice(0,8)}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},addSession:r=>{t(o=>({sessions:o.sessions.some(l=>l.id===r.id)?o.sessions:[r,...o.sessions]}))},revealSession:async r=>{let o=s().sessionDetails[r];if(!o){const l=await oo(r);t(u=>({sessionDetails:{...u.sessionDetails,[r]:l}})),o=l}s().sessions.some(l=>l.id===r)||s().addSession(f0(o)),await s().selectSession(r)},deleteSession:async r=>{var l;t({error:null});const o=(l=s().sessions.find(u=>u.id===r))==null?void 0:l.title;try{await hh(r),t(u=>bh(u,new Set([r]))),s().addLogEntry("INFO",`Session deleted — ${r.slice(0,8)}`),s().addToast("info",`Session "${o||r.slice(0,8)}" deleted`)}catch(u){t({error:u.message}),s().addToast("error",`Failed to delete session — ${u.message}`)}},renameSession:async(r,o)=>{t({error:null});try{const l=await Hx(r,o.trim());t(u=>({sessions:u.sessions.map(f=>f.id===r?l:f),sessionDetails:u.sessionDetails[r]?{...u.sessionDetails,[r]:{...u.sessionDetails[r],title:l.title}}:u.sessionDetails}))}catch(l){t({error:l.message}),s().addToast("error",`Failed to rename session — ${l.message}`)}},markFinished:async r=>{t({error:null});try{const o=await mh(r);t(l=>({sessions:l.sessions.map(u=>u.id===r?o:u)})),s().addToast("info","Session marked as finished")}catch(o){t({error:o.message}),s().addToast("error",`Failed to mark as finished — ${o.message}`)}},markFinishedMany:async r=>{await Th(t,s,r,mh,"marked as finished")},toggleStar:async r=>{const o=s().sessions.find(l=>l.id===r);if(o){t({error:null});try{const l=await Vx(r,o.starred?0:1);t(u=>({sessions:u.sessions.map(f=>f.id===r?l:f),sessionDetails:u.sessionDetails[r]?{...u.sessionDetails,[r]:{...u.sessionDetails[r],starred:l.starred}}:u.sessionDetails}))}catch(l){t({error:l.message}),s().addToast("error",`Failed to star session — ${l.message}`)}}},reopenSession:async r=>{t({error:null});try{const o=await gh(r);t(l=>({sessions:l.sessions.map(u=>u.id===r?o:u)})),s().addToast("info","Session reopened")}catch(o){t({error:o.message}),s().addToast("error",`Failed to reopen session — ${o.message}`)}},reopenSessionMany:async r=>{await Th(t,s,r,gh,"reopened")},deleteSessionMany:async r=>{if(r.length===0)return;t({error:null});const o=await Promise.allSettled(r.map(f=>hh(f))),l=new Set;if(o.forEach((f,p)=>{f.status==="fulfilled"&&l.add(r[p])}),l.size===0){t({error:"Failed to delete sessions"}),s().addToast("error","Failed to delete sessions");return}t(f=>bh(f,l)),s().addLogEntry("INFO",`${l.size} session${l.size===1?"":"s"} deleted`);const u=r.length-l.size;u===0?s().addToast("info",`${l.size} session${l.size===1?"":"s"} deleted`):(t({error:"One or more sessions failed to delete"}),s().addToast("warn",`Deleted ${l.size} of ${r.length} — ${u} failed`))},submitPrompt:async(r,o)=>{const l=s().activeSessionId;if(l){t({error:null,submittingPrompt:r}),t(u=>{const f=u.sessionDetails[l];return f?{sessionDetails:{...u.sessionDetails,[l]:{...f,is_running:1,status:"running"}},sessions:u.sessions.map(p=>p.id===l?{...p,is_running:1,status:"running"}:p)}:{}});try{const u=await lg(l,r,o);s().addLogEntry("INFO",`Turn submitted — "${r.slice(0,40)}"`),t(f=>{const p=f.sessionDetails[l];if(!p)return{submittingPrompt:null};const g=p.turns.findIndex(v=>v.id===u.id);if(g>=0)return{submittingPrompt:null,activeTurnIndex:g};const m={...u,items:[]};return{submittingPrompt:null,sessionDetails:{...f.sessionDetails,[l]:{...p,turns:[...p.turns,m]}},activeTurnIndex:p.turns.length}})}catch(u){t({submittingPrompt:null,error:u.message}),s().addLogEntry("ERROR",`Turn failed — ${u.message}`),s().addToast("error",`Failed to send prompt — ${u.message}`),t(f=>{const p=f.sessionDetails[l];if(!p)return{};const g=Nl(p)?1:0;return{sessionDetails:{...f.sessionDetails,[l]:{...p,is_running:g,status:g?"running":"active"}},sessions:f.sessions.map(m=>m.id===l?{...m,is_running:g,status:g?"running":"active"}:m)}})}}},cancelTurn:async()=>{const r=s().activeSessionId;if(r)try{await Bx(r)}catch(o){t({error:o.message})}},rewindToTurn:async(r,o)=>{t({error:null});try{const l=await Kx(r,o),u=await oo(r);t(f=>({sessionDetails:{...f.sessionDetails,[r]:u},sessions:f.sessions.map(p=>p.id===r?{...p,external_thread_id:l.external_thread_id,is_running:0,status:"active"}:p),activeTurnIndex:u.turns.length>0?u.turns.length-1:0})),s().addToast("info","Rewound to selected turn")}catch(l){t({error:l.message}),s().addToast("error",`Failed to rewind — ${l.message}`)}},restoreSession:async r=>{t({error:null});try{const o=await Yx(r),l=await oo(r);t(u=>({sessionDetails:{...u.sessionDetails,[r]:l},sessions:u.sessions.map(f=>f.id===r?{...f,external_thread_id:o.external_thread_id,is_running:0,status:"active"}:f),activeTurnIndex:l.turns.length>0?l.turns.length-1:0})),s().addToast("info","Restored rewound session")}catch(o){t({error:o.message}),s().addToast("error",`Failed to restore — ${o.message}`)}},branchFromTurn:async(r,o,l)=>{t({error:null});try{const u=await Xx(r,o,l);t(f=>({sessions:[u,...f.sessions]})),await s().selectSession(u.id),s().addToast("success","Branched from selected turn")}catch(u){t({error:u.message}),s().addToast("error",`Failed to branch — ${u.message}`)}},updateRuntimeConfig:async r=>{const o=s().activeSessionId;if(o){t({error:null});try{const l=await qx(o,JSON.stringify(r));t(u=>({sessions:u.sessions.map(f=>f.id===o?l:f),sessionDetails:u.sessionDetails[o]?{...u.sessionDetails,[o]:{...u.sessionDetails[o],runtime_config:l.runtime_config}}:u.sessionDetails}))}catch(l){t({error:l.message}),s().addToast("error",`Failed to update config — ${l.message}`)}}},refreshActiveSession:async()=>{const r=s().activeSessionId;if(r)try{const o=await oo(r);t(l=>({sessionDetails:{...l.sessionDetails,[r]:o},activeTurnIndex:o.turns.length>0?Math.min(l.activeTurnIndex,o.turns.length-1):0,sessions:l.sessions.map(u=>u.id===r?{...u,is_running:o.is_running,status:o.status}:u)}))}catch(o){t({error:o.message})}}});async function mg(t){const{sessions:s}=await Wt(`/claude-sessions?workspace=${encodeURIComponent(t)}`);return s}function h0(t,s){return ut(`/claude-sessions/${encodeURIComponent(t)}/import`,{workspace:s})}const Nh={available:!0,reason:null};let xu=null;const m0=(t,s)=>({workspaces:[],pickerSupport:null,loadPickerSupport:()=>{const r=s().pickerSupport;return r?Promise.resolve(r):(xu??(xu=Jx().then(o=>typeof(o==null?void 0:o.available)!="boolean"?Nh:(t({pickerSupport:o}),o)).catch(()=>Nh).finally(()=>{xu=null})),xu)},createWorkspaceAt:async r=>{const o=await Qx(r.trim());return t(l=>({workspaces:[...l.workspaces.filter(u=>u.id!==o.id),o]})),o},addWorkspace:async r=>{t({error:null});try{const o=await s().createWorkspaceAt(r);return s().addToast("success",`Workspace added — ${o.path}`),o}catch(o){return s().addToast("error",`Failed to add workspace — ${vi(o)}`),null}},removeWorkspace:async r=>{t({error:null});try{await Zx(r);const o=await cg();t({workspaces:o}),s().addToast("info","Workspace hidden")}catch(o){s().addToast("error",`Failed to hide workspace — ${o.message}`)}},createSessionInWorkspace:async r=>{t({error:null});try{const o=s().lastModelConfig,l=await cd({cwd:r,runtime_type:(o==null?void 0:o.provider)??"codex",model:o==null?void 0:o.model,model_reasoning_effort:o==null?void 0:o.reasoning});t(u=>({sessions:[l,...u.sessions]})),await s().selectSession(l.id),s().addLogEntry("INFO",`Session created in ${r} — ${l.id.slice(0,8)}`),s().addToast("success",`Session created in ${r.split("/").pop()||r}`)}catch(o){t({error:o.message}),s().addToast("error",`Failed to create session — ${o.message}`)}},pickAndAddWorkspace:async()=>{if(!(await s().loadPickerSupport()).available){s().setShowAddWorkspaceDialog(!0);return}try{const o=await e0();if(o.cancelled||!o.path)return;await s().addWorkspace(o.path)}catch(o){s().addToast("error",`Failed to pick directory — ${o.message}`)}},importClaudeSessions:async(r,o)=>{const l=[],u=[];for(const f of[...o].reverse())try{l.unshift(await h0(f,r))}catch(p){u.unshift({id:f,error:vi(p)})}return l.length>0&&(t(f=>({sessions:[...l,...f.sessions]})),await s().selectSession(l[0].id),s().addLogEntry("INFO",`Imported ${l.length} Claude Code session(s) into ${r}`),s().addToast("success",l.length===1?`Imported — ${l[0].title||"Claude Code session"}`:`Imported ${l.length} Claude Code sessions`)),{imported:l,failed:u}}}),Fs=new Map,ud=new Map,jl=new Map,dd=new Map,Cl=new Map;function g0(t,s,r=""){Fs.set(t,s),ud.set(t,r)}function v0(t){Fs.delete(t),ud.delete(t)}function wu(t,s){jl.set(t,s)}function jh(t,s,r){const o=jl.get(t);if(!o)return;const l=Fs.get(o);l&&l({source:"agentpane-host",event:s,payload:r})}function Ch(t,s){const r=jl.get(t);if(!r)return;const o=Fs.get(r);o&&o({source:"agentpane-host",event:"background_tasks",payload:{sessionId:t,tasks:s}})}function y0(t,s,r,o,l){if(typeof l=="string"&&l!==ud.get(t))return;const u=Fs.get(t);u&&u({source:"agentpane-host",event:"tool_call",payload:{callId:s,tool:r,name:r,args:o}})}function x0(t,s,r,o){const l=jl.get(t);if(!l)return;const u=Fs.get(l);u&&u({source:"agentpane-host",event:"turn:delta",payload:{sessionId:t,turnId:s,itemId:r,delta:o}})}function w0(t,s){dd.set(t,s)}function k0(t){dd.delete(t)}function S0(t,s){Cl.set(t,s)}function b0(t){Cl.delete(t)}function gg(t,s={}){const r=Cl.get(t);if(r){r(s);return}const o=Fs.get(t);o&&o({source:"agentpane-host",event:"state_changed",payload:{}})}function T0(){for(const t of new Set([...Fs.keys(),...Cl.keys()]))gg(t)}function N0(t){var r;const s=Fs.get(t);s&&s({source:"agentpane-host",event:"source:updated",payload:{}}),(r=dd.get(t))==null||r()}const j0=(t,s)=>({wsConnected:!1,backgroundTasks:{},retryStates:{},setWsConnected:r=>t({wsConnected:r}),onTurnCreated:(r,o)=>{t(l=>{const u=l.sessionDetails[r];return!u||o.thread_id?{}:u.turns.some(f=>f.id===o.id)?{}:{sessionDetails:{...l.sessionDetails,[r]:{...u,turns:[...u.turns,{...o,items:[]}]}}}})},onTurnStarted:(r,o)=>{s().addLogEntry("DEBUG",`turn:started — ${o.slice(0,8)}`),t(l=>{const u=ar(l.sessions,r,()=>({is_running:1,status:"running"})),f=l.sessionDetails[r];if(!f)return{sessions:u};const p=f.turns.findIndex(g=>g.id===o);return{sessionDetails:{...l.sessionDetails,[r]:{...Zn(f,o,g=>({...g,status:"running"})),is_running:1,status:"running"}},sessions:u,activeTurnIndex:l.activeSessionId===r&&p>=0?p:l.activeTurnIndex}})},onItemStarted:(r,o,l)=>{s().addLogEntry("DEBUG",`item:started — ${l.type}`),t(u=>{const f=Eh(l)?Dr(u.retryStates,o):u.retryStates,p=u.sessionDetails[r];return p?{sessionDetails:{...u.sessionDetails,[r]:Zn(p,o,g=>Su(g,l))},retryStates:f}:{retryStates:f}})},onItemUpdated:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:Zn(f,o,p=>Su(p,l))}}:{}})},onItemCompleted:(r,o,l)=>{if(s().addLogEntry("DEBUG",`item:completed — ${l.type}`),l.type==="background_task"&&(l.status==="completed"||l.status==="failed")){const u=l.data||{},f=u.task_type||"unknown",p=u.description||"background task",m=f==="local_agent"?"Subagent":f==="local_bash"?"Monitor":"Task";l.status==="completed"?s().addToast("success",`${m} completed: ${p}`):u.status!=="stopped"&&s().addToast("error",`${m} failed: ${p}`)}t(u=>{const f=Eh(l)?Dr(u.retryStates,o):u.retryStates,p=u.sessionDetails[r];return p?{retryStates:f,sessionDetails:{...u.sessionDetails,[r]:Zn(p,o,g=>{var v,k;let m=Su(g,l);if(l.type==="agent_message"&&((v=l.data)!=null&&v.text)&&(m={...m,agent_response:l.data.text}),l.type==="reasoning"&&((k=l.data)!=null&&k.text)){const w=m.thoughts?m.thoughts+`
|
|
41
|
+
`+l.data.text:l.data.text;m={...m,thoughts:w}}return m})}}:{retryStates:f}})},onItemDelta:(r,o,l,u)=>{x0(r,o,l,u),t(f=>{const p=Dr(f.retryStates,o),g=f.sessionDetails[r];return g?{sessionDetails:{...f.sessionDetails,[r]:Zn(g,o,m=>E0(m,l,u))},retryStates:p}:{retryStates:p}})},onTurnCompleted:(r,o,l,u,f)=>{const p=(l==null?void 0:l.input_tokens)??0,g=(l==null?void 0:l.output_tokens)??0;s().addLogEntry("INFO",`turn:completed — ${p} in / ${g} out`),jh(r,"turn:completed",{turnId:o,response:f??null}),s().refreshApps(),t(m=>{const v=m.sessionDetails[r],k=v?Zn(v,o,T=>({...T,status:"completed",token_usage:l??T.token_usage??null,...f&&!T.agent_response?{agent_response:f}:{}})):null,w=ku(k),S=w&&k?za(k):"active",C=ar(m.sessions,r,T=>({is_running:w,status:S,has_unreviewed:u?1:T.has_unreviewed})),E=Dr(m.retryStates,o);return k?{sessionDetails:{...m.sessionDetails,[r]:{...k,is_running:w,status:S,has_unreviewed:u?1:k.has_unreviewed}},sessions:C,retryStates:E}:{sessions:C,retryStates:E}})},onTokenUsageUpdated:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:Zn(f,o,p=>({...p,token_usage:l}))}}:{}})},onContextUsageUpdated:(r,o)=>{t(l=>{const u=l.sessionDetails[r];return u?{sessionDetails:{...l.sessionDetails,[r]:{...u,contextUsage:o}}}:{}})},onTurnFailed:(r,o,l,u)=>{s().addLogEntry("ERROR",`turn:failed — ${l}`),s().addToast("error",`Turn failed — ${l}`),jh(r,"turn:failed",{turnId:o,error:l}),t(f=>{const p=f.sessionDetails[r],g=l.includes("cancelled")||l.includes("aborted"),m=g?"aborted":"failed",v=p?Zn(p,o,E=>({...E,status:m,error:l,...u?{resume_state:u}:{},items:E.items.map(T=>T.status==="in_progress"?{...T,status:"failed"}:T)})):null,k=ku(v),w=k&&v?za(v):g?"active":"failed",S=ar(f.sessions,r,()=>({is_running:k,status:w})),C=Dr(f.retryStates,o);return v?{sessionDetails:{...f.sessionDetails,[r]:{...v,is_running:k,status:w}},sessions:S,retryStates:C}:{sessions:S,retryStates:C}})},onTurnCancelled:(r,o)=>{t(l=>{const u=l.sessionDetails[r],f=u?Zn(u,o,k=>({...k,status:"aborted",...k.resume_state==="waiting"||k.resume_state==="resuming"?{resume_state:"cancelled"}:{},items:k.items.map(w=>w.status==="in_progress"?{...w,status:"completed"}:w)})):null,p=ku(f),g=p&&f?za(f):"active",m=ar(l.sessions,r,()=>({is_running:p,status:g})),v=Dr(l.retryStates,o);return f?{sessionDetails:{...l.sessionDetails,[r]:{...f,is_running:p,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnInterrupted:(r,o,l)=>{s().addLogEntry("WARN",`turn:interrupted — ${l.reason}${l.detail?` (${l.detail})`:""}`),s().addToast("warn",C0(l.reason)),t(u=>{const f=u.sessionDetails[r],p=f?Zn(f,o,k=>({...k,status:"pending",error:null,resume_state:"waiting",interrupt_reason:l.reason,interrupted_at:l.interruptedAt,resume_attempts:l.attempts})):null,g=p?za(p):"interrupted",m=ar(u.sessions,r,()=>({is_running:1,status:g})),v=Dr(u.retryStates,o);return p?{sessionDetails:{...u.sessionDetails,[r]:{...p,is_running:1,status:g}},sessions:m,retryStates:v}:{sessions:m,retryStates:v}})},onTurnResuming:(r,o,l)=>{s().addLogEntry("INFO",`turn:resuming — ${o.slice(0,8)} (attempt ${l})`),t(u=>{const f=ar(u.sessions,r,()=>({is_running:1,status:"running"})),p=u.sessionDetails[r];return p?{sessionDetails:{...u.sessionDetails,[r]:{...Zn(p,o,g=>({...g,status:"running",error:null,resume_state:"resuming",resume_attempts:l})),is_running:1,status:"running"}},sessions:f}:{sessions:f}})},onTurnResumed:(r,o)=>{s().addLogEntry("INFO",`turn:resumed — ${o.slice(0,8)}`),s().addToast("success","Interrupted turn resumed"),t(l=>{const u=l.sessionDetails[r];return u?{sessionDetails:{...l.sessionDetails,[r]:Zn(u,o,f=>({...f,resume_state:"resumed"}))}}:{}})},onTurnRetrying:(r,o,l)=>{s().addLogEntry("WARN",`turn:retrying — ${r.slice(0,8)}/${o.slice(0,8)} attempt ${l.attempt}/${l.maxRetries} (${l.errorStatus??"no response"}${l.error?`, ${l.error}`:""})`),t(u=>({retryStates:{...u.retryStates,[o]:l}}))},onSessionTitle:(r,o)=>{t(l=>({sessions:l.sessions.map(u=>u.id===r?{...u,title:o}:u),sessionDetails:l.sessionDetails[r]?{...l.sessionDetails,[r]:{...l.sessionDetails[r],title:o}}:l.sessionDetails}))},onSessionTouched:r=>{t(o=>{const l=o.sessionDetails[r];return{sessions:ar(o.sessions,r,()=>({user_touched:1})),sessionDetails:l?{...o.sessionDetails,[r]:{...l,user_touched:1}}:o.sessionDetails}})},onSessionUpdated:r=>{const o={...r};delete o.is_running,delete o.status,t(l=>{const u=l.sessionDetails[r.id];return{sessions:ar(l.sessions,r.id,()=>o),sessionDetails:u?{...l.sessionDetails,[r.id]:{...u,...o}}:l.sessionDetails}})},onBackgroundTasksChanged:(r,o)=>{Ch(r,o),t(l=>{if(o.length===0&&!l.backgroundTasks[r])return{};const u={...l.backgroundTasks};return o.length>0?u[r]=o:delete u[r],{backgroundTasks:u}})},onBackgroundTasksSnapshot:r=>{for(const[l,u]of Object.entries(r))Ch(l,u);const o={};for(const[l,u]of Object.entries(r))u.length>0&&(o[l]=u);t({backgroundTasks:o})}});function C0(t){switch(t){case"network":return"Network error — the turn will resume when the connection is back";case"process_exit":return"The agent process stopped — resuming the turn";default:return"The agent host restarted — resuming the turn"}}function za(t){const s=[...t.turns,...(t.threads??[]).flatMap(r=>r.turns??[])].filter(pr);return s.length>0&&s.every(r=>r.status==="pending"&&r.resume_state==="waiting")?"interrupted":"running"}function Eh(t){return t.type!=="background_task"&&t.type!=="error"&&t.type!=="interruption"}function Dr(t,s){if(!(s in t))return t;const r={...t};return delete r[s],r}function ku(t){return t&&(t.turns.some(pr)||(t.threads??[]).some(r=>(r.turns??[]).some(pr)))?1:0}function ar(t,s,r){return t.some(o=>o.id===s)?t.map(o=>o.id===s?{...o,...r(o)}:o):t}function Zn(t,s,r){const o=(t.threads??[]).map(l=>(l.turns??[]).some(u=>u.id===s)?{...l,turns:(l.turns??[]).map(u=>u.id===s?r(u):u)}:l);return{...t,turns:t.turns.map(l=>l.id===s?r(l):l),threads:o}}function vg(t,s){for(let r=t.length-1;r>=0;r--)if(t[r].external_item_id===s)return r;return-1}function Su(t,s){const r=vg(t.items,s.external_item_id);if(r>=0){const o=[...t.items];return o[r]=s,{...t,items:o}}if(s.type==="agent_message"){const o=t.items.filter(l=>!(l.type==="agent_message"&&l.id.startsWith("delta-")));return{...t,items:[...o,s]}}return{...t,items:[...t.items,s]}}function E0(t,s,r){var u;const o=vg(t.items,s);if(o>=0){const f=t.items[o],g=(((u=f.data)==null?void 0:u.text)??"")+r,m=[...t.items];return m[o]={...f,data:{...f.data,text:g}},{...t,items:m,agent_response:g}}const l={id:`delta-${s}`,turn_id:t.id,external_item_id:s,type:"agent_message",data:{text:r},status:"in_progress",created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return{...t,items:[...t.items,l],agent_response:r}}function _0(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return Wt(`/providers/${t}/models${r}`)}const _h="curl -fsSL https://repoburg.com/install.sh | bash",R0=2e3,yg="agentpane:daemon-seen";function A0(t=mn()){if(!t)return!1;try{const s=new URL(t);return s.protocol==="http:"&&(s.hostname==="localhost"||s.hostname==="127.0.0.1")}catch{return!1}}async function I0(t=mn()){try{return await fetch(`${t}/health`,{mode:"no-cors",cache:"no-store"}),!0}catch{return!1}}function D0(){try{return localStorage.getItem(yg)==="true"}catch{return!1}}function M0(){try{localStorage.setItem(yg,"true")}catch{}}function L0(t){let s=!1,r=!1,o=!1,l=null;function u(){l!==null&&(clearTimeout(l),l=null)}async function f(){if(s||r)return;u(),r=!0;const m=await I0();if(r=!1,!s){if(m){M0(),g(),t.onReady();return}o||(o=!0,t.onMissing()),l=setTimeout(()=>void f(),R0)}}function p(){document.visibilityState==="visible"&&f()}function g(){s=!0,u(),window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",p)}return window.addEventListener("focus",p),document.addEventListener("visibilitychange",p),f(),g}const Fu=160,Uu=480,P0=240,tl=220,O0=300,$0=600,z0=36;function nl(){return typeof window>"u"?$0:Math.max(tl,Math.round(window.innerWidth*.7))}const Rh="agentpane:sidebar-width",Ah="agentpane:right-panel-width",bu="agentpane:right-panel-collapsed";function Ih(t,s,r,o){try{const l=localStorage.getItem(t);if(l==null)return o;const u=Number(l);return Number.isFinite(u)?Math.min(r,Math.max(s,u)):o}catch{return o}}function F0(t){try{return localStorage.getItem(t)==="true"}catch{return!1}}function Dh(t,s){try{localStorage.setItem(t,String(s))}catch{}}const Mh=200,U0=(t,s)=>({activeRightTab:"turns",eventLog:[],loading:!1,error:null,showNewSessionDialog:!1,showAddWorkspaceDialog:!1,importSessionsWorkspace:null,showRemoteModal:!1,toasts:[],showCommandPalette:!1,lastModelConfig:null,models:[],modelsLoading:!1,showModelSelector:!1,sidebarWidth:Ih(Rh,Fu,Uu,P0),rightPanelWidth:Ih(Ah,tl,nl(),O0),rightPanelCollapsed:F0(bu),deepLinkThreadId:null,vscodeViewOpen:!1,vscodeState:"stopped",vscodeId:null,vscodeToken:null,usageViewOpen:!1,daemonStatus:A0()?"checking":"ready",setActiveTurnIndex:r=>t({activeTurnIndex:r}),switchRightTab:r=>{s().rightPanelCollapsed&&Dh(bu,!1),t({activeRightTab:r,rightPanelCollapsed:!1})},setShowNewSessionDialog:r=>t({showNewSessionDialog:r}),setShowAddWorkspaceDialog:r=>t({showAddWorkspaceDialog:r}),setImportSessionsWorkspace:r=>t({importSessionsWorkspace:r}),setShowRemoteModal:r=>t({showRemoteModal:r}),setShowCommandPalette:r=>t({showCommandPalette:r}),setShowModelSelector:r=>t({showModelSelector:r}),setDeepLinkThreadId:r=>t({deepLinkThreadId:r}),setSidebarWidth:r=>{const o=Math.min(Uu,Math.max(Fu,Math.round(r)));t({sidebarWidth:o});try{localStorage.setItem(Rh,String(o))}catch{}},setRightPanelWidth:r=>{const o=Math.min(nl(),Math.max(tl,Math.round(r)));t({rightPanelWidth:o});try{localStorage.setItem(Ah,String(o))}catch{}},setRightPanelCollapsed:r=>{t({rightPanelCollapsed:r}),Dh(bu,r)},toggleRightPanel:()=>s().setRightPanelCollapsed(!s().rightPanelCollapsed),toggleVscodeView:()=>{if(s().vscodeViewOpen){t({vscodeViewOpen:!1});return}t({vscodeViewOpen:!0,vscodeState:"starting",vscodeId:null,vscodeToken:null})},setVscodeView:(r,o,l)=>t({vscodeState:r,vscodeId:o,vscodeToken:l}),toggleUsageView:()=>t({usageViewOpen:!s().usageViewOpen}),setDaemonStatus:r=>t({daemonStatus:r}),addToast:(r,o,l,u)=>{const f=Math.random().toString(36).slice(2,9);t(p=>({toasts:[...p.toasts,{id:f,type:r,message:o,undoAction:l,undoLabel:u}]}))},removeToast:r=>{t(o=>({toasts:o.toasts.filter(l=>l.id!==r)}))},addLogEntry:(r,o)=>{const l=new Date().toLocaleTimeString("en-GB",{hour12:!1});t(u=>{const f=[...u.eventLog,{time:l,level:r,message:o}];return f.length>Mh&&f.splice(0,f.length-Mh),{eventLog:f}})},loadModels:async(r,o)=>{if(!s().modelsLoading){t({modelsLoading:!0,models:[]});try{const l=await _0(r,o);t({models:l,modelsLoading:!1})}catch{t({modelsLoading:!1})}}}}),B0=(t,s)=>({createThread:async(r,o)=>{try{await ut(`/sessions/${r}/threads`,o),s().addLogEntry("INFO",`Thread created — "${o.message.slice(0,40)}"`)}catch(l){s().addToast("error",`Failed to create thread — ${l.message}`)}},followupThread:async(r,o,l)=>{try{await ut(`/sessions/${r}/threads/${o}/followup`,{message:l}),s().addLogEntry("INFO",`Thread follow-up — "${l.slice(0,40)}"`)}catch(u){s().addToast("error",`Failed to send follow-up — ${u.message}`)}},cancelThreadTurn:async(r,o)=>{try{await ut(`/sessions/${r}/cancel?threadId=${encodeURIComponent(o)}`),s().addLogEntry("INFO","Thread turn cancelled")}catch(l){s().addToast("error",`Failed to cancel thread turn — ${l.message}`)}},resolveThread:async(r,o)=>{try{await Ns(`/sessions/${r}/threads/${o}`,{status:"resolved"})}catch(l){s().addToast("error",`Failed to resolve thread — ${l.message}`)}},reopenThread:async(r,o)=>{try{await Ns(`/sessions/${r}/threads/${o}`,{status:"open"})}catch(l){s().addToast("error",`Failed to reopen thread — ${l.message}`)}},shareThread:async(r,o,l)=>{try{const u=await ut(`/sessions/${r}/threads/${o}/summarize`,{directives:l}),f=`
|
|
42
42
|
[Shared from a resolved discussion thread — summary of its findings]
|
|
43
43
|
|
|
44
44
|
\`\`\`QUOTE
|
|
45
45
|
${u.summary}
|
|
46
46
|
\`\`\`
|
|
47
47
|
|
|
48
|
-
`;return t({quotedText:f}),s().addLogEntry("INFO",`Thread shared to main session — "${u.summary.slice(0,40)}"`),s().addToast("success","Thread summary added to your input"),!0}catch(u){return s().addToast("error",`Failed to share thread — ${u.message}`),!1}},deleteThread:async(r,o)=>{try{await Tl(`/sessions/${r}/threads/${o}`)}catch(l){s().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,o)=>{try{return await ut(`/sessions/${r}/sidecar`,{message:o}),s().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(l){return s().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:[...f.threads??[],{...o,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:(f.threads??[]).map(p=>p.id===o?{...p,turns:[...p.turns??[],{...l,items:[]}]}:p)}}}:{}})},onThreadResolved:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];if(!f)return{};const p=(f.threads??[]).map(g=>g.id===o?{...g,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:g);return{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:p}}}})},onThreadDeleted:(r,o)=>{t(l=>{const u=l.sessionDetails[r];return u?{sessionDetails:{...l.sessionDetails,[r]:{...u,threads:(u.threads??[]).filter(f=>f.id!==o)}}}:{}})}}),B0=(t,s)=>({folders:[],loadFolders:async()=>{const r=await ug();t({folders:r})},createSidebarFolder:async(r,o)=>{try{const l=await e0(r,o);return t(u=>({folders:[...u.folders,l]})),l}catch(l){return s().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,o)=>{try{const l=await xh(r,{name:o});t(u=>({folders:u.folders.map(f=>f.id===r?l:f)}))}catch(l){s().addToast("error",`Failed to rename folder — ${l.message}`)}},deleteFolder:async r=>{const o=s().folders,l=s().sessions;t(u=>({folders:u.folders.filter(f=>f.id!==r),sessions:u.sessions.map(f=>f.folder_id===r?{...f,folder_id:null}:f)}));try{await t0(r)}catch(u){t({folders:o,sessions:l}),s().addToast("error",`Failed to delete folder — ${u.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=s().sessions,l=new Map(r.map(u=>[u.id,u]));t(u=>({sessions:u.sessions.map(f=>{const p=l.get(f.id);return p?{...f,folder_id:p.folder_id,sort_order:p.sort_order}:f})}));try{await n0(r)}catch(u){t({sessions:o}),s().addToast("error",`Failed to save session order — ${u.message}`)}},reorderFolders:async r=>{const o=s().folders,l=new Map(r.map((u,f)=>[u,f]));t(u=>({folders:u.folders.map(f=>l.has(f.id)?{...f,sort_order:l.get(f.id)}:f)}));try{await Promise.all(r.map((u,f)=>xh(u,{sort_order:f})))}catch(u){t({folders:o}),s().addToast("error",`Failed to save folder order — ${u.message}`)}}});function Lh(){return Wt("/apps")}function W0(){return Wt("/apps/root")}function Ph(t){return Wt(`/apps/${t}/source`)}function Oh(t,s=""){return Wt(`/apps/${t}/state?workspace=${encodeURIComponent(s)}`)}function xg(t,s,r=""){return zx(`/apps/${t}/state?workspace=${encodeURIComponent(r)}`,s)}function H0(t){return Tl(`/apps/${t}`)}function V0(t){return Wt(`/apps/${t}/sessions`)}function G0(){return Wt("/apps/examples")}function q0(t){return ut(`/apps/examples/${t}/install`,{})}function K0(t){return ut("/apps",t)}function Y0(t,s){return ut("/apps/import",{id:t,files:s})}function X0(t,s,r){return ut(`/apps/mcp/calls/${t}/result`,{result:s,error:null})}function Q0(t,s){return ut(`/apps/${t}/edit-session`,s)}function Z0(t,s){return ut(`/apps/${t}/files`,s)}async function J0(t,s){const r=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(s)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${t}/files/${s}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function ew(t,s){const r=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(s)}`);if(!r.ok)throw new Error(`GET /apps/${t}/files/${s} failed: ${r.status} ${r.statusText}`);return r.blob()}const Ya=new Set;async function Tu(t,s){Ya.add(s),await t().loadApps();const r=t().apps.find(o=>o.id===s);t().openAppTab(s),t().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??s}`)}const Bu="agentpane:app-workspaces";function tw(){try{const t=JSON.parse(localStorage.getItem(Bu)??"{}");return t&&typeof t=="object"?t:{}}catch{return{}}}const nw=(t,s)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:tw(),loadApps:async()=>{try{const[r,o]=await Promise.all([Lh(),W0().catch(()=>null)]);return r.forEach(l=>Ya.add(l.id)),t(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await Lh();for(const o of r)Ya.has(o.id)||(Ya.add(o.id),s().addToast("success",`New mini app discovered: ${o.title}`));t({apps:r})}catch{}},openAppTab:r=>{t(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>{t(o=>{const l=o.openAppTabs.filter(u=>u!==r);return{openAppTabs:l,activeAppTabId:o.activeAppTabId===r?l[l.length-1]??null:o.activeAppTabId}})},setActiveAppTab:r=>t({activeAppTabId:r}),openAppCatalog:()=>t({appCatalogOpen:!0}),closeAppCatalog:()=>t({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{t(l=>{const u={...l.appWorkspaces,[r]:o};try{localStorage.setItem(Bu,JSON.stringify(u))}catch{}return{appWorkspaces:u}})},installExampleApp:async r=>{try{return await q0(r),await Tu(s,r),!0}catch(o){return s().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await K0(r),await Tu(s,r.id),!0}catch(o){return s().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppFolder:async(r,o)=>{try{return await Y0(r,o),await Tu(s,r),!0}catch(l){return s().addToast("error",`Failed to import app — ${l.message}`),!1}},startAppEdit:async r=>{try{const o=s().lastModelConfig,l=await Q0(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});s().sessions.some(u=>u.id===l.id)||t(u=>({sessions:[l,...u.sessions]})),t({activeAppTabId:null}),await s().selectSession(l.id),s().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){s().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=s().apps.find(l=>l.id===r);if(o)try{await xg(r,{pinned:!o.pinned}),await s().loadApps()}catch(l){s().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await H0(r),t(o=>{const l={...o.appWorkspaces};delete l[r];try{localStorage.setItem(Bu,JSON.stringify(l))}catch{}return{apps:o.apps.filter(u=>u.id!==r),openAppTabs:o.openAppTabs.filter(u=>u!==r),activeAppTabId:o.activeAppTabId===r?null:o.activeAppTabId,appWorkspaces:l}}),s().addToast("success",`Mini app deleted: ${r}`)}catch(o){s().addToast("error",`Failed to delete app — ${o.message}`)}}}),$h=3e3,Hn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Vn=[];let sl=0,fd=0,rl=0,pd=0,il=0,hd=0,md=0;const ko=new Map,So=new Map;let yi=new Map,mi=0,xi=new Map,Nu=!1;function ol(t,s,r){if(Vn.push({t:Date.now(),cat:t,msg:s,ms:r}),Vn.length>$h){const o=Vn.length-$h;Vn.splice(0,o),In=Math.max(0,In-o)}}function gi(t,s,r){ol(t,s,r),console.log(`[perf:${t}] ${s}`)}function wg(t){gi("note",t)}function kg(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function sw(t,s){let r=yi.get(t);r||yi.set(t,r={n:0,bytes:0}),r.n++,r.bytes+=s;let o=ko.get(t);o||ko.set(t,o={n:0,bytes:0}),o.n++,o.bytes+=s}function rw(){mi++,md++}function iw(t){xi.set(t,(xi.get(t)??0)+1),So.set(t,(So.get(t)??0)+1)}let Xa=0;function ow(){Xa=performance.now()}function aw(){const t=performance.now(),s=Xa?t-Xa:null;Xa=0,requestAnimationFrame(()=>{if(s===null)return;const r=performance.now()-t+s;r>Hn.keypressMs&&gi("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(s)}ms, change→paint ${Math.round(performance.now()-t)}ms)`)})}const lw=5e3,Sg=500,zh=2e3;let In=0,ju=!1;function cw(t){return ut("/perf-log",{entries:t}).then(()=>{In+=t.length})}function uw(){if(ju||In>=Vn.length)return;const t=Vn.slice(In,In+Sg);t.length!==0&&(ju=!0,cw(t).catch(()=>{Vn.length-In>zh&&(In=Math.max(In,Vn.length-zh))}).finally(()=>{ju=!1}))}function Fh(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||In>=Vn.length)return;const t=Vn.slice(In,In+Sg);if(t.length!==0)try{const s=new Blob([JSON.stringify({entries:t})],{type:"application/json"});navigator.sendBeacon(`${mn()}/api/perf-log`,s),In+=t.length}catch{}}function dw(){let t=0;for(const o of yi.values())t+=o.n;const s=[];if(t>0){const o=[...yi.entries()].sort((l,u)=>u[1].n-l[1].n).map(([l,u])=>`${l}×${u.n}(${kg(u.bytes)})`).join(", ");s.push(`ws ${t}/s [${o}]`)}mi>0&&s.push(`store ${mi}/s`);const r=[...xi.entries()].sort((o,l)=>l[1]-o[1]).map(([o,l])=>`${o}×${l}`);if(r.length>0&&s.push(`renders ${r.join(" ")}`),s.length>0){const o=s.join(" · ");ol("stat",o);const l=[...xi.values()].some(u=>u>Hn.renderPerSecLog);(t>Hn.wsPerSecLog||mi>Hn.storePerSecLog||l)&&console.log(`[perf:stat] ${o}`)}yi=new Map,mi=0,xi=new Map}function fw(t){if(t instanceof Element){const s=t.id?`#${t.id}`:"",r=typeof t.className=="string"&&t.className?`.${t.className.trim().split(/\s+/)[0]}`:"";return`${t.tagName.toLowerCase()}${s}${r}`}return t?"window":"unknown"}function pw(){if(Nu||typeof window>"u")return()=>{};Nu=!0,sl=Date.now();const t=[];let s=performance.now()+250;const r=window.setInterval(()=>{const u=performance.now(),f=u-s;s=u+250,f>Hn.lagMs&&(fd++,rl=Math.max(rl,f),gi("lag",`event loop blocked ${Math.round(f)}ms`))},250);if(t.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let u=performance.now(),f=0;const p=g=>{const m=g-u;u=g,m>Hn.frameGapMs&&gi("lag",`frame gap ${Math.round(m)}ms`),f=window.requestAnimationFrame(p)};f=window.requestAnimationFrame(p),t.push(()=>window.cancelAnimationFrame(f))}if(typeof PerformanceObserver<"u"){try{const u=new PerformanceObserver(f=>{var p;for(const g of f.getEntries()){const m=g.duration;if(m<Hn.longtaskBufferMs)continue;pd++,il=Math.max(il,m);const v=(p=g.attribution)==null?void 0:p[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",w=`long task ${Math.round(m)}ms (${k})`;m>=Hn.longtaskLogMs?gi("longtask",w,m):ol("longtask",w,m)}});u.observe({type:"longtask",buffered:!1}),t.push(()=>u.disconnect())}catch{}try{const u=new PerformanceObserver(f=>{for(const p of f.getEntries()){const g=p.duration,m=p.processingStart-p.startTime;hd++;const v=`${p.name} ${Math.round(g)}ms (input delay ${Math.round(m)}ms) on ${fw(p.target)}`;g>=Hn.eventLogMs?gi("input",v,g):ol("input",v,g)}});u.observe({type:"event",durationThreshold:Hn.eventBufferMs}),t.push(()=>u.disconnect())}catch{}}const o=window.setInterval(dw,1e3);t.push(()=>window.clearInterval(o)),wg("perf logger session started");const l=window.setInterval(uw,lw);return t.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",Fh),t.push(()=>window.removeEventListener("beforeunload",Fh)),window.__agentPanePerf={dump:bg,reset:Tg},()=>{t.forEach(u=>u()),Nu=!1}}function bg(){const t=[],s=sl?Math.round((Date.now()-sl)/1e3):0;if(t.push("=== agent-pane perf report ==="),t.push(`uptime ${s}s · ${Vn.length} buffered entries`),t.push(`event-loop lag: ${fd} blocks >${Hn.lagMs}ms (max ${Math.round(rl)}ms)`),t.push(`long tasks: ${pd} ≥${Hn.longtaskBufferMs}ms (max ${Math.round(il)}ms)`),t.push(`slow input events (≥${Hn.eventBufferMs}ms): ${hd}`),t.push(`store updates: ${md} total`),ko.size>0){t.push("ws messages by type (top 15):");for(const[r,o]of[...ko.entries()].sort((l,u)=>u[1].n-l[1].n).slice(0,15))t.push(` ${r}: ${o.n} msgs, ${kg(o.bytes)}`)}if(So.size>0){t.push("render counts by component:");for(const[r,o]of[...So.entries()].sort((l,u)=>u[1]-l[1]))t.push(` ${r}: ${o}`)}t.push("--- last 200 entries ---");for(const r of Vn.slice(-200))t.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return t.join(`
|
|
49
|
-
`)}function Tg(){Vn.length=0,In=0,sl=Date.now(),fd=0,rl=0,pd=0,il=0,hd=0,md=0,ko.clear(),So.clear(),yi=new Map,mi=0,xi=new Map}const Dt={start:
|
|
48
|
+
`;return t({quotedText:f}),s().addLogEntry("INFO",`Thread shared to main session — "${u.summary.slice(0,40)}"`),s().addToast("success","Thread summary added to your input"),!0}catch(u){return s().addToast("error",`Failed to share thread — ${u.message}`),!1}},deleteThread:async(r,o)=>{try{await Tl(`/sessions/${r}/threads/${o}`)}catch(l){s().addToast("error",`Failed to delete thread — ${l.message}`)}},askSidecar:async(r,o)=>{try{return await ut(`/sessions/${r}/sidecar`,{message:o}),s().addLogEntry("INFO",`Sidecar asked — "${o.slice(0,40)}"`),!0}catch(l){return s().addToast("error",`Failed to ask the sidecar — ${l.message}`),!1}},onThreadCreated:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:[...f.threads??[],{...o,turns:[{...l,items:[]}]}]}}}:{}})},onThreadFollowup:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];return f?{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:(f.threads??[]).map(p=>p.id===o?{...p,turns:[...p.turns??[],{...l,items:[]}]}:p)}}}:{}})},onThreadResolved:(r,o,l)=>{t(u=>{const f=u.sessionDetails[r];if(!f)return{};const p=(f.threads??[]).map(g=>g.id===o?{...g,status:l,resolved_at:l==="resolved"?new Date().toISOString():null}:g);return{sessionDetails:{...u.sessionDetails,[r]:{...f,threads:p}}}})},onThreadDeleted:(r,o)=>{t(l=>{const u=l.sessionDetails[r];return u?{sessionDetails:{...l.sessionDetails,[r]:{...u,threads:(u.threads??[]).filter(f=>f.id!==o)}}}:{}})}}),W0=(t,s)=>({folders:[],loadFolders:async()=>{const r=await ug();t({folders:r})},createSidebarFolder:async(r,o)=>{try{const l=await t0(r,o);return t(u=>({folders:[...u.folders,l]})),l}catch(l){return s().addToast("error",`Failed to create folder — ${l.message}`),null}},renameFolder:async(r,o)=>{try{const l=await xh(r,{name:o});t(u=>({folders:u.folders.map(f=>f.id===r?l:f)}))}catch(l){s().addToast("error",`Failed to rename folder — ${l.message}`)}},deleteFolder:async r=>{const o=s().folders,l=s().sessions;t(u=>({folders:u.folders.filter(f=>f.id!==r),sessions:u.sessions.map(f=>f.folder_id===r?{...f,folder_id:null}:f)}));try{await n0(r)}catch(u){t({folders:o,sessions:l}),s().addToast("error",`Failed to delete folder — ${u.message}`)}},applyMoves:async r=>{if(r.length===0)return;const o=s().sessions,l=new Map(r.map(u=>[u.id,u]));t(u=>({sessions:u.sessions.map(f=>{const p=l.get(f.id);return p?{...f,folder_id:p.folder_id,sort_order:p.sort_order}:f})}));try{await s0(r)}catch(u){t({sessions:o}),s().addToast("error",`Failed to save session order — ${u.message}`)}},reorderFolders:async r=>{const o=s().folders,l=new Map(r.map((u,f)=>[u,f]));t(u=>({folders:u.folders.map(f=>l.has(f.id)?{...f,sort_order:l.get(f.id)}:f)}));try{await Promise.all(r.map((u,f)=>xh(u,{sort_order:f})))}catch(u){t({folders:o}),s().addToast("error",`Failed to save folder order — ${u.message}`)}}});function Lh(){return Wt("/apps")}function H0(){return Wt("/apps/root")}function Ph(t){return Wt(`/apps/${t}/source`)}function Oh(t,s=""){return Wt(`/apps/${t}/state?workspace=${encodeURIComponent(s)}`)}function xg(t,s,r=""){return Fx(`/apps/${t}/state?workspace=${encodeURIComponent(r)}`,s)}function V0(t){return Tl(`/apps/${t}`)}function G0(t){return Wt(`/apps/${t}/sessions`)}function q0(){return Wt("/apps/examples")}function K0(t){return ut(`/apps/examples/${t}/install`,{})}function Y0(t){return ut("/apps",t)}function X0(t,s){return ut("/apps/import",{id:t,files:s})}function Q0(t,s,r){return ut(`/apps/mcp/calls/${t}/result`,{result:s,error:null})}function Z0(t,s){return ut(`/apps/${t}/edit-session`,s)}function J0(t,s){return ut(`/apps/${t}/files`,s)}async function ew(t,s){const r=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(s)}/meta`);if(r.status===404)return null;if(!r.ok)throw new Error(`GET /apps/${t}/files/${s}/meta failed: ${r.status} ${r.statusText}`);return await r.json()}async function tw(t,s){const r=await fetch(`${mn()}/api/apps/${t}/files/${encodeURIComponent(s)}`);if(!r.ok)throw new Error(`GET /apps/${t}/files/${s} failed: ${r.status} ${r.statusText}`);return r.blob()}const Ya=new Set;async function Tu(t,s){Ya.add(s),await t().loadApps();const r=t().apps.find(o=>o.id===s);t().openAppTab(s),t().addToast("success",`Mini app added: ${(r==null?void 0:r.title)??s}`)}const Bu="agentpane:app-workspaces";function nw(){try{const t=JSON.parse(localStorage.getItem(Bu)??"{}");return t&&typeof t=="object"?t:{}}catch{return{}}}const sw=(t,s)=>({apps:[],appsRootPath:null,openAppTabs:[],activeAppTabId:null,appCatalogOpen:!1,appWorkspaces:nw(),loadApps:async()=>{try{const[r,o]=await Promise.all([Lh(),H0().catch(()=>null)]);return r.forEach(l=>Ya.add(l.id)),t(o?{apps:r,appsRootPath:o.root}:{apps:r}),!0}catch{return!1}},refreshApps:async()=>{try{const r=await Lh();for(const o of r)Ya.has(o.id)||(Ya.add(o.id),s().addToast("success",`New mini app discovered: ${o.title}`));t({apps:r})}catch{}},openAppTab:r=>{t(o=>({activeAppTabId:r,openAppTabs:o.openAppTabs.includes(r)?o.openAppTabs:[...o.openAppTabs,r]}))},closeAppTab:r=>{t(o=>{const l=o.openAppTabs.filter(u=>u!==r);return{openAppTabs:l,activeAppTabId:o.activeAppTabId===r?l[l.length-1]??null:o.activeAppTabId}})},setActiveAppTab:r=>t({activeAppTabId:r}),openAppCatalog:()=>t({appCatalogOpen:!0}),closeAppCatalog:()=>t({appCatalogOpen:!1}),setAppWorkspace:(r,o)=>{t(l=>{const u={...l.appWorkspaces,[r]:o};try{localStorage.setItem(Bu,JSON.stringify(u))}catch{}return{appWorkspaces:u}})},installExampleApp:async r=>{try{return await K0(r),await Tu(s,r),!0}catch(o){return s().addToast("error",`Failed to install app — ${o.message}`),!1}},createSkeletonApp:async r=>{try{return await Y0(r),await Tu(s,r.id),!0}catch(o){return s().addToast("error",`Failed to create app — ${o.message}`),!1}},importAppFolder:async(r,o)=>{try{return await X0(r,o),await Tu(s,r),!0}catch(l){return s().addToast("error",`Failed to import app — ${l.message}`),!1}},startAppEdit:async r=>{try{const o=s().lastModelConfig,l=await Z0(r,{runtime_type:o==null?void 0:o.provider,model:(o==null?void 0:o.model)??null,model_reasoning_effort:(o==null?void 0:o.reasoning)??null});s().sessions.some(u=>u.id===l.id)||t(u=>({sessions:[l,...u.sessions]})),t({activeAppTabId:null}),await s().selectSession(l.id),s().addLogEntry("INFO",`App edit session opened for ${r}`)}catch(o){s().addToast("error",`Failed to open app edit session — ${o.message}`)}},toggleAppPin:async r=>{const o=s().apps.find(l=>l.id===r);if(o)try{await xg(r,{pinned:!o.pinned}),await s().loadApps()}catch(l){s().addToast("error",`Failed to pin app — ${l.message}`)}},deleteApp:async r=>{try{await V0(r),t(o=>{const l={...o.appWorkspaces};delete l[r];try{localStorage.setItem(Bu,JSON.stringify(l))}catch{}return{apps:o.apps.filter(u=>u.id!==r),openAppTabs:o.openAppTabs.filter(u=>u!==r),activeAppTabId:o.activeAppTabId===r?null:o.activeAppTabId,appWorkspaces:l}}),s().addToast("success",`Mini app deleted: ${r}`)}catch(o){s().addToast("error",`Failed to delete app — ${o.message}`)}}}),$h=3e3,Hn={lagMs:100,longtaskBufferMs:50,longtaskLogMs:100,eventBufferMs:50,eventLogMs:100,keypressMs:100,wsPerSecLog:15,storePerSecLog:15,renderPerSecLog:6,frameGapMs:150},Vn=[];let sl=0,fd=0,rl=0,pd=0,il=0,hd=0,md=0;const ko=new Map,So=new Map;let yi=new Map,mi=0,xi=new Map,Nu=!1;function ol(t,s,r){if(Vn.push({t:Date.now(),cat:t,msg:s,ms:r}),Vn.length>$h){const o=Vn.length-$h;Vn.splice(0,o),In=Math.max(0,In-o)}}function gi(t,s,r){ol(t,s,r),console.log(`[perf:${t}] ${s}`)}function wg(t){gi("note",t)}function kg(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}function rw(t,s){let r=yi.get(t);r||yi.set(t,r={n:0,bytes:0}),r.n++,r.bytes+=s;let o=ko.get(t);o||ko.set(t,o={n:0,bytes:0}),o.n++,o.bytes+=s}function iw(){mi++,md++}function ow(t){xi.set(t,(xi.get(t)??0)+1),So.set(t,(So.get(t)??0)+1)}let Xa=0;function aw(){Xa=performance.now()}function lw(){const t=performance.now(),s=Xa?t-Xa:null;Xa=0,requestAnimationFrame(()=>{if(s===null)return;const r=performance.now()-t+s;r>Hn.keypressMs&&gi("input",`keystroke→paint ${Math.round(r)}ms (keydown→change ${Math.round(s)}ms, change→paint ${Math.round(performance.now()-t)}ms)`)})}const cw=5e3,Sg=500,zh=2e3;let In=0,ju=!1;function uw(t){return ut("/perf-log",{entries:t}).then(()=>{In+=t.length})}function dw(){if(ju||In>=Vn.length)return;const t=Vn.slice(In,In+Sg);t.length!==0&&(ju=!0,uw(t).catch(()=>{Vn.length-In>zh&&(In=Math.max(In,Vn.length-zh))}).finally(()=>{ju=!1}))}function Fh(){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function"||In>=Vn.length)return;const t=Vn.slice(In,In+Sg);if(t.length!==0)try{const s=new Blob([JSON.stringify({entries:t})],{type:"application/json"});navigator.sendBeacon(`${mn()}/api/perf-log`,s),In+=t.length}catch{}}function fw(){let t=0;for(const o of yi.values())t+=o.n;const s=[];if(t>0){const o=[...yi.entries()].sort((l,u)=>u[1].n-l[1].n).map(([l,u])=>`${l}×${u.n}(${kg(u.bytes)})`).join(", ");s.push(`ws ${t}/s [${o}]`)}mi>0&&s.push(`store ${mi}/s`);const r=[...xi.entries()].sort((o,l)=>l[1]-o[1]).map(([o,l])=>`${o}×${l}`);if(r.length>0&&s.push(`renders ${r.join(" ")}`),s.length>0){const o=s.join(" · ");ol("stat",o);const l=[...xi.values()].some(u=>u>Hn.renderPerSecLog);(t>Hn.wsPerSecLog||mi>Hn.storePerSecLog||l)&&console.log(`[perf:stat] ${o}`)}yi=new Map,mi=0,xi=new Map}function pw(t){if(t instanceof Element){const s=t.id?`#${t.id}`:"",r=typeof t.className=="string"&&t.className?`.${t.className.trim().split(/\s+/)[0]}`:"";return`${t.tagName.toLowerCase()}${s}${r}`}return t?"window":"unknown"}function hw(){if(Nu||typeof window>"u")return()=>{};Nu=!0,sl=Date.now();const t=[];let s=performance.now()+250;const r=window.setInterval(()=>{const u=performance.now(),f=u-s;s=u+250,f>Hn.lagMs&&(fd++,rl=Math.max(rl,f),gi("lag",`event loop blocked ${Math.round(f)}ms`))},250);if(t.push(()=>window.clearInterval(r)),typeof window.requestAnimationFrame=="function"){let u=performance.now(),f=0;const p=g=>{const m=g-u;u=g,m>Hn.frameGapMs&&gi("lag",`frame gap ${Math.round(m)}ms`),f=window.requestAnimationFrame(p)};f=window.requestAnimationFrame(p),t.push(()=>window.cancelAnimationFrame(f))}if(typeof PerformanceObserver<"u"){try{const u=new PerformanceObserver(f=>{var p;for(const g of f.getEntries()){const m=g.duration;if(m<Hn.longtaskBufferMs)continue;pd++,il=Math.max(il,m);const v=(p=g.attribution)==null?void 0:p[0],k=(v==null?void 0:v.containerName)||(v==null?void 0:v.name)||"unknown",w=`long task ${Math.round(m)}ms (${k})`;m>=Hn.longtaskLogMs?gi("longtask",w,m):ol("longtask",w,m)}});u.observe({type:"longtask",buffered:!1}),t.push(()=>u.disconnect())}catch{}try{const u=new PerformanceObserver(f=>{for(const p of f.getEntries()){const g=p.duration,m=p.processingStart-p.startTime;hd++;const v=`${p.name} ${Math.round(g)}ms (input delay ${Math.round(m)}ms) on ${pw(p.target)}`;g>=Hn.eventLogMs?gi("input",v,g):ol("input",v,g)}});u.observe({type:"event",durationThreshold:Hn.eventBufferMs}),t.push(()=>u.disconnect())}catch{}}const o=window.setInterval(fw,1e3);t.push(()=>window.clearInterval(o)),wg("perf logger session started");const l=window.setInterval(dw,cw);return t.push(()=>window.clearInterval(l)),window.addEventListener("beforeunload",Fh),t.push(()=>window.removeEventListener("beforeunload",Fh)),window.__agentPanePerf={dump:bg,reset:Tg},()=>{t.forEach(u=>u()),Nu=!1}}function bg(){const t=[],s=sl?Math.round((Date.now()-sl)/1e3):0;if(t.push("=== agent-pane perf report ==="),t.push(`uptime ${s}s · ${Vn.length} buffered entries`),t.push(`event-loop lag: ${fd} blocks >${Hn.lagMs}ms (max ${Math.round(rl)}ms)`),t.push(`long tasks: ${pd} ≥${Hn.longtaskBufferMs}ms (max ${Math.round(il)}ms)`),t.push(`slow input events (≥${Hn.eventBufferMs}ms): ${hd}`),t.push(`store updates: ${md} total`),ko.size>0){t.push("ws messages by type (top 15):");for(const[r,o]of[...ko.entries()].sort((l,u)=>u[1].n-l[1].n).slice(0,15))t.push(` ${r}: ${o.n} msgs, ${kg(o.bytes)}`)}if(So.size>0){t.push("render counts by component:");for(const[r,o]of[...So.entries()].sort((l,u)=>u[1]-l[1]))t.push(` ${r}: ${o}`)}t.push("--- last 200 entries ---");for(const r of Vn.slice(-200))t.push(`${new Date(r.t).toISOString().slice(11,23)} [${r.cat}] ${r.msg}`);return t.join(`
|
|
49
|
+
`)}function Tg(){Vn.length=0,In=0,sl=Date.now(),fd=0,rl=0,pd=0,il=0,hd=0,md=0,ko.clear(),So.clear(),yi=new Map,mi=0,xi=new Map}const Dt={start:hw,note:wg,trackWsEvent:rw,trackStoreUpdate:iw,trackRender:ow,markKeystroke:aw,markInputChange:lw,dump:bg,reset:Tg},M=Ax()((...t)=>({...p0(...t),...m0(...t),...j0(...t),...U0(...t),...B0(...t),...W0(...t),...sw(...t)}));typeof window<"u"&&(M.subscribe(()=>Dt.trackStoreUpdate()),a0(M));function Wu(t){switch(t){case"claude":return{iconClass:"ic-claude",iconText:"CL"};case"codex":return{iconClass:"ic-codex",iconText:"CX"};case"repoburg":return{iconClass:"ic-repoburg",iconText:"RB"};case"cursor":return{iconClass:"ic-cursor",iconText:"CR"};default:return{iconClass:"ic-codex",iconText:"CX"}}}function mw(t,s,r=!1,o="working",l=0){if(o==="finished")return"";if(t==="interrupted")return"interrupted";if(s)return"running";if(l>0)return"background";if(r&&t!=="failed")return"queued";switch(t){case"failed":return"error";case"aborted":return"paused";default:return"paused"}}function gw(t,s,r=!1,o="working",l=0){if(o==="finished")return"Finished";if(t==="interrupted")return"Interrupted";if(s)return"Running";if(l>0)return"Background";if(r&&t!=="failed")return"Review Pending";switch(t){case"failed":return"Failed";case"aborted":return"Aborted";case"active":return"Idle";case"completed":return"Completed";case"running":return"Running";default:return t}}function El(t,s=0){const r=t.is_running===1,o=t.lifecycle==="finished",l=Wu(t.runtime_type),u=mw(t.status,r,t.has_unreviewed===1,t.lifecycle,s),f=gw(t.status,r,t.has_unreviewed===1,t.lifecycle,s);return{dot:u,label:f,dotTitle:u==="background"?`${s} background task${s===1?"":"s"} running`:f,iconClass:l.iconClass,iconText:l.iconText,isRunning:r,isFinished:o,backgroundTaskCount:s}}function _l(t,s,r=!0){x.useEffect(()=>{if(!r)return;function o(l){t.current&&!t.current.contains(l.target)&&s()}return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}},[t,s,r])}function Eo(t,s=!0){x.useEffect(()=>{if(!s)return;function r(o){o.key==="Escape"&&t()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,s])}function gd({status:t,size:s=6,title:r}){return a.jsx("span",{className:`status-dot ${t}`,style:s!==6?{width:s,height:s}:void 0,title:r})}function vd({iconClass:t,iconText:s,size:r=20}){return a.jsx("span",{className:`runtime-icon ${t}`,style:r!==20?{width:r,height:r,fontSize:r*.45}:void 0,children:s})}/**
|
|
50
50
|
* @license lucide-react v0.469.0 - ISC
|
|
51
51
|
*
|
|
52
52
|
* This source code is licensed under the ISC license.
|
|
53
53
|
* See the LICENSE file in the root directory of this source tree.
|
|
54
|
-
*/const
|
|
54
|
+
*/const vw=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Ng=(...t)=>t.filter((s,r,o)=>!!s&&s.trim()!==""&&o.indexOf(s)===r).join(" ").trim();/**
|
|
55
55
|
* @license lucide-react v0.469.0 - ISC
|
|
56
56
|
*
|
|
57
57
|
* This source code is licensed under the ISC license.
|
|
58
58
|
* See the LICENSE file in the root directory of this source tree.
|
|
59
|
-
*/var
|
|
59
|
+
*/var yw={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
60
60
|
* @license lucide-react v0.469.0 - ISC
|
|
61
61
|
*
|
|
62
62
|
* This source code is licensed under the ISC license.
|
|
63
63
|
* See the LICENSE file in the root directory of this source tree.
|
|
64
|
-
*/const jg=x.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:f,...p},g)=>x.createElement("svg",{ref:g,...
|
|
64
|
+
*/const jg=x.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:u,iconNode:f,...p},g)=>x.createElement("svg",{ref:g,...yw,width:s,height:s,stroke:t,strokeWidth:o?Number(r)*24/Number(s):r,className:Ng("lucide",l),...p},[...f.map(([m,v])=>x.createElement(m,v)),...Array.isArray(u)?u:[u]]));/**
|
|
65
65
|
* @license lucide-react v0.469.0 - ISC
|
|
66
66
|
*
|
|
67
67
|
* This source code is licensed under the ISC license.
|
|
68
68
|
* See the LICENSE file in the root directory of this source tree.
|
|
69
|
-
*/const ge=(t,s)=>{const r=x.forwardRef(({className:o,...l},u)=>x.createElement(jg,{ref:u,iconNode:s,className:Ng(`lucide-${
|
|
69
|
+
*/const ge=(t,s)=>{const r=x.forwardRef(({className:o,...l},u)=>x.createElement(jg,{ref:u,iconNode:s,className:Ng(`lucide-${vw(t)}`,o),...l}));return r.displayName=`${t}`,r};/**
|
|
70
70
|
* @license lucide-react v0.469.0 - ISC
|
|
71
71
|
*
|
|
72
72
|
* This source code is licensed under the ISC license.
|
|
@@ -76,7 +76,7 @@ ${u.summary}
|
|
|
76
76
|
*
|
|
77
77
|
* This source code is licensed under the ISC license.
|
|
78
78
|
* See the LICENSE file in the root directory of this source tree.
|
|
79
|
-
*/const
|
|
79
|
+
*/const xw=ge("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/**
|
|
80
80
|
* @license lucide-react v0.469.0 - ISC
|
|
81
81
|
*
|
|
82
82
|
* This source code is licensed under the ISC license.
|
|
@@ -86,7 +86,7 @@ ${u.summary}
|
|
|
86
86
|
*
|
|
87
87
|
* This source code is licensed under the ISC license.
|
|
88
88
|
* See the LICENSE file in the root directory of this source tree.
|
|
89
|
-
*/const
|
|
89
|
+
*/const ww=ge("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
90
90
|
* @license lucide-react v0.469.0 - ISC
|
|
91
91
|
*
|
|
92
92
|
* This source code is licensed under the ISC license.
|
|
@@ -111,7 +111,7 @@ ${u.summary}
|
|
|
111
111
|
*
|
|
112
112
|
* This source code is licensed under the ISC license.
|
|
113
113
|
* See the LICENSE file in the root directory of this source tree.
|
|
114
|
-
*/const
|
|
114
|
+
*/const kw=ge("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
115
115
|
* @license lucide-react v0.469.0 - ISC
|
|
116
116
|
*
|
|
117
117
|
* This source code is licensed under the ISC license.
|
|
@@ -121,17 +121,17 @@ ${u.summary}
|
|
|
121
121
|
*
|
|
122
122
|
* This source code is licensed under the ISC license.
|
|
123
123
|
* See the LICENSE file in the root directory of this source tree.
|
|
124
|
-
*/const
|
|
124
|
+
*/const Sw=ge("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
125
125
|
* @license lucide-react v0.469.0 - ISC
|
|
126
126
|
*
|
|
127
127
|
* This source code is licensed under the ISC license.
|
|
128
128
|
* See the LICENSE file in the root directory of this source tree.
|
|
129
|
-
*/const
|
|
129
|
+
*/const bw=ge("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
130
130
|
* @license lucide-react v0.469.0 - ISC
|
|
131
131
|
*
|
|
132
132
|
* This source code is licensed under the ISC license.
|
|
133
133
|
* See the LICENSE file in the root directory of this source tree.
|
|
134
|
-
*/const
|
|
134
|
+
*/const Tw=ge("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
135
135
|
* @license lucide-react v0.469.0 - ISC
|
|
136
136
|
*
|
|
137
137
|
* This source code is licensed under the ISC license.
|
|
@@ -151,17 +151,17 @@ ${u.summary}
|
|
|
151
151
|
*
|
|
152
152
|
* This source code is licensed under the ISC license.
|
|
153
153
|
* See the LICENSE file in the root directory of this source tree.
|
|
154
|
-
*/const
|
|
154
|
+
*/const Nw=ge("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
|
|
155
155
|
* @license lucide-react v0.469.0 - ISC
|
|
156
156
|
*
|
|
157
157
|
* This source code is licensed under the ISC license.
|
|
158
158
|
* See the LICENSE file in the root directory of this source tree.
|
|
159
|
-
*/const
|
|
159
|
+
*/const jw=ge("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
160
160
|
* @license lucide-react v0.469.0 - ISC
|
|
161
161
|
*
|
|
162
162
|
* This source code is licensed under the ISC license.
|
|
163
163
|
* See the LICENSE file in the root directory of this source tree.
|
|
164
|
-
*/const
|
|
164
|
+
*/const Cw=ge("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
|
|
165
165
|
* @license lucide-react v0.469.0 - ISC
|
|
166
166
|
*
|
|
167
167
|
* This source code is licensed under the ISC license.
|
|
@@ -171,12 +171,12 @@ ${u.summary}
|
|
|
171
171
|
*
|
|
172
172
|
* This source code is licensed under the ISC license.
|
|
173
173
|
* See the LICENSE file in the root directory of this source tree.
|
|
174
|
-
*/const
|
|
174
|
+
*/const Ew=ge("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
|
|
175
175
|
* @license lucide-react v0.469.0 - ISC
|
|
176
176
|
*
|
|
177
177
|
* This source code is licensed under the ISC license.
|
|
178
178
|
* See the LICENSE file in the root directory of this source tree.
|
|
179
|
-
*/const
|
|
179
|
+
*/const _w=ge("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
|
180
180
|
* @license lucide-react v0.469.0 - ISC
|
|
181
181
|
*
|
|
182
182
|
* This source code is licensed under the ISC license.
|
|
@@ -206,12 +206,12 @@ ${u.summary}
|
|
|
206
206
|
*
|
|
207
207
|
* This source code is licensed under the ISC license.
|
|
208
208
|
* See the LICENSE file in the root directory of this source tree.
|
|
209
|
-
*/const
|
|
209
|
+
*/const Rw=ge("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
210
210
|
* @license lucide-react v0.469.0 - ISC
|
|
211
211
|
*
|
|
212
212
|
* This source code is licensed under the ISC license.
|
|
213
213
|
* See the LICENSE file in the root directory of this source tree.
|
|
214
|
-
*/const
|
|
214
|
+
*/const Aw=ge("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
|
|
215
215
|
* @license lucide-react v0.469.0 - ISC
|
|
216
216
|
*
|
|
217
217
|
* This source code is licensed under the ISC license.
|
|
@@ -221,22 +221,22 @@ ${u.summary}
|
|
|
221
221
|
*
|
|
222
222
|
* This source code is licensed under the ISC license.
|
|
223
223
|
* See the LICENSE file in the root directory of this source tree.
|
|
224
|
-
*/const
|
|
224
|
+
*/const Iw=ge("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
225
225
|
* @license lucide-react v0.469.0 - ISC
|
|
226
226
|
*
|
|
227
227
|
* This source code is licensed under the ISC license.
|
|
228
228
|
* See the LICENSE file in the root directory of this source tree.
|
|
229
|
-
*/const
|
|
229
|
+
*/const Dw=ge("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
|
|
230
230
|
* @license lucide-react v0.469.0 - ISC
|
|
231
231
|
*
|
|
232
232
|
* This source code is licensed under the ISC license.
|
|
233
233
|
* See the LICENSE file in the root directory of this source tree.
|
|
234
|
-
*/const
|
|
234
|
+
*/const Mw=ge("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
235
235
|
* @license lucide-react v0.469.0 - ISC
|
|
236
236
|
*
|
|
237
237
|
* This source code is licensed under the ISC license.
|
|
238
238
|
* See the LICENSE file in the root directory of this source tree.
|
|
239
|
-
*/const
|
|
239
|
+
*/const Lw=ge("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
240
240
|
* @license lucide-react v0.469.0 - ISC
|
|
241
241
|
*
|
|
242
242
|
* This source code is licensed under the ISC license.
|
|
@@ -246,12 +246,12 @@ ${u.summary}
|
|
|
246
246
|
*
|
|
247
247
|
* This source code is licensed under the ISC license.
|
|
248
248
|
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
-
*/const
|
|
249
|
+
*/const Pw=ge("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
250
250
|
* @license lucide-react v0.469.0 - ISC
|
|
251
251
|
*
|
|
252
252
|
* This source code is licensed under the ISC license.
|
|
253
253
|
* See the LICENSE file in the root directory of this source tree.
|
|
254
|
-
*/const
|
|
254
|
+
*/const Ow=ge("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
|
|
255
255
|
* @license lucide-react v0.469.0 - ISC
|
|
256
256
|
*
|
|
257
257
|
* This source code is licensed under the ISC license.
|
|
@@ -261,7 +261,7 @@ ${u.summary}
|
|
|
261
261
|
*
|
|
262
262
|
* This source code is licensed under the ISC license.
|
|
263
263
|
* See the LICENSE file in the root directory of this source tree.
|
|
264
|
-
*/const
|
|
264
|
+
*/const $w=ge("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
265
265
|
* @license lucide-react v0.469.0 - ISC
|
|
266
266
|
*
|
|
267
267
|
* This source code is licensed under the ISC license.
|
|
@@ -271,27 +271,27 @@ ${u.summary}
|
|
|
271
271
|
*
|
|
272
272
|
* This source code is licensed under the ISC license.
|
|
273
273
|
* See the LICENSE file in the root directory of this source tree.
|
|
274
|
-
*/const
|
|
274
|
+
*/const zw=ge("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/**
|
|
275
275
|
* @license lucide-react v0.469.0 - ISC
|
|
276
276
|
*
|
|
277
277
|
* This source code is licensed under the ISC license.
|
|
278
278
|
* See the LICENSE file in the root directory of this source tree.
|
|
279
|
-
*/const
|
|
279
|
+
*/const Fw=ge("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/**
|
|
280
280
|
* @license lucide-react v0.469.0 - ISC
|
|
281
281
|
*
|
|
282
282
|
* This source code is licensed under the ISC license.
|
|
283
283
|
* See the LICENSE file in the root directory of this source tree.
|
|
284
|
-
*/const
|
|
284
|
+
*/const Uw=ge("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/**
|
|
285
285
|
* @license lucide-react v0.469.0 - ISC
|
|
286
286
|
*
|
|
287
287
|
* This source code is licensed under the ISC license.
|
|
288
288
|
* See the LICENSE file in the root directory of this source tree.
|
|
289
|
-
*/const
|
|
289
|
+
*/const Bw=ge("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
290
290
|
* @license lucide-react v0.469.0 - ISC
|
|
291
291
|
*
|
|
292
292
|
* This source code is licensed under the ISC license.
|
|
293
293
|
* See the LICENSE file in the root directory of this source tree.
|
|
294
|
-
*/const
|
|
294
|
+
*/const Ww=ge("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
295
295
|
* @license lucide-react v0.469.0 - ISC
|
|
296
296
|
*
|
|
297
297
|
* This source code is licensed under the ISC license.
|
|
@@ -301,12 +301,12 @@ ${u.summary}
|
|
|
301
301
|
*
|
|
302
302
|
* This source code is licensed under the ISC license.
|
|
303
303
|
* See the LICENSE file in the root directory of this source tree.
|
|
304
|
-
*/const
|
|
304
|
+
*/const Hw=ge("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
305
305
|
* @license lucide-react v0.469.0 - ISC
|
|
306
306
|
*
|
|
307
307
|
* This source code is licensed under the ISC license.
|
|
308
308
|
* See the LICENSE file in the root directory of this source tree.
|
|
309
|
-
*/const
|
|
309
|
+
*/const Vw=ge("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
|
|
310
310
|
* @license lucide-react v0.469.0 - ISC
|
|
311
311
|
*
|
|
312
312
|
* This source code is licensed under the ISC license.
|
|
@@ -321,12 +321,12 @@ ${u.summary}
|
|
|
321
321
|
*
|
|
322
322
|
* This source code is licensed under the ISC license.
|
|
323
323
|
* See the LICENSE file in the root directory of this source tree.
|
|
324
|
-
*/const
|
|
324
|
+
*/const Gw=ge("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
325
325
|
* @license lucide-react v0.469.0 - ISC
|
|
326
326
|
*
|
|
327
327
|
* This source code is licensed under the ISC license.
|
|
328
328
|
* See the LICENSE file in the root directory of this source tree.
|
|
329
|
-
*/const
|
|
329
|
+
*/const qw=ge("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/**
|
|
330
330
|
* @license lucide-react v0.469.0 - ISC
|
|
331
331
|
*
|
|
332
332
|
* This source code is licensed under the ISC license.
|
|
@@ -346,7 +346,7 @@ ${u.summary}
|
|
|
346
346
|
*
|
|
347
347
|
* This source code is licensed under the ISC license.
|
|
348
348
|
* See the LICENSE file in the root directory of this source tree.
|
|
349
|
-
*/const
|
|
349
|
+
*/const Kw=ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
350
350
|
* @license lucide-react v0.469.0 - ISC
|
|
351
351
|
*
|
|
352
352
|
* This source code is licensed under the ISC license.
|
|
@@ -356,7 +356,7 @@ ${u.summary}
|
|
|
356
356
|
*
|
|
357
357
|
* This source code is licensed under the ISC license.
|
|
358
358
|
* See the LICENSE file in the root directory of this source tree.
|
|
359
|
-
*/const
|
|
359
|
+
*/const Yw=ge("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
|
|
360
360
|
* @license lucide-react v0.469.0 - ISC
|
|
361
361
|
*
|
|
362
362
|
* This source code is licensed under the ISC license.
|
|
@@ -386,17 +386,17 @@ ${u.summary}
|
|
|
386
386
|
*
|
|
387
387
|
* This source code is licensed under the ISC license.
|
|
388
388
|
* See the LICENSE file in the root directory of this source tree.
|
|
389
|
-
*/const
|
|
389
|
+
*/const Xw=ge("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
|
|
390
390
|
* @license lucide-react v0.469.0 - ISC
|
|
391
391
|
*
|
|
392
392
|
* This source code is licensed under the ISC license.
|
|
393
393
|
* See the LICENSE file in the root directory of this source tree.
|
|
394
|
-
*/const
|
|
394
|
+
*/const Qw=ge("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
395
395
|
* @license lucide-react v0.469.0 - ISC
|
|
396
396
|
*
|
|
397
397
|
* This source code is licensed under the ISC license.
|
|
398
398
|
* See the LICENSE file in the root directory of this source tree.
|
|
399
|
-
*/const
|
|
399
|
+
*/const Zw=ge("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
400
400
|
* @license lucide-react v0.469.0 - ISC
|
|
401
401
|
*
|
|
402
402
|
* This source code is licensed under the ISC license.
|
|
@@ -406,7 +406,7 @@ ${u.summary}
|
|
|
406
406
|
*
|
|
407
407
|
* This source code is licensed under the ISC license.
|
|
408
408
|
* See the LICENSE file in the root directory of this source tree.
|
|
409
|
-
*/const
|
|
409
|
+
*/const Jw=ge("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
410
410
|
* @license lucide-react v0.469.0 - ISC
|
|
411
411
|
*
|
|
412
412
|
* This source code is licensed under the ISC license.
|
|
@@ -416,15 +416,15 @@ ${u.summary}
|
|
|
416
416
|
*
|
|
417
417
|
* This source code is licensed under the ISC license.
|
|
418
418
|
* See the LICENSE file in the root directory of this source tree.
|
|
419
|
-
*/const
|
|
419
|
+
*/const e1=ge("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),t1=new Set(["path","circle","rect","line","ellipse","polyline","polygon"]),n1=new Set("d cx cy r rx ry x y width height x1 x2 y1 y2 points fill".split(" "));function s1(t){return t.filter(([s])=>t1.has(s)).map(([s,r],o)=>[s,{...Object.fromEntries(Object.entries(r).filter(([l])=>n1.has(l))),key:String(o)}])}function bi({iconNode:t,size:s=14,className:r}){const o=x.useMemo(()=>t?s1(t):[],[t]);return o.length===0?a.jsx(Dg,{size:s,className:r,"aria-hidden":"true","data-testid":"app-icon-default"}):a.jsx(jg,{iconNode:o,size:s,className:r,"aria-hidden":"true","data-testid":"app-icon"})}var po=eg();function r1(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return x.useMemo(()=>o=>{s.forEach(l=>l(o))},s)}const Al=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ti(t){const s=Object.prototype.toString.call(t);return s==="[object Window]"||s==="[object global]"}function yd(t){return"nodeType"in t}function Nn(t){var s,r;return t?Ti(t)?t:yd(t)&&(s=(r=t.ownerDocument)==null?void 0:r.defaultView)!=null?s:window:window}function xd(t){const{Document:s}=Nn(t);return t instanceof s}function Ro(t){return Ti(t)?!1:t instanceof Nn(t).HTMLElement}function Ug(t){return t instanceof Nn(t).SVGElement}function Ni(t){return t?Ti(t)?t.document:yd(t)?xd(t)?t:Ro(t)||Ug(t)?t.ownerDocument:document:document:document}const ds=Al?x.useLayoutEffect:x.useEffect;function Il(t){const s=x.useRef(t);return ds(()=>{s.current=t}),x.useCallback(function(){for(var r=arguments.length,o=new Array(r),l=0;l<r;l++)o[l]=arguments[l];return s.current==null?void 0:s.current(...o)},[])}function i1(){const t=x.useRef(null),s=x.useCallback((o,l)=>{t.current=setInterval(o,l)},[]),r=x.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[s,r]}function No(t,s){s===void 0&&(s=[t]);const r=x.useRef(t);return ds(()=>{r.current!==t&&(r.current=t)},s),r}function Ao(t,s){const r=x.useRef();return x.useMemo(()=>{const o=t(r.current);return r.current=o,o},[...s])}function dl(t){const s=Il(t),r=x.useRef(null),o=x.useCallback(l=>{l!==r.current&&(s==null||s(l,r.current)),r.current=l},[]);return[r,o]}function fl(t){const s=x.useRef();return x.useEffect(()=>{s.current=t},[t]),s.current}let Eu={};function Io(t,s){return x.useMemo(()=>{if(s)return s;const r=Eu[t]==null?0:Eu[t]+1;return Eu[t]=r,t+"-"+r},[t,s])}function Bg(t){return function(s){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return o.reduce((u,f)=>{const p=Object.entries(f);for(const[g,m]of p){const v=u[g];v!=null&&(u[g]=v+t*m)}return u},{...s})}}const ki=Bg(1),pl=Bg(-1);function o1(t){return"clientX"in t&&"clientY"in t}function Dl(t){if(!t)return!1;const{KeyboardEvent:s}=Nn(t.target);return s&&t instanceof s}function a1(t){if(!t)return!1;const{TouchEvent:s}=Nn(t.target);return s&&t instanceof s}function hl(t){if(a1(t)){if(t.touches&&t.touches.length){const{clientX:s,clientY:r}=t.touches[0];return{x:s,y:r}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:s,clientY:r}=t.changedTouches[0];return{x:s,y:r}}}return o1(t)?{x:t.clientX,y:t.clientY}:null}const zs=Object.freeze({Translate:{toString(t){if(!t)return;const{x:s,y:r}=t;return"translate3d("+(s?Math.round(s):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:s,scaleY:r}=t;return"scaleX("+s+") scaleY("+r+")"}},Transform:{toString(t){if(t)return[zs.Translate.toString(t),zs.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:s,duration:r,easing:o}=t;return s+" "+r+"ms "+o}}}),Wh="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function l1(t){return t.matches(Wh)?t:t.querySelector(Wh)}const c1={display:"none"};function u1(t){let{id:s,value:r}=t;return ot.createElement("div",{id:s,style:c1},r)}function d1(t){let{id:s,announcement:r,ariaLiveType:o="assertive"}=t;const l={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return ot.createElement("div",{id:s,style:l,role:"status","aria-live":o,"aria-atomic":!0},r)}function f1(){const[t,s]=x.useState("");return{announce:x.useCallback(o=>{o!=null&&s(o)},[]),announcement:t}}const Wg=x.createContext(null);function p1(t){const s=x.useContext(Wg);x.useEffect(()=>{if(!s)throw new Error("useDndMonitor must be used within a children of <DndContext>");return s(t)},[t,s])}function h1(){const[t]=x.useState(()=>new Set),s=x.useCallback(o=>(t.add(o),()=>t.delete(o)),[t]);return[x.useCallback(o=>{let{type:l,event:u}=o;t.forEach(f=>{var p;return(p=f[l])==null?void 0:p.call(f,u)})},[t]),s]}const m1={draggable:`
|
|
420
420
|
To pick up a draggable item, press the space bar.
|
|
421
421
|
While dragging, use the arrow keys to move the item.
|
|
422
422
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
423
|
-
`},m1={onDragStart(t){let{active:s}=t;return"Picked up draggable item "+s.id+"."},onDragOver(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was moved over droppable area "+r.id+".":"Draggable item "+s.id+" is no longer over a droppable area."},onDragEnd(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was dropped over droppable area "+r.id:"Draggable item "+s.id+" was dropped."},onDragCancel(t){let{active:s}=t;return"Dragging was cancelled. Draggable item "+s.id+" was dropped."}};function g1(t){let{announcements:s=m1,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=h1}=t;const{announce:u,announcement:f}=d1(),p=Io("DndLiveRegion"),[g,m]=x.useState(!1);if(x.useEffect(()=>{m(!0)},[]),f1(x.useMemo(()=>({onDragStart(k){let{active:w}=k;u(s.onDragStart({active:w}))},onDragMove(k){let{active:w,over:S}=k;s.onDragMove&&u(s.onDragMove({active:w,over:S}))},onDragOver(k){let{active:w,over:S}=k;u(s.onDragOver({active:w,over:S}))},onDragEnd(k){let{active:w,over:S}=k;u(s.onDragEnd({active:w,over:S}))},onDragCancel(k){let{active:w,over:S}=k;u(s.onDragCancel({active:w,over:S}))}}),[u,s])),!g)return null;const v=ot.createElement(ot.Fragment,null,ot.createElement(c1,{id:o,value:l.draggable}),ot.createElement(u1,{id:p,announcement:f}));return r?po.createPortal(v,r):v}var Bt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Bt||(Bt={}));function ml(){}function v1(t,s){return x.useMemo(()=>({sensor:t,options:s??{}}),[t,s])}function y1(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return x.useMemo(()=>[...s].filter(o=>o!=null),[...s])}const fs=Object.freeze({x:0,y:0});function x1(t,s){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function w1(t,s){const r=hl(t);if(!r)return"0 0";const o={x:(r.x-s.left)/s.width*100,y:(r.y-s.top)/s.height*100};return o.x+"% "+o.y+"%"}function k1(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return r-o}function S1(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return o-r}function b1(t,s){if(!t||t.length===0)return null;const[r]=t;return r[s]}function Hh(t,s,r){return s===void 0&&(s=t.left),r===void 0&&(r=t.top),{x:s+t.width*.5,y:r+t.height*.5}}const T1=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const l=Hh(s,s.left,s.top),u=[];for(const f of o){const{id:p}=f,g=r.get(p);if(g){const m=x1(Hh(g),l);u.push({id:p,data:{droppableContainer:f,value:m}})}}return u.sort(k1)};function N1(t,s){const r=Math.max(s.top,t.top),o=Math.max(s.left,t.left),l=Math.min(s.left+s.width,t.left+t.width),u=Math.min(s.top+s.height,t.top+t.height),f=l-o,p=u-r;if(o<l&&r<u){const g=s.width*s.height,m=t.width*t.height,v=f*p,k=v/(g+m-v);return Number(k.toFixed(4))}return 0}const j1=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const l=[];for(const u of o){const{id:f}=u,p=r.get(f);if(p){const g=N1(p,s);g>0&&l.push({id:f,data:{droppableContainer:u,value:g}})}}return l.sort(S1)};function C1(t,s,r){return{...t,scaleX:s&&r?s.width/r.width:1,scaleY:s&&r?s.height/r.height:1}}function Hg(t,s){return t&&s?{x:t.left-s.left,y:t.top-s.top}:fs}function E1(t){return function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),u=1;u<o;u++)l[u-1]=arguments[u];return l.reduce((f,p)=>({...f,top:f.top+t*p.y,bottom:f.bottom+t*p.y,left:f.left+t*p.x,right:f.right+t*p.x}),{...r})}}const _1=E1(1);function Vg(t){if(t.startsWith("matrix3d(")){const s=t.slice(9,-1).split(/, /);return{x:+s[12],y:+s[13],scaleX:+s[0],scaleY:+s[5]}}else if(t.startsWith("matrix(")){const s=t.slice(7,-1).split(/, /);return{x:+s[4],y:+s[5],scaleX:+s[0],scaleY:+s[3]}}return null}function R1(t,s,r){const o=Vg(s);if(!o)return t;const{scaleX:l,scaleY:u,x:f,y:p}=o,g=t.left-f-(1-l)*parseFloat(r),m=t.top-p-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?t.width/l:t.width,k=u?t.height/u:t.height;return{width:v,height:k,top:m,right:g+v,bottom:m+k,left:g}}const A1={ignoreTransform:!1};function ji(t,s){s===void 0&&(s=A1);let r=t.getBoundingClientRect();if(s.ignoreTransform){const{transform:m,transformOrigin:v}=Nn(t).getComputedStyle(t);m&&(r=R1(r,m,v))}const{top:o,left:l,width:u,height:f,bottom:p,right:g}=r;return{top:o,left:l,width:u,height:f,bottom:p,right:g}}function Vh(t){return ji(t,{ignoreTransform:!0})}function I1(t){const s=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:s,bottom:r,width:s,height:r}}function D1(t,s){return s===void 0&&(s=Nn(t).getComputedStyle(t)),s.position==="fixed"}function M1(t,s){s===void 0&&(s=Nn(t).getComputedStyle(t));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const u=s[l];return typeof u=="string"?r.test(u):!1})}function wd(t,s){const r=[];function o(l){if(s!=null&&r.length>=s||!l)return r;if(xd(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Ro(l)||Ug(l)||r.includes(l))return r;const u=Nn(t).getComputedStyle(l);return l!==t&&M1(l,u)&&r.push(l),D1(l,u)?r:o(l.parentNode)}return t?o(t):r}function Gg(t){const[s]=wd(t,1);return s??null}function _u(t){return!Al||!t?null:Ti(t)?t:yd(t)?xd(t)||t===Ni(t).scrollingElement?window:Ro(t)?t:null:null}function qg(t){return Ti(t)?t.scrollX:t.scrollLeft}function Kg(t){return Ti(t)?t.scrollY:t.scrollTop}function Hu(t){return{x:qg(t),y:Kg(t)}}var Jt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Jt||(Jt={}));function Yg(t){return!Al||!t?!1:t===document.scrollingElement}function Xg(t){const s={x:0,y:0},r=Yg(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},l=t.scrollTop<=s.y,u=t.scrollLeft<=s.x,f=t.scrollTop>=o.y,p=t.scrollLeft>=o.x;return{isTop:l,isLeft:u,isBottom:f,isRight:p,maxScroll:o,minScroll:s}}const L1={x:.2,y:.2};function P1(t,s,r,o,l){let{top:u,left:f,right:p,bottom:g}=r;o===void 0&&(o=10),l===void 0&&(l=L1);const{isTop:m,isBottom:v,isLeft:k,isRight:w}=Xg(t),S={x:0,y:0},C={x:0,y:0},E={height:s.height*l.y,width:s.width*l.x};return!m&&u<=s.top+E.height?(S.y=Jt.Backward,C.y=o*Math.abs((s.top+E.height-u)/E.height)):!v&&g>=s.bottom-E.height&&(S.y=Jt.Forward,C.y=o*Math.abs((s.bottom-E.height-g)/E.height)),!w&&p>=s.right-E.width?(S.x=Jt.Forward,C.x=o*Math.abs((s.right-E.width-p)/E.width)):!k&&f<=s.left+E.width&&(S.x=Jt.Backward,C.x=o*Math.abs((s.left+E.width-f)/E.width)),{direction:S,speed:C}}function O1(t){if(t===document.scrollingElement){const{innerWidth:u,innerHeight:f}=window;return{top:0,left:0,right:u,bottom:f,width:u,height:f}}const{top:s,left:r,right:o,bottom:l}=t.getBoundingClientRect();return{top:s,left:r,right:o,bottom:l,width:t.clientWidth,height:t.clientHeight}}function Qg(t){return t.reduce((s,r)=>ki(s,Hu(r)),fs)}function $1(t){return t.reduce((s,r)=>s+qg(r),0)}function z1(t){return t.reduce((s,r)=>s+Kg(r),0)}function Zg(t,s){if(s===void 0&&(s=ji),!t)return;const{top:r,left:o,bottom:l,right:u}=s(t);Gg(t)&&(l<=0||u<=0||r>=window.innerHeight||o>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const F1=[["x",["left","right"],$1],["y",["top","bottom"],z1]];class kd{constructor(s,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=wd(r),l=Qg(o);this.rect={...s},this.width=s.width,this.height=s.height;for(const[u,f,p]of F1)for(const g of f)Object.defineProperty(this,g,{get:()=>{const m=p(o),v=l[u]-m;return this.rect[g]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class go{constructor(s){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=s}add(s,r,o){var l;(l=this.target)==null||l.addEventListener(s,r,o),this.listeners.push([s,r,o])}}function U1(t){const{EventTarget:s}=Nn(t);return t instanceof s?t:Ni(t)}function Ru(t,s){const r=Math.abs(t.x),o=Math.abs(t.y);return typeof s=="number"?Math.sqrt(r**2+o**2)>s:"x"in s&&"y"in s?r>s.x&&o>s.y:"x"in s?r>s.x:"y"in s?o>s.y:!1}var es;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(es||(es={}));function Gh(t){t.preventDefault()}function B1(t){t.stopPropagation()}var et;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(et||(et={}));const Jg={start:[et.Space,et.Enter],cancel:[et.Esc],end:[et.Space,et.Enter,et.Tab]},W1=(t,s)=>{let{currentCoordinates:r}=s;switch(t.code){case et.Right:return{...r,x:r.x+25};case et.Left:return{...r,x:r.x-25};case et.Down:return{...r,y:r.y+25};case et.Up:return{...r,y:r.y-25}}};class ev{constructor(s){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=s;const{event:{target:r}}=s;this.props=s,this.listeners=new go(Ni(r)),this.windowListeners=new go(Nn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(es.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:s,onStart:r}=this.props,o=s.node.current;o&&Zg(o),r(fs)}handleKeyDown(s){if(Dl(s)){const{active:r,context:o,options:l}=this.props,{keyboardCodes:u=Jg,coordinateGetter:f=W1,scrollBehavior:p="smooth"}=l,{code:g}=s;if(u.end.includes(g)){this.handleEnd(s);return}if(u.cancel.includes(g)){this.handleCancel(s);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:fs;this.referenceCoordinates||(this.referenceCoordinates=v);const k=f(s,{active:r,context:o.current,currentCoordinates:v});if(k){const w=pl(k,v),S={x:0,y:0},{scrollableAncestors:C}=o.current;for(const E of C){const T=s.code,{isTop:A,isRight:_,isLeft:B,isBottom:I,maxScroll:W,minScroll:Y}=Xg(E),K=O1(E),F={x:Math.min(T===et.Right?K.right-K.width/2:K.right,Math.max(T===et.Right?K.left:K.left+K.width/2,k.x)),y:Math.min(T===et.Down?K.bottom-K.height/2:K.bottom,Math.max(T===et.Down?K.top:K.top+K.height/2,k.y))},re=T===et.Right&&!_||T===et.Left&&!B,he=T===et.Down&&!I||T===et.Up&&!A;if(re&&F.x!==k.x){const G=E.scrollLeft+w.x,Ne=T===et.Right&&G<=W.x||T===et.Left&&G>=Y.x;if(Ne&&!w.y){E.scrollTo({left:G,behavior:p});return}Ne?S.x=E.scrollLeft-G:S.x=T===et.Right?E.scrollLeft-W.x:E.scrollLeft-Y.x,S.x&&E.scrollBy({left:-S.x,behavior:p});break}else if(he&&F.y!==k.y){const G=E.scrollTop+w.y,Ne=T===et.Down&&G<=W.y||T===et.Up&&G>=Y.y;if(Ne&&!w.x){E.scrollTo({top:G,behavior:p});return}Ne?S.y=E.scrollTop-G:S.y=T===et.Down?E.scrollTop-W.y:E.scrollTop-Y.y,S.y&&E.scrollBy({top:-S.y,behavior:p});break}}this.handleMove(s,ki(pl(k,this.referenceCoordinates),S))}}}handleMove(s,r){const{onMove:o}=this.props;s.preventDefault(),o(r)}handleEnd(s){const{onEnd:r}=this.props;s.preventDefault(),this.detach(),r()}handleCancel(s){const{onCancel:r}=this.props;s.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ev.activators=[{eventName:"onKeyDown",handler:(t,s,r)=>{let{keyboardCodes:o=Jg,onActivation:l}=s,{active:u}=r;const{code:f}=t.nativeEvent;if(o.start.includes(f)){const p=u.activatorNode.current;return p&&t.target!==p?!1:(t.preventDefault(),l==null||l({event:t.nativeEvent}),!0)}return!1}}];function qh(t){return!!(t&&"distance"in t)}function Kh(t){return!!(t&&"delay"in t)}class Sd{constructor(s,r,o){var l;o===void 0&&(o=U1(s.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=s,this.events=r;const{event:u}=s,{target:f}=u;this.props=s,this.events=r,this.document=Ni(f),this.documentListeners=new go(this.document),this.listeners=new go(o),this.windowListeners=new go(Nn(f)),this.initialCoordinates=(l=hl(u))!=null?l:fs,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:s,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(s.move.name,this.handleMove,{passive:!1}),this.listeners.add(s.end.name,this.handleEnd),s.cancel&&this.listeners.add(s.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,Gh),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,Gh),this.documentListeners.add(es.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Kh(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(qh(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(s,r){const{active:o,onPending:l}=this.props;l(o,s,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:s}=this,{onStart:r}=this.props;s&&(this.activated=!0,this.documentListeners.add(es.Click,B1,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(s))}handleMove(s){var r;const{activated:o,initialCoordinates:l,props:u}=this,{onMove:f,options:{activationConstraint:p}}=u;if(!l)return;const g=(r=hl(s))!=null?r:fs,m=pl(l,g);if(!o&&p){if(qh(p)){if(p.tolerance!=null&&Ru(m,p.tolerance))return this.handleCancel();if(Ru(m,p.distance))return this.handleStart()}if(Kh(p)&&Ru(m,p.tolerance))return this.handleCancel();this.handlePending(p,m);return}s.cancelable&&s.preventDefault(),f(g)}handleEnd(){const{onAbort:s,onEnd:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleCancel(){const{onAbort:s,onCancel:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleKeydown(s){s.code===et.Esc&&this.handleCancel()}removeTextSelection(){var s;(s=this.document.getSelection())==null||s.removeAllRanges()}}const H1={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class bd extends Sd{constructor(s){const{event:r}=s,o=Ni(r.target);super(s,H1,o)}}bd.activators=[{eventName:"onPointerDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const V1={move:{name:"mousemove"},end:{name:"mouseup"}};var Vu;(function(t){t[t.RightClick=2]="RightClick"})(Vu||(Vu={}));class G1 extends Sd{constructor(s){super(s,V1,Ni(s.event.target))}}G1.activators=[{eventName:"onMouseDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return r.button===Vu.RightClick?!1:(o==null||o({event:r}),!0)}}];const Au={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class q1 extends Sd{constructor(s){super(s,Au)}static setup(){return window.addEventListener(Au.move.name,s,{capture:!1,passive:!1}),function(){window.removeEventListener(Au.move.name,s)};function s(){}}}q1.activators=[{eventName:"onTouchStart",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;const{touches:l}=r;return l.length>1?!1:(o==null||o({event:r}),!0)}}];var vo;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(vo||(vo={}));var gl;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(gl||(gl={}));function K1(t){let{acceleration:s,activator:r=vo.Pointer,canScroll:o,draggingRect:l,enabled:u,interval:f=5,order:p=gl.TreeOrder,pointerCoordinates:g,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:w}=t;const S=X1({delta:k,disabled:!u}),[C,E]=r1(),T=x.useRef({x:0,y:0}),A=x.useRef({x:0,y:0}),_=x.useMemo(()=>{switch(r){case vo.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case vo.DraggableRect:return l}},[r,l,g]),B=x.useRef(null),I=x.useCallback(()=>{const Y=B.current;if(!Y)return;const K=T.current.x*A.current.x,F=T.current.y*A.current.y;Y.scrollBy(K,F)},[]),W=x.useMemo(()=>p===gl.TreeOrder?[...m].reverse():m,[p,m]);x.useEffect(()=>{if(!u||!m.length||!_){E();return}for(const Y of W){if((o==null?void 0:o(Y))===!1)continue;const K=m.indexOf(Y),F=v[K];if(!F)continue;const{direction:re,speed:he}=P1(Y,F,_,s,w);for(const G of["x","y"])S[G][re[G]]||(he[G]=0,re[G]=0);if(he.x>0||he.y>0){E(),B.current=Y,C(I,f),T.current=he,A.current=re;return}}T.current={x:0,y:0},A.current={x:0,y:0},E()},[s,I,o,E,u,f,JSON.stringify(_),JSON.stringify(S),C,m,W,v,JSON.stringify(w)])}const Y1={x:{[Jt.Backward]:!1,[Jt.Forward]:!1},y:{[Jt.Backward]:!1,[Jt.Forward]:!1}};function X1(t){let{delta:s,disabled:r}=t;const o=fl(s);return Ao(l=>{if(r||!o||!l)return Y1;const u={x:Math.sign(s.x-o.x),y:Math.sign(s.y-o.y)};return{x:{[Jt.Backward]:l.x[Jt.Backward]||u.x===-1,[Jt.Forward]:l.x[Jt.Forward]||u.x===1},y:{[Jt.Backward]:l.y[Jt.Backward]||u.y===-1,[Jt.Forward]:l.y[Jt.Forward]||u.y===1}}},[r,s,o])}function Q1(t,s){const r=s!=null?t.get(s):void 0,o=r?r.node.current:null;return Ao(l=>{var u;return s==null?null:(u=o??l)!=null?u:null},[o,s])}function Z1(t,s){return x.useMemo(()=>t.reduce((r,o)=>{const{sensor:l}=o,u=l.activators.map(f=>({eventName:f.eventName,handler:s(f.handler,o)}));return[...r,...u]},[]),[t,s])}var jo;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(jo||(jo={}));var Gu;(function(t){t.Optimized="optimized"})(Gu||(Gu={}));const Yh=new Map;function J1(t,s){let{dragging:r,dependencies:o,config:l}=s;const[u,f]=x.useState(null),{frequency:p,measure:g,strategy:m}=l,v=x.useRef(t),k=T(),w=No(k),S=x.useCallback(function(A){A===void 0&&(A=[]),!w.current&&f(_=>_===null?A:_.concat(A.filter(B=>!_.includes(B))))},[w]),C=x.useRef(null),E=Ao(A=>{if(k&&!r)return Yh;if(!A||A===Yh||v.current!==t||u!=null){const _=new Map;for(let B of t){if(!B)continue;if(u&&u.length>0&&!u.includes(B.id)&&B.rect.current){_.set(B.id,B.rect.current);continue}const I=B.node.current,W=I?new kd(g(I),I):null;B.rect.current=W,W&&_.set(B.id,W)}return _}return A},[t,u,r,k,g]);return x.useEffect(()=>{v.current=t},[t]),x.useEffect(()=>{k||S()},[r,k]),x.useEffect(()=>{u&&u.length>0&&f(null)},[JSON.stringify(u)]),x.useEffect(()=>{k||typeof p!="number"||C.current!==null||(C.current=setTimeout(()=>{S(),C.current=null},p))},[p,k,S,...o]),{droppableRects:E,measureDroppableContainers:S,measuringScheduled:u!=null};function T(){switch(m){case jo.Always:return!1;case jo.BeforeDragging:return r;default:return!r}}}function Td(t,s){return Ao(r=>t?r||(typeof s=="function"?s(t):t):null,[s,t])}function ek(t,s){return Td(t,s)}function tk(t){let{callback:s,disabled:r}=t;const o=Il(s),l=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(o)},[o,r]);return x.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Ml(t){let{callback:s,disabled:r}=t;const o=Il(s),l=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(o)},[r]);return x.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function nk(t){return new kd(ji(t),t)}function Xh(t,s,r){s===void 0&&(s=nk);const[o,l]=x.useState(null);function u(){l(g=>{if(!t)return null;if(t.isConnected===!1){var m;return(m=g??r)!=null?m:null}const v=s(t);return JSON.stringify(g)===JSON.stringify(v)?g:v})}const f=tk({callback(g){if(t)for(const m of g){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(t)){u();break}}}}),p=Ml({callback:u});return ds(()=>{u(),t?(p==null||p.observe(t),f==null||f.observe(document.body,{childList:!0,subtree:!0})):(p==null||p.disconnect(),f==null||f.disconnect())},[t]),o}function sk(t){const s=Td(t);return Hg(t,s)}const Qh=[];function rk(t){const s=x.useRef(t),r=Ao(o=>t?o&&o!==Qh&&t&&s.current&&t.parentNode===s.current.parentNode?o:wd(t):Qh,[t]);return x.useEffect(()=>{s.current=t},[t]),r}function ik(t){const[s,r]=x.useState(null),o=x.useRef(t),l=x.useCallback(u=>{const f=_u(u.target);f&&r(p=>p?(p.set(f,Hu(f)),new Map(p)):null)},[]);return x.useEffect(()=>{const u=o.current;if(t!==u){f(u);const p=t.map(g=>{const m=_u(g);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,Hu(m)]):null}).filter(g=>g!=null);r(p.length?new Map(p):null),o.current=t}return()=>{f(t),f(u)};function f(p){p.forEach(g=>{const m=_u(g);m==null||m.removeEventListener("scroll",l)})}},[l,t]),x.useMemo(()=>t.length?s?Array.from(s.values()).reduce((u,f)=>ki(u,f),fs):Qg(t):fs,[t,s])}function Zh(t,s){s===void 0&&(s=[]);const r=x.useRef(null);return x.useEffect(()=>{r.current=null},s),x.useEffect(()=>{const o=t!==fs;o&&!r.current&&(r.current=t),!o&&r.current&&(r.current=null)},[t]),r.current?pl(t,r.current):fs}function ok(t){x.useEffect(()=>{if(!Al)return;const s=t.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of s)r==null||r()}},t.map(s=>{let{sensor:r}=s;return r}))}function ak(t,s){return x.useMemo(()=>t.reduce((r,o)=>{let{eventName:l,handler:u}=o;return r[l]=f=>{u(f,s)},r},{}),[t,s])}function tv(t){return x.useMemo(()=>t?I1(t):null,[t])}const Jh=[];function lk(t,s){s===void 0&&(s=ji);const[r]=t,o=tv(r?Nn(r):null),[l,u]=x.useState(Jh);function f(){u(()=>t.length?t.map(g=>Yg(g)?o:new kd(s(g),g)):Jh)}const p=Ml({callback:f});return ds(()=>{p==null||p.disconnect(),f(),t.forEach(g=>p==null?void 0:p.observe(g))},[t]),l}function nv(t){if(!t)return null;if(t.children.length>1)return t;const s=t.children[0];return Ro(s)?s:t}function ck(t){let{measure:s}=t;const[r,o]=x.useState(null),l=x.useCallback(m=>{for(const{target:v}of m)if(Ro(v)){o(k=>{const w=s(v);return k?{...k,width:w.width,height:w.height}:w});break}},[s]),u=Ml({callback:l}),f=x.useCallback(m=>{const v=nv(m);u==null||u.disconnect(),v&&(u==null||u.observe(v)),o(v?s(v):null)},[s,u]),[p,g]=dl(f);return x.useMemo(()=>({nodeRef:p,rect:r,setRef:g}),[r,p,g])}const uk=[{sensor:bd,options:{}},{sensor:ev,options:{}}],dk={current:{}},Za={draggable:{measure:Vh},droppable:{measure:Vh,strategy:jo.WhileDragging,frequency:Gu.Optimized},dragOverlay:{measure:ji}};class yo extends Map{get(s){var r;return s!=null&&(r=super.get(s))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(s=>{let{disabled:r}=s;return!r})}getNodeFor(s){var r,o;return(r=(o=this.get(s))==null?void 0:o.node.current)!=null?r:void 0}}const fk={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new yo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ml},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Za,measureDroppableContainers:ml,windowRect:null,measuringScheduled:!1},sv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ml,draggableNodes:new Map,over:null,measureDroppableContainers:ml},Do=x.createContext(sv),rv=x.createContext(fk);function pk(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new yo}}}function hk(t,s){switch(s.type){case Bt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:s.initialCoordinates,active:s.active}};case Bt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:s.coordinates.x-t.draggable.initialCoordinates.x,y:s.coordinates.y-t.draggable.initialCoordinates.y}}};case Bt.DragEnd:case Bt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Bt.RegisterDroppable:{const{element:r}=s,{id:o}=r,l=new yo(t.droppable.containers);return l.set(o,r),{...t,droppable:{...t.droppable,containers:l}}}case Bt.SetDroppableDisabled:{const{id:r,key:o,disabled:l}=s,u=t.droppable.containers.get(r);if(!u||o!==u.key)return t;const f=new yo(t.droppable.containers);return f.set(r,{...u,disabled:l}),{...t,droppable:{...t.droppable,containers:f}}}case Bt.UnregisterDroppable:{const{id:r,key:o}=s,l=t.droppable.containers.get(r);if(!l||o!==l.key)return t;const u=new yo(t.droppable.containers);return u.delete(r),{...t,droppable:{...t.droppable,containers:u}}}default:return t}}function mk(t){let{disabled:s}=t;const{active:r,activatorEvent:o,draggableNodes:l}=x.useContext(Do),u=fl(o),f=fl(r==null?void 0:r.id);return x.useEffect(()=>{if(!s&&!o&&u&&f!=null){if(!Dl(u)||document.activeElement===u.target)return;const p=l.get(f);if(!p)return;const{activatorNode:g,node:m}=p;if(!g.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[g.current,m.current]){if(!v)continue;const k=a1(v);if(k){k.focus();break}}})}},[o,s,l,f,u]),null}function iv(t,s){let{transform:r,...o}=s;return t!=null&&t.length?t.reduce((l,u)=>u({transform:l,...o}),r):r}function gk(t){return x.useMemo(()=>({draggable:{...Za.draggable,...t==null?void 0:t.draggable},droppable:{...Za.droppable,...t==null?void 0:t.droppable},dragOverlay:{...Za.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function vk(t){let{activeNode:s,measure:r,initialRect:o,config:l=!0}=t;const u=x.useRef(!1),{x:f,y:p}=typeof l=="boolean"?{x:l,y:l}:l;ds(()=>{if(!f&&!p||!s){u.current=!1;return}if(u.current||!o)return;const m=s==null?void 0:s.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=Hg(v,o);if(f||(k.x=0),p||(k.y=0),u.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const w=Gg(m);w&&w.scrollBy({top:k.y,left:k.x})}},[s,f,p,o,r])}const Ll=x.createContext({...fs,scaleX:1,scaleY:1});var cr;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(cr||(cr={}));const yk=x.memo(function(s){var r,o,l,u;let{id:f,accessibility:p,autoScroll:g=!0,children:m,sensors:v=uk,collisionDetection:k=j1,measuring:w,modifiers:S,...C}=s;const E=x.useReducer(hk,void 0,pk),[T,A]=E,[_,B]=p1(),[I,W]=x.useState(cr.Uninitialized),Y=I===cr.Initialized,{draggable:{active:K,nodes:F,translate:re},droppable:{containers:he}}=T,G=K!=null?F.get(K):null,Ne=x.useRef({initial:null,translated:null}),Se=x.useMemo(()=>{var Xe;return K!=null?{id:K,data:(Xe=G==null?void 0:G.data)!=null?Xe:dk,rect:Ne}:null},[K,G]),Pe=x.useRef(null),[te,oe]=x.useState(null),[ae,O]=x.useState(null),Q=No(C,Object.values(C)),U=Io("DndDescribedBy",f),j=x.useMemo(()=>he.getEnabled(),[he]),P=gk(w),{droppableRects:ne,measureDroppableContainers:de,measuringScheduled:X}=J1(j,{dragging:Y,dependencies:[re.x,re.y],config:P.droppable}),fe=Q1(F,K),be=x.useMemo(()=>ae?hl(ae):null,[ae]),Ee=yn(),Re=ek(fe,P.draggable.measure);vk({activeNode:K!=null?F.get(K):null,config:Ee.layoutShiftCompensation,initialRect:Re,measure:P.draggable.measure});const Ce=Xh(fe,P.draggable.measure,Re),at=Xh(fe?fe.parentElement:null),De=x.useRef({activatorEvent:null,active:null,activeNode:fe,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:F,draggingNode:null,draggingNodeRect:null,droppableContainers:he,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=he.getNodeFor((r=De.current.over)==null?void 0:r.id),$e=ck({measure:P.dragOverlay.measure}),en=(o=$e.nodeRef.current)!=null?o:fe,Fe=Y?(l=$e.rect)!=null?l:Ce:null,Ht=!!($e.nodeRef.current&&$e.rect),tn=sk(Ht?null:Ce),wt=tv(en?Nn(en):null),jt=rk(Y?lt??fe:null),$t=lk(jt),Mt=iv(S,{transform:{x:re.x-tn.x,y:re.y-tn.y,scaleX:1,scaleY:1},activatorEvent:ae,active:Se,activeNodeRect:Ce,containerNodeRect:at,draggingNodeRect:Fe,over:De.current.over,overlayNodeRect:$e.rect,scrollableAncestors:jt,scrollableAncestorRects:$t,windowRect:wt}),q=be?ki(be,re):null,pe=ik(jt),Ue=Zh(pe),tt=Zh(pe,[Ce]),mt=ki(Mt,Ue),gt=Fe?_1(Fe,Mt):null,Ct=Se&>?k({active:Se,collisionRect:gt,droppableRects:ne,droppableContainers:j,pointerCoordinates:q}):null,an=b1(Ct,"id"),[dt,Dn]=x.useState(null),Mn=Ht?Mt:ki(Mt,tt),ps=C1(Mn,(u=dt==null?void 0:dt.rect)!=null?u:null,Ce),hs=x.useRef(null),ts=x.useCallback((Xe,Et)=>{let{sensor:ft,options:Gt}=Et;if(Pe.current==null)return;const vt=F.get(Pe.current);if(!vt)return;const yt=Xe.nativeEvent,it=new ft({active:Pe.current,activeNode:vt,event:yt,options:Gt,context:De,onAbort(st){if(!F.get(st))return;const{onDragAbort:R}=Q.current,ue={id:st};R==null||R(ue),_({type:"onDragAbort",event:ue})},onPending(st,Lt,R,ue){if(!F.get(st))return;const{onDragPending:ve}=Q.current,Me={id:st,constraint:Lt,initialCoordinates:R,offset:ue};ve==null||ve(Me),_({type:"onDragPending",event:Me})},onStart(st){const Lt=Pe.current;if(Lt==null)return;const R=F.get(Lt);if(!R)return;const{onDragStart:ue}=Q.current,ie={activatorEvent:yt,active:{id:Lt,data:R.data,rect:Ne}};po.unstable_batchedUpdates(()=>{ue==null||ue(ie),W(cr.Initializing),A({type:Bt.DragStart,initialCoordinates:st,active:Lt}),_({type:"onDragStart",event:ie}),oe(hs.current),O(yt)})},onMove(st){A({type:Bt.DragMove,coordinates:st})},onEnd:qt(Bt.DragEnd),onCancel:qt(Bt.DragCancel)});hs.current=it;function qt(st){return async function(){const{active:R,collisions:ue,over:ie,scrollAdjustedTranslate:ve}=De.current;let Me=null;if(R&&ve){const{cancelDrop:Ge}=Q.current;Me={activatorEvent:yt,active:R,collisions:ue,delta:ve,over:ie},st===Bt.DragEnd&&typeof Ge=="function"&&await Promise.resolve(Ge(Me))&&(st=Bt.DragCancel)}Pe.current=null,po.unstable_batchedUpdates(()=>{A({type:st}),W(cr.Uninitialized),Dn(null),oe(null),O(null),hs.current=null;const Ge=st===Bt.DragEnd?"onDragEnd":"onDragCancel";if(Me){const Le=Q.current[Ge];Le==null||Le(Me),_({type:Ge,event:Me})}})}}},[F]),Ln=x.useCallback((Xe,Et)=>(ft,Gt)=>{const vt=ft.nativeEvent,yt=F.get(Gt);if(Pe.current!==null||!yt||vt.dndKit||vt.defaultPrevented)return;const it={active:yt};Xe(ft,Et.options,it)===!0&&(vt.dndKit={capturedBy:Et.sensor},Pe.current=Gt,ts(ft,Et))},[F,ts]),vn=Z1(v,Ln);ok(v),ds(()=>{Ce&&I===cr.Initializing&&W(cr.Initialized)},[Ce,I]),x.useEffect(()=>{const{onDragMove:Xe}=Q.current,{active:Et,activatorEvent:ft,collisions:Gt,over:vt}=De.current;if(!Et||!ft)return;const yt={active:Et,activatorEvent:ft,collisions:Gt,delta:{x:mt.x,y:mt.y},over:vt};po.unstable_batchedUpdates(()=>{Xe==null||Xe(yt),_({type:"onDragMove",event:yt})})},[mt.x,mt.y]),x.useEffect(()=>{const{active:Xe,activatorEvent:Et,collisions:ft,droppableContainers:Gt,scrollAdjustedTranslate:vt}=De.current;if(!Xe||Pe.current==null||!Et||!vt)return;const{onDragOver:yt}=Q.current,it=Gt.get(an),qt=it&&it.rect.current?{id:it.id,rect:it.rect.current,data:it.data,disabled:it.disabled}:null,st={active:Xe,activatorEvent:Et,collisions:ft,delta:{x:vt.x,y:vt.y},over:qt};po.unstable_batchedUpdates(()=>{Dn(qt),yt==null||yt(st),_({type:"onDragOver",event:st})})},[an]),ds(()=>{De.current={activatorEvent:ae,active:Se,activeNode:fe,collisionRect:gt,collisions:Ct,droppableRects:ne,draggableNodes:F,draggingNode:en,draggingNodeRect:Fe,droppableContainers:he,over:dt,scrollableAncestors:jt,scrollAdjustedTranslate:mt},Ne.current={initial:Fe,translated:gt}},[Se,fe,Ct,gt,F,en,Fe,ne,he,dt,jt,mt]),K1({...Ee,delta:re,draggingRect:gt,pointerCoordinates:q,scrollableAncestors:jt,scrollableAncestorRects:$t});const ln=x.useMemo(()=>({active:Se,activeNode:fe,activeNodeRect:Ce,activatorEvent:ae,collisions:Ct,containerNodeRect:at,dragOverlay:$e,draggableNodes:F,droppableContainers:he,droppableRects:ne,over:dt,measureDroppableContainers:de,scrollableAncestors:jt,scrollableAncestorRects:$t,measuringConfiguration:P,measuringScheduled:X,windowRect:wt}),[Se,fe,Ce,ae,Ct,at,$e,F,he,ne,dt,de,jt,$t,P,X,wt]),Vt=x.useMemo(()=>({activatorEvent:ae,activators:vn,active:Se,activeNodeRect:Ce,ariaDescribedById:{draggable:U},dispatch:A,draggableNodes:F,over:dt,measureDroppableContainers:de}),[ae,vn,Se,Ce,A,U,F,dt,de]);return ot.createElement(Wg.Provider,{value:B},ot.createElement(Do.Provider,{value:Vt},ot.createElement(rv.Provider,{value:ln},ot.createElement(Ll.Provider,{value:ps},m)),ot.createElement(mk,{disabled:(p==null?void 0:p.restoreFocus)===!1})),ot.createElement(g1,{...p,hiddenTextDescribedById:U}));function yn(){const Xe=(te==null?void 0:te.autoScrollEnabled)===!1,Et=typeof g=="object"?g.enabled===!1:g===!1,ft=Y&&!Xe&&!Et;return typeof g=="object"?{...g,enabled:ft}:{enabled:ft}}}),xk=x.createContext(null),em="button",wk="Draggable";function kk(t){let{id:s,data:r,disabled:o=!1,attributes:l}=t;const u=Io(wk),{activators:f,activatorEvent:p,active:g,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:w}=x.useContext(Do),{role:S=em,roleDescription:C="draggable",tabIndex:E=0}=l??{},T=(g==null?void 0:g.id)===s,A=x.useContext(T?Ll:xk),[_,B]=dl(),[I,W]=dl(),Y=ak(f,s),K=No(r);ds(()=>(k.set(s,{id:s,key:u,node:_,activatorNode:I,data:K}),()=>{const re=k.get(s);re&&re.key===u&&k.delete(s)}),[k,s]);const F=x.useMemo(()=>({role:S,tabIndex:E,"aria-disabled":o,"aria-pressed":T&&S===em?!0:void 0,"aria-roledescription":C,"aria-describedby":v.draggable}),[o,S,E,T,C,v.draggable]);return{active:g,activatorEvent:p,activeNodeRect:m,attributes:F,isDragging:T,listeners:o?void 0:Y,node:_,over:w,setNodeRef:B,setActivatorNodeRef:W,transform:A}}function ov(){return x.useContext(rv)}const Sk="Droppable",bk={timeout:25};function av(t){let{data:s,disabled:r=!1,id:o,resizeObserverConfig:l}=t;const u=Io(Sk),{active:f,dispatch:p,over:g,measureDroppableContainers:m}=x.useContext(Do),v=x.useRef({disabled:r}),k=x.useRef(!1),w=x.useRef(null),S=x.useRef(null),{disabled:C,updateMeasurementsFor:E,timeout:T}={...bk,...l},A=No(E??o),_=x.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(A.current)?A.current:[A.current]),S.current=null},T)},[T]),B=Ml({callback:_,disabled:C||!f}),I=x.useCallback((F,re)=>{B&&(re&&(B.unobserve(re),k.current=!1),F&&B.observe(F))},[B]),[W,Y]=dl(I),K=No(s);return x.useEffect(()=>{!B||!W.current||(B.disconnect(),k.current=!1,B.observe(W.current))},[W,B]),x.useEffect(()=>(p({type:Bt.RegisterDroppable,element:{id:o,key:u,disabled:r,node:W,rect:w,data:K}}),()=>p({type:Bt.UnregisterDroppable,key:u,id:o})),[o]),x.useEffect(()=>{r!==v.current.disabled&&(p({type:Bt.SetDroppableDisabled,id:o,key:u,disabled:r}),v.current.disabled=r)},[o,u,r,p]),{active:f,rect:w,isOver:(g==null?void 0:g.id)===o,node:W,over:g,setNodeRef:Y}}function Tk(t){let{animation:s,children:r}=t;const[o,l]=x.useState(null),[u,f]=x.useState(null),p=fl(r);return!r&&!o&&p&&l(p),ds(()=>{if(!u)return;const g=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(g==null||m==null){l(null);return}Promise.resolve(s(m,u)).then(()=>{l(null)})},[s,o,u]),ot.createElement(ot.Fragment,null,r,o?x.cloneElement(o,{ref:f}):null)}const Nk={x:0,y:0,scaleX:1,scaleY:1};function jk(t){let{children:s}=t;return ot.createElement(Do.Provider,{value:sv},ot.createElement(Ll.Provider,{value:Nk},s))}const Ck={position:"fixed",touchAction:"none"},Ek=t=>Dl(t)?"transform 250ms ease":void 0,_k=x.forwardRef((t,s)=>{let{as:r,activatorEvent:o,adjustScale:l,children:u,className:f,rect:p,style:g,transform:m,transition:v=Ek}=t;if(!p)return null;const k=l?m:{...m,scaleX:1,scaleY:1},w={...Ck,width:p.width,height:p.height,top:p.top,left:p.left,transform:zs.Transform.toString(k),transformOrigin:l&&o?w1(o,p):void 0,transition:typeof v=="function"?v(o):v,...g};return ot.createElement(r,{className:f,style:w,ref:s},u)}),Rk=t=>s=>{let{active:r,dragOverlay:o}=s;const l={},{styles:u,className:f}=t;if(u!=null&&u.active)for(const[p,g]of Object.entries(u.active))g!==void 0&&(l[p]=r.node.style.getPropertyValue(p),r.node.style.setProperty(p,g));if(u!=null&&u.dragOverlay)for(const[p,g]of Object.entries(u.dragOverlay))g!==void 0&&o.node.style.setProperty(p,g);return f!=null&&f.active&&r.node.classList.add(f.active),f!=null&&f.dragOverlay&&o.node.classList.add(f.dragOverlay),function(){for(const[g,m]of Object.entries(l))r.node.style.setProperty(g,m);f!=null&&f.active&&r.node.classList.remove(f.active)}},Ak=t=>{let{transform:{initial:s,final:r}}=t;return[{transform:zs.Transform.toString(s)},{transform:zs.Transform.toString(r)}]},Ik={duration:250,easing:"ease",keyframes:Ak,sideEffects:Rk({styles:{active:{opacity:"0"}}})};function Dk(t){let{config:s,draggableNodes:r,droppableContainers:o,measuringConfiguration:l}=t;return Il((u,f)=>{if(s===null)return;const p=r.get(u);if(!p)return;const g=p.node.current;if(!g)return;const m=nv(f);if(!m)return;const{transform:v}=Nn(f).getComputedStyle(f),k=Vg(v);if(!k)return;const w=typeof s=="function"?s:Mk(s);return Zg(g,l.draggable.measure),w({active:{id:u,data:p.data,node:g,rect:l.draggable.measure(g)},draggableNodes:r,dragOverlay:{node:f,rect:l.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:l,transform:k})})}function Mk(t){const{duration:s,easing:r,sideEffects:o,keyframes:l}={...Ik,...t};return u=>{let{active:f,dragOverlay:p,transform:g,...m}=u;if(!s)return;const v={x:p.rect.left-f.rect.left,y:p.rect.top-f.rect.top},k={scaleX:g.scaleX!==1?f.rect.width*g.scaleX/p.rect.width:1,scaleY:g.scaleY!==1?f.rect.height*g.scaleY/p.rect.height:1},w={x:g.x-v.x,y:g.y-v.y,...k},S=l({...m,active:f,dragOverlay:p,transform:{initial:g,final:w}}),[C]=S,E=S[S.length-1];if(JSON.stringify(C)===JSON.stringify(E))return;const T=o==null?void 0:o({active:f,dragOverlay:p,...m}),A=p.node.animate(S,{duration:s,easing:r,fill:"forwards"});return new Promise(_=>{A.onfinish=()=>{T==null||T(),_()}})}}let tm=0;function Lk(t){return x.useMemo(()=>{if(t!=null)return tm++,tm},[t])}const Pk=ot.memo(t=>{let{adjustScale:s=!1,children:r,dropAnimation:o,style:l,transition:u,modifiers:f,wrapperElement:p="div",className:g,zIndex:m=999}=t;const{activatorEvent:v,active:k,activeNodeRect:w,containerNodeRect:S,draggableNodes:C,droppableContainers:E,dragOverlay:T,over:A,measuringConfiguration:_,scrollableAncestors:B,scrollableAncestorRects:I,windowRect:W}=ov(),Y=x.useContext(Ll),K=Lk(k==null?void 0:k.id),F=iv(f,{activatorEvent:v,active:k,activeNodeRect:w,containerNodeRect:S,draggingNodeRect:T.rect,over:A,overlayNodeRect:T.rect,scrollableAncestors:B,scrollableAncestorRects:I,transform:Y,windowRect:W}),re=Td(w),he=Dk({config:o,draggableNodes:C,droppableContainers:E,measuringConfiguration:_}),G=re?T.setRef:void 0;return ot.createElement(jk,null,ot.createElement(Tk,{animation:he},k&&K?ot.createElement(_k,{key:K,id:k.id,ref:G,as:p,activatorEvent:v,adjustScale:s,className:g,transition:u,rect:re,style:{zIndex:m,...l},transform:F},r):null))});function lv(t,s,r){const o=t.slice();return o.splice(r<0?o.length+r:r,0,o.splice(s,1)[0]),o}function Ok(t,s){return t.reduce((r,o,l)=>{const u=s.get(o);return u&&(r[l]=u),r},Array(t.length))}function Fa(t){return t!==null&&t>=0}function $k(t,s){if(t===s)return!0;if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==s[r])return!1;return!0}function zk(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const cv=t=>{let{rects:s,activeIndex:r,overIndex:o,index:l}=t;const u=lv(s,o,r),f=s[l],p=u[l];return!p||!f?null:{x:p.left-f.left,y:p.top-f.top,scaleX:p.width/f.width,scaleY:p.height/f.height}},Ua={scaleX:1,scaleY:1},nm=t=>{var s;let{activeIndex:r,activeNodeRect:o,index:l,rects:u,overIndex:f}=t;const p=(s=u[r])!=null?s:o;if(!p)return null;if(l===r){const m=u[f];return m?{x:0,y:r<f?m.top+m.height-(p.top+p.height):m.top-p.top,...Ua}:null}const g=Fk(u,l,r);return l>r&&l<=f?{x:0,y:-p.height-g,...Ua}:l<r&&l>=f?{x:0,y:p.height+g,...Ua}:{x:0,y:0,...Ua}};function Fk(t,s,r){const o=t[s],l=t[s-1],u=t[s+1];return o?r<s?l?o.top-(l.top+l.height):u?u.top-(o.top+o.height):0:u?u.top-(o.top+o.height):l?o.top-(l.top+l.height):0:0}const uv="Sortable",dv=ot.createContext({activeIndex:-1,containerId:uv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cv,disabled:{draggable:!1,droppable:!1}});function sm(t){let{children:s,id:r,items:o,strategy:l=cv,disabled:u=!1}=t;const{active:f,dragOverlay:p,droppableRects:g,over:m,measureDroppableContainers:v}=ov(),k=Io(uv,r),w=p.rect!==null,S=x.useMemo(()=>o.map(Y=>typeof Y=="object"&&"id"in Y?Y.id:Y),[o]),C=f!=null,E=f?S.indexOf(f.id):-1,T=m?S.indexOf(m.id):-1,A=x.useRef(S),_=!$k(S,A.current),B=T!==-1&&E===-1||_,I=zk(u);ds(()=>{_&&C&&v(S)},[_,S,C,v]),x.useEffect(()=>{A.current=S},[S]);const W=x.useMemo(()=>({activeIndex:E,containerId:k,disabled:I,disableTransforms:B,items:S,overIndex:T,useDragOverlay:w,sortedRects:Ok(S,g),strategy:l}),[E,k,I.draggable,I.droppable,B,S,T,g,w,l]);return ot.createElement(dv.Provider,{value:W},s)}const Uk=t=>{let{id:s,items:r,activeIndex:o,overIndex:l}=t;return lv(r,o,l).indexOf(s)},Bk=t=>{let{containerId:s,isSorting:r,wasDragging:o,index:l,items:u,newIndex:f,previousItems:p,previousContainerId:g,transition:m}=t;return!m||!o||p!==u&&l===f?!1:r?!0:f!==l&&s===g},Wk={duration:200,easing:"ease"},fv="transform",Hk=zs.Transition.toString({property:fv,duration:0,easing:"linear"}),Vk={roleDescription:"sortable"};function Gk(t){let{disabled:s,index:r,node:o,rect:l}=t;const[u,f]=x.useState(null),p=x.useRef(r);return ds(()=>{if(!s&&r!==p.current&&o.current){const g=l.current;if(g){const m=ji(o.current,{ignoreTransform:!0}),v={x:g.left-m.left,y:g.top-m.top,scaleX:g.width/m.width,scaleY:g.height/m.height};(v.x||v.y)&&f(v)}}r!==p.current&&(p.current=r)},[s,r,o,l]),x.useEffect(()=>{u&&f(null)},[u]),u}function pv(t){let{animateLayoutChanges:s=Bk,attributes:r,disabled:o,data:l,getNewIndex:u=Uk,id:f,strategy:p,resizeObserverConfig:g,transition:m=Wk}=t;const{items:v,containerId:k,activeIndex:w,disabled:S,disableTransforms:C,sortedRects:E,overIndex:T,useDragOverlay:A,strategy:_}=x.useContext(dv),B=qk(o,S),I=v.indexOf(f),W=x.useMemo(()=>({sortable:{containerId:k,index:I,items:v},...l}),[k,l,I,v]),Y=x.useMemo(()=>v.slice(v.indexOf(f)),[v,f]),{rect:K,node:F,isOver:re,setNodeRef:he}=av({id:f,data:W,disabled:B.droppable,resizeObserverConfig:{updateMeasurementsFor:Y,...g}}),{active:G,activatorEvent:Ne,activeNodeRect:Se,attributes:Pe,setNodeRef:te,listeners:oe,isDragging:ae,over:O,setActivatorNodeRef:Q,transform:U}=kk({id:f,data:W,attributes:{...Vk,...r},disabled:B.draggable}),j=s1(he,te),P=!!G,ne=P&&!C&&Fa(w)&&Fa(T),de=!A&&ae,X=de&&ne?U:null,be=ne?X??(p??_)({rects:E,activeNodeRect:Se,activeIndex:w,overIndex:T,index:I}):null,Ee=Fa(w)&&Fa(T)?u({id:f,items:v,activeIndex:w,overIndex:T}):I,Re=G==null?void 0:G.id,Ce=x.useRef({activeId:Re,items:v,newIndex:Ee,containerId:k}),at=v!==Ce.current.items,De=s({active:G,containerId:k,isDragging:ae,isSorting:P,id:f,index:I,items:v,newIndex:Ce.current.newIndex,previousItems:Ce.current.items,previousContainerId:Ce.current.containerId,transition:m,wasDragging:Ce.current.activeId!=null}),lt=Gk({disabled:!De,index:I,node:F,rect:K});return x.useEffect(()=>{P&&Ce.current.newIndex!==Ee&&(Ce.current.newIndex=Ee),k!==Ce.current.containerId&&(Ce.current.containerId=k),v!==Ce.current.items&&(Ce.current.items=v)},[P,Ee,k,v]),x.useEffect(()=>{if(Re===Ce.current.activeId)return;if(Re!=null&&Ce.current.activeId==null){Ce.current.activeId=Re;return}const en=setTimeout(()=>{Ce.current.activeId=Re},50);return()=>clearTimeout(en)},[Re]),{active:G,activeIndex:w,attributes:Pe,data:W,rect:K,index:I,newIndex:Ee,items:v,isOver:re,isSorting:P,isDragging:ae,listeners:oe,node:F,overIndex:T,over:O,setNodeRef:j,setActivatorNodeRef:Q,setDroppableNodeRef:he,setDraggableNodeRef:te,transform:lt??be,transition:$e()};function $e(){if(lt||at&&Ce.current.newIndex===I)return Hk;if(!(de&&!Dl(Ne)||!m)&&(P||De))return zs.Transition.toString({...m,property:fv})}}function qk(t,s){var r,o;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t==null?void 0:t.draggable)!=null?r:s.draggable,droppable:(o=t==null?void 0:t.droppable)!=null?o:s.droppable}}et.Down,et.Right,et.Up,et.Left;function Ba(t){const[s,r]=x.useState(()=>{try{const l=localStorage.getItem(t);if(l==null)return new Set;const u=JSON.parse(l);return Array.isArray(u)?new Set(u.filter(f=>typeof f=="string")):new Set}catch{return new Set}}),o=x.useCallback(l=>{r(u=>{const f=l(new Set(u));try{localStorage.setItem(t,JSON.stringify([...f]))}catch{}return f})},[t]);return[s,o]}function Kk(t,s=!1){const[r,o]=x.useState(()=>{try{const u=localStorage.getItem(t);return u==="1"?!0:u==="0"?!1:s}catch{return s}}),l=x.useCallback(u=>{o(u);try{localStorage.setItem(t,u?"1":"0")}catch{}},[t]);return[r,l]}async function vl(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const s=document.createElement("textarea");s.value=t,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const r=document.execCommand("copy");return document.body.removeChild(s),r}catch{return!1}}}function Yk(t){return t.origin_app_id!=null&&!t.user_touched&&!t.starred}const qu="(no directory)";function fr(t){return t.replaceAll("\\","/").replace(/\/+$/,"")}function Ku(t,s){if(!s||!t.cwd)return!1;const r=fr(t.cwd),o=fr(s);return r.startsWith(`${o}/`)}function Xk(t,s){const r=new Map;for(const f of s){const p=f.cwd||qu,g=r.get(p)??[];g.push(f),r.set(p,g)}const o=new Set,l=new Set(t.filter(f=>f.deleted===1).map(f=>f.path)),u=[];for(const f of t){if(f.deleted===1){o.add(f.path);continue}o.add(f.path),u.push({path:f.path,label:f.label||f.path.split("/").pop()||f.path,sessions:r.get(f.path)??[],workspace:f})}for(const[f,p]of r)o.has(f)||l.has(f)||u.push({path:f,label:f===qu?"Other":f.split("/").pop()||f,sessions:p,workspace:null});return u}function Qk(t,s,r){if(s.length===0)return!1;const o=new Set(t.filter(l=>l.deleted===1).map(l=>l.path));return s.some(l=>!Ku(l,r)&&!o.has(l.cwd||qu))}function yl(t){return[...t].sort((s,r)=>r.sort_order-s.sort_order||(s.created_at<r.created_at?1:-1))}function rm(t,s,r,o){const l=s.map(u=>({folder:u,sessions:t.sessions.filter(f=>f.folder_id===u.id),finishedKey:`folder:${u.id}:finished`,hidden:o.has(u.id)}));return l.push({folder:null,sessions:t.sessions.filter(u=>!(u.folder_id&&r.has(u.folder_id))),finishedKey:`${t.path}:finished`,hidden:!1}),l}function im(t,s){return{working:yl(t.sessions.filter(r=>r.lifecycle!=="finished")),finished:yl(t.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:s.has(t.finishedKey)}}function Wa(t,s){return t.folder_id&&s.has(t.folder_id)?t.folder_id:null}function Zk(t){const s=new Set(t.map(o=>o.name));if(!s.has("New Folder"))return"New Folder";let r=2;for(;s.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function om({id:t,children:s,className:r}){const{setNodeRef:o,isOver:l}=av({id:t});return a.jsx("div",{ref:o,className:`${r??""}${l?" drop-over":""}`,children:s})}function Nd({inputRef:t,value:s,onChange:r,onConfirm:o,onCancel:l}){return a.jsx("input",{ref:t,className:"tree-rename-input",value:s,onChange:u=>r(u.target.value),onClick:u=>u.stopPropagation(),onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{u.key==="Enter"&&o(),u.key==="Escape"&&l()},onBlur:o})}function Jk({s:t,backgroundTaskCount:s,isActive:r,isSelected:o,originApp:l,renaming:u,renameValue:f,renameRef:p,onRenameValue:g,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:w,onToggleStar:S}){const{attributes:C,listeners:E,setNodeRef:T,transform:A,transition:_,isDragging:B}=pv({id:`s:${t.id}`}),I=El(t,s);return a.jsxs("div",{ref:T,style:{transform:zs.Transform.toString(A),transition:_},className:`tree-item ${r?"active":""}${o?" selected":""} ${I.isFinished?"tree-item-finished":""}${B?" dragging":""}${t.starred?" tree-item-starred":""}`,...C,...E,onClick:k,onContextMenu:w,children:[a.jsx(vd,{iconClass:I.iconClass,iconText:I.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(bi,{iconNode:l.iconNode,size:10})}),u?a.jsx(Nd,{inputRef:p,value:f,onChange:g,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:t.title||t.id.slice(0,8)}),!u&&a.jsx("button",{className:`star-btn${t.starred?" starred":""}`,title:t.starred?"Unstar session":"Star session",onClick:W=>{W.stopPropagation(),S()},onPointerDown:W=>W.stopPropagation(),children:a.jsx(ul,{size:10,fill:t.starred?"currentColor":"none"})}),I.dot&&a.jsx(gd,{status:I.dot,title:I.dotTitle})]})}function eS({folder:t,count:s,collapsed:r,renaming:o,renameValue:l,renameRef:u,onRenameValue:f,onRenameConfirm:p,onRenameCancel:g,onToggle:m,onCtxMenu:v,children:k}){const{attributes:w,listeners:S,setNodeRef:C,transform:E,transition:T,isDragging:A,over:_}=pv({id:`f:${t.id}`}),B=_!=null&&String(_.id).startsWith("s:");return a.jsxs("div",{ref:C,style:{transform:zs.Transform.toString(E),transition:T},className:`tree-folder ${r?"collapsed":""}${A?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${B?" drop-over":""}`,...w,...S,onClick:()=>{o||m()},onContextMenu:v,children:o?a.jsx(Nd,{inputRef:u,value:l,onChange:f,onConfirm:p,onCancel:g}):a.jsxs(a.Fragment,{children:[a.jsx(wi,{size:8,className:"tree-chevron"}),a.jsx(cl,{size:12}),a.jsx("span",{className:"tree-folder-label",children:t.name}),a.jsx("span",{className:"tree-count",children:s})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function tS(){const t=M(R=>R.sessions),s=M(R=>R.backgroundTasks),r=M(R=>R.workspaces),o=M(R=>R.folders),l=M(R=>R.activeSessionId),u=M(R=>R.selectSession),f=M(R=>R.deleteSession),p=M(R=>R.removeWorkspace),g=M(R=>R.createSessionInWorkspace),m=M(R=>R.pickAndAddWorkspace),v=M(R=>R.setImportSessionsWorkspace),k=M(R=>R.renameSession),w=M(R=>R.markFinished),S=M(R=>R.markFinishedMany),C=M(R=>R.toggleStar),E=M(R=>R.reopenSession),T=M(R=>R.reopenSessionMany),A=M(R=>R.deleteSessionMany),_=M(R=>R.createSidebarFolder),B=M(R=>R.renameFolder),I=M(R=>R.deleteFolder),W=M(R=>R.applyMoves),Y=M(R=>R.reorderFolders),K=M(R=>R.apps),F=M(R=>R.appsRootPath),re=M(R=>R.activeAppTabId),he=M(R=>R.openAppTab),G=M(R=>R.startAppEdit),Ne=M(R=>R.toggleAppPin),Se=M(R=>R.deleteApp),Pe=M(R=>R.openAppCatalog),[te,oe]=Ba("agentpane:sidebar-ws-collapsed"),[ae,O]=Ba("agentpane:sidebar-sub-collapsed"),[Q,U]=Ba("agentpane:sidebar-folders-collapsed"),[j,P]=Ba("agentpane:sidebar-app-edits-collapsed"),[ne,de]=Kk("agentpane:sidebar-hide-auto-sessions"),[X,fe]=x.useState(null),[be,Ee]=x.useState(null),[Re,Ce]=x.useState(""),[at,De]=x.useState(null),[lt,$e]=x.useState(new Set),[en,Fe]=x.useState(null),Ht=x.useRef(null),tn=x.useRef(null),wt=x.useRef(null),jt=x.useRef(!1),$t=y1(v1(bd,{activationConstraint:{distance:5}}));function Mt(){$e(new Set),Fe(null)}_l(Ht,()=>fe(null),!!X),Eo(()=>{fe(null),Mt()},!!X||lt.size>0),x.useLayoutEffect(()=>{const R=Ht.current;if(!X||!R)return;const ue=8,{offsetWidth:ie,offsetHeight:ve}=R,Me=X.x+ie>window.innerWidth-ue?Math.max(ue,X.x-ie):X.x,Ge=X.y+ve>window.innerHeight-ue?Math.max(ue,X.y-ve):X.y;R.style.left=`${Me}px`,R.style.top=`${Ge}px`},[X]);const q=x.useMemo(()=>new Map(t.map(R=>[R.id,R])),[t]),pe=x.useMemo(()=>new Map(o.map(R=>[R.id,R])),[o]),Ue=x.useMemo(()=>{const R=new Map;for(const ue of[...o].sort((ie,ve)=>ie.sort_order-ve.sort_order)){const ie=R.get(ue.workspace_path)??[];ie.push(ue),R.set(ue.workspace_path,ie)}return R},[o]);function tt(R){oe(ue=>{const ie=new Set(ue);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function mt(R){O(ue=>{const ie=new Set(ue);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function gt(R){U(ue=>{const ie=new Set(ue);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function Ct(){de(!ne),Mt()}function an(R){P(ue=>{const ie=new Set(ue);return ie.has(R)?ie.delete(R):ie.add(R),ie})}x.useEffect(()=>{be&&tn.current&&(tn.current.focus(),tn.current.select())},[be]),x.useEffect(()=>{var R,ue,ie;jt.current||!l||(jt.current=!0,(ie=(ue=(R=wt.current)==null?void 0:R.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:ue.scrollIntoView)==null||ie.call(ue,{block:"nearest"}))},[l]);function dt(R,ue,ie,ve=""){Ee({kind:R,id:ue}),Ce(ie||ve)}function Dn(){if(be){const R=Re.trim();R&&(be.kind==="session"?k(be.id,R):B(be.id,R))}Ee(null)}function Mn(){Ee(null),Ce("")}async function ps(R){const ue=Zk(Ue.get(R)??[]),ie=await _(R,ue);ie&&dt("folder",ie.id,ie.name)}function hs(R){const ue=String(R.active.id);if(ue.startsWith("s:")){const ie=q.get(ue.slice(2));ie&&De({kind:"session",label:ie.title||ie.id.slice(0,8)})}else if(ue.startsWith("f:")){const ie=pe.get(ue.slice(2));ie&&De({kind:"folder",label:ie.name})}}function ts(R){De(null);const{active:ue,over:ie}=R;if(!ie)return;const ve=String(ue.id),Me=String(ie.id);if(ve.startsWith("s:")){const Ge=q.get(ve.slice(2));if(!Ge)return;const Le=Ge.cwd||"(no directory)",zt=Wa(Ge,pe);let Pn,Be;if(Me.startsWith("f:")){const Qe=pe.get(Me.slice(2));if(!Qe)return;Pn=Qe.workspace_path,Be=Qe.id}else if(Me.startsWith("s:")){const Qe=q.get(Me.slice(2));if(!Qe)return;Pn=Qe.cwd||"(no directory)",Be=Wa(Qe,pe)}else if(Me.startsWith("c:")){const Qe=Me.slice(2),_t=Qe.lastIndexOf("|");Pn=Qe.slice(0,_t);const gs=Qe.slice(_t+1);Be=gs==="root"?null:gs}else return;if(Pn!==Le)return;const xn=yl(t.filter(Qe=>(Qe.cwd||"(no directory)")===Pn&&Wa(Qe,pe)===Be)),js=xn.filter(Qe=>Qe.id!==Ge.id);let Us=js.length;if(Me.startsWith("s:")){const Qe=js.findIndex(_t=>_t.id===Me.slice(2));Qe>=0&&(Us=Qe)}const On=[...js.slice(0,Us),Ge,...js.slice(Us)],ms=[];if(Be===zt){if(On.length===xn.length&&On.every((Qe,_t)=>Qe.id===xn[_t].id))return;On.forEach((Qe,_t)=>ms.push({id:Qe.id,folder_id:Be,sort_order:On.length-1-_t}))}else{const Qe=yl(t.filter(_t=>(_t.cwd||"(no directory)")===Le&&Wa(_t,pe)===zt)).filter(_t=>_t.id!==Ge.id);Qe.forEach((_t,gs)=>ms.push({id:_t.id,folder_id:zt,sort_order:Qe.length-1-gs})),On.forEach((_t,gs)=>ms.push({id:_t.id,folder_id:Be,sort_order:On.length-1-gs}))}W(ms);return}if(ve.startsWith("f:")){if(!Me.startsWith("f:"))return;const Ge=pe.get(ve.slice(2)),Le=pe.get(Me.slice(2));if(!Ge||!Le||Ge.id===Le.id||Ge.workspace_path!==Le.workspace_path)return;const zt=(Ue.get(Ge.workspace_path)??[]).map(xn=>xn.id),Pn=zt.indexOf(Ge.id),Be=zt.indexOf(Le.id);zt.splice(Be,0,...zt.splice(Pn,1)),Y(zt)}}const Ln=F?t.filter(R=>!Ku(R,F)):t,vn=new Set(ne?Ln.filter(R=>Yk(R)&&R.id!==l).map(R=>R.id):[]),ln=Xk(r,vn.size>0?Ln.filter(R=>!vn.has(R.id)):Ln),Vt=x.useMemo(()=>{const R=new Map;if(!F)return R;const ue=fr(F);for(const ie of t){if(!Ku(ie,F))continue;const ve=fr(ie.cwd).slice(ue.length+1).split("/")[0],Me=R.get(ve)??[];Me.push(ie),R.set(ve,Me)}return R},[t,F]);function yn(R){return{folder:null,sessions:Vt.get(R)??[],finishedKey:`app:${R}:finished`,hidden:j.has(R)}}const Xe=[],Et=R=>{if(R.hidden)return;const{working:ue,finished:ie,finishedCollapsed:ve}=im(R,ae);Xe.push(...ue.map(Me=>Me.id)),ve||Xe.push(...ie.map(Me=>Me.id))};for(const R of ln){if(te.has(R.path))continue;const ue=Ue.get(R.path)??[],ie=new Set(ue.map(ve=>ve.id));rm(R,ue,ie,Q).forEach(Et)}K.forEach(R=>Et(yn(R.id)));const ft=t.filter(R=>lt.has(R.id)),Gt=ft.filter(R=>R.lifecycle!=="finished").map(R=>R.id),vt=ft.filter(R=>R.lifecycle==="finished").map(R=>R.id);function yt(R,ue){if(ue.metaKey||ue.ctrlKey){ue.preventDefault(),Fe(R.id),$e(ie=>{const ve=new Set(ie);return ve.has(R.id)?ve.delete(R.id):ve.add(R.id),ve});return}if(ue.shiftKey){ue.preventDefault();const ie=en??R.id;Fe(ie);const ve=Xe.indexOf(ie),Me=Xe.indexOf(R.id);if(ve>=0&&Me>=0){const[Ge,Le]=ve<Me?[ve,Me]:[Me,ve];$e(new Set(Xe.slice(Ge,Le+1)))}return}Mt(),Fe(R.id),u(R.id)}function it(R,ue){ue.preventDefault();const ie=lt.has(R.id)&<.size>1;lt.has(R.id)||($e(new Set),Fe(R.id)),fe({x:ue.clientX,y:ue.clientY,type:"session",sessionId:R.id,sessionTitle:R.title,sessionLifecycle:R.lifecycle,sessionExternalId:R.external_thread_id,multi:ie})}function qt(R){var ie;const ue=R.origin_app_id?K.find(ve=>ve.id===R.origin_app_id):null;return a.jsx(Jk,{s:R,backgroundTaskCount:((ie=s[R.id])==null?void 0:ie.length)??0,isActive:l===R.id,isSelected:lt.has(R.id),originApp:ue??null,renaming:(be==null?void 0:be.kind)==="session"&&be.id===R.id,renameValue:Re,renameRef:tn,onRenameValue:Ce,onRenameConfirm:Dn,onRenameCancel:Mn,onSelect:ve=>yt(R,ve),onToggleStar:()=>C(R.id),onCtxMenu:ve=>it(R,ve)},R.id)}function st(R){var ie;const ue=El(R,((ie=s[R.id])==null?void 0:ie.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===R.id?" active":""}${lt.has(R.id)?" selected":""}${ue.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:ve=>yt(R,ve),onContextMenu:ve=>it(R,ve),children:[a.jsx(vd,{iconClass:ue.iconClass,iconText:ue.iconText,size:14}),(be==null?void 0:be.kind)==="session"&&be.id===R.id?a.jsx(Nd,{inputRef:tn,value:Re,onChange:Ce,onConfirm:Dn,onCancel:Mn}):a.jsx("span",{className:"tree-label",children:R.title||R.id.slice(0,8)}),ue.dot&&a.jsx(gd,{status:ue.dot,title:ue.dotTitle})]},R.id)}function Lt(R,ue="workspace"){const{working:ie,finished:ve,finishedCollapsed:Me}=im(R,ae),Ge=ue==="workspace"?qt:st,Le=a.jsxs(a.Fragment,{children:[ie.length===0&&ve.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):ie.map(Ge),ve.length>0&&a.jsxs("div",{className:`tree-subgroup ${Me?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>mt(R.finishedKey),children:[a.jsx(wi,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:ve.length})]}),!Me&&a.jsx("div",{className:"tree-subgroup-items",children:ve.map(Ge)})]})]});if(ue==="app")return Le;const zt=[...ie,...ve].map(Pn=>`s:${Pn.id}`);return a.jsx(sm,{items:zt,strategy:nm,children:Le})}return a.jsxs("div",{className:"ide-sidebar",ref:wt,children:[a.jsxs("div",{className:"sidebar-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Workspaces"}),a.jsxs("div",{className:"sidebar-header-actions",children:[a.jsx("button",{className:`sidebar-add sidebar-filter${ne?" active":""}`,title:ne?`Show automatic sessions (${vn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":ne?"Show automatic sessions":"Hide automatic sessions","aria-pressed":ne,onClick:Ct,children:ne?a.jsx(yw,{size:14}):a.jsx(hr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(dr,{size:14})})]})]}),a.jsxs(yk,{sensors:$t,collisionDetection:T1,onDragStart:hs,onDragEnd:ts,children:[ln.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):ln.map(R=>{const ue=te.has(R.path),ie=Ue.get(R.path)??[],ve=new Set(ie.map(Le=>Le.id)),Me=rm(R,ie,ve,Q),Ge=Me[Me.length-1];return a.jsxs("div",{className:`tree-section ${ue?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>tt(R.path),onContextMenu:Le=>{Le.preventDefault(),fe({x:Le.clientX,y:Le.clientY,type:"workspace",path:R.path})},children:[a.jsx(wi,{size:9,className:"tree-chevron"}),a.jsx(cl,{size:14}),a.jsx("span",{className:"tree-section-label",children:R.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Le=>{Le.stopPropagation(),g(R.path)},children:a.jsx(dr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Le=>{Le.stopPropagation(),ps(R.path)},children:a.jsx(Cu,{size:11})}),a.jsx("span",{className:"tree-count",children:R.sessions.length})]}),!ue&&a.jsxs("div",{className:"tree-children",children:[a.jsx(sm,{items:ie.map(Le=>`f:${Le.id}`),strategy:nm,children:Me.filter(Le=>Le.folder).map(Le=>a.jsx(eS,{folder:Le.folder,count:Le.sessions.length,collapsed:Le.hidden,renaming:(be==null?void 0:be.kind)==="folder"&&be.id===Le.folder.id,renameValue:Re,renameRef:tn,onRenameValue:Ce,onRenameConfirm:Dn,onRenameCancel:Mn,onToggle:()=>gt(Le.folder.id),onCtxMenu:zt=>{zt.preventDefault(),fe({x:zt.clientX,y:zt.clientY,type:"folder",folderId:Le.folder.id,folderName:Le.folder.name})},children:a.jsx(om,{id:`c:${R.path}|${Le.folder.id}`,children:Lt(Le)})},Le.folder.id))}),a.jsx(om,{id:`c:${R.path}|root`,children:Lt(Ge)})]})]},R.path)}),a.jsx(Pk,{children:at&&a.jsxs("div",{className:"drag-overlay",children:[at.kind==="folder"&&a.jsx(cl,{size:12}),a.jsx("span",{children:at.label})]})})]}),a.jsxs("div",{className:"sidebar-apps",children:[a.jsxs("div",{className:"sidebar-header sidebar-apps-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Apps"}),a.jsx("button",{className:"sidebar-add",title:"Add mini app",onClick:()=>Pe(),children:a.jsx(dr,{size:14})})]}),K.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),K.map(R=>{const ue=yn(R.id),ie=ue.sessions.length>0&&!ue.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${re===R.id?" active":""}`,title:R.description??void 0,onClick:()=>he(R.id),onContextMenu:ve=>{ve.preventDefault(),fe({x:ve.clientX,y:ve.clientY,type:"app",appId:R.id,appPinned:R.pinned})},children:[ue.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${ie?"":" closed"}`,title:"Edit sessions of this app",onClick:ve=>{ve.stopPropagation(),an(R.id)},children:a.jsx(wi,{size:10,className:"tree-chevron"})}),a.jsx(bi,{iconNode:R.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:R.title}),ue.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:ue.sessions.length}),R.pinned&&a.jsx(ul,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ie&&a.jsx("div",{className:"sidebar-app-edits",children:Lt(ue,"app")})]},R.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(Cu,{size:14}),a.jsx("span",{children:"Add workspace"})]}),X&&a.jsxs("div",{ref:Ht,className:"ctx-menu",style:{position:"fixed",left:X.x,top:X.y,zIndex:500},children:[X.type==="workspace"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{g(X.path),fe(null)},children:[a.jsx(dr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ps(X.path),fe(null)},children:[a.jsx(Cu,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(X.path),fe(null)},children:[a.jsx(Ig,{size:12})," Import Claude Code Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{p(X.path),fe(null)},children:[a.jsx(us,{size:12})," Hide Workspace"]})]}),X.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("folder",X.folderId,X.folderName??""),fe(null)},children:[a.jsx(Qa,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{I(X.folderId),fe(null)},children:[a.jsx(us,{size:12})," Delete Folder"]})]}),X.type==="session"&&!X.multi&&a.jsx(a.Fragment,{children:X.sessionLifecycle!=="finished"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("session",X.sessionId,X.sessionTitle??""),fe(null)},children:[a.jsx(Qa,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{w(X.sessionId),fe(null)},children:[a.jsx(al,{size:12})," Mark as Finished"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(vl(X.sessionExternalId),fe(null))},children:[a.jsx(ll,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(X.sessionId),fe(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{E(X.sessionId),fe(null)},children:[a.jsx(To,{size:12})," Reopen"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(vl(X.sessionExternalId),fe(null))},children:[a.jsx(ll,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(X.sessionId),fe(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]})}),X.type==="session"&&X.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[ft.length," sessions selected"]}),Gt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Gt),fe(null),Mt()},children:[a.jsx(al,{size:12})," Mark ",Gt.length," as Finished"]}),vt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(vt),fe(null),Mt()},children:[a.jsx(To,{size:12})," Reopen ",vt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{A([...lt]),fe(null),Mt()},children:[a.jsx(us,{size:12})," Delete ",ft.length," Sessions"]})]}),X.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{G(X.appId),fe(null)},children:[a.jsx(Qa,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Ne(X.appId),fe(null)},children:[a.jsx(ul,{size:12})," ",X.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{Se(X.appId),fe(null)},children:[a.jsx(us,{size:12})," Delete App"]})]})]})]})}function nS(){const t=M(S=>S.openTabs),s=M(S=>S.activeSessionId),r=M(S=>S.sessions),o=M(S=>S.backgroundTasks),l=M(S=>S.selectSession),u=M(S=>S.closeTab),f=M(S=>S.setShowNewSessionDialog),p=M(S=>S.apps),g=M(S=>S.openAppTabs),m=M(S=>S.activeAppTabId),v=M(S=>S.openAppTab),k=M(S=>S.closeAppTab),w=M(S=>S.setActiveAppTab);return a.jsxs("div",{className:"ide-tabs",children:[t.map(S=>{var A;const C=r.find(_=>_.id===S);if(!C)return null;const E=El(C,((A=o[S])==null?void 0:A.length)??0),T=s===S&&m==null;return a.jsxs("div",{className:`ide-tab ${T?"active":""}`,onClick:()=>{m!=null&&w(null),l(S)},children:[a.jsx(vd,{iconClass:E.iconClass,iconText:E.iconText,size:14}),C.title||S.slice(0,8),E.dot&&a.jsx(gd,{status:E.dot,title:E.dotTitle}),a.jsx("span",{className:"ide-tab-close",onClick:_=>{_.stopPropagation(),u(S)},children:a.jsx(gn,{size:12})})]},S)}),g.map(S=>{const C=p.find(T=>T.id===S),E=m===S;return a.jsxs("div",{className:`ide-tab ${E?"active":""}`,onClick:()=>v(S),children:[a.jsx(bi,{iconNode:C==null?void 0:C.iconNode,size:12,className:"miniapp-tab-icon"}),(C==null?void 0:C.title)??S,a.jsx("span",{className:"ide-tab-close",onClick:T=>{T.stopPropagation(),k(S)},children:a.jsx(gn,{size:12})})]},S)}),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>f(!0),children:a.jsx(dr,{size:14})})]})}function jd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $r=jd();function hv(t){$r=t}var xo={exec:()=>null};function nt(t,s=""){let r=typeof t=="string"?t:t.source;const o={replace:(l,u)=>{let f=typeof u=="string"?u:u.source;return f=f.replace(Tn.caret,"$1"),r=r.replace(l,f),o},getRegex:()=>new RegExp(r,s)};return o}var Tn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},sS=/^(?:[ \t]*(?:\n|$))+/,rS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,iS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Mo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,oS=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Cd=/(?:[*+-]|\d{1,9}[.)])/,mv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,gv=nt(mv).replace(/bull/g,Cd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),aS=nt(mv).replace(/bull/g,Cd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ed=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,lS=/^[^\n]+/,_d=/(?!\s*\])(?:\\.|[^\[\]\\])+/,cS=nt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_d).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),uS=nt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Cd).getRegex(),Pl="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Rd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,dS=nt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Rd).replace("tag",Pl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vv=nt(Ed).replace("hr",Mo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pl).getRegex(),fS=nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",vv).getRegex(),Ad={blockquote:fS,code:rS,def:cS,fences:iS,heading:oS,hr:Mo,html:dS,lheading:gv,list:uS,newline:sS,paragraph:vv,table:xo,text:lS},am=nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Mo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pl).getRegex(),pS={...Ad,lheading:aS,table:am,paragraph:nt(Ed).replace("hr",Mo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",am).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pl).getRegex()},hS={...Ad,html:nt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Rd).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:nt(Ed).replace("hr",Mo).replace("heading",` *#{1,6} *[^
|
|
424
|
-
]`).replace("lheading",gv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},
|
|
423
|
+
`},g1={onDragStart(t){let{active:s}=t;return"Picked up draggable item "+s.id+"."},onDragOver(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was moved over droppable area "+r.id+".":"Draggable item "+s.id+" is no longer over a droppable area."},onDragEnd(t){let{active:s,over:r}=t;return r?"Draggable item "+s.id+" was dropped over droppable area "+r.id:"Draggable item "+s.id+" was dropped."},onDragCancel(t){let{active:s}=t;return"Dragging was cancelled. Draggable item "+s.id+" was dropped."}};function v1(t){let{announcements:s=g1,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=m1}=t;const{announce:u,announcement:f}=f1(),p=Io("DndLiveRegion"),[g,m]=x.useState(!1);if(x.useEffect(()=>{m(!0)},[]),p1(x.useMemo(()=>({onDragStart(k){let{active:w}=k;u(s.onDragStart({active:w}))},onDragMove(k){let{active:w,over:S}=k;s.onDragMove&&u(s.onDragMove({active:w,over:S}))},onDragOver(k){let{active:w,over:S}=k;u(s.onDragOver({active:w,over:S}))},onDragEnd(k){let{active:w,over:S}=k;u(s.onDragEnd({active:w,over:S}))},onDragCancel(k){let{active:w,over:S}=k;u(s.onDragCancel({active:w,over:S}))}}),[u,s])),!g)return null;const v=ot.createElement(ot.Fragment,null,ot.createElement(u1,{id:o,value:l.draggable}),ot.createElement(d1,{id:p,announcement:f}));return r?po.createPortal(v,r):v}var Bt;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Bt||(Bt={}));function ml(){}function y1(t,s){return x.useMemo(()=>({sensor:t,options:s??{}}),[t,s])}function x1(){for(var t=arguments.length,s=new Array(t),r=0;r<t;r++)s[r]=arguments[r];return x.useMemo(()=>[...s].filter(o=>o!=null),[...s])}const fs=Object.freeze({x:0,y:0});function w1(t,s){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function k1(t,s){const r=hl(t);if(!r)return"0 0";const o={x:(r.x-s.left)/s.width*100,y:(r.y-s.top)/s.height*100};return o.x+"% "+o.y+"%"}function S1(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return r-o}function b1(t,s){let{data:{value:r}}=t,{data:{value:o}}=s;return o-r}function T1(t,s){if(!t||t.length===0)return null;const[r]=t;return r[s]}function Hh(t,s,r){return s===void 0&&(s=t.left),r===void 0&&(r=t.top),{x:s+t.width*.5,y:r+t.height*.5}}const N1=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const l=Hh(s,s.left,s.top),u=[];for(const f of o){const{id:p}=f,g=r.get(p);if(g){const m=w1(Hh(g),l);u.push({id:p,data:{droppableContainer:f,value:m}})}}return u.sort(S1)};function j1(t,s){const r=Math.max(s.top,t.top),o=Math.max(s.left,t.left),l=Math.min(s.left+s.width,t.left+t.width),u=Math.min(s.top+s.height,t.top+t.height),f=l-o,p=u-r;if(o<l&&r<u){const g=s.width*s.height,m=t.width*t.height,v=f*p,k=v/(g+m-v);return Number(k.toFixed(4))}return 0}const C1=t=>{let{collisionRect:s,droppableRects:r,droppableContainers:o}=t;const l=[];for(const u of o){const{id:f}=u,p=r.get(f);if(p){const g=j1(p,s);g>0&&l.push({id:f,data:{droppableContainer:u,value:g}})}}return l.sort(b1)};function E1(t,s,r){return{...t,scaleX:s&&r?s.width/r.width:1,scaleY:s&&r?s.height/r.height:1}}function Hg(t,s){return t&&s?{x:t.left-s.left,y:t.top-s.top}:fs}function _1(t){return function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),u=1;u<o;u++)l[u-1]=arguments[u];return l.reduce((f,p)=>({...f,top:f.top+t*p.y,bottom:f.bottom+t*p.y,left:f.left+t*p.x,right:f.right+t*p.x}),{...r})}}const R1=_1(1);function Vg(t){if(t.startsWith("matrix3d(")){const s=t.slice(9,-1).split(/, /);return{x:+s[12],y:+s[13],scaleX:+s[0],scaleY:+s[5]}}else if(t.startsWith("matrix(")){const s=t.slice(7,-1).split(/, /);return{x:+s[4],y:+s[5],scaleX:+s[0],scaleY:+s[3]}}return null}function A1(t,s,r){const o=Vg(s);if(!o)return t;const{scaleX:l,scaleY:u,x:f,y:p}=o,g=t.left-f-(1-l)*parseFloat(r),m=t.top-p-(1-u)*parseFloat(r.slice(r.indexOf(" ")+1)),v=l?t.width/l:t.width,k=u?t.height/u:t.height;return{width:v,height:k,top:m,right:g+v,bottom:m+k,left:g}}const I1={ignoreTransform:!1};function ji(t,s){s===void 0&&(s=I1);let r=t.getBoundingClientRect();if(s.ignoreTransform){const{transform:m,transformOrigin:v}=Nn(t).getComputedStyle(t);m&&(r=A1(r,m,v))}const{top:o,left:l,width:u,height:f,bottom:p,right:g}=r;return{top:o,left:l,width:u,height:f,bottom:p,right:g}}function Vh(t){return ji(t,{ignoreTransform:!0})}function D1(t){const s=t.innerWidth,r=t.innerHeight;return{top:0,left:0,right:s,bottom:r,width:s,height:r}}function M1(t,s){return s===void 0&&(s=Nn(t).getComputedStyle(t)),s.position==="fixed"}function L1(t,s){s===void 0&&(s=Nn(t).getComputedStyle(t));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(l=>{const u=s[l];return typeof u=="string"?r.test(u):!1})}function wd(t,s){const r=[];function o(l){if(s!=null&&r.length>=s||!l)return r;if(xd(l)&&l.scrollingElement!=null&&!r.includes(l.scrollingElement))return r.push(l.scrollingElement),r;if(!Ro(l)||Ug(l)||r.includes(l))return r;const u=Nn(t).getComputedStyle(l);return l!==t&&L1(l,u)&&r.push(l),M1(l,u)?r:o(l.parentNode)}return t?o(t):r}function Gg(t){const[s]=wd(t,1);return s??null}function _u(t){return!Al||!t?null:Ti(t)?t:yd(t)?xd(t)||t===Ni(t).scrollingElement?window:Ro(t)?t:null:null}function qg(t){return Ti(t)?t.scrollX:t.scrollLeft}function Kg(t){return Ti(t)?t.scrollY:t.scrollTop}function Hu(t){return{x:qg(t),y:Kg(t)}}var Jt;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Jt||(Jt={}));function Yg(t){return!Al||!t?!1:t===document.scrollingElement}function Xg(t){const s={x:0,y:0},r=Yg(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},o={x:t.scrollWidth-r.width,y:t.scrollHeight-r.height},l=t.scrollTop<=s.y,u=t.scrollLeft<=s.x,f=t.scrollTop>=o.y,p=t.scrollLeft>=o.x;return{isTop:l,isLeft:u,isBottom:f,isRight:p,maxScroll:o,minScroll:s}}const P1={x:.2,y:.2};function O1(t,s,r,o,l){let{top:u,left:f,right:p,bottom:g}=r;o===void 0&&(o=10),l===void 0&&(l=P1);const{isTop:m,isBottom:v,isLeft:k,isRight:w}=Xg(t),S={x:0,y:0},C={x:0,y:0},E={height:s.height*l.y,width:s.width*l.x};return!m&&u<=s.top+E.height?(S.y=Jt.Backward,C.y=o*Math.abs((s.top+E.height-u)/E.height)):!v&&g>=s.bottom-E.height&&(S.y=Jt.Forward,C.y=o*Math.abs((s.bottom-E.height-g)/E.height)),!w&&p>=s.right-E.width?(S.x=Jt.Forward,C.x=o*Math.abs((s.right-E.width-p)/E.width)):!k&&f<=s.left+E.width&&(S.x=Jt.Backward,C.x=o*Math.abs((s.left+E.width-f)/E.width)),{direction:S,speed:C}}function $1(t){if(t===document.scrollingElement){const{innerWidth:u,innerHeight:f}=window;return{top:0,left:0,right:u,bottom:f,width:u,height:f}}const{top:s,left:r,right:o,bottom:l}=t.getBoundingClientRect();return{top:s,left:r,right:o,bottom:l,width:t.clientWidth,height:t.clientHeight}}function Qg(t){return t.reduce((s,r)=>ki(s,Hu(r)),fs)}function z1(t){return t.reduce((s,r)=>s+qg(r),0)}function F1(t){return t.reduce((s,r)=>s+Kg(r),0)}function Zg(t,s){if(s===void 0&&(s=ji),!t)return;const{top:r,left:o,bottom:l,right:u}=s(t);Gg(t)&&(l<=0||u<=0||r>=window.innerHeight||o>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const U1=[["x",["left","right"],z1],["y",["top","bottom"],F1]];class kd{constructor(s,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const o=wd(r),l=Qg(o);this.rect={...s},this.width=s.width,this.height=s.height;for(const[u,f,p]of U1)for(const g of f)Object.defineProperty(this,g,{get:()=>{const m=p(o),v=l[u]-m;return this.rect[g]+v},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class go{constructor(s){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var o;return(o=this.target)==null?void 0:o.removeEventListener(...r)})},this.target=s}add(s,r,o){var l;(l=this.target)==null||l.addEventListener(s,r,o),this.listeners.push([s,r,o])}}function B1(t){const{EventTarget:s}=Nn(t);return t instanceof s?t:Ni(t)}function Ru(t,s){const r=Math.abs(t.x),o=Math.abs(t.y);return typeof s=="number"?Math.sqrt(r**2+o**2)>s:"x"in s&&"y"in s?r>s.x&&o>s.y:"x"in s?r>s.x:"y"in s?o>s.y:!1}var es;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(es||(es={}));function Gh(t){t.preventDefault()}function W1(t){t.stopPropagation()}var et;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(et||(et={}));const Jg={start:[et.Space,et.Enter],cancel:[et.Esc],end:[et.Space,et.Enter,et.Tab]},H1=(t,s)=>{let{currentCoordinates:r}=s;switch(t.code){case et.Right:return{...r,x:r.x+25};case et.Left:return{...r,x:r.x-25};case et.Down:return{...r,y:r.y+25};case et.Up:return{...r,y:r.y-25}}};class ev{constructor(s){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=s;const{event:{target:r}}=s;this.props=s,this.listeners=new go(Ni(r)),this.windowListeners=new go(Nn(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(es.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:s,onStart:r}=this.props,o=s.node.current;o&&Zg(o),r(fs)}handleKeyDown(s){if(Dl(s)){const{active:r,context:o,options:l}=this.props,{keyboardCodes:u=Jg,coordinateGetter:f=H1,scrollBehavior:p="smooth"}=l,{code:g}=s;if(u.end.includes(g)){this.handleEnd(s);return}if(u.cancel.includes(g)){this.handleCancel(s);return}const{collisionRect:m}=o.current,v=m?{x:m.left,y:m.top}:fs;this.referenceCoordinates||(this.referenceCoordinates=v);const k=f(s,{active:r,context:o.current,currentCoordinates:v});if(k){const w=pl(k,v),S={x:0,y:0},{scrollableAncestors:C}=o.current;for(const E of C){const T=s.code,{isTop:A,isRight:_,isLeft:B,isBottom:I,maxScroll:W,minScroll:Y}=Xg(E),K=$1(E),F={x:Math.min(T===et.Right?K.right-K.width/2:K.right,Math.max(T===et.Right?K.left:K.left+K.width/2,k.x)),y:Math.min(T===et.Down?K.bottom-K.height/2:K.bottom,Math.max(T===et.Down?K.top:K.top+K.height/2,k.y))},re=T===et.Right&&!_||T===et.Left&&!B,he=T===et.Down&&!I||T===et.Up&&!A;if(re&&F.x!==k.x){const G=E.scrollLeft+w.x,Ne=T===et.Right&&G<=W.x||T===et.Left&&G>=Y.x;if(Ne&&!w.y){E.scrollTo({left:G,behavior:p});return}Ne?S.x=E.scrollLeft-G:S.x=T===et.Right?E.scrollLeft-W.x:E.scrollLeft-Y.x,S.x&&E.scrollBy({left:-S.x,behavior:p});break}else if(he&&F.y!==k.y){const G=E.scrollTop+w.y,Ne=T===et.Down&&G<=W.y||T===et.Up&&G>=Y.y;if(Ne&&!w.x){E.scrollTo({top:G,behavior:p});return}Ne?S.y=E.scrollTop-G:S.y=T===et.Down?E.scrollTop-W.y:E.scrollTop-Y.y,S.y&&E.scrollBy({top:-S.y,behavior:p});break}}this.handleMove(s,ki(pl(k,this.referenceCoordinates),S))}}}handleMove(s,r){const{onMove:o}=this.props;s.preventDefault(),o(r)}handleEnd(s){const{onEnd:r}=this.props;s.preventDefault(),this.detach(),r()}handleCancel(s){const{onCancel:r}=this.props;s.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ev.activators=[{eventName:"onKeyDown",handler:(t,s,r)=>{let{keyboardCodes:o=Jg,onActivation:l}=s,{active:u}=r;const{code:f}=t.nativeEvent;if(o.start.includes(f)){const p=u.activatorNode.current;return p&&t.target!==p?!1:(t.preventDefault(),l==null||l({event:t.nativeEvent}),!0)}return!1}}];function qh(t){return!!(t&&"distance"in t)}function Kh(t){return!!(t&&"delay"in t)}class Sd{constructor(s,r,o){var l;o===void 0&&(o=B1(s.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=s,this.events=r;const{event:u}=s,{target:f}=u;this.props=s,this.events=r,this.document=Ni(f),this.documentListeners=new go(this.document),this.listeners=new go(o),this.windowListeners=new go(Nn(f)),this.initialCoordinates=(l=hl(u))!=null?l:fs,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:s,props:{options:{activationConstraint:r,bypassActivationConstraint:o}}}=this;if(this.listeners.add(s.move.name,this.handleMove,{passive:!1}),this.listeners.add(s.end.name,this.handleEnd),s.cancel&&this.listeners.add(s.cancel.name,this.handleCancel),this.windowListeners.add(es.Resize,this.handleCancel),this.windowListeners.add(es.DragStart,Gh),this.windowListeners.add(es.VisibilityChange,this.handleCancel),this.windowListeners.add(es.ContextMenu,Gh),this.documentListeners.add(es.Keydown,this.handleKeydown),r){if(o!=null&&o({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Kh(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(qh(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(s,r){const{active:o,onPending:l}=this.props;l(o,s,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:s}=this,{onStart:r}=this.props;s&&(this.activated=!0,this.documentListeners.add(es.Click,W1,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(es.SelectionChange,this.removeTextSelection),r(s))}handleMove(s){var r;const{activated:o,initialCoordinates:l,props:u}=this,{onMove:f,options:{activationConstraint:p}}=u;if(!l)return;const g=(r=hl(s))!=null?r:fs,m=pl(l,g);if(!o&&p){if(qh(p)){if(p.tolerance!=null&&Ru(m,p.tolerance))return this.handleCancel();if(Ru(m,p.distance))return this.handleStart()}if(Kh(p)&&Ru(m,p.tolerance))return this.handleCancel();this.handlePending(p,m);return}s.cancelable&&s.preventDefault(),f(g)}handleEnd(){const{onAbort:s,onEnd:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleCancel(){const{onAbort:s,onCancel:r}=this.props;this.detach(),this.activated||s(this.props.active),r()}handleKeydown(s){s.code===et.Esc&&this.handleCancel()}removeTextSelection(){var s;(s=this.document.getSelection())==null||s.removeAllRanges()}}const V1={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class bd extends Sd{constructor(s){const{event:r}=s,o=Ni(r.target);super(s,V1,o)}}bd.activators=[{eventName:"onPointerDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return!r.isPrimary||r.button!==0?!1:(o==null||o({event:r}),!0)}}];const G1={move:{name:"mousemove"},end:{name:"mouseup"}};var Vu;(function(t){t[t.RightClick=2]="RightClick"})(Vu||(Vu={}));class q1 extends Sd{constructor(s){super(s,G1,Ni(s.event.target))}}q1.activators=[{eventName:"onMouseDown",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;return r.button===Vu.RightClick?!1:(o==null||o({event:r}),!0)}}];const Au={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class K1 extends Sd{constructor(s){super(s,Au)}static setup(){return window.addEventListener(Au.move.name,s,{capture:!1,passive:!1}),function(){window.removeEventListener(Au.move.name,s)};function s(){}}}K1.activators=[{eventName:"onTouchStart",handler:(t,s)=>{let{nativeEvent:r}=t,{onActivation:o}=s;const{touches:l}=r;return l.length>1?!1:(o==null||o({event:r}),!0)}}];var vo;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(vo||(vo={}));var gl;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(gl||(gl={}));function Y1(t){let{acceleration:s,activator:r=vo.Pointer,canScroll:o,draggingRect:l,enabled:u,interval:f=5,order:p=gl.TreeOrder,pointerCoordinates:g,scrollableAncestors:m,scrollableAncestorRects:v,delta:k,threshold:w}=t;const S=Q1({delta:k,disabled:!u}),[C,E]=i1(),T=x.useRef({x:0,y:0}),A=x.useRef({x:0,y:0}),_=x.useMemo(()=>{switch(r){case vo.Pointer:return g?{top:g.y,bottom:g.y,left:g.x,right:g.x}:null;case vo.DraggableRect:return l}},[r,l,g]),B=x.useRef(null),I=x.useCallback(()=>{const Y=B.current;if(!Y)return;const K=T.current.x*A.current.x,F=T.current.y*A.current.y;Y.scrollBy(K,F)},[]),W=x.useMemo(()=>p===gl.TreeOrder?[...m].reverse():m,[p,m]);x.useEffect(()=>{if(!u||!m.length||!_){E();return}for(const Y of W){if((o==null?void 0:o(Y))===!1)continue;const K=m.indexOf(Y),F=v[K];if(!F)continue;const{direction:re,speed:he}=O1(Y,F,_,s,w);for(const G of["x","y"])S[G][re[G]]||(he[G]=0,re[G]=0);if(he.x>0||he.y>0){E(),B.current=Y,C(I,f),T.current=he,A.current=re;return}}T.current={x:0,y:0},A.current={x:0,y:0},E()},[s,I,o,E,u,f,JSON.stringify(_),JSON.stringify(S),C,m,W,v,JSON.stringify(w)])}const X1={x:{[Jt.Backward]:!1,[Jt.Forward]:!1},y:{[Jt.Backward]:!1,[Jt.Forward]:!1}};function Q1(t){let{delta:s,disabled:r}=t;const o=fl(s);return Ao(l=>{if(r||!o||!l)return X1;const u={x:Math.sign(s.x-o.x),y:Math.sign(s.y-o.y)};return{x:{[Jt.Backward]:l.x[Jt.Backward]||u.x===-1,[Jt.Forward]:l.x[Jt.Forward]||u.x===1},y:{[Jt.Backward]:l.y[Jt.Backward]||u.y===-1,[Jt.Forward]:l.y[Jt.Forward]||u.y===1}}},[r,s,o])}function Z1(t,s){const r=s!=null?t.get(s):void 0,o=r?r.node.current:null;return Ao(l=>{var u;return s==null?null:(u=o??l)!=null?u:null},[o,s])}function J1(t,s){return x.useMemo(()=>t.reduce((r,o)=>{const{sensor:l}=o,u=l.activators.map(f=>({eventName:f.eventName,handler:s(f.handler,o)}));return[...r,...u]},[]),[t,s])}var jo;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(jo||(jo={}));var Gu;(function(t){t.Optimized="optimized"})(Gu||(Gu={}));const Yh=new Map;function ek(t,s){let{dragging:r,dependencies:o,config:l}=s;const[u,f]=x.useState(null),{frequency:p,measure:g,strategy:m}=l,v=x.useRef(t),k=T(),w=No(k),S=x.useCallback(function(A){A===void 0&&(A=[]),!w.current&&f(_=>_===null?A:_.concat(A.filter(B=>!_.includes(B))))},[w]),C=x.useRef(null),E=Ao(A=>{if(k&&!r)return Yh;if(!A||A===Yh||v.current!==t||u!=null){const _=new Map;for(let B of t){if(!B)continue;if(u&&u.length>0&&!u.includes(B.id)&&B.rect.current){_.set(B.id,B.rect.current);continue}const I=B.node.current,W=I?new kd(g(I),I):null;B.rect.current=W,W&&_.set(B.id,W)}return _}return A},[t,u,r,k,g]);return x.useEffect(()=>{v.current=t},[t]),x.useEffect(()=>{k||S()},[r,k]),x.useEffect(()=>{u&&u.length>0&&f(null)},[JSON.stringify(u)]),x.useEffect(()=>{k||typeof p!="number"||C.current!==null||(C.current=setTimeout(()=>{S(),C.current=null},p))},[p,k,S,...o]),{droppableRects:E,measureDroppableContainers:S,measuringScheduled:u!=null};function T(){switch(m){case jo.Always:return!1;case jo.BeforeDragging:return r;default:return!r}}}function Td(t,s){return Ao(r=>t?r||(typeof s=="function"?s(t):t):null,[s,t])}function tk(t,s){return Td(t,s)}function nk(t){let{callback:s,disabled:r}=t;const o=Il(s),l=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:u}=window;return new u(o)},[o,r]);return x.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function Ml(t){let{callback:s,disabled:r}=t;const o=Il(s),l=x.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:u}=window;return new u(o)},[r]);return x.useEffect(()=>()=>l==null?void 0:l.disconnect(),[l]),l}function sk(t){return new kd(ji(t),t)}function Xh(t,s,r){s===void 0&&(s=sk);const[o,l]=x.useState(null);function u(){l(g=>{if(!t)return null;if(t.isConnected===!1){var m;return(m=g??r)!=null?m:null}const v=s(t);return JSON.stringify(g)===JSON.stringify(v)?g:v})}const f=nk({callback(g){if(t)for(const m of g){const{type:v,target:k}=m;if(v==="childList"&&k instanceof HTMLElement&&k.contains(t)){u();break}}}}),p=Ml({callback:u});return ds(()=>{u(),t?(p==null||p.observe(t),f==null||f.observe(document.body,{childList:!0,subtree:!0})):(p==null||p.disconnect(),f==null||f.disconnect())},[t]),o}function rk(t){const s=Td(t);return Hg(t,s)}const Qh=[];function ik(t){const s=x.useRef(t),r=Ao(o=>t?o&&o!==Qh&&t&&s.current&&t.parentNode===s.current.parentNode?o:wd(t):Qh,[t]);return x.useEffect(()=>{s.current=t},[t]),r}function ok(t){const[s,r]=x.useState(null),o=x.useRef(t),l=x.useCallback(u=>{const f=_u(u.target);f&&r(p=>p?(p.set(f,Hu(f)),new Map(p)):null)},[]);return x.useEffect(()=>{const u=o.current;if(t!==u){f(u);const p=t.map(g=>{const m=_u(g);return m?(m.addEventListener("scroll",l,{passive:!0}),[m,Hu(m)]):null}).filter(g=>g!=null);r(p.length?new Map(p):null),o.current=t}return()=>{f(t),f(u)};function f(p){p.forEach(g=>{const m=_u(g);m==null||m.removeEventListener("scroll",l)})}},[l,t]),x.useMemo(()=>t.length?s?Array.from(s.values()).reduce((u,f)=>ki(u,f),fs):Qg(t):fs,[t,s])}function Zh(t,s){s===void 0&&(s=[]);const r=x.useRef(null);return x.useEffect(()=>{r.current=null},s),x.useEffect(()=>{const o=t!==fs;o&&!r.current&&(r.current=t),!o&&r.current&&(r.current=null)},[t]),r.current?pl(t,r.current):fs}function ak(t){x.useEffect(()=>{if(!Al)return;const s=t.map(r=>{let{sensor:o}=r;return o.setup==null?void 0:o.setup()});return()=>{for(const r of s)r==null||r()}},t.map(s=>{let{sensor:r}=s;return r}))}function lk(t,s){return x.useMemo(()=>t.reduce((r,o)=>{let{eventName:l,handler:u}=o;return r[l]=f=>{u(f,s)},r},{}),[t,s])}function tv(t){return x.useMemo(()=>t?D1(t):null,[t])}const Jh=[];function ck(t,s){s===void 0&&(s=ji);const[r]=t,o=tv(r?Nn(r):null),[l,u]=x.useState(Jh);function f(){u(()=>t.length?t.map(g=>Yg(g)?o:new kd(s(g),g)):Jh)}const p=Ml({callback:f});return ds(()=>{p==null||p.disconnect(),f(),t.forEach(g=>p==null?void 0:p.observe(g))},[t]),l}function nv(t){if(!t)return null;if(t.children.length>1)return t;const s=t.children[0];return Ro(s)?s:t}function uk(t){let{measure:s}=t;const[r,o]=x.useState(null),l=x.useCallback(m=>{for(const{target:v}of m)if(Ro(v)){o(k=>{const w=s(v);return k?{...k,width:w.width,height:w.height}:w});break}},[s]),u=Ml({callback:l}),f=x.useCallback(m=>{const v=nv(m);u==null||u.disconnect(),v&&(u==null||u.observe(v)),o(v?s(v):null)},[s,u]),[p,g]=dl(f);return x.useMemo(()=>({nodeRef:p,rect:r,setRef:g}),[r,p,g])}const dk=[{sensor:bd,options:{}},{sensor:ev,options:{}}],fk={current:{}},Za={draggable:{measure:Vh},droppable:{measure:Vh,strategy:jo.WhileDragging,frequency:Gu.Optimized},dragOverlay:{measure:ji}};class yo extends Map{get(s){var r;return s!=null&&(r=super.get(s))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(s=>{let{disabled:r}=s;return!r})}getNodeFor(s){var r,o;return(r=(o=this.get(s))==null?void 0:o.node.current)!=null?r:void 0}}const pk={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new yo,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ml},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Za,measureDroppableContainers:ml,windowRect:null,measuringScheduled:!1},sv={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:ml,draggableNodes:new Map,over:null,measureDroppableContainers:ml},Do=x.createContext(sv),rv=x.createContext(pk);function hk(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new yo}}}function mk(t,s){switch(s.type){case Bt.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:s.initialCoordinates,active:s.active}};case Bt.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:s.coordinates.x-t.draggable.initialCoordinates.x,y:s.coordinates.y-t.draggable.initialCoordinates.y}}};case Bt.DragEnd:case Bt.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Bt.RegisterDroppable:{const{element:r}=s,{id:o}=r,l=new yo(t.droppable.containers);return l.set(o,r),{...t,droppable:{...t.droppable,containers:l}}}case Bt.SetDroppableDisabled:{const{id:r,key:o,disabled:l}=s,u=t.droppable.containers.get(r);if(!u||o!==u.key)return t;const f=new yo(t.droppable.containers);return f.set(r,{...u,disabled:l}),{...t,droppable:{...t.droppable,containers:f}}}case Bt.UnregisterDroppable:{const{id:r,key:o}=s,l=t.droppable.containers.get(r);if(!l||o!==l.key)return t;const u=new yo(t.droppable.containers);return u.delete(r),{...t,droppable:{...t.droppable,containers:u}}}default:return t}}function gk(t){let{disabled:s}=t;const{active:r,activatorEvent:o,draggableNodes:l}=x.useContext(Do),u=fl(o),f=fl(r==null?void 0:r.id);return x.useEffect(()=>{if(!s&&!o&&u&&f!=null){if(!Dl(u)||document.activeElement===u.target)return;const p=l.get(f);if(!p)return;const{activatorNode:g,node:m}=p;if(!g.current&&!m.current)return;requestAnimationFrame(()=>{for(const v of[g.current,m.current]){if(!v)continue;const k=l1(v);if(k){k.focus();break}}})}},[o,s,l,f,u]),null}function iv(t,s){let{transform:r,...o}=s;return t!=null&&t.length?t.reduce((l,u)=>u({transform:l,...o}),r):r}function vk(t){return x.useMemo(()=>({draggable:{...Za.draggable,...t==null?void 0:t.draggable},droppable:{...Za.droppable,...t==null?void 0:t.droppable},dragOverlay:{...Za.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function yk(t){let{activeNode:s,measure:r,initialRect:o,config:l=!0}=t;const u=x.useRef(!1),{x:f,y:p}=typeof l=="boolean"?{x:l,y:l}:l;ds(()=>{if(!f&&!p||!s){u.current=!1;return}if(u.current||!o)return;const m=s==null?void 0:s.node.current;if(!m||m.isConnected===!1)return;const v=r(m),k=Hg(v,o);if(f||(k.x=0),p||(k.y=0),u.current=!0,Math.abs(k.x)>0||Math.abs(k.y)>0){const w=Gg(m);w&&w.scrollBy({top:k.y,left:k.x})}},[s,f,p,o,r])}const Ll=x.createContext({...fs,scaleX:1,scaleY:1});var cr;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(cr||(cr={}));const xk=x.memo(function(s){var r,o,l,u;let{id:f,accessibility:p,autoScroll:g=!0,children:m,sensors:v=dk,collisionDetection:k=C1,measuring:w,modifiers:S,...C}=s;const E=x.useReducer(mk,void 0,hk),[T,A]=E,[_,B]=h1(),[I,W]=x.useState(cr.Uninitialized),Y=I===cr.Initialized,{draggable:{active:K,nodes:F,translate:re},droppable:{containers:he}}=T,G=K!=null?F.get(K):null,Ne=x.useRef({initial:null,translated:null}),Se=x.useMemo(()=>{var Xe;return K!=null?{id:K,data:(Xe=G==null?void 0:G.data)!=null?Xe:fk,rect:Ne}:null},[K,G]),Pe=x.useRef(null),[te,oe]=x.useState(null),[ae,O]=x.useState(null),Q=No(C,Object.values(C)),U=Io("DndDescribedBy",f),j=x.useMemo(()=>he.getEnabled(),[he]),P=vk(w),{droppableRects:ne,measureDroppableContainers:de,measuringScheduled:X}=ek(j,{dragging:Y,dependencies:[re.x,re.y],config:P.droppable}),fe=Z1(F,K),be=x.useMemo(()=>ae?hl(ae):null,[ae]),Ee=yn(),Re=tk(fe,P.draggable.measure);yk({activeNode:K!=null?F.get(K):null,config:Ee.layoutShiftCompensation,initialRect:Re,measure:P.draggable.measure});const Ce=Xh(fe,P.draggable.measure,Re),at=Xh(fe?fe.parentElement:null),De=x.useRef({activatorEvent:null,active:null,activeNode:fe,collisionRect:null,collisions:null,droppableRects:ne,draggableNodes:F,draggingNode:null,draggingNodeRect:null,droppableContainers:he,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),lt=he.getNodeFor((r=De.current.over)==null?void 0:r.id),$e=uk({measure:P.dragOverlay.measure}),en=(o=$e.nodeRef.current)!=null?o:fe,Fe=Y?(l=$e.rect)!=null?l:Ce:null,Ht=!!($e.nodeRef.current&&$e.rect),tn=rk(Ht?null:Ce),wt=tv(en?Nn(en):null),jt=ik(Y?lt??fe:null),$t=ck(jt),Mt=iv(S,{transform:{x:re.x-tn.x,y:re.y-tn.y,scaleX:1,scaleY:1},activatorEvent:ae,active:Se,activeNodeRect:Ce,containerNodeRect:at,draggingNodeRect:Fe,over:De.current.over,overlayNodeRect:$e.rect,scrollableAncestors:jt,scrollableAncestorRects:$t,windowRect:wt}),q=be?ki(be,re):null,pe=ok(jt),Ue=Zh(pe),tt=Zh(pe,[Ce]),mt=ki(Mt,Ue),gt=Fe?R1(Fe,Mt):null,Ct=Se&>?k({active:Se,collisionRect:gt,droppableRects:ne,droppableContainers:j,pointerCoordinates:q}):null,an=T1(Ct,"id"),[dt,Dn]=x.useState(null),Mn=Ht?Mt:ki(Mt,tt),ps=E1(Mn,(u=dt==null?void 0:dt.rect)!=null?u:null,Ce),hs=x.useRef(null),ts=x.useCallback((Xe,Et)=>{let{sensor:ft,options:Gt}=Et;if(Pe.current==null)return;const vt=F.get(Pe.current);if(!vt)return;const yt=Xe.nativeEvent,it=new ft({active:Pe.current,activeNode:vt,event:yt,options:Gt,context:De,onAbort(st){if(!F.get(st))return;const{onDragAbort:R}=Q.current,ue={id:st};R==null||R(ue),_({type:"onDragAbort",event:ue})},onPending(st,Lt,R,ue){if(!F.get(st))return;const{onDragPending:ve}=Q.current,Me={id:st,constraint:Lt,initialCoordinates:R,offset:ue};ve==null||ve(Me),_({type:"onDragPending",event:Me})},onStart(st){const Lt=Pe.current;if(Lt==null)return;const R=F.get(Lt);if(!R)return;const{onDragStart:ue}=Q.current,ie={activatorEvent:yt,active:{id:Lt,data:R.data,rect:Ne}};po.unstable_batchedUpdates(()=>{ue==null||ue(ie),W(cr.Initializing),A({type:Bt.DragStart,initialCoordinates:st,active:Lt}),_({type:"onDragStart",event:ie}),oe(hs.current),O(yt)})},onMove(st){A({type:Bt.DragMove,coordinates:st})},onEnd:qt(Bt.DragEnd),onCancel:qt(Bt.DragCancel)});hs.current=it;function qt(st){return async function(){const{active:R,collisions:ue,over:ie,scrollAdjustedTranslate:ve}=De.current;let Me=null;if(R&&ve){const{cancelDrop:Ge}=Q.current;Me={activatorEvent:yt,active:R,collisions:ue,delta:ve,over:ie},st===Bt.DragEnd&&typeof Ge=="function"&&await Promise.resolve(Ge(Me))&&(st=Bt.DragCancel)}Pe.current=null,po.unstable_batchedUpdates(()=>{A({type:st}),W(cr.Uninitialized),Dn(null),oe(null),O(null),hs.current=null;const Ge=st===Bt.DragEnd?"onDragEnd":"onDragCancel";if(Me){const Le=Q.current[Ge];Le==null||Le(Me),_({type:Ge,event:Me})}})}}},[F]),Ln=x.useCallback((Xe,Et)=>(ft,Gt)=>{const vt=ft.nativeEvent,yt=F.get(Gt);if(Pe.current!==null||!yt||vt.dndKit||vt.defaultPrevented)return;const it={active:yt};Xe(ft,Et.options,it)===!0&&(vt.dndKit={capturedBy:Et.sensor},Pe.current=Gt,ts(ft,Et))},[F,ts]),vn=J1(v,Ln);ak(v),ds(()=>{Ce&&I===cr.Initializing&&W(cr.Initialized)},[Ce,I]),x.useEffect(()=>{const{onDragMove:Xe}=Q.current,{active:Et,activatorEvent:ft,collisions:Gt,over:vt}=De.current;if(!Et||!ft)return;const yt={active:Et,activatorEvent:ft,collisions:Gt,delta:{x:mt.x,y:mt.y},over:vt};po.unstable_batchedUpdates(()=>{Xe==null||Xe(yt),_({type:"onDragMove",event:yt})})},[mt.x,mt.y]),x.useEffect(()=>{const{active:Xe,activatorEvent:Et,collisions:ft,droppableContainers:Gt,scrollAdjustedTranslate:vt}=De.current;if(!Xe||Pe.current==null||!Et||!vt)return;const{onDragOver:yt}=Q.current,it=Gt.get(an),qt=it&&it.rect.current?{id:it.id,rect:it.rect.current,data:it.data,disabled:it.disabled}:null,st={active:Xe,activatorEvent:Et,collisions:ft,delta:{x:vt.x,y:vt.y},over:qt};po.unstable_batchedUpdates(()=>{Dn(qt),yt==null||yt(st),_({type:"onDragOver",event:st})})},[an]),ds(()=>{De.current={activatorEvent:ae,active:Se,activeNode:fe,collisionRect:gt,collisions:Ct,droppableRects:ne,draggableNodes:F,draggingNode:en,draggingNodeRect:Fe,droppableContainers:he,over:dt,scrollableAncestors:jt,scrollAdjustedTranslate:mt},Ne.current={initial:Fe,translated:gt}},[Se,fe,Ct,gt,F,en,Fe,ne,he,dt,jt,mt]),Y1({...Ee,delta:re,draggingRect:gt,pointerCoordinates:q,scrollableAncestors:jt,scrollableAncestorRects:$t});const ln=x.useMemo(()=>({active:Se,activeNode:fe,activeNodeRect:Ce,activatorEvent:ae,collisions:Ct,containerNodeRect:at,dragOverlay:$e,draggableNodes:F,droppableContainers:he,droppableRects:ne,over:dt,measureDroppableContainers:de,scrollableAncestors:jt,scrollableAncestorRects:$t,measuringConfiguration:P,measuringScheduled:X,windowRect:wt}),[Se,fe,Ce,ae,Ct,at,$e,F,he,ne,dt,de,jt,$t,P,X,wt]),Vt=x.useMemo(()=>({activatorEvent:ae,activators:vn,active:Se,activeNodeRect:Ce,ariaDescribedById:{draggable:U},dispatch:A,draggableNodes:F,over:dt,measureDroppableContainers:de}),[ae,vn,Se,Ce,A,U,F,dt,de]);return ot.createElement(Wg.Provider,{value:B},ot.createElement(Do.Provider,{value:Vt},ot.createElement(rv.Provider,{value:ln},ot.createElement(Ll.Provider,{value:ps},m)),ot.createElement(gk,{disabled:(p==null?void 0:p.restoreFocus)===!1})),ot.createElement(v1,{...p,hiddenTextDescribedById:U}));function yn(){const Xe=(te==null?void 0:te.autoScrollEnabled)===!1,Et=typeof g=="object"?g.enabled===!1:g===!1,ft=Y&&!Xe&&!Et;return typeof g=="object"?{...g,enabled:ft}:{enabled:ft}}}),wk=x.createContext(null),em="button",kk="Draggable";function Sk(t){let{id:s,data:r,disabled:o=!1,attributes:l}=t;const u=Io(kk),{activators:f,activatorEvent:p,active:g,activeNodeRect:m,ariaDescribedById:v,draggableNodes:k,over:w}=x.useContext(Do),{role:S=em,roleDescription:C="draggable",tabIndex:E=0}=l??{},T=(g==null?void 0:g.id)===s,A=x.useContext(T?Ll:wk),[_,B]=dl(),[I,W]=dl(),Y=lk(f,s),K=No(r);ds(()=>(k.set(s,{id:s,key:u,node:_,activatorNode:I,data:K}),()=>{const re=k.get(s);re&&re.key===u&&k.delete(s)}),[k,s]);const F=x.useMemo(()=>({role:S,tabIndex:E,"aria-disabled":o,"aria-pressed":T&&S===em?!0:void 0,"aria-roledescription":C,"aria-describedby":v.draggable}),[o,S,E,T,C,v.draggable]);return{active:g,activatorEvent:p,activeNodeRect:m,attributes:F,isDragging:T,listeners:o?void 0:Y,node:_,over:w,setNodeRef:B,setActivatorNodeRef:W,transform:A}}function ov(){return x.useContext(rv)}const bk="Droppable",Tk={timeout:25};function av(t){let{data:s,disabled:r=!1,id:o,resizeObserverConfig:l}=t;const u=Io(bk),{active:f,dispatch:p,over:g,measureDroppableContainers:m}=x.useContext(Do),v=x.useRef({disabled:r}),k=x.useRef(!1),w=x.useRef(null),S=x.useRef(null),{disabled:C,updateMeasurementsFor:E,timeout:T}={...Tk,...l},A=No(E??o),_=x.useCallback(()=>{if(!k.current){k.current=!0;return}S.current!=null&&clearTimeout(S.current),S.current=setTimeout(()=>{m(Array.isArray(A.current)?A.current:[A.current]),S.current=null},T)},[T]),B=Ml({callback:_,disabled:C||!f}),I=x.useCallback((F,re)=>{B&&(re&&(B.unobserve(re),k.current=!1),F&&B.observe(F))},[B]),[W,Y]=dl(I),K=No(s);return x.useEffect(()=>{!B||!W.current||(B.disconnect(),k.current=!1,B.observe(W.current))},[W,B]),x.useEffect(()=>(p({type:Bt.RegisterDroppable,element:{id:o,key:u,disabled:r,node:W,rect:w,data:K}}),()=>p({type:Bt.UnregisterDroppable,key:u,id:o})),[o]),x.useEffect(()=>{r!==v.current.disabled&&(p({type:Bt.SetDroppableDisabled,id:o,key:u,disabled:r}),v.current.disabled=r)},[o,u,r,p]),{active:f,rect:w,isOver:(g==null?void 0:g.id)===o,node:W,over:g,setNodeRef:Y}}function Nk(t){let{animation:s,children:r}=t;const[o,l]=x.useState(null),[u,f]=x.useState(null),p=fl(r);return!r&&!o&&p&&l(p),ds(()=>{if(!u)return;const g=o==null?void 0:o.key,m=o==null?void 0:o.props.id;if(g==null||m==null){l(null);return}Promise.resolve(s(m,u)).then(()=>{l(null)})},[s,o,u]),ot.createElement(ot.Fragment,null,r,o?x.cloneElement(o,{ref:f}):null)}const jk={x:0,y:0,scaleX:1,scaleY:1};function Ck(t){let{children:s}=t;return ot.createElement(Do.Provider,{value:sv},ot.createElement(Ll.Provider,{value:jk},s))}const Ek={position:"fixed",touchAction:"none"},_k=t=>Dl(t)?"transform 250ms ease":void 0,Rk=x.forwardRef((t,s)=>{let{as:r,activatorEvent:o,adjustScale:l,children:u,className:f,rect:p,style:g,transform:m,transition:v=_k}=t;if(!p)return null;const k=l?m:{...m,scaleX:1,scaleY:1},w={...Ek,width:p.width,height:p.height,top:p.top,left:p.left,transform:zs.Transform.toString(k),transformOrigin:l&&o?k1(o,p):void 0,transition:typeof v=="function"?v(o):v,...g};return ot.createElement(r,{className:f,style:w,ref:s},u)}),Ak=t=>s=>{let{active:r,dragOverlay:o}=s;const l={},{styles:u,className:f}=t;if(u!=null&&u.active)for(const[p,g]of Object.entries(u.active))g!==void 0&&(l[p]=r.node.style.getPropertyValue(p),r.node.style.setProperty(p,g));if(u!=null&&u.dragOverlay)for(const[p,g]of Object.entries(u.dragOverlay))g!==void 0&&o.node.style.setProperty(p,g);return f!=null&&f.active&&r.node.classList.add(f.active),f!=null&&f.dragOverlay&&o.node.classList.add(f.dragOverlay),function(){for(const[g,m]of Object.entries(l))r.node.style.setProperty(g,m);f!=null&&f.active&&r.node.classList.remove(f.active)}},Ik=t=>{let{transform:{initial:s,final:r}}=t;return[{transform:zs.Transform.toString(s)},{transform:zs.Transform.toString(r)}]},Dk={duration:250,easing:"ease",keyframes:Ik,sideEffects:Ak({styles:{active:{opacity:"0"}}})};function Mk(t){let{config:s,draggableNodes:r,droppableContainers:o,measuringConfiguration:l}=t;return Il((u,f)=>{if(s===null)return;const p=r.get(u);if(!p)return;const g=p.node.current;if(!g)return;const m=nv(f);if(!m)return;const{transform:v}=Nn(f).getComputedStyle(f),k=Vg(v);if(!k)return;const w=typeof s=="function"?s:Lk(s);return Zg(g,l.draggable.measure),w({active:{id:u,data:p.data,node:g,rect:l.draggable.measure(g)},draggableNodes:r,dragOverlay:{node:f,rect:l.dragOverlay.measure(m)},droppableContainers:o,measuringConfiguration:l,transform:k})})}function Lk(t){const{duration:s,easing:r,sideEffects:o,keyframes:l}={...Dk,...t};return u=>{let{active:f,dragOverlay:p,transform:g,...m}=u;if(!s)return;const v={x:p.rect.left-f.rect.left,y:p.rect.top-f.rect.top},k={scaleX:g.scaleX!==1?f.rect.width*g.scaleX/p.rect.width:1,scaleY:g.scaleY!==1?f.rect.height*g.scaleY/p.rect.height:1},w={x:g.x-v.x,y:g.y-v.y,...k},S=l({...m,active:f,dragOverlay:p,transform:{initial:g,final:w}}),[C]=S,E=S[S.length-1];if(JSON.stringify(C)===JSON.stringify(E))return;const T=o==null?void 0:o({active:f,dragOverlay:p,...m}),A=p.node.animate(S,{duration:s,easing:r,fill:"forwards"});return new Promise(_=>{A.onfinish=()=>{T==null||T(),_()}})}}let tm=0;function Pk(t){return x.useMemo(()=>{if(t!=null)return tm++,tm},[t])}const Ok=ot.memo(t=>{let{adjustScale:s=!1,children:r,dropAnimation:o,style:l,transition:u,modifiers:f,wrapperElement:p="div",className:g,zIndex:m=999}=t;const{activatorEvent:v,active:k,activeNodeRect:w,containerNodeRect:S,draggableNodes:C,droppableContainers:E,dragOverlay:T,over:A,measuringConfiguration:_,scrollableAncestors:B,scrollableAncestorRects:I,windowRect:W}=ov(),Y=x.useContext(Ll),K=Pk(k==null?void 0:k.id),F=iv(f,{activatorEvent:v,active:k,activeNodeRect:w,containerNodeRect:S,draggingNodeRect:T.rect,over:A,overlayNodeRect:T.rect,scrollableAncestors:B,scrollableAncestorRects:I,transform:Y,windowRect:W}),re=Td(w),he=Mk({config:o,draggableNodes:C,droppableContainers:E,measuringConfiguration:_}),G=re?T.setRef:void 0;return ot.createElement(Ck,null,ot.createElement(Nk,{animation:he},k&&K?ot.createElement(Rk,{key:K,id:k.id,ref:G,as:p,activatorEvent:v,adjustScale:s,className:g,transition:u,rect:re,style:{zIndex:m,...l},transform:F},r):null))});function lv(t,s,r){const o=t.slice();return o.splice(r<0?o.length+r:r,0,o.splice(s,1)[0]),o}function $k(t,s){return t.reduce((r,o,l)=>{const u=s.get(o);return u&&(r[l]=u),r},Array(t.length))}function Fa(t){return t!==null&&t>=0}function zk(t,s){if(t===s)return!0;if(t.length!==s.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==s[r])return!1;return!0}function Fk(t){return typeof t=="boolean"?{draggable:t,droppable:t}:t}const cv=t=>{let{rects:s,activeIndex:r,overIndex:o,index:l}=t;const u=lv(s,o,r),f=s[l],p=u[l];return!p||!f?null:{x:p.left-f.left,y:p.top-f.top,scaleX:p.width/f.width,scaleY:p.height/f.height}},Ua={scaleX:1,scaleY:1},nm=t=>{var s;let{activeIndex:r,activeNodeRect:o,index:l,rects:u,overIndex:f}=t;const p=(s=u[r])!=null?s:o;if(!p)return null;if(l===r){const m=u[f];return m?{x:0,y:r<f?m.top+m.height-(p.top+p.height):m.top-p.top,...Ua}:null}const g=Uk(u,l,r);return l>r&&l<=f?{x:0,y:-p.height-g,...Ua}:l<r&&l>=f?{x:0,y:p.height+g,...Ua}:{x:0,y:0,...Ua}};function Uk(t,s,r){const o=t[s],l=t[s-1],u=t[s+1];return o?r<s?l?o.top-(l.top+l.height):u?u.top-(o.top+o.height):0:u?u.top-(o.top+o.height):l?o.top-(l.top+l.height):0:0}const uv="Sortable",dv=ot.createContext({activeIndex:-1,containerId:uv,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cv,disabled:{draggable:!1,droppable:!1}});function sm(t){let{children:s,id:r,items:o,strategy:l=cv,disabled:u=!1}=t;const{active:f,dragOverlay:p,droppableRects:g,over:m,measureDroppableContainers:v}=ov(),k=Io(uv,r),w=p.rect!==null,S=x.useMemo(()=>o.map(Y=>typeof Y=="object"&&"id"in Y?Y.id:Y),[o]),C=f!=null,E=f?S.indexOf(f.id):-1,T=m?S.indexOf(m.id):-1,A=x.useRef(S),_=!zk(S,A.current),B=T!==-1&&E===-1||_,I=Fk(u);ds(()=>{_&&C&&v(S)},[_,S,C,v]),x.useEffect(()=>{A.current=S},[S]);const W=x.useMemo(()=>({activeIndex:E,containerId:k,disabled:I,disableTransforms:B,items:S,overIndex:T,useDragOverlay:w,sortedRects:$k(S,g),strategy:l}),[E,k,I.draggable,I.droppable,B,S,T,g,w,l]);return ot.createElement(dv.Provider,{value:W},s)}const Bk=t=>{let{id:s,items:r,activeIndex:o,overIndex:l}=t;return lv(r,o,l).indexOf(s)},Wk=t=>{let{containerId:s,isSorting:r,wasDragging:o,index:l,items:u,newIndex:f,previousItems:p,previousContainerId:g,transition:m}=t;return!m||!o||p!==u&&l===f?!1:r?!0:f!==l&&s===g},Hk={duration:200,easing:"ease"},fv="transform",Vk=zs.Transition.toString({property:fv,duration:0,easing:"linear"}),Gk={roleDescription:"sortable"};function qk(t){let{disabled:s,index:r,node:o,rect:l}=t;const[u,f]=x.useState(null),p=x.useRef(r);return ds(()=>{if(!s&&r!==p.current&&o.current){const g=l.current;if(g){const m=ji(o.current,{ignoreTransform:!0}),v={x:g.left-m.left,y:g.top-m.top,scaleX:g.width/m.width,scaleY:g.height/m.height};(v.x||v.y)&&f(v)}}r!==p.current&&(p.current=r)},[s,r,o,l]),x.useEffect(()=>{u&&f(null)},[u]),u}function pv(t){let{animateLayoutChanges:s=Wk,attributes:r,disabled:o,data:l,getNewIndex:u=Bk,id:f,strategy:p,resizeObserverConfig:g,transition:m=Hk}=t;const{items:v,containerId:k,activeIndex:w,disabled:S,disableTransforms:C,sortedRects:E,overIndex:T,useDragOverlay:A,strategy:_}=x.useContext(dv),B=Kk(o,S),I=v.indexOf(f),W=x.useMemo(()=>({sortable:{containerId:k,index:I,items:v},...l}),[k,l,I,v]),Y=x.useMemo(()=>v.slice(v.indexOf(f)),[v,f]),{rect:K,node:F,isOver:re,setNodeRef:he}=av({id:f,data:W,disabled:B.droppable,resizeObserverConfig:{updateMeasurementsFor:Y,...g}}),{active:G,activatorEvent:Ne,activeNodeRect:Se,attributes:Pe,setNodeRef:te,listeners:oe,isDragging:ae,over:O,setActivatorNodeRef:Q,transform:U}=Sk({id:f,data:W,attributes:{...Gk,...r},disabled:B.draggable}),j=r1(he,te),P=!!G,ne=P&&!C&&Fa(w)&&Fa(T),de=!A&&ae,X=de&&ne?U:null,be=ne?X??(p??_)({rects:E,activeNodeRect:Se,activeIndex:w,overIndex:T,index:I}):null,Ee=Fa(w)&&Fa(T)?u({id:f,items:v,activeIndex:w,overIndex:T}):I,Re=G==null?void 0:G.id,Ce=x.useRef({activeId:Re,items:v,newIndex:Ee,containerId:k}),at=v!==Ce.current.items,De=s({active:G,containerId:k,isDragging:ae,isSorting:P,id:f,index:I,items:v,newIndex:Ce.current.newIndex,previousItems:Ce.current.items,previousContainerId:Ce.current.containerId,transition:m,wasDragging:Ce.current.activeId!=null}),lt=qk({disabled:!De,index:I,node:F,rect:K});return x.useEffect(()=>{P&&Ce.current.newIndex!==Ee&&(Ce.current.newIndex=Ee),k!==Ce.current.containerId&&(Ce.current.containerId=k),v!==Ce.current.items&&(Ce.current.items=v)},[P,Ee,k,v]),x.useEffect(()=>{if(Re===Ce.current.activeId)return;if(Re!=null&&Ce.current.activeId==null){Ce.current.activeId=Re;return}const en=setTimeout(()=>{Ce.current.activeId=Re},50);return()=>clearTimeout(en)},[Re]),{active:G,activeIndex:w,attributes:Pe,data:W,rect:K,index:I,newIndex:Ee,items:v,isOver:re,isSorting:P,isDragging:ae,listeners:oe,node:F,overIndex:T,over:O,setNodeRef:j,setActivatorNodeRef:Q,setDroppableNodeRef:he,setDraggableNodeRef:te,transform:lt??be,transition:$e()};function $e(){if(lt||at&&Ce.current.newIndex===I)return Vk;if(!(de&&!Dl(Ne)||!m)&&(P||De))return zs.Transition.toString({...m,property:fv})}}function Kk(t,s){var r,o;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(r=t==null?void 0:t.draggable)!=null?r:s.draggable,droppable:(o=t==null?void 0:t.droppable)!=null?o:s.droppable}}et.Down,et.Right,et.Up,et.Left;function Ba(t){const[s,r]=x.useState(()=>{try{const l=localStorage.getItem(t);if(l==null)return new Set;const u=JSON.parse(l);return Array.isArray(u)?new Set(u.filter(f=>typeof f=="string")):new Set}catch{return new Set}}),o=x.useCallback(l=>{r(u=>{const f=l(new Set(u));try{localStorage.setItem(t,JSON.stringify([...f]))}catch{}return f})},[t]);return[s,o]}function Yk(t,s=!1){const[r,o]=x.useState(()=>{try{const u=localStorage.getItem(t);return u==="1"?!0:u==="0"?!1:s}catch{return s}}),l=x.useCallback(u=>{o(u);try{localStorage.setItem(t,u?"1":"0")}catch{}},[t]);return[r,l]}async function vl(t){try{return await navigator.clipboard.writeText(t),!0}catch{try{const s=document.createElement("textarea");s.value=t,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const r=document.execCommand("copy");return document.body.removeChild(s),r}catch{return!1}}}function Xk(t){return t.origin_app_id!=null&&!t.user_touched&&!t.starred}const qu="(no directory)";function fr(t){return t.replaceAll("\\","/").replace(/\/+$/,"")}function Ku(t,s){if(!s||!t.cwd)return!1;const r=fr(t.cwd),o=fr(s);return r.startsWith(`${o}/`)}function Qk(t,s){const r=new Map;for(const f of s){const p=f.cwd||qu,g=r.get(p)??[];g.push(f),r.set(p,g)}const o=new Set,l=new Set(t.filter(f=>f.deleted===1).map(f=>f.path)),u=[];for(const f of t){if(f.deleted===1){o.add(f.path);continue}o.add(f.path),u.push({path:f.path,label:f.label||f.path.split("/").pop()||f.path,sessions:r.get(f.path)??[],workspace:f})}for(const[f,p]of r)o.has(f)||l.has(f)||u.push({path:f,label:f===qu?"Other":f.split("/").pop()||f,sessions:p,workspace:null});return u}function Zk(t,s,r){if(s.length===0)return!1;const o=new Set(t.filter(l=>l.deleted===1).map(l=>l.path));return s.some(l=>!Ku(l,r)&&!o.has(l.cwd||qu))}function yl(t){return[...t].sort((s,r)=>r.sort_order-s.sort_order||(s.created_at<r.created_at?1:-1))}function rm(t,s,r,o){const l=s.map(u=>({folder:u,sessions:t.sessions.filter(f=>f.folder_id===u.id),finishedKey:`folder:${u.id}:finished`,hidden:o.has(u.id)}));return l.push({folder:null,sessions:t.sessions.filter(u=>!(u.folder_id&&r.has(u.folder_id))),finishedKey:`${t.path}:finished`,hidden:!1}),l}function im(t,s){return{working:yl(t.sessions.filter(r=>r.lifecycle!=="finished")),finished:yl(t.sessions.filter(r=>r.lifecycle==="finished")),finishedCollapsed:s.has(t.finishedKey)}}function Wa(t,s){return t.folder_id&&s.has(t.folder_id)?t.folder_id:null}function Jk(t){const s=new Set(t.map(o=>o.name));if(!s.has("New Folder"))return"New Folder";let r=2;for(;s.has(`New Folder ${r}`);)r++;return`New Folder ${r}`}function om({id:t,children:s,className:r}){const{setNodeRef:o,isOver:l}=av({id:t});return a.jsx("div",{ref:o,className:`${r??""}${l?" drop-over":""}`,children:s})}function Nd({inputRef:t,value:s,onChange:r,onConfirm:o,onCancel:l}){return a.jsx("input",{ref:t,className:"tree-rename-input",value:s,onChange:u=>r(u.target.value),onClick:u=>u.stopPropagation(),onPointerDown:u=>u.stopPropagation(),onKeyDown:u=>{u.key==="Enter"&&o(),u.key==="Escape"&&l()},onBlur:o})}function eS({s:t,backgroundTaskCount:s,isActive:r,isSelected:o,originApp:l,renaming:u,renameValue:f,renameRef:p,onRenameValue:g,onRenameConfirm:m,onRenameCancel:v,onSelect:k,onCtxMenu:w,onToggleStar:S}){const{attributes:C,listeners:E,setNodeRef:T,transform:A,transition:_,isDragging:B}=pv({id:`s:${t.id}`}),I=El(t,s);return a.jsxs("div",{ref:T,style:{transform:zs.Transform.toString(A),transition:_},className:`tree-item ${r?"active":""}${o?" selected":""} ${I.isFinished?"tree-item-finished":""}${B?" dragging":""}${t.starred?" tree-item-starred":""}`,...C,...E,onClick:k,onContextMenu:w,children:[a.jsx(vd,{iconClass:I.iconClass,iconText:I.iconText,size:16}),l&&a.jsx("span",{className:"tree-app-badge",title:"Created by a mini app",children:a.jsx(bi,{iconNode:l.iconNode,size:10})}),u?a.jsx(Nd,{inputRef:p,value:f,onChange:g,onConfirm:m,onCancel:v}):a.jsx("span",{className:"tree-label",children:t.title||t.id.slice(0,8)}),!u&&a.jsx("button",{className:`star-btn${t.starred?" starred":""}`,title:t.starred?"Unstar session":"Star session",onClick:W=>{W.stopPropagation(),S()},onPointerDown:W=>W.stopPropagation(),children:a.jsx(ul,{size:10,fill:t.starred?"currentColor":"none"})}),I.dot&&a.jsx(gd,{status:I.dot,title:I.dotTitle})]})}function tS({folder:t,count:s,collapsed:r,renaming:o,renameValue:l,renameRef:u,onRenameValue:f,onRenameConfirm:p,onRenameCancel:g,onToggle:m,onCtxMenu:v,children:k}){const{attributes:w,listeners:S,setNodeRef:C,transform:E,transition:T,isDragging:A,over:_}=pv({id:`f:${t.id}`}),B=_!=null&&String(_.id).startsWith("s:");return a.jsxs("div",{ref:C,style:{transform:zs.Transform.toString(E),transition:T},className:`tree-folder ${r?"collapsed":""}${A?" dragging":""}`,children:[a.jsx("div",{className:`tree-folder-header${B?" drop-over":""}`,...w,...S,onClick:()=>{o||m()},onContextMenu:v,children:o?a.jsx(Nd,{inputRef:u,value:l,onChange:f,onConfirm:p,onCancel:g}):a.jsxs(a.Fragment,{children:[a.jsx(wi,{size:8,className:"tree-chevron"}),a.jsx(cl,{size:12}),a.jsx("span",{className:"tree-folder-label",children:t.name}),a.jsx("span",{className:"tree-count",children:s})]})}),!r&&a.jsx("div",{className:"tree-folder-children",children:k})]})}function nS(){const t=M(R=>R.sessions),s=M(R=>R.backgroundTasks),r=M(R=>R.workspaces),o=M(R=>R.folders),l=M(R=>R.activeSessionId),u=M(R=>R.selectSession),f=M(R=>R.deleteSession),p=M(R=>R.removeWorkspace),g=M(R=>R.createSessionInWorkspace),m=M(R=>R.pickAndAddWorkspace),v=M(R=>R.setImportSessionsWorkspace),k=M(R=>R.renameSession),w=M(R=>R.markFinished),S=M(R=>R.markFinishedMany),C=M(R=>R.toggleStar),E=M(R=>R.reopenSession),T=M(R=>R.reopenSessionMany),A=M(R=>R.deleteSessionMany),_=M(R=>R.createSidebarFolder),B=M(R=>R.renameFolder),I=M(R=>R.deleteFolder),W=M(R=>R.applyMoves),Y=M(R=>R.reorderFolders),K=M(R=>R.apps),F=M(R=>R.appsRootPath),re=M(R=>R.activeAppTabId),he=M(R=>R.openAppTab),G=M(R=>R.startAppEdit),Ne=M(R=>R.toggleAppPin),Se=M(R=>R.deleteApp),Pe=M(R=>R.openAppCatalog),[te,oe]=Ba("agentpane:sidebar-ws-collapsed"),[ae,O]=Ba("agentpane:sidebar-sub-collapsed"),[Q,U]=Ba("agentpane:sidebar-folders-collapsed"),[j,P]=Ba("agentpane:sidebar-app-edits-collapsed"),[ne,de]=Yk("agentpane:sidebar-hide-auto-sessions"),[X,fe]=x.useState(null),[be,Ee]=x.useState(null),[Re,Ce]=x.useState(""),[at,De]=x.useState(null),[lt,$e]=x.useState(new Set),[en,Fe]=x.useState(null),Ht=x.useRef(null),tn=x.useRef(null),wt=x.useRef(null),jt=x.useRef(!1),$t=x1(y1(bd,{activationConstraint:{distance:5}}));function Mt(){$e(new Set),Fe(null)}_l(Ht,()=>fe(null),!!X),Eo(()=>{fe(null),Mt()},!!X||lt.size>0),x.useLayoutEffect(()=>{const R=Ht.current;if(!X||!R)return;const ue=8,{offsetWidth:ie,offsetHeight:ve}=R,Me=X.x+ie>window.innerWidth-ue?Math.max(ue,X.x-ie):X.x,Ge=X.y+ve>window.innerHeight-ue?Math.max(ue,X.y-ve):X.y;R.style.left=`${Me}px`,R.style.top=`${Ge}px`},[X]);const q=x.useMemo(()=>new Map(t.map(R=>[R.id,R])),[t]),pe=x.useMemo(()=>new Map(o.map(R=>[R.id,R])),[o]),Ue=x.useMemo(()=>{const R=new Map;for(const ue of[...o].sort((ie,ve)=>ie.sort_order-ve.sort_order)){const ie=R.get(ue.workspace_path)??[];ie.push(ue),R.set(ue.workspace_path,ie)}return R},[o]);function tt(R){oe(ue=>{const ie=new Set(ue);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function mt(R){O(ue=>{const ie=new Set(ue);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function gt(R){U(ue=>{const ie=new Set(ue);return ie.has(R)?ie.delete(R):ie.add(R),ie})}function Ct(){de(!ne),Mt()}function an(R){P(ue=>{const ie=new Set(ue);return ie.has(R)?ie.delete(R):ie.add(R),ie})}x.useEffect(()=>{be&&tn.current&&(tn.current.focus(),tn.current.select())},[be]),x.useEffect(()=>{var R,ue,ie;jt.current||!l||(jt.current=!0,(ie=(ue=(R=wt.current)==null?void 0:R.querySelector(".tree-item.active, .sidebar-app-edit-row.active"))==null?void 0:ue.scrollIntoView)==null||ie.call(ue,{block:"nearest"}))},[l]);function dt(R,ue,ie,ve=""){Ee({kind:R,id:ue}),Ce(ie||ve)}function Dn(){if(be){const R=Re.trim();R&&(be.kind==="session"?k(be.id,R):B(be.id,R))}Ee(null)}function Mn(){Ee(null),Ce("")}async function ps(R){const ue=Jk(Ue.get(R)??[]),ie=await _(R,ue);ie&&dt("folder",ie.id,ie.name)}function hs(R){const ue=String(R.active.id);if(ue.startsWith("s:")){const ie=q.get(ue.slice(2));ie&&De({kind:"session",label:ie.title||ie.id.slice(0,8)})}else if(ue.startsWith("f:")){const ie=pe.get(ue.slice(2));ie&&De({kind:"folder",label:ie.name})}}function ts(R){De(null);const{active:ue,over:ie}=R;if(!ie)return;const ve=String(ue.id),Me=String(ie.id);if(ve.startsWith("s:")){const Ge=q.get(ve.slice(2));if(!Ge)return;const Le=Ge.cwd||"(no directory)",zt=Wa(Ge,pe);let Pn,Be;if(Me.startsWith("f:")){const Qe=pe.get(Me.slice(2));if(!Qe)return;Pn=Qe.workspace_path,Be=Qe.id}else if(Me.startsWith("s:")){const Qe=q.get(Me.slice(2));if(!Qe)return;Pn=Qe.cwd||"(no directory)",Be=Wa(Qe,pe)}else if(Me.startsWith("c:")){const Qe=Me.slice(2),_t=Qe.lastIndexOf("|");Pn=Qe.slice(0,_t);const gs=Qe.slice(_t+1);Be=gs==="root"?null:gs}else return;if(Pn!==Le)return;const xn=yl(t.filter(Qe=>(Qe.cwd||"(no directory)")===Pn&&Wa(Qe,pe)===Be)),js=xn.filter(Qe=>Qe.id!==Ge.id);let Us=js.length;if(Me.startsWith("s:")){const Qe=js.findIndex(_t=>_t.id===Me.slice(2));Qe>=0&&(Us=Qe)}const On=[...js.slice(0,Us),Ge,...js.slice(Us)],ms=[];if(Be===zt){if(On.length===xn.length&&On.every((Qe,_t)=>Qe.id===xn[_t].id))return;On.forEach((Qe,_t)=>ms.push({id:Qe.id,folder_id:Be,sort_order:On.length-1-_t}))}else{const Qe=yl(t.filter(_t=>(_t.cwd||"(no directory)")===Le&&Wa(_t,pe)===zt)).filter(_t=>_t.id!==Ge.id);Qe.forEach((_t,gs)=>ms.push({id:_t.id,folder_id:zt,sort_order:Qe.length-1-gs})),On.forEach((_t,gs)=>ms.push({id:_t.id,folder_id:Be,sort_order:On.length-1-gs}))}W(ms);return}if(ve.startsWith("f:")){if(!Me.startsWith("f:"))return;const Ge=pe.get(ve.slice(2)),Le=pe.get(Me.slice(2));if(!Ge||!Le||Ge.id===Le.id||Ge.workspace_path!==Le.workspace_path)return;const zt=(Ue.get(Ge.workspace_path)??[]).map(xn=>xn.id),Pn=zt.indexOf(Ge.id),Be=zt.indexOf(Le.id);zt.splice(Be,0,...zt.splice(Pn,1)),Y(zt)}}const Ln=F?t.filter(R=>!Ku(R,F)):t,vn=new Set(ne?Ln.filter(R=>Xk(R)&&R.id!==l).map(R=>R.id):[]),ln=Qk(r,vn.size>0?Ln.filter(R=>!vn.has(R.id)):Ln),Vt=x.useMemo(()=>{const R=new Map;if(!F)return R;const ue=fr(F);for(const ie of t){if(!Ku(ie,F))continue;const ve=fr(ie.cwd).slice(ue.length+1).split("/")[0],Me=R.get(ve)??[];Me.push(ie),R.set(ve,Me)}return R},[t,F]);function yn(R){return{folder:null,sessions:Vt.get(R)??[],finishedKey:`app:${R}:finished`,hidden:j.has(R)}}const Xe=[],Et=R=>{if(R.hidden)return;const{working:ue,finished:ie,finishedCollapsed:ve}=im(R,ae);Xe.push(...ue.map(Me=>Me.id)),ve||Xe.push(...ie.map(Me=>Me.id))};for(const R of ln){if(te.has(R.path))continue;const ue=Ue.get(R.path)??[],ie=new Set(ue.map(ve=>ve.id));rm(R,ue,ie,Q).forEach(Et)}K.forEach(R=>Et(yn(R.id)));const ft=t.filter(R=>lt.has(R.id)),Gt=ft.filter(R=>R.lifecycle!=="finished").map(R=>R.id),vt=ft.filter(R=>R.lifecycle==="finished").map(R=>R.id);function yt(R,ue){if(ue.metaKey||ue.ctrlKey){ue.preventDefault(),Fe(R.id),$e(ie=>{const ve=new Set(ie);return ve.has(R.id)?ve.delete(R.id):ve.add(R.id),ve});return}if(ue.shiftKey){ue.preventDefault();const ie=en??R.id;Fe(ie);const ve=Xe.indexOf(ie),Me=Xe.indexOf(R.id);if(ve>=0&&Me>=0){const[Ge,Le]=ve<Me?[ve,Me]:[Me,ve];$e(new Set(Xe.slice(Ge,Le+1)))}return}Mt(),Fe(R.id),u(R.id)}function it(R,ue){ue.preventDefault();const ie=lt.has(R.id)&<.size>1;lt.has(R.id)||($e(new Set),Fe(R.id)),fe({x:ue.clientX,y:ue.clientY,type:"session",sessionId:R.id,sessionTitle:R.title,sessionLifecycle:R.lifecycle,sessionExternalId:R.external_thread_id,multi:ie})}function qt(R){var ie;const ue=R.origin_app_id?K.find(ve=>ve.id===R.origin_app_id):null;return a.jsx(eS,{s:R,backgroundTaskCount:((ie=s[R.id])==null?void 0:ie.length)??0,isActive:l===R.id,isSelected:lt.has(R.id),originApp:ue??null,renaming:(be==null?void 0:be.kind)==="session"&&be.id===R.id,renameValue:Re,renameRef:tn,onRenameValue:Ce,onRenameConfirm:Dn,onRenameCancel:Mn,onSelect:ve=>yt(R,ve),onToggleStar:()=>C(R.id),onCtxMenu:ve=>it(R,ve)},R.id)}function st(R){var ie;const ue=El(R,((ie=s[R.id])==null?void 0:ie.length)??0);return a.jsxs("div",{className:`sidebar-app-edit-row${l===R.id?" active":""}${lt.has(R.id)?" selected":""}${ue.isFinished?" tree-item-finished":""}`,title:"App edit session — click to open",onClick:ve=>yt(R,ve),onContextMenu:ve=>it(R,ve),children:[a.jsx(vd,{iconClass:ue.iconClass,iconText:ue.iconText,size:14}),(be==null?void 0:be.kind)==="session"&&be.id===R.id?a.jsx(Nd,{inputRef:tn,value:Re,onChange:Ce,onConfirm:Dn,onCancel:Mn}):a.jsx("span",{className:"tree-label",children:R.title||R.id.slice(0,8)}),ue.dot&&a.jsx(gd,{status:ue.dot,title:ue.dotTitle})]},R.id)}function Lt(R,ue="workspace"){const{working:ie,finished:ve,finishedCollapsed:Me}=im(R,ae),Ge=ue==="workspace"?qt:st,Le=a.jsxs(a.Fragment,{children:[ie.length===0&&ve.length===0?a.jsx("div",{className:"tree-empty",children:"No sessions"}):ie.map(Ge),ve.length>0&&a.jsxs("div",{className:`tree-subgroup ${Me?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-subgroup-header",onClick:()=>mt(R.finishedKey),children:[a.jsx(wi,{size:8,className:"tree-chevron"}),a.jsx("span",{className:"tree-subgroup-label",children:"Finished"}),a.jsx("span",{className:"tree-subgroup-count",children:ve.length})]}),!Me&&a.jsx("div",{className:"tree-subgroup-items",children:ve.map(Ge)})]})]});if(ue==="app")return Le;const zt=[...ie,...ve].map(Pn=>`s:${Pn.id}`);return a.jsx(sm,{items:zt,strategy:nm,children:Le})}return a.jsxs("div",{className:"ide-sidebar",ref:wt,children:[a.jsxs("div",{className:"sidebar-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Workspaces"}),a.jsxs("div",{className:"sidebar-header-actions",children:[a.jsx("button",{className:`sidebar-add sidebar-filter${ne?" active":""}`,title:ne?`Show automatic sessions (${vn.size} hidden)`:"Hide automatic sessions — the ones mini apps run on their own. Sessions you message, stop, rewind, rename or star stay visible.","aria-label":ne?"Show automatic sessions":"Hide automatic sessions","aria-pressed":ne,onClick:Ct,children:ne?a.jsx(xw,{size:14}):a.jsx(hr,{size:14})}),a.jsx("button",{className:"sidebar-add",title:"Add workspace",onClick:()=>m(),children:a.jsx(dr,{size:14})})]})]}),a.jsxs(xk,{sensors:$t,collisionDetection:N1,onDragStart:hs,onDragEnd:ts,children:[ln.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No workspaces yet. Click + to add one."}):ln.map(R=>{const ue=te.has(R.path),ie=Ue.get(R.path)??[],ve=new Set(ie.map(Le=>Le.id)),Me=rm(R,ie,ve,Q),Ge=Me[Me.length-1];return a.jsxs("div",{className:`tree-section ${ue?"collapsed":""}`,children:[a.jsxs("div",{className:"tree-section-header",onClick:()=>tt(R.path),onContextMenu:Le=>{Le.preventDefault(),fe({x:Le.clientX,y:Le.clientY,type:"workspace",path:R.path})},children:[a.jsx(wi,{size:9,className:"tree-chevron"}),a.jsx(cl,{size:14}),a.jsx("span",{className:"tree-section-label",children:R.label}),a.jsx("button",{className:"tree-section-add",title:"New session in this workspace",onClick:Le=>{Le.stopPropagation(),g(R.path)},children:a.jsx(dr,{size:11})}),a.jsx("button",{className:"tree-section-add",title:"New folder in this workspace",onClick:Le=>{Le.stopPropagation(),ps(R.path)},children:a.jsx(Cu,{size:11})}),a.jsx("span",{className:"tree-count",children:R.sessions.length})]}),!ue&&a.jsxs("div",{className:"tree-children",children:[a.jsx(sm,{items:ie.map(Le=>`f:${Le.id}`),strategy:nm,children:Me.filter(Le=>Le.folder).map(Le=>a.jsx(tS,{folder:Le.folder,count:Le.sessions.length,collapsed:Le.hidden,renaming:(be==null?void 0:be.kind)==="folder"&&be.id===Le.folder.id,renameValue:Re,renameRef:tn,onRenameValue:Ce,onRenameConfirm:Dn,onRenameCancel:Mn,onToggle:()=>gt(Le.folder.id),onCtxMenu:zt=>{zt.preventDefault(),fe({x:zt.clientX,y:zt.clientY,type:"folder",folderId:Le.folder.id,folderName:Le.folder.name})},children:a.jsx(om,{id:`c:${R.path}|${Le.folder.id}`,children:Lt(Le)})},Le.folder.id))}),a.jsx(om,{id:`c:${R.path}|root`,children:Lt(Ge)})]})]},R.path)}),a.jsx(Ok,{children:at&&a.jsxs("div",{className:"drag-overlay",children:[at.kind==="folder"&&a.jsx(cl,{size:12}),a.jsx("span",{children:at.label})]})})]}),a.jsxs("div",{className:"sidebar-apps",children:[a.jsxs("div",{className:"sidebar-header sidebar-apps-header",children:[a.jsx("span",{className:"sidebar-header-title",children:"Apps"}),a.jsx("button",{className:"sidebar-add",title:"Add mini app",onClick:()=>Pe(),children:a.jsx(dr,{size:14})})]}),K.length===0&&a.jsx("div",{className:"tree-empty",children:"No apps yet"}),K.map(R=>{const ue=yn(R.id),ie=ue.sessions.length>0&&!ue.hidden;return a.jsxs("div",{className:"sidebar-app-block",children:[a.jsxs("div",{className:`sidebar-app-row${re===R.id?" active":""}`,title:R.description??void 0,onClick:()=>he(R.id),onContextMenu:ve=>{ve.preventDefault(),fe({x:ve.clientX,y:ve.clientY,type:"app",appId:R.id,appPinned:R.pinned})},children:[ue.sessions.length>0&&a.jsx("button",{className:`sidebar-app-chevron${ie?"":" closed"}`,title:"Edit sessions of this app",onClick:ve=>{ve.stopPropagation(),an(R.id)},children:a.jsx(wi,{size:10,className:"tree-chevron"})}),a.jsx(bi,{iconNode:R.iconNode,size:14,className:"sidebar-app-icon"}),a.jsx("span",{className:"tree-label",children:R.title}),ue.sessions.length>0&&a.jsx("span",{className:"sidebar-app-count",children:ue.sessions.length}),R.pinned&&a.jsx(ul,{size:10,className:"sidebar-app-pin",fill:"currentColor"})]}),ie&&a.jsx("div",{className:"sidebar-app-edits",children:Lt(ue,"app")})]},R.id)})]}),a.jsxs("div",{className:"sidebar-footer",onClick:()=>m(),children:[a.jsx(Cu,{size:14}),a.jsx("span",{children:"Add workspace"})]}),X&&a.jsxs("div",{ref:Ht,className:"ctx-menu",style:{position:"fixed",left:X.x,top:X.y,zIndex:500},children:[X.type==="workspace"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{g(X.path),fe(null)},children:[a.jsx(dr,{size:12})," New Session"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{ps(X.path),fe(null)},children:[a.jsx(Cu,{size:12})," New Folder"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{v(X.path),fe(null)},children:[a.jsx(Ig,{size:12})," Import Claude Code Sessions…"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{p(X.path),fe(null)},children:[a.jsx(us,{size:12})," Hide Workspace"]})]}),X.type==="folder"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("folder",X.folderId,X.folderName??""),fe(null)},children:[a.jsx(Qa,{size:12})," Rename Folder"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{I(X.folderId),fe(null)},children:[a.jsx(us,{size:12})," Delete Folder"]})]}),X.type==="session"&&!X.multi&&a.jsx(a.Fragment,{children:X.sessionLifecycle!=="finished"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{dt("session",X.sessionId,X.sessionTitle??""),fe(null)},children:[a.jsx(Qa,{size:12})," Rename"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{w(X.sessionId),fe(null)},children:[a.jsx(al,{size:12})," Mark as Finished"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(vl(X.sessionExternalId),fe(null))},children:[a.jsx(ll,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(X.sessionId),fe(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{E(X.sessionId),fe(null)},children:[a.jsx(To,{size:12})," Reopen"]}),a.jsxs("div",{className:`ctx-menu-item${X.sessionExternalId?"":" ctx-disabled"}`,title:X.sessionExternalId?void 0:"Session not started",onClick:()=>{X.sessionExternalId&&(vl(X.sessionExternalId),fe(null))},children:[a.jsx(ll,{size:12})," Copy Session ID"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{f(X.sessionId),fe(null)},children:[a.jsx(us,{size:12})," Delete Session"]})]})}),X.type==="session"&&X.multi&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-header",children:[ft.length," sessions selected"]}),Gt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{S(Gt),fe(null),Mt()},children:[a.jsx(al,{size:12})," Mark ",Gt.length," as Finished"]}),vt.length>0&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{T(vt),fe(null),Mt()},children:[a.jsx(To,{size:12})," Reopen ",vt.length]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{A([...lt]),fe(null),Mt()},children:[a.jsx(us,{size:12})," Delete ",ft.length," Sessions"]})]}),X.type==="app"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{G(X.appId),fe(null)},children:[a.jsx(Qa,{size:12})," Edit App"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{Ne(X.appId),fe(null)},children:[a.jsx(ul,{size:12})," ",X.appPinned?"Unpin":"Pin"]}),a.jsxs("div",{className:"ctx-menu-item ctx-danger",onClick:()=>{Se(X.appId),fe(null)},children:[a.jsx(us,{size:12})," Delete App"]})]})]})]})}function sS(){const t=M(S=>S.openTabs),s=M(S=>S.activeSessionId),r=M(S=>S.sessions),o=M(S=>S.backgroundTasks),l=M(S=>S.selectSession),u=M(S=>S.closeTab),f=M(S=>S.setShowNewSessionDialog),p=M(S=>S.apps),g=M(S=>S.openAppTabs),m=M(S=>S.activeAppTabId),v=M(S=>S.openAppTab),k=M(S=>S.closeAppTab),w=M(S=>S.setActiveAppTab);return a.jsxs("div",{className:"ide-tabs",children:[t.map(S=>{var A;const C=r.find(_=>_.id===S);if(!C)return null;const E=El(C,((A=o[S])==null?void 0:A.length)??0),T=s===S&&m==null;return a.jsxs("div",{className:`ide-tab ${T?"active":""}`,onClick:()=>{m!=null&&w(null),l(S)},children:[a.jsx(vd,{iconClass:E.iconClass,iconText:E.iconText,size:14}),C.title||S.slice(0,8),E.dot&&a.jsx(gd,{status:E.dot,title:E.dotTitle}),a.jsx("span",{className:"ide-tab-close",onClick:_=>{_.stopPropagation(),u(S)},children:a.jsx(gn,{size:12})})]},S)}),g.map(S=>{const C=p.find(T=>T.id===S),E=m===S;return a.jsxs("div",{className:`ide-tab ${E?"active":""}`,onClick:()=>v(S),children:[a.jsx(bi,{iconNode:C==null?void 0:C.iconNode,size:12,className:"miniapp-tab-icon"}),(C==null?void 0:C.title)??S,a.jsx("span",{className:"ide-tab-close",onClick:T=>{T.stopPropagation(),k(S)},children:a.jsx(gn,{size:12})})]},S)}),a.jsx("div",{className:"ide-tab-add",title:"New Session",onClick:()=>f(!0),children:a.jsx(dr,{size:14})})]})}function jd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var $r=jd();function hv(t){$r=t}var xo={exec:()=>null};function nt(t,s=""){let r=typeof t=="string"?t:t.source;const o={replace:(l,u)=>{let f=typeof u=="string"?u:u.source;return f=f.replace(Tn.caret,"$1"),r=r.replace(l,f),o},getRegex:()=>new RegExp(r,s)};return o}var Tn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},rS=/^(?:[ \t]*(?:\n|$))+/,iS=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,oS=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Mo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,aS=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Cd=/(?:[*+-]|\d{1,9}[.)])/,mv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,gv=nt(mv).replace(/bull/g,Cd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),lS=nt(mv).replace(/bull/g,Cd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ed=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,cS=/^[^\n]+/,_d=/(?!\s*\])(?:\\.|[^\[\]\\])+/,uS=nt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",_d).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),dS=nt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Cd).getRegex(),Pl="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Rd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,fS=nt("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Rd).replace("tag",Pl).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vv=nt(Ed).replace("hr",Mo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pl).getRegex(),pS=nt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",vv).getRegex(),Ad={blockquote:pS,code:iS,def:uS,fences:oS,heading:aS,hr:Mo,html:fS,lheading:gv,list:dS,newline:rS,paragraph:vv,table:xo,text:cS},am=nt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Mo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pl).getRegex(),hS={...Ad,lheading:lS,table:am,paragraph:nt(Ed).replace("hr",Mo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",am).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pl).getRegex()},mS={...Ad,html:nt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Rd).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:xo,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:nt(Ed).replace("hr",Mo).replace("heading",` *#{1,6} *[^
|
|
424
|
+
]`).replace("lheading",gv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},gS=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,vS=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,yv=/^( {2,}|\\)\n(?!\s*$)/,yS=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ol=/[\p{P}\p{S}]/u,Id=/[\s\p{P}\p{S}]/u,xv=/[^\s\p{P}\p{S}]/u,xS=nt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Id).getRegex(),wv=/(?!~)[\p{P}\p{S}]/u,wS=/(?!~)[\s\p{P}\p{S}]/u,kS=/(?:[^\s\p{P}\p{S}]|~)/u,SS=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,kv=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,bS=nt(kv,"u").replace(/punct/g,Ol).getRegex(),TS=nt(kv,"u").replace(/punct/g,wv).getRegex(),Sv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",NS=nt(Sv,"gu").replace(/notPunctSpace/g,xv).replace(/punctSpace/g,Id).replace(/punct/g,Ol).getRegex(),jS=nt(Sv,"gu").replace(/notPunctSpace/g,kS).replace(/punctSpace/g,wS).replace(/punct/g,wv).getRegex(),CS=nt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,xv).replace(/punctSpace/g,Id).replace(/punct/g,Ol).getRegex(),ES=nt(/\\(punct)/,"gu").replace(/punct/g,Ol).getRegex(),_S=nt(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),RS=nt(Rd).replace("(?:-->|$)","-->").getRegex(),AS=nt("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",RS).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),xl=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,IS=nt(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",xl).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),bv=nt(/^!?\[(label)\]\[(ref)\]/).replace("label",xl).replace("ref",_d).getRegex(),Tv=nt(/^!?\[(ref)\](?:\[\])?/).replace("ref",_d).getRegex(),DS=nt("reflink|nolink(?!\\()","g").replace("reflink",bv).replace("nolink",Tv).getRegex(),Dd={_backpedal:xo,anyPunctuation:ES,autolink:_S,blockSkip:SS,br:yv,code:vS,del:xo,emStrongLDelim:bS,emStrongRDelimAst:NS,emStrongRDelimUnd:CS,escape:gS,link:IS,nolink:Tv,punctuation:xS,reflink:bv,reflinkSearch:DS,tag:AS,text:yS,url:xo},MS={...Dd,link:nt(/^!?\[(label)\]\((.*?)\)/).replace("label",xl).getRegex(),reflink:nt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xl).getRegex()},Yu={...Dd,emStrongRDelimAst:jS,emStrongLDelim:TS,url:nt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},LS={...Yu,br:nt(yv).replace("{2,}","*").getRegex(),text:nt(Yu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ha={normal:Ad,gfm:hS,pedantic:mS},ao={normal:Dd,gfm:Yu,breaks:LS,pedantic:MS},PS={"&":"&","<":"<",">":">",'"':""","'":"'"},lm=t=>PS[t];function bs(t,s){if(s){if(Tn.escapeTest.test(t))return t.replace(Tn.escapeReplace,lm)}else if(Tn.escapeTestNoEncode.test(t))return t.replace(Tn.escapeReplaceNoEncode,lm);return t}function cm(t){try{t=encodeURI(t).replace(Tn.percentDecode,"%")}catch{return null}return t}function um(t,s){var u;const r=t.replace(Tn.findPipe,(f,p,g)=>{let m=!1,v=p;for(;--v>=0&&g[v]==="\\";)m=!m;return m?"|":" |"}),o=r.split(Tn.splitPipe);let l=0;if(o[0].trim()||o.shift(),o.length>0&&!((u=o.at(-1))!=null&&u.trim())&&o.pop(),s)if(o.length>s)o.splice(s);else for(;o.length<s;)o.push("");for(;l<o.length;l++)o[l]=o[l].trim().replace(Tn.slashPipe,"|");return o}function lo(t,s,r){const o=t.length;if(o===0)return"";let l=0;for(;l<o&&t.charAt(o-l-1)===s;)l++;return t.slice(0,o-l)}function OS(t,s){if(t.indexOf(s[1])===-1)return-1;let r=0;for(let o=0;o<t.length;o++)if(t[o]==="\\")o++;else if(t[o]===s[0])r++;else if(t[o]===s[1]&&(r--,r<0))return o;return r>0?-2:-1}function dm(t,s,r,o,l){const u=s.href,f=s.title||null,p=t[1].replace(l.other.outputLinkReplace,"$1");o.state.inLink=!0;const g={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:u,title:f,text:p,tokens:o.inlineTokens(p)};return o.state.inLink=!1,g}function $S(t,s,r){const o=t.match(r.other.indentCodeCompensation);if(o===null)return s;const l=o[1];return s.split(`
|
|
425
425
|
`).map(u=>{const f=u.match(r.other.beginningSpace);if(f===null)return u;const[p]=f;return p.length>=l.length?u.slice(l.length):u}).join(`
|
|
426
426
|
`)}var wl=class{constructor(t){rt(this,"options");rt(this,"rules");rt(this,"lexer");this.options=t||$r}space(t){const s=this.rules.block.newline.exec(t);if(s&&s[0].length>0)return{type:"space",raw:s[0]}}code(t){const s=this.rules.block.code.exec(t);if(s){const r=s[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s[0],codeBlockStyle:"indented",text:this.options.pedantic?r:lo(r,`
|
|
427
|
-
`)}}}fences(t){const s=this.rules.block.fences.exec(t);if(s){const r=s[0],o
|
|
427
|
+
`)}}}fences(t){const s=this.rules.block.fences.exec(t);if(s){const r=s[0],o=$S(r,s[3]||"",this.rules);return{type:"code",raw:r,lang:s[2]?s[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):s[2],text:o}}}heading(t){const s=this.rules.block.heading.exec(t);if(s){let r=s[2].trim();if(this.rules.other.endingHash.test(r)){const o=lo(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:s[0],depth:s[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const s=this.rules.block.hr.exec(t);if(s)return{type:"hr",raw:lo(s[0],`
|
|
428
428
|
`)}}blockquote(t){const s=this.rules.block.blockquote.exec(t);if(s){let r=lo(s[0],`
|
|
429
429
|
`).split(`
|
|
430
430
|
`),o="",l="";const u=[];for(;r.length>0;){let f=!1;const p=[];let g;for(g=0;g<r.length;g++)if(this.rules.other.blockquoteStart.test(r[g]))p.push(r[g]),f=!0;else if(!f)p.push(r[g]);else break;r=r.slice(g);const m=p.join(`
|
|
@@ -445,7 +445,7 @@ ${v}`:v;const k=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.block
|
|
|
445
445
|
`+w}!S&&!w.trim()&&(S=!0),m+=Y+`
|
|
446
446
|
`,t=t.substring(Y.length+1),k=K.slice(C)}}l.loose||(f?l.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(f=!0));let E=null,T;this.options.gfm&&(E=this.rules.other.listIsTask.exec(v),E&&(T=E[0]!=="[ ] ",v=v.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:m,task:!!E,checked:T,loose:!1,text:v,tokens:[]}),l.raw+=m}const p=l.items.at(-1);if(p)p.raw=p.raw.trimEnd(),p.text=p.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let g=0;g<l.items.length;g++)if(this.lexer.state.top=!1,l.items[g].tokens=this.lexer.blockTokens(l.items[g].text,[]),!l.loose){const m=l.items[g].tokens.filter(k=>k.type==="space"),v=m.length>0&&m.some(k=>this.rules.other.anyLine.test(k.raw));l.loose=v}if(l.loose)for(let g=0;g<l.items.length;g++)l.items[g].loose=!0;return l}}html(t){const s=this.rules.block.html.exec(t);if(s)return{type:"html",block:!0,raw:s[0],pre:s[1]==="pre"||s[1]==="script"||s[1]==="style",text:s[0]}}def(t){const s=this.rules.block.def.exec(t);if(s){const r=s[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=s[2]?s[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=s[3]?s[3].substring(1,s[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):s[3];return{type:"def",tag:r,raw:s[0],href:o,title:l}}}table(t){var f;const s=this.rules.block.table.exec(t);if(!s||!this.rules.other.tableDelimiter.test(s[2]))return;const r=um(s[1]),o=s[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(f=s[3])!=null&&f.trim()?s[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
447
447
|
`):[],u={type:"table",raw:s[0],header:[],align:[],rows:[]};if(r.length===o.length){for(const p of o)this.rules.other.tableAlignRight.test(p)?u.align.push("right"):this.rules.other.tableAlignCenter.test(p)?u.align.push("center"):this.rules.other.tableAlignLeft.test(p)?u.align.push("left"):u.align.push(null);for(let p=0;p<r.length;p++)u.header.push({text:r[p],tokens:this.lexer.inline(r[p]),header:!0,align:u.align[p]});for(const p of l)u.rows.push(um(p,u.header.length).map((g,m)=>({text:g,tokens:this.lexer.inline(g),header:!1,align:u.align[m]})));return u}}lheading(t){const s=this.rules.block.lheading.exec(t);if(s)return{type:"heading",raw:s[0],depth:s[2].charAt(0)==="="?1:2,text:s[1],tokens:this.lexer.inline(s[1])}}paragraph(t){const s=this.rules.block.paragraph.exec(t);if(s){const r=s[1].charAt(s[1].length-1)===`
|
|
448
|
-
`?s[1].slice(0,-1):s[1];return{type:"paragraph",raw:s[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const s=this.rules.block.text.exec(t);if(s)return{type:"text",raw:s[0],text:s[0],tokens:this.lexer.inline(s[0])}}escape(t){const s=this.rules.inline.escape.exec(t);if(s)return{type:"escape",raw:s[0],text:s[1]}}tag(t){const s=this.rules.inline.tag.exec(t);if(s)return!this.lexer.state.inLink&&this.rules.other.startATag.test(s[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(s[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(s[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(s[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:s[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:s[0]}}link(t){const s=this.rules.inline.link.exec(t);if(s){const r=s[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const u=lo(r.slice(0,-1),"\\");if((r.length-u.length)%2===0)return}else{const u=
|
|
448
|
+
`?s[1].slice(0,-1):s[1];return{type:"paragraph",raw:s[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const s=this.rules.block.text.exec(t);if(s)return{type:"text",raw:s[0],text:s[0],tokens:this.lexer.inline(s[0])}}escape(t){const s=this.rules.inline.escape.exec(t);if(s)return{type:"escape",raw:s[0],text:s[1]}}tag(t){const s=this.rules.inline.tag.exec(t);if(s)return!this.lexer.state.inLink&&this.rules.other.startATag.test(s[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(s[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(s[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(s[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:s[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:s[0]}}link(t){const s=this.rules.inline.link.exec(t);if(s){const r=s[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const u=lo(r.slice(0,-1),"\\");if((r.length-u.length)%2===0)return}else{const u=OS(s[2],"()");if(u===-2)return;if(u>-1){const p=(s[0].indexOf("!")===0?5:4)+s[1].length+u;s[2]=s[2].substring(0,u),s[0]=s[0].substring(0,p).trim(),s[3]=""}}let o=s[2],l="";if(this.options.pedantic){const u=this.rules.other.pedanticHrefTitle.exec(o);u&&(o=u[1],l=u[3])}else l=s[3]?s[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),dm(s,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},s[0],this.lexer,this.rules)}}reflink(t,s){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=s[o.toLowerCase()];if(!l){const u=r[0].charAt(0);return{type:"text",raw:u,text:u}}return dm(r,l,r[0],this.lexer,this.rules)}}emStrong(t,s,r=""){let o=this.rules.inline.emStrongLDelim.exec(t);if(!o||o[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(o[1]||o[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const u=[...o[0]].length-1;let f,p,g=u,m=0;const v=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(v.lastIndex=0,s=s.slice(-1*t.length+u);(o=v.exec(s))!=null;){if(f=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!f)continue;if(p=[...f].length,o[3]||o[4]){g+=p;continue}else if((o[5]||o[6])&&u%3&&!((u+p)%3)){m+=p;continue}if(g-=p,g>0)continue;p=Math.min(p,p+g+m);const k=[...o[0]][0].length,w=t.slice(0,u+o.index+k+p);if(Math.min(u,p)%2){const C=w.slice(1,-1);return{type:"em",raw:w,text:C,tokens:this.lexer.inlineTokens(C)}}const S=w.slice(2,-2);return{type:"strong",raw:w,text:S,tokens:this.lexer.inlineTokens(S)}}}}codespan(t){const s=this.rules.inline.code.exec(t);if(s){let r=s[2].replace(this.rules.other.newLineCharGlobal," ");const o=this.rules.other.nonSpaceChar.test(r),l=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&l&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:s[0],text:r}}}br(t){const s=this.rules.inline.br.exec(t);if(s)return{type:"br",raw:s[0]}}del(t){const s=this.rules.inline.del.exec(t);if(s)return{type:"del",raw:s[0],text:s[2],tokens:this.lexer.inlineTokens(s[2])}}autolink(t){const s=this.rules.inline.autolink.exec(t);if(s){let r,o;return s[2]==="@"?(r=s[1],o="mailto:"+r):(r=s[1],o=r),{type:"link",raw:s[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let s;if(s=this.rules.inline.url.exec(t)){let o,l;if(s[2]==="@")o=s[0],l="mailto:"+o;else{let u;do u=s[0],s[0]=((r=this.rules.inline._backpedal.exec(s[0]))==null?void 0:r[0])??"";while(u!==s[0]);o=s[0],s[1]==="www."?l="http://"+s[0]:l=s[0]}return{type:"link",raw:s[0],text:o,href:l,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(t){const s=this.rules.inline.text.exec(t);if(s){const r=this.lexer.state.inRawBlock;return{type:"text",raw:s[0],text:s[0],escaped:r}}}},Os=class Xu{constructor(s){rt(this,"tokens");rt(this,"options");rt(this,"state");rt(this,"tokenizer");rt(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=s||$r,this.options.tokenizer=this.options.tokenizer||new wl,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:Tn,block:Ha.normal,inline:ao.normal};this.options.pedantic?(r.block=Ha.pedantic,r.inline=ao.pedantic):this.options.gfm&&(r.block=Ha.gfm,this.options.breaks?r.inline=ao.breaks:r.inline=ao.gfm),this.tokenizer.rules=r}static get rules(){return{block:Ha,inline:ao}}static lex(s,r){return new Xu(r).lex(s)}static lexInline(s,r){return new Xu(r).inlineTokens(s)}lex(s){s=s.replace(Tn.carriageReturn,`
|
|
449
449
|
`),this.blockTokens(s,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const o=this.inlineQueue[r];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(s,r=[],o=!1){var l,u,f;for(this.options.pedantic&&(s=s.replace(Tn.tabCharGlobal," ").replace(Tn.spaceLine,""));s;){let p;if((u=(l=this.options.extensions)==null?void 0:l.block)!=null&&u.some(m=>(p=m.call({lexer:this},s,r))?(s=s.substring(p.raw.length),r.push(p),!0):!1))continue;if(p=this.tokenizer.space(s)){s=s.substring(p.raw.length);const m=r.at(-1);p.raw.length===1&&m!==void 0?m.raw+=`
|
|
450
450
|
`:r.push(p);continue}if(p=this.tokenizer.code(s)){s=s.substring(p.raw.length);const m=r.at(-1);(m==null?void 0:m.type)==="paragraph"||(m==null?void 0:m.type)==="text"?(m.raw+=`
|
|
451
451
|
`+p.raw,m.text+=`
|
|
@@ -474,29 +474,29 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
474
474
|
${t}</tr>
|
|
475
475
|
`}tablecell(t){const s=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+s+`</${r}>
|
|
476
476
|
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${bs(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:s,tokens:r}){const o=this.parser.parseInline(r),l=cm(t);if(l===null)return o;t=l;let u='<a href="'+t+'"';return s&&(u+=' title="'+bs(s)+'"'),u+=">"+o+"</a>",u}image({href:t,title:s,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));const l=cm(t);if(l===null)return bs(r);t=l;let u=`<img src="${t}" alt="${r}"`;return s&&(u+=` title="${bs(s)}"`),u+=">",u}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:bs(t.text)}},Md=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},$s=class Qu{constructor(s){rt(this,"options");rt(this,"renderer");rt(this,"textRenderer");this.options=s||$r,this.options.renderer=this.options.renderer||new kl,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Md}static parse(s,r){return new Qu(r).parse(s)}static parseInline(s,r){return new Qu(r).parseInline(s)}parse(s,r=!0){var l,u;let o="";for(let f=0;f<s.length;f++){const p=s[f];if((u=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&u[p.type]){const m=p,v=this.options.extensions.renderers[m.type].call({parser:this},m);if(v!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){o+=v||"";continue}}const g=p;switch(g.type){case"space":{o+=this.renderer.space(g);continue}case"hr":{o+=this.renderer.hr(g);continue}case"heading":{o+=this.renderer.heading(g);continue}case"code":{o+=this.renderer.code(g);continue}case"table":{o+=this.renderer.table(g);continue}case"blockquote":{o+=this.renderer.blockquote(g);continue}case"list":{o+=this.renderer.list(g);continue}case"html":{o+=this.renderer.html(g);continue}case"paragraph":{o+=this.renderer.paragraph(g);continue}case"text":{let m=g,v=this.renderer.text(m);for(;f+1<s.length&&s[f+1].type==="text";)m=s[++f],v+=`
|
|
477
|
-
`+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(s,r=this.renderer){var l,u;let o="";for(let f=0;f<s.length;f++){const p=s[f];if((u=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&u[p.type]){const m=this.options.extensions.renderers[p.type].call({parser:this},p);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(p.type)){o+=m||"";continue}}const g=p;switch(g.type){case"escape":{o+=r.text(g);break}case"html":{o+=r.html(g);break}case"link":{o+=r.link(g);break}case"image":{o+=r.image(g);break}case"strong":{o+=r.strong(g);break}case"em":{o+=r.em(g);break}case"codespan":{o+=r.codespan(g);break}case"br":{o+=r.br(g);break}case"del":{o+=r.del(g);break}case"text":{o+=r.text(g);break}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},zu,Ja=(zu=class{constructor(t){rt(this,"options");rt(this,"block");this.options=t||$r}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Os.lex:Os.lexInline}provideParser(){return this.block?$s.parse:$s.parseInline}},rt(zu,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),zu)
|
|
478
|
-
Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+bs(r.message+"",!0)+"</pre>";return s?Promise.resolve(o):o}if(s)return Promise.reject(r);throw r}}},Pr=new
|
|
479
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BS(t,s){return zS(t)||FS(t,s)||WS(t,s)||US()}function WS(t,s){if(t){if(typeof t=="string")return fm(t,s);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fm(t,s):void 0}}const Nv=Object.entries,pm=Object.setPrototypeOf,HS=Object.isFrozen,VS=Object.getPrototypeOf,GS=Object.getOwnPropertyDescriptor;let rn=Object.freeze,on=Object.seal,hi=Object.create,jv=typeof Reflect<"u"&&Reflect,Zu=jv.apply,Ju=jv.construct;rn||(rn=function(s){return s});on||(on=function(s){return s});Zu||(Zu=function(s,r){for(var o=arguments.length,l=new Array(o>2?o-2:0),u=2;u<o;u++)l[u-2]=arguments[u];return s.apply(r,l)});Ju||(Ju=function(s){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return new s(...o)});const di=Ot(Array.prototype.forEach),qS=Ot(Array.prototype.lastIndexOf),hm=Ot(Array.prototype.pop),fi=Ot(Array.prototype.push),KS=Ot(Array.prototype.splice),ur=Array.isArray,ho=Ot(String.prototype.toLowerCase),Iu=Ot(String.prototype.toString),mm=Ot(String.prototype.match),co=Ot(String.prototype.replace),gm=Ot(String.prototype.indexOf),YS=Ot(String.prototype.trim),XS=Ot(Number.prototype.toString),QS=Ot(Boolean.prototype.toString),vm=typeof BigInt>"u"?null:Ot(BigInt.prototype.toString),ym=typeof Symbol>"u"?null:Ot(Symbol.prototype.toString),Zt=Ot(Object.prototype.hasOwnProperty),uo=Ot(Object.prototype.toString),Qt=Ot(RegExp.prototype.test),Mr=ZS(TypeError);function Ot(t){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return Zu(t,s,o)}}function ZS(t){return function(){for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return Ju(t,r)}}function He(t,s){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ho;if(pm&&pm(t,null),!ur(s))return t;let o=s.length;for(;o--;){let l=s[o];if(typeof l=="string"){const u=r(l);u!==l&&(HS(s)||(s[o]=u),l=u)}t[l]=!0}return t}function JS(t){for(let s=0;s<t.length;s++)Zt(t,s)||(t[s]=null);return t}function pn(t){const s=hi(null);for(const o of Nv(t)){var r=BS(o,2);const l=r[0],u=r[1];Zt(t,l)&&(ur(u)?s[l]=JS(u):u&&typeof u=="object"&&u.constructor===Object?s[l]=pn(u):s[l]=u)}return s}function eb(t){switch(typeof t){case"string":return t;case"number":return XS(t);case"boolean":return QS(t);case"bigint":return vm?vm(t):"0";case"symbol":return ym?ym(t):"Symbol()";case"undefined":return uo(t);case"function":case"object":{if(t===null)return uo(t);const s=t,r=ls(s,"toString");if(typeof r=="function"){const o=r(s);return typeof o=="string"?o:uo(o)}return uo(t)}default:return uo(t)}}function ls(t,s){for(;t!==null;){const o=GS(t,s);if(o){if(o.get)return Ot(o.get);if(typeof o.value=="function")return Ot(o.value)}t=VS(t)}function r(){return null}return r}function tb(t){try{return Qt(t,""),!0}catch{return!1}}const xm=rn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Du=rn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Mu=rn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),nb=rn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Lu=rn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),sb=rn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wm=rn(["#text"]),km=rn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Pu=rn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Sm=rn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Va=rn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rb=on(/{{[\w\W]*|^[\w\W]*}}/g),ib=on(/<%[\w\W]*|^[\w\W]*%>/g),ob=on(/\${[\w\W]*/g),ab=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),lb=on(/^aria-[\-\w]+$/),bm=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cb=on(/^(?:\w+script|data):/i),ub=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),db=on(/^html$/i),fb=on(/^[a-z][.\w]*(-[.\w]+)+$/i),Tm=on(/<[/\w!]/g),Nm=on(/<[/\w]/g),pb=on(/<\/no(script|embed|frames)/i),hb=on(/\/>/i),Wn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},mb=function(){return typeof window>"u"?null:window},gb=function(s,r){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";r&&r.hasAttribute(l)&&(o=r.getAttribute(l));const u="dompurify"+(o?"#"+o:"");try{return s.createPolicy(u,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},jm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},lr=function(s,r,o,l){return Zt(s,r)&&ur(s[r])?He(l.base?pn(l.base):{},s[r],l.transform):o};function Cv(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mb();const s=le=>Cv(le);if(s.version="3.4.13",s.removed=[],!t||!t.document||t.document.nodeType!==Wn.document||!t.Element)return s.isSupported=!1,s;let r=t.document;const o=r,l=o.currentScript;t.DocumentFragment;const u=t.HTMLTemplateElement,f=t.Node,p=t.Element,g=t.NodeFilter,m=t.NamedNodeMap;m===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const v=t.DOMParser,k=t.trustedTypes,w=p.prototype,S=ls(w,"cloneNode"),C=ls(w,"remove"),E=ls(w,"nextSibling"),T=ls(w,"childNodes"),A=ls(w,"parentNode"),_=ls(w,"shadowRoot"),B=ls(w,"attributes"),I=f&&f.prototype?ls(f.prototype,"nodeType"):null,W=f&&f.prototype?ls(f.prototype,"nodeName"):null,Y=f&&f.prototype?ls(f.prototype,"ownerDocument"):null;if(typeof u=="function"){const le=r.createElement("template");le.content&&le.content.ownerDocument&&(r=le.content.ownerDocument)}let K,F="",re,he=!1,G=0;const Ne=function(){if(G>0)throw Mr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Se=function(b){Ne(),G++;try{return K.createHTML(b)}finally{G--}},Pe=function(b){Ne(),G++;try{return K.createScriptURL(b)}finally{G--}},te=function(){return he||(re=gb(k,l),he=!0),re},oe=r,ae=oe.implementation,O=oe.createNodeIterator,Q=oe.createDocumentFragment,U=oe.getElementsByTagName,j=o.importNode;let P=jm();s.isSupported=typeof Nv=="function"&&typeof A=="function"&&ae&&ae.createHTMLDocument!==void 0;const ne=rb,de=ib,X=ob,fe=ab,be=lb,Ee=cb,Re=ub,Ce=fb;let at=bm,De=null;const lt=He({},[...xm,...Du,...Mu,...Lu,...wm]);let $e=null;const en=He({},[...km,...Pu,...Sm,...Va]);let Fe=Object.seal(hi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ht=null,tn=null;const wt=Object.seal(hi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let jt=!0,$t=!0,Mt=!1,q=!0,pe=!1,Ue=!0,tt=!1,mt=!1,gt=null,Ct=null,an=!1,dt=!1,Dn=!1,Mn=!1,ps=!0,hs=!1;const ts="user-content-";let Ln=!0,vn=!1,ln={},Vt=null;const yn=He({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Xe=null;const Et=He({},["audio","video","img","source","image","track"]);let ft=null;const Gt=He({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vt="http://www.w3.org/1998/Math/MathML",yt="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml";let qt=it,st=!1,Lt=null;const R=He({},[vt,yt,it],Iu),ue=rn(["mi","mo","mn","ms","mtext"]);let ie=He({},ue);const ve=rn(["annotation-xml"]);let Me=He({},ve);const Ge=He({},["title","style","font","a","script"]);let Le=null;const zt=["application/xhtml+xml","text/html"],Pn="text/html";let Be=null,xn=null;const js=r.createElement("form"),Us=function(b){return b instanceof RegExp||b instanceof Function},On=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(xn&&xn===b)return;(!b||typeof b!="object")&&(b={}),b=pn(b),Le=zt.indexOf(b.PARSER_MEDIA_TYPE)===-1?Pn:b.PARSER_MEDIA_TYPE,Be=Le==="application/xhtml+xml"?Iu:ho,De=lr(b,"ALLOWED_TAGS",lt,{transform:Be}),$e=lr(b,"ALLOWED_ATTR",en,{transform:Be}),Lt=lr(b,"ALLOWED_NAMESPACES",R,{transform:Iu}),ft=lr(b,"ADD_URI_SAFE_ATTR",Gt,{transform:Be,base:Gt}),Xe=lr(b,"ADD_DATA_URI_TAGS",Et,{transform:Be,base:Et}),Vt=lr(b,"FORBID_CONTENTS",yn,{transform:Be}),Ht=lr(b,"FORBID_TAGS",pn({}),{transform:Be}),tn=lr(b,"FORBID_ATTR",pn({}),{transform:Be}),ln=Zt(b,"USE_PROFILES")?b.USE_PROFILES&&typeof b.USE_PROFILES=="object"?pn(b.USE_PROFILES):b.USE_PROFILES:!1,jt=b.ALLOW_ARIA_ATTR!==!1,$t=b.ALLOW_DATA_ATTR!==!1,Mt=b.ALLOW_UNKNOWN_PROTOCOLS||!1,q=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=b.SAFE_FOR_TEMPLATES||!1,Ue=b.SAFE_FOR_XML!==!1,tt=b.WHOLE_DOCUMENT||!1,dt=b.RETURN_DOM||!1,Dn=b.RETURN_DOM_FRAGMENT||!1,Mn=b.RETURN_TRUSTED_TYPE||!1,an=b.FORCE_BODY||!1,ps=b.SANITIZE_DOM!==!1,hs=b.SANITIZE_NAMED_PROPS||!1,Ln=b.KEEP_CONTENT!==!1,vn=b.IN_PLACE||!1,at=tb(b.ALLOWED_URI_REGEXP)?b.ALLOWED_URI_REGEXP:bm,qt=typeof b.NAMESPACE=="string"?b.NAMESPACE:it,ie=Zt(b,"MATHML_TEXT_INTEGRATION_POINTS")&&b.MATHML_TEXT_INTEGRATION_POINTS&&typeof b.MATHML_TEXT_INTEGRATION_POINTS=="object"?pn(b.MATHML_TEXT_INTEGRATION_POINTS):He({},ue),Me=Zt(b,"HTML_INTEGRATION_POINTS")&&b.HTML_INTEGRATION_POINTS&&typeof b.HTML_INTEGRATION_POINTS=="object"?pn(b.HTML_INTEGRATION_POINTS):He({},ve);const $=Zt(b,"CUSTOM_ELEMENT_HANDLING")&&b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING=="object"?pn(b.CUSTOM_ELEMENT_HANDLING):hi(null);if(Fe=hi(null),Zt($,"tagNameCheck")&&Us($.tagNameCheck)&&(Fe.tagNameCheck=$.tagNameCheck),Zt($,"attributeNameCheck")&&Us($.attributeNameCheck)&&(Fe.attributeNameCheck=$.attributeNameCheck),Zt($,"allowCustomizedBuiltInElements")&&typeof $.allowCustomizedBuiltInElements=="boolean"&&(Fe.allowCustomizedBuiltInElements=$.allowCustomizedBuiltInElements),on(Fe),pe&&($t=!1),Dn&&(dt=!0),ln&&(De=He({},wm),$e=hi(null),ln.html===!0&&(He(De,xm),He($e,km)),ln.svg===!0&&(He(De,Du),He($e,Pu),He($e,Va)),ln.svgFilters===!0&&(He(De,Mu),He($e,Pu),He($e,Va)),ln.mathMl===!0&&(He(De,Lu),He($e,Sm),He($e,Va))),wt.tagCheck=null,wt.attributeCheck=null,Zt(b,"ADD_TAGS")&&(typeof b.ADD_TAGS=="function"?wt.tagCheck=b.ADD_TAGS:ur(b.ADD_TAGS)&&(De===lt&&(De=pn(De)),He(De,b.ADD_TAGS,Be))),Zt(b,"ADD_ATTR")&&(typeof b.ADD_ATTR=="function"?wt.attributeCheck=b.ADD_ATTR:ur(b.ADD_ATTR)&&($e===en&&($e=pn($e)),He($e,b.ADD_ATTR,Be))),Zt(b,"ADD_URI_SAFE_ATTR")&&ur(b.ADD_URI_SAFE_ATTR)&&He(ft,b.ADD_URI_SAFE_ATTR,Be),Zt(b,"FORBID_CONTENTS")&&ur(b.FORBID_CONTENTS)&&(Vt===yn&&(Vt=pn(Vt)),He(Vt,b.FORBID_CONTENTS,Be)),Zt(b,"ADD_FORBID_CONTENTS")&&ur(b.ADD_FORBID_CONTENTS)&&(Vt===yn&&(Vt=pn(Vt)),He(Vt,b.ADD_FORBID_CONTENTS,Be)),Ln&&(De["#text"]=!0),tt&&He(De,["html","head","body"]),De.table&&(He(De,["tbody"]),delete Ht.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Mr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Mr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Z=K;K=b.TRUSTED_TYPES_POLICY;try{F=Se("")}catch(we){throw K=Z,we}}else b.TRUSTED_TYPES_POLICY===null?(K=void 0,F=""):(K===void 0&&(K=te()),K&&typeof F=="string"&&(F=Se("")));rn&&rn(b),xn=b},ms=He({},[...Du,...Mu,...nb]),Qe=He({},[...Lu,...sb]),_t=function(b,$,Z){return $.namespaceURI===it?b==="svg":$.namespaceURI===vt?b==="svg"&&(Z==="annotation-xml"||ie[Z]):!!ms[b]},gs=function(b,$,Z){return $.namespaceURI===it?b==="math":$.namespaceURI===yt?b==="math"&&Me[Z]:!!Qe[b]},$l=function(b,$,Z){return $.namespaceURI===yt&&!Me[Z]||$.namespaceURI===vt&&!ie[Z]?!1:!Qe[b]&&(Ge[b]||!ms[b])},kt=function(b){let $=A(b);(!$||!$.tagName)&&($={namespaceURI:qt,tagName:"template"});const Z=ho(b.tagName),we=ho($.tagName);return Lt[b.namespaceURI]?b.namespaceURI===yt?_t(Z,$,we):b.namespaceURI===vt?gs(Z,$,we):b.namespaceURI===it?$l(Z,$,we):!!(Le==="application/xhtml+xml"&&Lt[b.namespaceURI]):!1},vs=function(b){fi(s.removed,{element:b});try{A(b).removeChild(b)}catch{if(C(b),!A(b))throw Mr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Bs=function(b){mr(b);const $=T(b);if($){const we=[];di($,je=>{fi(we,je)}),di(we,je=>{try{C(je)}catch{}})}const Z=B(b);if(Z)for(let we=Z.length-1;we>=0;--we){const je=Z[we],ze=je&&je.name;if(typeof ze=="string")try{b.removeAttribute(ze)}catch{}}},ys=function(b,$){try{fi(s.removed,{attribute:$.getAttributeNode(b),from:$})}catch{fi(s.removed,{attribute:null,from:$})}if($.removeAttribute(b),b==="is")if(dt||Dn)try{vs($)}catch{}else try{$.setAttribute(b,"")}catch{}},zr=function(b){const $=B(b);if($)for(let Z=$.length-1;Z>=0;--Z){const we=$[Z],je=we&&we.name;if(!(typeof je!="string"||$e[Be(je)]))try{b.removeAttribute(je)}catch{}}},mr=function(b){const $=[b];for(;$.length>0;){const Z=$.pop();(I?I(Z):Z.nodeType)===Wn.element&&zr(Z);const je=T(Z);if(je)for(let ze=je.length-1;ze>=0;--ze)$.push(je[ze])}},Lo=function(b){if(!Ue)return;const $=[b];for(;$.length>0;){const Z=$.pop(),we=I?I(Z):Z.nodeType;if(we===Wn.processingInstruction||we===Wn.comment&&Qt(Nm,Z.data)){try{C(Z)}catch{}continue}if(we===Wn.element){const ze=Z,Ke=Be(W?W(Z):Z.nodeName);try{ze.hasAttribute&&ze.hasAttribute("patchsrc")&&ze.removeAttribute("patchsrc"),ze.hasAttribute&&ze.hasAttribute("for")&&Ke!=="label"&&Ke!=="output"&&ze.removeAttribute("for")}catch{}}const je=T(Z);if(je)for(let ze=je.length-1;ze>=0;--ze)$.push(je[ze])}},gr=function(b){let $=null,Z=null;if(an)b="<remove></remove>"+b;else{const ze=mm(b,/^[\r\n\t ]+/);Z=ze&&ze[0]}Le==="application/xhtml+xml"&&qt===it&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const we=K?Se(b):b;if(qt===it)try{$=new v().parseFromString(we,Le)}catch{}if(!$||!$.documentElement){$=ae.createDocument(qt,"template",null);try{$.documentElement.innerHTML=st?F:we}catch{}}const je=$.body||$.documentElement;return b&&Z&&je.insertBefore(r.createTextNode(Z),je.childNodes[0]||null),qt===it?U.call($,tt?"html":"body")[0]:tt?$.documentElement:je},$n=function(b){const $=Y?Y(b):b.ownerDocument;return O.call($||b,b,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Fr=function(b){return b=co(b,ne," "),b=co(b,de," "),b=co(b,X," "),b},wn=function(b){var $;b.normalize();const Z=Y?Y(b):b.ownerDocument,we=O.call(Z||b,b,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let je=we.nextNode();for(;je;)je.data=Fr(je.data),je=we.nextNode();const ze=($=b.querySelectorAll)===null||$===void 0?void 0:$.call(b,"template");ze&&di(ze,Ke=>{Ws(Ke.content)&&wn(Ke.content)})},Ur=function(b){const $=W?W(b):null;return typeof $!="string"||Be($)!=="form"?!1:typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||b.attributes!==B(b)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function"||b.nodeType!==I(b)||b.childNodes!==T(b)},Ws=function(b){if(!I||typeof b!="object"||b===null)return!1;try{return I(b)===Wn.documentFragment}catch{return!1}},vr=function(b){if(!I||typeof b!="object"||b===null)return!1;try{return typeof I(b)=="number"}catch{return!1}};function kn(le,b,$){le.length!==0&&di(le,Z=>{Z.call(s,b,$,xn)})}const Br=function(b,$){return!!(Ue&&b.hasChildNodes()&&!vr(b.firstElementChild)&&Qt(Tm,b.textContent)&&Qt(Tm,b.innerHTML)||Ue&&b.namespaceURI===it&&$==="style"&&vr(b.firstElementChild)||b.nodeType===Wn.processingInstruction||Ue&&b.nodeType===Wn.comment&&Qt(Nm,b.data))},yr=function(b,$,Z){if(!Ht[$]&&Ei($)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,$)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck($)))return!1;if(Ln&&!Vt[$]){const we=A(b),je=T(b);if(je&&we){const ze=je.length;for(let Ke=ze-1;Ke>=0;--Ke){const Ze=b===Z?S(je[Ke],!0):je[Ke];we.insertBefore(Ze,E(b))}}}return vs(b),!0},xr=function(b,$,Z,we){return b.length===0?$:$===Z||$===we?pn($):$},Po=function(b,$){if(kn(P.beforeSanitizeElements,b,null),b!==$&&A(b)===null)return vn&&mr(b),!0;if(Ur(b))return vs(b),!0;const Z=Be(W?W(b):b.nodeName);if(De=xr(P.uponSanitizeElement,De,lt,gt),kn(P.uponSanitizeElement,b,{tagName:Z,allowedTags:De}),b!==$&&A(b)===null)return vn&&mr(b),!0;if(Br(b,Z))return vs(b),!0;if(Ht[Z]||!(wt.tagCheck instanceof Function&&wt.tagCheck(Z))&&!De[Z]){const je=yr(b,Z,$);return je===!1&&kn(P.afterSanitizeElements,b,null),je}if((I?I(b):b.nodeType)===Wn.element&&!kt(b)||(Z==="noscript"||Z==="noembed"||Z==="noframes")&&Qt(pb,b.innerHTML))return vs(b),!0;if(pe&&b.nodeType===Wn.text){const je=Fr(b.textContent);b.textContent!==je&&(fi(s.removed,{element:b.cloneNode()}),b.textContent=je)}return kn(P.afterSanitizeElements,b,null),!1},Oo=function(b,$,Z){if(tn[$]||Ue&&$==="patchsrc"||Ue&&$==="for"&&b!=="label"&&b!=="output"||ps&&($==="id"||$==="name")&&(Z in r||Z in js))return!1;const we=$e[$]||wt.attributeCheck instanceof Function&&wt.attributeCheck($,b);if(!($t&&Qt(fe,$))){if(!(jt&&Qt(be,$))){if(we){if(!ft[$]){if(!Qt(at,co(Z,Re,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&b!=="script"&&gm(Z,"data:")===0&&Xe[b])){if(!(Mt&&!Qt(Ee,co(Z,Re,"")))){if(Z)return!1}}}}}else if(!(Ei(b)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,b)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(b))&&(Fe.attributeNameCheck instanceof RegExp&&Qt(Fe.attributeNameCheck,$)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck($,b))||$==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,Z)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(Z))))return!1}}return!0},Ci=He({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ei=function(b){return!Ci[ho(b)]&&Qt(Ce,b)},_i=function(b,$,Z,we){if(K&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Z)switch(k.getAttributeType(b,$)){case"TrustedHTML":return Se(we);case"TrustedScriptURL":return Pe(we)}return we},wr=function(b,$,Z,we){try{Z?b.setAttributeNS(Z,$,we):b.setAttribute($,we),Ur(b)?vs(b):hm(s.removed)}catch{ys($,b)}},$o=function(b){kn(P.beforeSanitizeAttributes,b,null);const $=b.attributes;if(!$||Ur(b))return;$e=xr(P.uponSanitizeAttribute,$e,en,Ct);const Z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$e,forceKeepAttr:void 0};let we=$.length;const je=Be(b.nodeName);for(;we--;){const ze=$[we],Ke=ze.name,Ze=ze.namespaceURI,St=ze.value,bt=Be(Ke),Cs=St;let At=Ke==="value"?Cs:YS(Cs);if(Z.attrName=bt,Z.attrValue=At,Z.keepAttr=!0,Z.forceKeepAttr=void 0,kn(P.uponSanitizeAttribute,b,Z),At=Z.attrValue,hs&&(bt==="id"||bt==="name")&&gm(At,ts)!==0&&(ys(Ke,b),At=ts+At),Ue&&Qt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,At)){ys(Ke,b);continue}if(bt==="attributename"&&mm(At,"href")){ys(Ke,b);continue}if(!Z.forceKeepAttr){if(!Z.keepAttr){ys(Ke,b);continue}if(!q&&Qt(hb,At)){ys(Ke,b);continue}if(pe&&(At=Fr(At)),!Oo(je,bt,At)){ys(Ke,b);continue}At=_i(je,bt,Ze,At),At!==Cs&&wr(b,Ke,Ze,At)}}kn(P.afterSanitizeAttributes,b,null)},Hs=function(b){let $=null;const Z=$n(b);for(kn(P.beforeSanitizeShadowDOM,b,null);$=Z.nextNode();)if(kn(P.uponSanitizeShadowNode,$,null),Po($,b),$o($),Ws($.content)&&Hs($.content),(I?I($):$.nodeType)===Wn.element){const je=_($);Ws(je)&&(qe(je),Hs(je))}kn(P.afterSanitizeShadowDOM,b,null)},qe=function(b){const $=[{node:b,shadow:null}];for(;$.length>0;){const Z=$.pop();if(Z.shadow){Hs(Z.shadow);continue}const we=Z.node,ze=(I?I(we):we.nodeType)===Wn.element,Ke=T(we);if(Ke)for(let Ze=Ke.length-1;Ze>=0;--Ze)$.push({node:Ke[Ze],shadow:null});if(ze){const Ze=W?W(we):null;if(typeof Ze=="string"&&Be(Ze)==="template"){const St=we.content;Ws(St)&&$.push({node:St,shadow:null})}}if(ze){const Ze=_(we);Ws(Ze)&&$.push({node:null,shadow:Ze},{node:Ze,shadow:null})}}};return s.sanitize=function(le){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,Z=null,we=null,je=null;if(st=!le,st&&(le="<!-->"),typeof le!="string"&&!vr(le)&&(le=eb(le),typeof le!="string"))throw Mr("dirty is not a string, aborting");if(!s.isSupported)return le;mt?(De=gt,$e=Ct):On(b),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(De=pn(De)),P.uponSanitizeAttribute.length>0&&($e=pn($e)),s.removed=[];const ze=vn&&typeof le!="string"&&vr(le);if(ze){Lo(le);const St=W?W(le):le.nodeName;if(typeof St=="string"){const bt=Be(St);if(!De[bt]||Ht[bt])throw Bs(le),Mr("root node is forbidden and cannot be sanitized in-place")}if(Ur(le))throw Bs(le),Mr("root node is clobbered and cannot be sanitized in-place");try{qe(le)}catch(bt){throw Bs(le),bt}}else if(vr(le))$=gr("<!---->"),Z=$.ownerDocument.importNode(le,!0),Z.nodeType===Wn.element&&Z.nodeName==="BODY"||Z.nodeName==="HTML"?$=Z:$.appendChild(Z),qe(Z);else{if(!dt&&!pe&&!tt&&le.indexOf("<")===-1)return K&&Mn?Se(le):le;if($=gr(le),!$)return dt?null:Mn?F:""}$&&an&&vs($.firstChild);const Ke=ze?le:$;try{const St=$n(Ke);for(;we=St.nextNode();)Po(we,Ke),$o(we),Ws(we.content)&&Hs(we.content)}catch(St){throw ze&&(Bs(le),di(s.removed,bt=>{bt.element&&mr(bt.element)})),St}if(ze)return di(s.removed,St=>{St.element&&mr(St.element)}),pe&&wn(le),le;if(dt){if(pe&&wn($),Dn)for(je=Q.call($.ownerDocument);$.firstChild;)je.appendChild($.firstChild);else je=$;return($e.shadowroot||$e.shadowrootmode)&&(je=j.call(o,je,!0)),je}let Ze=tt?$.outerHTML:$.innerHTML;return tt&&De["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&Qt(db,$.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
|
|
480
|
-
`+Ze),pe&&(Ze=Fr(Ze)),K&&Mn?Se(Ze):Ze},s.setConfig=function(){let le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};On(le),mt=!0,gt=De,Ct=$e},s.clearConfig=function(){xn=null,mt=!1,gt=null,Ct=null,K=re,F=""},s.isValidAttribute=function(le,b,$){xn||On({});const Z=Be(le),we=Be(b);return Oo(Z,we,$)},s.addHook=function(le,b){typeof b=="function"&&Zt(P,le)&&fi(P[le],b)},s.removeHook=function(le,b){if(Zt(P,le)){if(b!==void 0){const $=
|
|
477
|
+
`+this.renderer.text(m);r?o+=this.renderer.paragraph({type:"paragraph",raw:v,text:v,tokens:[{type:"text",raw:v,text:v,escaped:!0}]}):o+=v;continue}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}parseInline(s,r=this.renderer){var l,u;let o="";for(let f=0;f<s.length;f++){const p=s[f];if((u=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&u[p.type]){const m=this.options.extensions.renderers[p.type].call({parser:this},p);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(p.type)){o+=m||"";continue}}const g=p;switch(g.type){case"escape":{o+=r.text(g);break}case"html":{o+=r.html(g);break}case"link":{o+=r.link(g);break}case"image":{o+=r.image(g);break}case"strong":{o+=r.strong(g);break}case"em":{o+=r.em(g);break}case"codespan":{o+=r.codespan(g);break}case"br":{o+=r.br(g);break}case"del":{o+=r.del(g);break}case"text":{o+=r.text(g);break}default:{const m='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return o}},zu,Ja=(zu=class{constructor(t){rt(this,"options");rt(this,"block");this.options=t||$r}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Os.lex:Os.lexInline}provideParser(){return this.block?$s.parse:$s.parseInline}},rt(zu,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),zu),zS=class{constructor(...t){rt(this,"defaults",jd());rt(this,"options",this.setOptions);rt(this,"parse",this.parseMarkdown(!0));rt(this,"parseInline",this.parseMarkdown(!1));rt(this,"Parser",$s);rt(this,"Renderer",kl);rt(this,"TextRenderer",Md);rt(this,"Lexer",Os);rt(this,"Tokenizer",wl);rt(this,"Hooks",Ja);this.use(...t)}walkTokens(t,s){var o,l;let r=[];for(const u of t)switch(r=r.concat(s.call(this,u)),u.type){case"table":{const f=u;for(const p of f.header)r=r.concat(this.walkTokens(p.tokens,s));for(const p of f.rows)for(const g of p)r=r.concat(this.walkTokens(g.tokens,s));break}case"list":{const f=u;r=r.concat(this.walkTokens(f.items,s));break}default:{const f=u;(l=(o=this.defaults.extensions)==null?void 0:o.childTokens)!=null&&l[f.type]?this.defaults.extensions.childTokens[f.type].forEach(p=>{const g=f[p].flat(1/0);r=r.concat(this.walkTokens(g,s))}):f.tokens&&(r=r.concat(this.walkTokens(f.tokens,s)))}}return r}use(...t){const s=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const u=s.renderers[l.name];u?s.renderers[l.name]=function(...f){let p=l.renderer.apply(this,f);return p===!1&&(p=u.apply(this,f)),p}:s.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const u=s[l.level];u?u.unshift(l.tokenizer):s[l.level]=[l.tokenizer],l.start&&(l.level==="block"?s.startBlock?s.startBlock.push(l.start):s.startBlock=[l.start]:l.level==="inline"&&(s.startInline?s.startInline.push(l.start):s.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(s.childTokens[l.name]=l.childTokens)}),o.extensions=s),r.renderer){const l=this.defaults.renderer||new kl(this.defaults);for(const u in r.renderer){if(!(u in l))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;const f=u,p=r.renderer[f],g=l[f];l[f]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v||""}}o.renderer=l}if(r.tokenizer){const l=this.defaults.tokenizer||new wl(this.defaults);for(const u in r.tokenizer){if(!(u in l))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;const f=u,p=r.tokenizer[f],g=l[f];l[f]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v}}o.tokenizer=l}if(r.hooks){const l=this.defaults.hooks||new Ja;for(const u in r.hooks){if(!(u in l))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;const f=u,p=r.hooks[f],g=l[f];Ja.passThroughHooks.has(u)?l[f]=m=>{if(this.defaults.async)return Promise.resolve(p.call(l,m)).then(k=>g.call(l,k));const v=p.call(l,m);return g.call(l,v)}:l[f]=(...m)=>{let v=p.apply(l,m);return v===!1&&(v=g.apply(l,m)),v}}o.hooks=l}if(r.walkTokens){const l=this.defaults.walkTokens,u=r.walkTokens;o.walkTokens=function(f){let p=[];return p.push(u.call(this,f)),l&&(p=p.concat(l.call(this,f))),p}}this.defaults={...this.defaults,...o}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,s){return Os.lex(t,s??this.defaults)}parser(t,s){return $s.parse(t,s??this.defaults)}parseMarkdown(t){return(r,o)=>{const l={...o},u={...this.defaults,...l},f=this.onError(!!u.silent,!!u.async);if(this.defaults.async===!0&&l.async===!1)return f(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return f(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));u.hooks&&(u.hooks.options=u,u.hooks.block=t);const p=u.hooks?u.hooks.provideLexer():t?Os.lex:Os.lexInline,g=u.hooks?u.hooks.provideParser():t?$s.parse:$s.parseInline;if(u.async)return Promise.resolve(u.hooks?u.hooks.preprocess(r):r).then(m=>p(m,u)).then(m=>u.hooks?u.hooks.processAllTokens(m):m).then(m=>u.walkTokens?Promise.all(this.walkTokens(m,u.walkTokens)).then(()=>m):m).then(m=>g(m,u)).then(m=>u.hooks?u.hooks.postprocess(m):m).catch(f);try{u.hooks&&(r=u.hooks.preprocess(r));let m=p(r,u);u.hooks&&(m=u.hooks.processAllTokens(m)),u.walkTokens&&this.walkTokens(m,u.walkTokens);let v=g(m,u);return u.hooks&&(v=u.hooks.postprocess(v)),v}catch(m){return f(m)}}}onError(t,s){return r=>{if(r.message+=`
|
|
478
|
+
Please report this to https://github.com/markedjs/marked.`,t){const o="<p>An error occurred:</p><pre>"+bs(r.message+"",!0)+"</pre>";return s?Promise.resolve(o):o}if(s)return Promise.reject(r);throw r}}},Pr=new zS;function Ve(t,s){return Pr.parse(t,s)}Ve.options=Ve.setOptions=function(t){return Pr.setOptions(t),Ve.defaults=Pr.defaults,hv(Ve.defaults),Ve};Ve.getDefaults=jd;Ve.defaults=$r;Ve.use=function(...t){return Pr.use(...t),Ve.defaults=Pr.defaults,hv(Ve.defaults),Ve};Ve.walkTokens=function(t,s){return Pr.walkTokens(t,s)};Ve.parseInline=Pr.parseInline;Ve.Parser=$s;Ve.parser=$s.parse;Ve.Renderer=kl;Ve.TextRenderer=Md;Ve.Lexer=Os;Ve.lexer=Os.lex;Ve.Tokenizer=wl;Ve.Hooks=Ja;Ve.parse=Ve;Ve.options;Ve.setOptions;Ve.use;Ve.walkTokens;Ve.parseInline;$s.parse;Os.lex;/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */function fm(t,s){(s==null||s>t.length)&&(s=t.length);for(var r=0,o=Array(s);r<s;r++)o[r]=t[r];return o}function FS(t){if(Array.isArray(t))return t}function US(t,s){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var o,l,u,f,p=[],g=!0,m=!1;try{if(u=(r=r.call(t)).next,s!==0)for(;!(g=(o=u.call(r)).done)&&(p.push(o.value),p.length!==s);g=!0);}catch(v){m=!0,l=v}finally{try{if(!g&&r.return!=null&&(f=r.return(),Object(f)!==f))return}finally{if(m)throw l}}return p}}function BS(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
479
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WS(t,s){return FS(t)||US(t,s)||HS(t,s)||BS()}function HS(t,s){if(t){if(typeof t=="string")return fm(t,s);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?fm(t,s):void 0}}const Nv=Object.entries,pm=Object.setPrototypeOf,VS=Object.isFrozen,GS=Object.getPrototypeOf,qS=Object.getOwnPropertyDescriptor;let rn=Object.freeze,on=Object.seal,hi=Object.create,jv=typeof Reflect<"u"&&Reflect,Zu=jv.apply,Ju=jv.construct;rn||(rn=function(s){return s});on||(on=function(s){return s});Zu||(Zu=function(s,r){for(var o=arguments.length,l=new Array(o>2?o-2:0),u=2;u<o;u++)l[u-2]=arguments[u];return s.apply(r,l)});Ju||(Ju=function(s){for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return new s(...o)});const di=Ot(Array.prototype.forEach),KS=Ot(Array.prototype.lastIndexOf),hm=Ot(Array.prototype.pop),fi=Ot(Array.prototype.push),YS=Ot(Array.prototype.splice),ur=Array.isArray,ho=Ot(String.prototype.toLowerCase),Iu=Ot(String.prototype.toString),mm=Ot(String.prototype.match),co=Ot(String.prototype.replace),gm=Ot(String.prototype.indexOf),XS=Ot(String.prototype.trim),QS=Ot(Number.prototype.toString),ZS=Ot(Boolean.prototype.toString),vm=typeof BigInt>"u"?null:Ot(BigInt.prototype.toString),ym=typeof Symbol>"u"?null:Ot(Symbol.prototype.toString),Zt=Ot(Object.prototype.hasOwnProperty),uo=Ot(Object.prototype.toString),Qt=Ot(RegExp.prototype.test),Mr=JS(TypeError);function Ot(t){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var r=arguments.length,o=new Array(r>1?r-1:0),l=1;l<r;l++)o[l-1]=arguments[l];return Zu(t,s,o)}}function JS(t){return function(){for(var s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return Ju(t,r)}}function He(t,s){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ho;if(pm&&pm(t,null),!ur(s))return t;let o=s.length;for(;o--;){let l=s[o];if(typeof l=="string"){const u=r(l);u!==l&&(VS(s)||(s[o]=u),l=u)}t[l]=!0}return t}function eb(t){for(let s=0;s<t.length;s++)Zt(t,s)||(t[s]=null);return t}function pn(t){const s=hi(null);for(const o of Nv(t)){var r=WS(o,2);const l=r[0],u=r[1];Zt(t,l)&&(ur(u)?s[l]=eb(u):u&&typeof u=="object"&&u.constructor===Object?s[l]=pn(u):s[l]=u)}return s}function tb(t){switch(typeof t){case"string":return t;case"number":return QS(t);case"boolean":return ZS(t);case"bigint":return vm?vm(t):"0";case"symbol":return ym?ym(t):"Symbol()";case"undefined":return uo(t);case"function":case"object":{if(t===null)return uo(t);const s=t,r=ls(s,"toString");if(typeof r=="function"){const o=r(s);return typeof o=="string"?o:uo(o)}return uo(t)}default:return uo(t)}}function ls(t,s){for(;t!==null;){const o=qS(t,s);if(o){if(o.get)return Ot(o.get);if(typeof o.value=="function")return Ot(o.value)}t=GS(t)}function r(){return null}return r}function nb(t){try{return Qt(t,""),!0}catch{return!1}}const xm=rn(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Du=rn(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Mu=rn(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sb=rn(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Lu=rn(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),rb=rn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wm=rn(["#text"]),km=rn(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Pu=rn(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Sm=rn(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Va=rn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ib=on(/{{[\w\W]*|^[\w\W]*}}/g),ob=on(/<%[\w\W]*|^[\w\W]*%>/g),ab=on(/\${[\w\W]*/g),lb=on(/^data-[\-\w.\u00B7-\uFFFF]+$/),cb=on(/^aria-[\-\w]+$/),bm=on(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ub=on(/^(?:\w+script|data):/i),db=on(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),fb=on(/^html$/i),pb=on(/^[a-z][.\w]*(-[.\w]+)+$/i),Tm=on(/<[/\w!]/g),Nm=on(/<[/\w]/g),hb=on(/<\/no(script|embed|frames)/i),mb=on(/\/>/i),Wn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},gb=function(){return typeof window>"u"?null:window},vb=function(s,r){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let o=null;const l="data-tt-policy-suffix";r&&r.hasAttribute(l)&&(o=r.getAttribute(l));const u="dompurify"+(o?"#"+o:"");try{return s.createPolicy(u,{createHTML(f){return f},createScriptURL(f){return f}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},jm=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},lr=function(s,r,o,l){return Zt(s,r)&&ur(s[r])?He(l.base?pn(l.base):{},s[r],l.transform):o};function Cv(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:gb();const s=le=>Cv(le);if(s.version="3.4.13",s.removed=[],!t||!t.document||t.document.nodeType!==Wn.document||!t.Element)return s.isSupported=!1,s;let r=t.document;const o=r,l=o.currentScript;t.DocumentFragment;const u=t.HTMLTemplateElement,f=t.Node,p=t.Element,g=t.NodeFilter,m=t.NamedNodeMap;m===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const v=t.DOMParser,k=t.trustedTypes,w=p.prototype,S=ls(w,"cloneNode"),C=ls(w,"remove"),E=ls(w,"nextSibling"),T=ls(w,"childNodes"),A=ls(w,"parentNode"),_=ls(w,"shadowRoot"),B=ls(w,"attributes"),I=f&&f.prototype?ls(f.prototype,"nodeType"):null,W=f&&f.prototype?ls(f.prototype,"nodeName"):null,Y=f&&f.prototype?ls(f.prototype,"ownerDocument"):null;if(typeof u=="function"){const le=r.createElement("template");le.content&&le.content.ownerDocument&&(r=le.content.ownerDocument)}let K,F="",re,he=!1,G=0;const Ne=function(){if(G>0)throw Mr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},Se=function(b){Ne(),G++;try{return K.createHTML(b)}finally{G--}},Pe=function(b){Ne(),G++;try{return K.createScriptURL(b)}finally{G--}},te=function(){return he||(re=vb(k,l),he=!0),re},oe=r,ae=oe.implementation,O=oe.createNodeIterator,Q=oe.createDocumentFragment,U=oe.getElementsByTagName,j=o.importNode;let P=jm();s.isSupported=typeof Nv=="function"&&typeof A=="function"&&ae&&ae.createHTMLDocument!==void 0;const ne=ib,de=ob,X=ab,fe=lb,be=cb,Ee=ub,Re=db,Ce=pb;let at=bm,De=null;const lt=He({},[...xm,...Du,...Mu,...Lu,...wm]);let $e=null;const en=He({},[...km,...Pu,...Sm,...Va]);let Fe=Object.seal(hi(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ht=null,tn=null;const wt=Object.seal(hi(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let jt=!0,$t=!0,Mt=!1,q=!0,pe=!1,Ue=!0,tt=!1,mt=!1,gt=null,Ct=null,an=!1,dt=!1,Dn=!1,Mn=!1,ps=!0,hs=!1;const ts="user-content-";let Ln=!0,vn=!1,ln={},Vt=null;const yn=He({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Xe=null;const Et=He({},["audio","video","img","source","image","track"]);let ft=null;const Gt=He({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vt="http://www.w3.org/1998/Math/MathML",yt="http://www.w3.org/2000/svg",it="http://www.w3.org/1999/xhtml";let qt=it,st=!1,Lt=null;const R=He({},[vt,yt,it],Iu),ue=rn(["mi","mo","mn","ms","mtext"]);let ie=He({},ue);const ve=rn(["annotation-xml"]);let Me=He({},ve);const Ge=He({},["title","style","font","a","script"]);let Le=null;const zt=["application/xhtml+xml","text/html"],Pn="text/html";let Be=null,xn=null;const js=r.createElement("form"),Us=function(b){return b instanceof RegExp||b instanceof Function},On=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(xn&&xn===b)return;(!b||typeof b!="object")&&(b={}),b=pn(b),Le=zt.indexOf(b.PARSER_MEDIA_TYPE)===-1?Pn:b.PARSER_MEDIA_TYPE,Be=Le==="application/xhtml+xml"?Iu:ho,De=lr(b,"ALLOWED_TAGS",lt,{transform:Be}),$e=lr(b,"ALLOWED_ATTR",en,{transform:Be}),Lt=lr(b,"ALLOWED_NAMESPACES",R,{transform:Iu}),ft=lr(b,"ADD_URI_SAFE_ATTR",Gt,{transform:Be,base:Gt}),Xe=lr(b,"ADD_DATA_URI_TAGS",Et,{transform:Be,base:Et}),Vt=lr(b,"FORBID_CONTENTS",yn,{transform:Be}),Ht=lr(b,"FORBID_TAGS",pn({}),{transform:Be}),tn=lr(b,"FORBID_ATTR",pn({}),{transform:Be}),ln=Zt(b,"USE_PROFILES")?b.USE_PROFILES&&typeof b.USE_PROFILES=="object"?pn(b.USE_PROFILES):b.USE_PROFILES:!1,jt=b.ALLOW_ARIA_ATTR!==!1,$t=b.ALLOW_DATA_ATTR!==!1,Mt=b.ALLOW_UNKNOWN_PROTOCOLS||!1,q=b.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=b.SAFE_FOR_TEMPLATES||!1,Ue=b.SAFE_FOR_XML!==!1,tt=b.WHOLE_DOCUMENT||!1,dt=b.RETURN_DOM||!1,Dn=b.RETURN_DOM_FRAGMENT||!1,Mn=b.RETURN_TRUSTED_TYPE||!1,an=b.FORCE_BODY||!1,ps=b.SANITIZE_DOM!==!1,hs=b.SANITIZE_NAMED_PROPS||!1,Ln=b.KEEP_CONTENT!==!1,vn=b.IN_PLACE||!1,at=nb(b.ALLOWED_URI_REGEXP)?b.ALLOWED_URI_REGEXP:bm,qt=typeof b.NAMESPACE=="string"?b.NAMESPACE:it,ie=Zt(b,"MATHML_TEXT_INTEGRATION_POINTS")&&b.MATHML_TEXT_INTEGRATION_POINTS&&typeof b.MATHML_TEXT_INTEGRATION_POINTS=="object"?pn(b.MATHML_TEXT_INTEGRATION_POINTS):He({},ue),Me=Zt(b,"HTML_INTEGRATION_POINTS")&&b.HTML_INTEGRATION_POINTS&&typeof b.HTML_INTEGRATION_POINTS=="object"?pn(b.HTML_INTEGRATION_POINTS):He({},ve);const $=Zt(b,"CUSTOM_ELEMENT_HANDLING")&&b.CUSTOM_ELEMENT_HANDLING&&typeof b.CUSTOM_ELEMENT_HANDLING=="object"?pn(b.CUSTOM_ELEMENT_HANDLING):hi(null);if(Fe=hi(null),Zt($,"tagNameCheck")&&Us($.tagNameCheck)&&(Fe.tagNameCheck=$.tagNameCheck),Zt($,"attributeNameCheck")&&Us($.attributeNameCheck)&&(Fe.attributeNameCheck=$.attributeNameCheck),Zt($,"allowCustomizedBuiltInElements")&&typeof $.allowCustomizedBuiltInElements=="boolean"&&(Fe.allowCustomizedBuiltInElements=$.allowCustomizedBuiltInElements),on(Fe),pe&&($t=!1),Dn&&(dt=!0),ln&&(De=He({},wm),$e=hi(null),ln.html===!0&&(He(De,xm),He($e,km)),ln.svg===!0&&(He(De,Du),He($e,Pu),He($e,Va)),ln.svgFilters===!0&&(He(De,Mu),He($e,Pu),He($e,Va)),ln.mathMl===!0&&(He(De,Lu),He($e,Sm),He($e,Va))),wt.tagCheck=null,wt.attributeCheck=null,Zt(b,"ADD_TAGS")&&(typeof b.ADD_TAGS=="function"?wt.tagCheck=b.ADD_TAGS:ur(b.ADD_TAGS)&&(De===lt&&(De=pn(De)),He(De,b.ADD_TAGS,Be))),Zt(b,"ADD_ATTR")&&(typeof b.ADD_ATTR=="function"?wt.attributeCheck=b.ADD_ATTR:ur(b.ADD_ATTR)&&($e===en&&($e=pn($e)),He($e,b.ADD_ATTR,Be))),Zt(b,"ADD_URI_SAFE_ATTR")&&ur(b.ADD_URI_SAFE_ATTR)&&He(ft,b.ADD_URI_SAFE_ATTR,Be),Zt(b,"FORBID_CONTENTS")&&ur(b.FORBID_CONTENTS)&&(Vt===yn&&(Vt=pn(Vt)),He(Vt,b.FORBID_CONTENTS,Be)),Zt(b,"ADD_FORBID_CONTENTS")&&ur(b.ADD_FORBID_CONTENTS)&&(Vt===yn&&(Vt=pn(Vt)),He(Vt,b.ADD_FORBID_CONTENTS,Be)),Ln&&(De["#text"]=!0),tt&&He(De,["html","head","body"]),De.table&&(He(De,["tbody"]),delete Ht.tbody),b.TRUSTED_TYPES_POLICY){if(typeof b.TRUSTED_TYPES_POLICY.createHTML!="function")throw Mr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof b.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Mr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Z=K;K=b.TRUSTED_TYPES_POLICY;try{F=Se("")}catch(we){throw K=Z,we}}else b.TRUSTED_TYPES_POLICY===null?(K=void 0,F=""):(K===void 0&&(K=te()),K&&typeof F=="string"&&(F=Se("")));rn&&rn(b),xn=b},ms=He({},[...Du,...Mu,...sb]),Qe=He({},[...Lu,...rb]),_t=function(b,$,Z){return $.namespaceURI===it?b==="svg":$.namespaceURI===vt?b==="svg"&&(Z==="annotation-xml"||ie[Z]):!!ms[b]},gs=function(b,$,Z){return $.namespaceURI===it?b==="math":$.namespaceURI===yt?b==="math"&&Me[Z]:!!Qe[b]},$l=function(b,$,Z){return $.namespaceURI===yt&&!Me[Z]||$.namespaceURI===vt&&!ie[Z]?!1:!Qe[b]&&(Ge[b]||!ms[b])},kt=function(b){let $=A(b);(!$||!$.tagName)&&($={namespaceURI:qt,tagName:"template"});const Z=ho(b.tagName),we=ho($.tagName);return Lt[b.namespaceURI]?b.namespaceURI===yt?_t(Z,$,we):b.namespaceURI===vt?gs(Z,$,we):b.namespaceURI===it?$l(Z,$,we):!!(Le==="application/xhtml+xml"&&Lt[b.namespaceURI]):!1},vs=function(b){fi(s.removed,{element:b});try{A(b).removeChild(b)}catch{if(C(b),!A(b))throw Mr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Bs=function(b){mr(b);const $=T(b);if($){const we=[];di($,je=>{fi(we,je)}),di(we,je=>{try{C(je)}catch{}})}const Z=B(b);if(Z)for(let we=Z.length-1;we>=0;--we){const je=Z[we],ze=je&&je.name;if(typeof ze=="string")try{b.removeAttribute(ze)}catch{}}},ys=function(b,$){try{fi(s.removed,{attribute:$.getAttributeNode(b),from:$})}catch{fi(s.removed,{attribute:null,from:$})}if($.removeAttribute(b),b==="is")if(dt||Dn)try{vs($)}catch{}else try{$.setAttribute(b,"")}catch{}},zr=function(b){const $=B(b);if($)for(let Z=$.length-1;Z>=0;--Z){const we=$[Z],je=we&&we.name;if(!(typeof je!="string"||$e[Be(je)]))try{b.removeAttribute(je)}catch{}}},mr=function(b){const $=[b];for(;$.length>0;){const Z=$.pop();(I?I(Z):Z.nodeType)===Wn.element&&zr(Z);const je=T(Z);if(je)for(let ze=je.length-1;ze>=0;--ze)$.push(je[ze])}},Lo=function(b){if(!Ue)return;const $=[b];for(;$.length>0;){const Z=$.pop(),we=I?I(Z):Z.nodeType;if(we===Wn.processingInstruction||we===Wn.comment&&Qt(Nm,Z.data)){try{C(Z)}catch{}continue}if(we===Wn.element){const ze=Z,Ke=Be(W?W(Z):Z.nodeName);try{ze.hasAttribute&&ze.hasAttribute("patchsrc")&&ze.removeAttribute("patchsrc"),ze.hasAttribute&&ze.hasAttribute("for")&&Ke!=="label"&&Ke!=="output"&&ze.removeAttribute("for")}catch{}}const je=T(Z);if(je)for(let ze=je.length-1;ze>=0;--ze)$.push(je[ze])}},gr=function(b){let $=null,Z=null;if(an)b="<remove></remove>"+b;else{const ze=mm(b,/^[\r\n\t ]+/);Z=ze&&ze[0]}Le==="application/xhtml+xml"&&qt===it&&(b='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+b+"</body></html>");const we=K?Se(b):b;if(qt===it)try{$=new v().parseFromString(we,Le)}catch{}if(!$||!$.documentElement){$=ae.createDocument(qt,"template",null);try{$.documentElement.innerHTML=st?F:we}catch{}}const je=$.body||$.documentElement;return b&&Z&&je.insertBefore(r.createTextNode(Z),je.childNodes[0]||null),qt===it?U.call($,tt?"html":"body")[0]:tt?$.documentElement:je},$n=function(b){const $=Y?Y(b):b.ownerDocument;return O.call($||b,b,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},Fr=function(b){return b=co(b,ne," "),b=co(b,de," "),b=co(b,X," "),b},wn=function(b){var $;b.normalize();const Z=Y?Y(b):b.ownerDocument,we=O.call(Z||b,b,g.SHOW_TEXT|g.SHOW_COMMENT|g.SHOW_CDATA_SECTION|g.SHOW_PROCESSING_INSTRUCTION,null);let je=we.nextNode();for(;je;)je.data=Fr(je.data),je=we.nextNode();const ze=($=b.querySelectorAll)===null||$===void 0?void 0:$.call(b,"template");ze&&di(ze,Ke=>{Ws(Ke.content)&&wn(Ke.content)})},Ur=function(b){const $=W?W(b):null;return typeof $!="string"||Be($)!=="form"?!1:typeof b.nodeName!="string"||typeof b.textContent!="string"||typeof b.removeChild!="function"||b.attributes!==B(b)||typeof b.removeAttribute!="function"||typeof b.setAttribute!="function"||typeof b.namespaceURI!="string"||typeof b.insertBefore!="function"||typeof b.hasChildNodes!="function"||b.nodeType!==I(b)||b.childNodes!==T(b)},Ws=function(b){if(!I||typeof b!="object"||b===null)return!1;try{return I(b)===Wn.documentFragment}catch{return!1}},vr=function(b){if(!I||typeof b!="object"||b===null)return!1;try{return typeof I(b)=="number"}catch{return!1}};function kn(le,b,$){le.length!==0&&di(le,Z=>{Z.call(s,b,$,xn)})}const Br=function(b,$){return!!(Ue&&b.hasChildNodes()&&!vr(b.firstElementChild)&&Qt(Tm,b.textContent)&&Qt(Tm,b.innerHTML)||Ue&&b.namespaceURI===it&&$==="style"&&vr(b.firstElementChild)||b.nodeType===Wn.processingInstruction||Ue&&b.nodeType===Wn.comment&&Qt(Nm,b.data))},yr=function(b,$,Z){if(!Ht[$]&&Ei($)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,$)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck($)))return!1;if(Ln&&!Vt[$]){const we=A(b),je=T(b);if(je&&we){const ze=je.length;for(let Ke=ze-1;Ke>=0;--Ke){const Ze=b===Z?S(je[Ke],!0):je[Ke];we.insertBefore(Ze,E(b))}}}return vs(b),!0},xr=function(b,$,Z,we){return b.length===0?$:$===Z||$===we?pn($):$},Po=function(b,$){if(kn(P.beforeSanitizeElements,b,null),b!==$&&A(b)===null)return vn&&mr(b),!0;if(Ur(b))return vs(b),!0;const Z=Be(W?W(b):b.nodeName);if(De=xr(P.uponSanitizeElement,De,lt,gt),kn(P.uponSanitizeElement,b,{tagName:Z,allowedTags:De}),b!==$&&A(b)===null)return vn&&mr(b),!0;if(Br(b,Z))return vs(b),!0;if(Ht[Z]||!(wt.tagCheck instanceof Function&&wt.tagCheck(Z))&&!De[Z]){const je=yr(b,Z,$);return je===!1&&kn(P.afterSanitizeElements,b,null),je}if((I?I(b):b.nodeType)===Wn.element&&!kt(b)||(Z==="noscript"||Z==="noembed"||Z==="noframes")&&Qt(hb,b.innerHTML))return vs(b),!0;if(pe&&b.nodeType===Wn.text){const je=Fr(b.textContent);b.textContent!==je&&(fi(s.removed,{element:b.cloneNode()}),b.textContent=je)}return kn(P.afterSanitizeElements,b,null),!1},Oo=function(b,$,Z){if(tn[$]||Ue&&$==="patchsrc"||Ue&&$==="for"&&b!=="label"&&b!=="output"||ps&&($==="id"||$==="name")&&(Z in r||Z in js))return!1;const we=$e[$]||wt.attributeCheck instanceof Function&&wt.attributeCheck($,b);if(!($t&&Qt(fe,$))){if(!(jt&&Qt(be,$))){if(we){if(!ft[$]){if(!Qt(at,co(Z,Re,""))){if(!(($==="src"||$==="xlink:href"||$==="href")&&b!=="script"&&gm(Z,"data:")===0&&Xe[b])){if(!(Mt&&!Qt(Ee,co(Z,Re,"")))){if(Z)return!1}}}}}else if(!(Ei(b)&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,b)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(b))&&(Fe.attributeNameCheck instanceof RegExp&&Qt(Fe.attributeNameCheck,$)||Fe.attributeNameCheck instanceof Function&&Fe.attributeNameCheck($,b))||$==="is"&&Fe.allowCustomizedBuiltInElements&&(Fe.tagNameCheck instanceof RegExp&&Qt(Fe.tagNameCheck,Z)||Fe.tagNameCheck instanceof Function&&Fe.tagNameCheck(Z))))return!1}}return!0},Ci=He({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ei=function(b){return!Ci[ho(b)]&&Qt(Ce,b)},_i=function(b,$,Z,we){if(K&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Z)switch(k.getAttributeType(b,$)){case"TrustedHTML":return Se(we);case"TrustedScriptURL":return Pe(we)}return we},wr=function(b,$,Z,we){try{Z?b.setAttributeNS(Z,$,we):b.setAttribute($,we),Ur(b)?vs(b):hm(s.removed)}catch{ys($,b)}},$o=function(b){kn(P.beforeSanitizeAttributes,b,null);const $=b.attributes;if(!$||Ur(b))return;$e=xr(P.uponSanitizeAttribute,$e,en,Ct);const Z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$e,forceKeepAttr:void 0};let we=$.length;const je=Be(b.nodeName);for(;we--;){const ze=$[we],Ke=ze.name,Ze=ze.namespaceURI,St=ze.value,bt=Be(Ke),Cs=St;let At=Ke==="value"?Cs:XS(Cs);if(Z.attrName=bt,Z.attrValue=At,Z.keepAttr=!0,Z.forceKeepAttr=void 0,kn(P.uponSanitizeAttribute,b,Z),At=Z.attrValue,hs&&(bt==="id"||bt==="name")&&gm(At,ts)!==0&&(ys(Ke,b),At=ts+At),Ue&&Qt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,At)){ys(Ke,b);continue}if(bt==="attributename"&&mm(At,"href")){ys(Ke,b);continue}if(!Z.forceKeepAttr){if(!Z.keepAttr){ys(Ke,b);continue}if(!q&&Qt(mb,At)){ys(Ke,b);continue}if(pe&&(At=Fr(At)),!Oo(je,bt,At)){ys(Ke,b);continue}At=_i(je,bt,Ze,At),At!==Cs&&wr(b,Ke,Ze,At)}}kn(P.afterSanitizeAttributes,b,null)},Hs=function(b){let $=null;const Z=$n(b);for(kn(P.beforeSanitizeShadowDOM,b,null);$=Z.nextNode();)if(kn(P.uponSanitizeShadowNode,$,null),Po($,b),$o($),Ws($.content)&&Hs($.content),(I?I($):$.nodeType)===Wn.element){const je=_($);Ws(je)&&(qe(je),Hs(je))}kn(P.afterSanitizeShadowDOM,b,null)},qe=function(b){const $=[{node:b,shadow:null}];for(;$.length>0;){const Z=$.pop();if(Z.shadow){Hs(Z.shadow);continue}const we=Z.node,ze=(I?I(we):we.nodeType)===Wn.element,Ke=T(we);if(Ke)for(let Ze=Ke.length-1;Ze>=0;--Ze)$.push({node:Ke[Ze],shadow:null});if(ze){const Ze=W?W(we):null;if(typeof Ze=="string"&&Be(Ze)==="template"){const St=we.content;Ws(St)&&$.push({node:St,shadow:null})}}if(ze){const Ze=_(we);Ws(Ze)&&$.push({node:null,shadow:Ze},{node:Ze,shadow:null})}}};return s.sanitize=function(le){let b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},$=null,Z=null,we=null,je=null;if(st=!le,st&&(le="<!-->"),typeof le!="string"&&!vr(le)&&(le=tb(le),typeof le!="string"))throw Mr("dirty is not a string, aborting");if(!s.isSupported)return le;mt?(De=gt,$e=Ct):On(b),(P.uponSanitizeElement.length>0||P.uponSanitizeAttribute.length>0)&&(De=pn(De)),P.uponSanitizeAttribute.length>0&&($e=pn($e)),s.removed=[];const ze=vn&&typeof le!="string"&&vr(le);if(ze){Lo(le);const St=W?W(le):le.nodeName;if(typeof St=="string"){const bt=Be(St);if(!De[bt]||Ht[bt])throw Bs(le),Mr("root node is forbidden and cannot be sanitized in-place")}if(Ur(le))throw Bs(le),Mr("root node is clobbered and cannot be sanitized in-place");try{qe(le)}catch(bt){throw Bs(le),bt}}else if(vr(le))$=gr("<!---->"),Z=$.ownerDocument.importNode(le,!0),Z.nodeType===Wn.element&&Z.nodeName==="BODY"||Z.nodeName==="HTML"?$=Z:$.appendChild(Z),qe(Z);else{if(!dt&&!pe&&!tt&&le.indexOf("<")===-1)return K&&Mn?Se(le):le;if($=gr(le),!$)return dt?null:Mn?F:""}$&&an&&vs($.firstChild);const Ke=ze?le:$;try{const St=$n(Ke);for(;we=St.nextNode();)Po(we,Ke),$o(we),Ws(we.content)&&Hs(we.content)}catch(St){throw ze&&(Bs(le),di(s.removed,bt=>{bt.element&&mr(bt.element)})),St}if(ze)return di(s.removed,St=>{St.element&&mr(St.element)}),pe&&wn(le),le;if(dt){if(pe&&wn($),Dn)for(je=Q.call($.ownerDocument);$.firstChild;)je.appendChild($.firstChild);else je=$;return($e.shadowroot||$e.shadowrootmode)&&(je=j.call(o,je,!0)),je}let Ze=tt?$.outerHTML:$.innerHTML;return tt&&De["!doctype"]&&$.ownerDocument&&$.ownerDocument.doctype&&$.ownerDocument.doctype.name&&Qt(fb,$.ownerDocument.doctype.name)&&(Ze="<!DOCTYPE "+$.ownerDocument.doctype.name+`>
|
|
480
|
+
`+Ze),pe&&(Ze=Fr(Ze)),K&&Mn?Se(Ze):Ze},s.setConfig=function(){let le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};On(le),mt=!0,gt=De,Ct=$e},s.clearConfig=function(){xn=null,mt=!1,gt=null,Ct=null,K=re,F=""},s.isValidAttribute=function(le,b,$){xn||On({});const Z=Be(le),we=Be(b);return Oo(Z,we,$)},s.addHook=function(le,b){typeof b=="function"&&Zt(P,le)&&fi(P[le],b)},s.removeHook=function(le,b){if(Zt(P,le)){if(b!==void 0){const $=KS(P[le],b);return $===-1?void 0:YS(P[le],$,1)[0]}return hm(P[le])}},s.removeHooks=function(le){Zt(P,le)&&(P[le]=[])},s.removeAllHooks=function(){P=jm()},s}var Ld=Cv();const yb=new Set(["command_execution","file_change","mcp_tool_call","web_search"]),xb=100;function Cm(t){return yb.has(t.type)}function wb({items:t,runtimeType:s,turn:r,threads:o=[]}){const[l,u]=x.useState(!1),[f,p]=x.useState(!1);if(t.length===0)return null;const g=t.length,m=f?0:Math.max(0,g-xb),v=m>0?t.slice(m):t;return a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>u(k=>!k),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(Jw,{size:12})}),a.jsxs("span",{className:"tool-calls-summary",children:[g," tool call",g>1?"s":""]}),a.jsx(bo,{size:14,className:"tool-calls-chevron",style:{transform:l?"rotate(90deg)":"none"}})]}),l&&a.jsxs("div",{className:"tool-calls-body",children:[m>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>p(!0),children:["Show ",m," earlier tool call",m>1?"s":""]})}),v.map(k=>a.jsx(Ps,{item:k,runtimeType:s,turn:r,threads:o},k.id))]})]})}Ve.setOptions({breaks:!0,gfm:!0});function kb(t){const s=Ve.parse(t);return Ld.sanitize(s)}function Em(t,s){var l;const r=document.createTreeWalker(t,NodeFilter.SHOW_TEXT);let o=0;for(;r.nextNode();){const u=r.currentNode,f=((l=u.textContent)==null?void 0:l.length)??0;if(o+f>s)return{node:u,offset:s-o};o+=f}return null}function Sb(t,s,r){const o=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),l=[];for(;o.nextNode();){const u=o.currentNode;if(!u.textContent||u.textContent.trim()==="")continue;const f=document.createRange();f.selectNodeContents(u),!(f.compareBoundaryPoints(Range.START_TO_END,s)<=0)&&(f.compareBoundaryPoints(Range.END_TO_START,s)>=0||l.push(u))}for(const u of l){const f=u.length;let p=0,g=f;if(u===s.startContainer&&(p=Math.min(s.startOffset,f)),u===s.endContainer&&(g=Math.min(s.endOffset,f)),p>=g)continue;g<f&&u.splitText(g);const m=p>0?u.splitText(p):u,v=r(),k=m.parentNode;k&&(k.insertBefore(v,m),v.appendChild(m))}}function bb(t,s){t.querySelectorAll("mark[data-thread-id]").forEach(r=>{const o=r.parentNode;if(!o)return;const l=document.createTextNode(r.textContent||"");o.replaceChild(l,r),o.normalize()});for(const r of s){if(r.start_offset===null||r.end_offset===null)continue;const o=Em(t,r.start_offset),l=Em(t,r.end_offset);if(!o||!l)continue;const u=document.createRange();u.setStart(o.node,o.offset),u.setEnd(l.node,l.offset),Sb(t,u,()=>{const f=document.createElement("mark");return f.setAttribute("data-thread-id",r.id),r.status==="resolved"&&f.classList.add("thread-mark-resolved"),f})}}function Tb(t){const s=window.getSelection();if(!s||s.rangeCount===0)return null;const r=s.getRangeAt(0);if(r.collapsed||!t.contains(r.commonAncestorContainer))return null;const o=document.createRange();o.setStart(t,0),o.setEnd(r.startContainer,r.startOffset);const l=o.toString().length,u=r.toString();return{start:l,end:l+u.length,text:u}}function Nb({itemId:t,turnId:s,sessionId:r,content:o,threads:l}){const u=x.useRef(null),f=x.useRef(null),p=x.useRef(null),g=x.useRef(""),m=x.useRef(0),[v,k]=x.useState(!1),[w,S]=x.useState({x:0,y:0}),[C,E]=x.useState(!1),[T,A]=x.useState({x:0,y:0}),[_,B]=x.useState(""),[I,W]=x.useState(null),[Y,K]=x.useState(!1),F=M(U=>U.createThread),re=M(U=>U.switchRightTab),he=M(U=>Nl(U.sessionDetails[r])),G=x.useCallback(async()=>{await vl(o||""),K(!0),setTimeout(()=>K(!1),1500)},[o]),Ne=x.useCallback(()=>{var j;if(!I)return;const U=`
|
|
481
481
|
\`\`\`QUOTE
|
|
482
482
|
${I.text}
|
|
483
483
|
\`\`\`
|
|
484
484
|
|
|
485
|
-
`;M.setState({quotedText:U}),k(!1),W(null),(j=window.getSelection())==null||j.removeAllRanges()},[I]),Se=x.useMemo(()=>
|
|
485
|
+
`;M.setState({quotedText:U}),k(!1),W(null),(j=window.getSelection())==null||j.removeAllRanges()},[I]),Se=x.useMemo(()=>kb(o||"…"),[o]),Pe=x.useMemo(()=>l.filter(U=>U.item_id===t),[l,t]);x.useEffect(()=>{u.current&&bb(u.current,Pe)},[Se,Pe]),x.useEffect(()=>{g.current=_},[_]),x.useEffect(()=>{function U(j){f.current&&!f.current.contains(j.target)&&(k(!1),g.current.trim()||E(!1))}return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[]);const te=x.useCallback(()=>{k(!1),g.current.trim()||E(!1)},[]),oe=x.useCallback(()=>{const U=u.current;if(!U)return;const j=Tb(U);if(j&&j.text.trim().length>0){const P=window.getSelection();if(P&&P.rangeCount>0&&P.anchorNode&&P.focusNode){const de=P.getRangeAt(0).getBoundingClientRect(),X=28,fe=6,be=170;let Ee=!1;try{const at=document.createRange();at.setStart(P.focusNode,P.focusOffset),at.setEnd(P.focusNode,P.focusOffset);const De=document.createRange();De.setStart(P.anchorNode,P.anchorOffset),De.setEnd(P.anchorNode,P.anchorOffset),Ee=De.compareBoundaryPoints(Range.START_TO_START,at)>0}catch{Ee=!1}let Re=de.top-X-fe;Re<8&&(Re=de.bottom+fe);let Ce=Ee?de.left-be:de.right;Ce=Math.max(8,Math.min(Ce,window.innerWidth-be-8)),S({x:Ce,y:Re}),k(!0),W(j)}}else k(!1)},[]);x.useEffect(()=>{function U(j){const P=j.target;P&&(P.closest(".selection-actions")||P.closest(".thread-create-popover"))||oe()}return document.addEventListener("mouseup",U),()=>document.removeEventListener("mouseup",U)},[oe]);const ae=x.useCallback(()=>{k(!1),E(!0),A({x:w.x,y:w.y})},[w]);x.useLayoutEffect(()=>{if(!C)return;const U=p.current;if(!U)return;const j=U.offsetWidth,P=U.offsetHeight,ne=8;let de=w.x,X=w.y;de-j<ne&&(de=j+ne),de>window.innerWidth-ne&&(de=window.innerWidth-ne),X<ne&&(X=ne),X+P>window.innerHeight-ne&&(X=window.innerHeight-P-ne),A({x:de,y:X})},[C,w]);const O=x.useCallback(async()=>{var U;he||!I||!_.trim()||(await F(r,{itemId:t,turnId:s,startOffset:I.start,endOffset:I.end,selectedText:I.text,message:_.trim()}),B(""),E(!1),W(null),(U=window.getSelection())==null||U.removeAllRanges(),re("threads"))},[I,_,F,r,t,s,re,he]),Q=x.useCallback(U=>{const j=U.target;if(j.tagName==="MARK"&&j.hasAttribute("data-thread-id")){U.preventDefault(),re("threads");const P=j.getAttribute("data-thread-id");setTimeout(()=>{const ne=document.getElementById(`thread-${P}`);ne&&(ne.scrollIntoView({behavior:"smooth",block:"center"}),ne.classList.add("thread-card-highlighted"),setTimeout(()=>ne.classList.remove("thread-card-highlighted"),1500))},100)}},[re]);return a.jsxs("div",{className:"copy-text-wrapper",style:{position:"relative"},ref:f,children:[a.jsx("div",{ref:u,dangerouslySetInnerHTML:{__html:Se},onMouseDown:te,onClick:Q}),a.jsx("button",{className:`copy-text-btn${Y?" copied":""}`,onClick:G,title:Y?"Copied":"Copy message","aria-label":"Copy message text",children:Y?a.jsx(Ts,{size:14}):a.jsx(ll,{size:14})}),v&&!C&&a.jsxs("div",{className:"selection-actions",style:{left:w.x,top:w.y},children:[!he&&a.jsxs("button",{className:"discuss-button",onClick:ae,title:"Start a discussion about this text",children:[a.jsx(Ow,{size:14}),a.jsx("span",{children:"Discuss"})]}),a.jsxs("button",{className:"discuss-button",onClick:Ne,title:"Quote this text in your message",children:[a.jsx(Lg,{size:14}),a.jsx("span",{children:"Quote"})]})]}),C&&a.jsxs("div",{ref:p,className:"thread-create-popover",style:{left:T.x,top:T.y},children:[a.jsxs("div",{className:"thread-create-header",children:[a.jsxs("span",{className:"thread-create-quote",children:['"',I==null?void 0:I.text.slice(0,80),I&&I.text.length>80?"…":"",'"']}),a.jsx("button",{className:"thread-create-close",onClick:()=>{E(!1),W(null)},children:a.jsx(gn,{size:14})})]}),a.jsx("textarea",{className:"thread-create-input",placeholder:"Ask about this text…",value:_,onChange:U=>B(U.target.value),autoFocus:!0,rows:2,onKeyDown:U=>{if(U.key==="Enter"&&(U.metaKey||U.ctrlKey)&&(U.preventDefault(),O()),U.key==="Escape")if(g.current.trim()){const j=Date.now();m.current&&j-m.current<400?(m.current=0,E(!1),W(null)):m.current=j}else E(!1),W(null)}}),a.jsxs("div",{className:"thread-create-footer",children:[a.jsx("span",{className:"thread-create-hint",children:"⌘↵ to send · Esc to cancel"}),a.jsxs("button",{className:"thread-create-send",onClick:O,disabled:!_.trim()||he,title:he?"Wait for the running turn to finish first":void 0,children:[a.jsx(_o,{size:13}),a.jsx("span",{children:"Send"})]})]})]})]})}const _m=x.memo(Nb),Sl=new Map,Ev=new Set,ed=new Set,Rm=new Map;function _v(){ed.forEach(t=>t())}function Rv(t,s){return`${t}:${s}`}function jb(t,s,r,o,l){var g;const u=Rv(s,r),f=Sl.get(t)??new Map,p=new Map(f);((g=p.get(u))==null?void 0:g.answer)===l?p.delete(u):p.set(u,{itemIndex:s,groupIndex:r,question:o,answer:l}),Sl.set(t,p),_v()}function Cb(t){Sl.delete(t),_v()}function Eb(t){Ev.add(t),Cb(t)}function _b(t){const s=x.useCallback(r=>(ed.add(r),()=>{ed.delete(r)}),[]);return x.useSyncExternalStore(s,()=>Sl.get(t)??Rm,()=>Rm)}function Rb(t){return[...t].sort((s,r)=>s.itemIndex-r.itemIndex||s.groupIndex-r.groupIndex).map(s=>`> ${s.question}
|
|
486
486
|
${s.answer}`).join(`
|
|
487
487
|
|
|
488
|
-
`)}function Am({item:t,turn:s}){var S;const r=t.data??{},o=x.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(C=>!!C&&Array.isArray(C.selections)&&C.selections.length>0):[],[r.groups]),l=
|
|
489
|
-
… (truncated, click to expand)`:A;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx($g,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Command"}),B&&a.jsx("span",{className:"turn-header-meta",children:B})]}),a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:T})}),A&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:W})}),I&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>f(Y=>!Y),children:u?"Show less":`Show full output (${(A.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const E=(p=t.data)==null?void 0:p.changes,T=Array.isArray(E)?E:[],A=`${T.length} file${T.length!==1?"s":""}`;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(jw,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:A})]}),a.jsx("div",{className:"file-change-list",children:T.map((_,B)=>{const I=_.kind==="add"?"A":_.kind==="delete"?"D":"M",W=_.kind==="add"?"fc-add":_.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${W}`,children:I}),a.jsx("span",{className:"fc-name",children:_.path})]},B)})})]})}case"mcp_tool_call":{const E=t.data||{},T=E.tool||"mcp";if(T==="Agent"){const F=E.arguments,re=(F==null?void 0:F.description)||(F==null?void 0:F.prompt)||"Subagent",he=t.status==="failed",G=l?"running…":he?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(hr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:re}),a.jsx("span",{className:`agent-call-status ${l?"running":he?"failed":"done"}`,children:G})]})}const A=E.server||"",_=E.arguments,B=E.result,I=E.error,W=t.status==="failed"||!!I,Y=l?"running…":W?"failed":"done",K=((g=B==null?void 0:B.content)==null?void 0:g.filter(F=>F.type==="text").map(F=>F.text))??[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Hw,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",T]}),A&&a.jsx("span",{className:"turn-header-meta",children:A}),a.jsx("span",{className:"turn-header-meta",style:W?{color:"var(--red)"}:void 0,children:Y})]}),_&&Object.keys(_).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(_).map(([F,re])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:F}),F==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(re)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof re=="string"?re:JSON.stringify(re,null,2)})]},F))}),K.length>0&&K.map((F,re)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:F})},re)),I&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:I})})]})}case"web_search":{const E=((m=t.data)==null?void 0:m.query)||"";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(qw,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),a.jsx("p",{className:"user-message",children:E})]})}case"todo_list":{const E=((v=t.data)==null?void 0:v.items)||[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Dw,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:E.map((T,A)=>a.jsxs("li",{className:T.completed?"todo-done":"todo-pending",children:[T.completed?a.jsx(Ts,{size:14}):a.jsx(Or,{size:14})," ",T.text]},A))})]})}case"ask_user":return a.jsx(Am,{item:t,turn:r});case"final_result":{const E=t.data??{},T=E.text||"",A=E.html||null,_=Array.isArray(E.groups)?E.groups.filter(W=>!!W&&Array.isArray(W.selections)&&W.selections.length>0):[],{iconClass:B,iconText:I}=Wu(s??"codex");return a.jsxs(a.Fragment,{children:[(T||A)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${B}`,children:I}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),T&&a.jsx(_m,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:T,threads:o,runtimeType:s}),A&&a.jsx(Wb,{html:A})]}),_.length>0&&a.jsx(Am,{item:t,turn:r})]})}case"background_task":{const E=t.data||{},T=E.task_type||"unknown",A=E.subagent_type||null,_=E.description||"",B=E.status||"running",I=E.last_tool_name||null,W=E.token_count||null,Y=T==="local_agent",K=T==="local_bash",F=Y?hr:K?Og:Eg,re=Y?`Subagent${A?`: ${A}`:""}`:K?"Monitor":"Background Task",he=B==="running"?"running…":B==="completed"?"done":B==="failed"?"failed":B==="stopped"?"stopped":B,G=t.status==="failed"||B==="failed";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(F,{size:14})}),a.jsx("span",{className:"turn-header-title",children:re}),a.jsx("span",{className:"turn-header-meta",style:G?{color:"var(--red)"}:void 0,children:he})]}),_&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:_}),I&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",I,W!=null&&` · ${W.toLocaleString()} tokens`]}),a.jsx("div",{className:"cmd-output",style:{color:"var(--text-muted)",fontSize:"11px"},children:"Output available in Tasks panel — click the status bar indicator or the Tasks tab."})]})}case"context_compaction":{const E=((k=t.data)==null?void 0:k.trigger)??"auto",T=((w=t.data)==null?void 0:w.pre_tokens)??0,A=((S=t.data)==null?void 0:S.post_tokens)??0,_=T>0?Math.round((1-A/T)*100):0,B=E==="manual"?"Context compacted (/compact)":"Context auto-compacted";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Ow,{size:14})}),a.jsx("span",{className:"turn-header-title",children:B})]}),a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:[T.toLocaleString()," → ",A.toLocaleString()," tokens (",_,"% reduction)"]})]})}case"interruption":return a.jsx(Db,{item:t});case"error":{const E=((C=t.data)==null?void 0:C.message)||"Unknown error";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--red)",color:"#fff"},children:a.jsx(Rl,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Error"})]}),a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:E})})]})}default:return null}}const Ps=x.memo(Hb,(t,s)=>t.item===s.item&&t.runtimeType===s.runtimeType&&t.threads===s.threads&&t.turn.id===s.turn.id);function Vb({turn:t,runtimeType:s,threads:r=[]}){Dt.trackRender("TurnContent");const[o,l]=x.useState(!1),[u,f]=x.useState(!1),[p,g]=x.useState(!1);x.useEffect(()=>{const G=t.items.some(Ne=>Ne.type==="background_task"&&Ne.status==="in_progress");t.status==="running"||t.status==="pending"?l(!0):t.status==="completed"&&!G&&l(!1)},[t.status,t.items]);let m=-1;for(let G=t.items.length-1;G>=0;G--)if(t.items[G].type==="agent_message"){m=G;break}const v=m>=0,k=v?t.items.slice(0,m):t.items,w=t.items.some(G=>G.type==="final_result"||G.type==="ask_user"),S=!v&&t.status==="completed"&&t.agent_response&&!w?{id:`response-${t.id}`,turn_id:t.id,external_item_id:`response-${t.id}`,type:"agent_message",data:{text:t.agent_response},status:"completed",created_at:t.created_at,updated_at:t.updated_at}:null,E=k.filter(G=>{var Ne;return!(G.type==="reasoning"&&(!((Ne=G.data)!=null&&Ne.text)||G.data.text===""))}).filter(G=>!(G.type==="background_task"||G.type==="ask_user"||G.type==="final_result")),T=u?0:Math.max(0,E.length-$b),A=T>0?E.slice(T):E,_=[];let B=null;for(const G of A)G.type==="agent_message"?(B&&_.push(B),B={agentMessage:G,toolItems:[],otherItems:[]}):G.type==="interruption"||G.type==="error"?(B&&_.push(B),_.push({agentMessage:null,toolItems:[],otherItems:[G]}),B=null):(B||(B={agentMessage:null,toolItems:[],otherItems:[]}),Cm(G)?B.toolItems.push(G):B.otherItems.push(G));B&&_.push(B);const I=t.items.filter(G=>G.type==="background_task"),W=p?0:Math.max(0,I.length-Ob),Y=W>0?I.slice(W):I,K=E.filter(G=>Cm(G)).length,F=K>0||E.length>0&&(t.status==="running"||t.status==="pending"),re=t.status==="pending"&&t.resume_state==="waiting",he=t.resume_state==="gave_up"||t.resume_state==="skipped"||t.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:t.user_prompt}),Array.isArray(t.attachments)&&t.attachments.length>0&&a.jsx(zb,{attachments:t.attachments})]}),F&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(G=>!G),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(Rw,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:K>0?`${K} tool call${K>1?"s":""}`:re?"interrupted":"thinking…"}),a.jsx(bo,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&a.jsxs("div",{className:"tool-calls-body",children:[T>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>f(!0),children:["Show ",T," earlier step",T>1?"s":""]})}),_.map((G,Ne)=>a.jsxs("div",{className:"intermediate-segment",children:[G.agentMessage&&a.jsx(Ps,{item:G.agentMessage,runtimeType:s,turn:t,threads:r}),G.otherItems.map(Se=>a.jsx(Ps,{item:Se,runtimeType:s,turn:t,threads:r},Se.id)),G.toolItems.length>0&&a.jsx(xb,{items:G.toolItems,runtimeType:s,turn:t,threads:r})]},Ne))]})]}),W>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(!0),children:["Show ",W," earlier background task",W>1?"s":""]})}),Y.map(G=>a.jsx(Ps,{item:G,runtimeType:s,turn:t,threads:r},`task-${G.id}`)),v&&a.jsx(Ps,{item:t.items[m],runtimeType:s,turn:t,threads:r},t.items[m].id),S&&a.jsx(Ps,{item:S,runtimeType:s,turn:t,threads:r},S.id),v&&t.items.slice(m+1).filter(G=>G.type!=="ask_user"&&G.type!=="background_task"&&G.type!=="final_result").map(G=>a.jsx(Ps,{item:G,runtimeType:s,turn:t,threads:r},G.id)),t.items.filter(G=>G.type==="final_result").map(G=>a.jsx(Ps,{item:G,runtimeType:s,turn:t,threads:r},`final-${G.id}`)),t.items.filter(G=>G.type==="ask_user").map(G=>a.jsx(Ps,{item:G,runtimeType:s,turn:t,threads:r},`ask-${G.id}`)),t.items.length===0&&!t.error&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.status==="running"?"Agent is thinking…":"Waiting to start…"})}),t.error&&!he&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:t.error})})}),t.status==="running"&&a.jsx(Pb,{turnId:t.id}),a.jsx(Lb,{turn:t}),t.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Or,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const Gb=x.memo(Vb),qb=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function Kb(){const t=M(T=>T.workspaces),s=M(T=>T.loadPickerSupport),r=M(T=>T.pickAndAddWorkspace),o=M(T=>T.createSessionInWorkspace),l=M(T=>T.setImportSessionsWorkspace);x.useEffect(()=>{s()},[s]);const u=t.filter(T=>T.deleted===0),[f,p]=x.useState(null),g=u.find(T=>T.path===f)??u[u.length-1]??null,m=(g==null?void 0:g.path)??null,[v,k]=x.useState(null);x.useEffect(()=>{if(!m)return;let T=!1;return mg(m).then(A=>{T||k({path:m,count:A.length})}).catch(()=>{}),()=>{T=!0}},[m]);const w=v&&v.path===m?v.count:0,[S,C]=x.useState(!1);async function E(T){C(!0);try{await o(T)}finally{C(!1)}}return a.jsx("div",{className:"render-scroll welcome-scroll",children:a.jsxs("main",{className:"welcome","aria-labelledby":"welcome-title",children:[a.jsx("h1",{className:"welcome-title",id:"welcome-title",children:"Welcome to Repoburg"}),a.jsx("p",{className:"welcome-lead",children:"Run Claude Code and Codex agents on your projects, side by side. Each session works in a workspace: one of your project folders."}),a.jsxs("ol",{className:"welcome-steps",children:[a.jsxs("li",{className:`welcome-step${g?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:g?a.jsx(Ts,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),g?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:g.path,children:g.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(Ew,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${g?" current":" upcoming"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:"2"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Start your first session"}),g&&m?a.jsxs(a.Fragment,{children:[u.length>1&&a.jsxs("label",{className:"welcome-step-text welcome-target",children:["In",a.jsx("select",{className:"dialog-input dialog-select",value:m,onChange:T=>p(T.target.value),children:u.map(T=>a.jsx("option",{value:T.path,children:T.label||T.path},T.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:S,onClick:()=>void E(m),children:[a.jsx(dr,{size:14})," New session"]}),w>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(Ig,{size:14})," Import ",w," Claude Code"," ",w===1?"session":"sessions"]})]}),w>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," in this folder continue right where they left off."]})]}):a.jsx("p",{className:"welcome-step-text",children:"Then start an agent session in it."})]})]})]}),a.jsxs("p",{className:"welcome-tip",children:["Later: right-click a workspace to import its Claude Code sessions, and press ",a.jsx("kbd",{children:qb})," for the command palette."]})]})})}const Yb=[],Ga=50;function Xb(){Dt.trackRender("RenderArea");const t=M(S=>S.activeSessionId),s=M(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=M(S=>S.submittingPrompt),o=M(S=>S.loading),l=M(S=>!S.activeSessionId&&!Qk(S.workspaces,S.sessions,S.appsRootPath)),u=(s==null?void 0:s.turns)??[],f=(s==null?void 0:s.threads)??Yb,p=x.useRef(null),[g,m]=x.useState(Ga);x.useEffect(()=>{m(Ga)},[t]);const v=u.filter(S=>!S.thread_id),k=Math.max(0,v.length-g),w=v.slice(k);return x.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[t,u.length]),o&&!s?a.jsx("div",{className:"render-scroll",children:a.jsxs("div",{className:"skeleton-bars",children:[a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"})]})}):s?a.jsxs("div",{className:"render-scroll",ref:p,children:[r&&a.jsx("div",{className:"turn-block",children:a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:r})]}),a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Sending…"})})]})}),u.length===0&&!r&&a.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),k>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>m(S=>S+Ga),children:["Show ",Math.min(Ga,k)," earlier turns (",k," hidden)"]})}),w.map((S,C)=>a.jsx("div",{id:`turn-${k+C}`,className:"turn-block",children:a.jsx(Gb,{turn:S,runtimeType:s.runtime_type,threads:f})},S.id))]}):l?a.jsx(Kb,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const Qb=x.memo(Xb),Zb=[{id:"model",label:"/model",hint:"Change model",capability:"dynamicModels"},{id:"sandbox",label:"/sandbox",hint:"Sandbox mode",capability:"sandbox",subPopup:"sandbox"},{id:"websearch",label:"/websearch",hint:"Web search mode",capability:"webSearch",subPopup:"websearch"},{id:"network",label:"/network",hint:"Network access",capability:"networkAccess",subPopup:"network"},{id:"skills",label:"/skills",hint:"Browse skills",capability:"skills"},{id:"plugins",label:"/plugins",hint:"Browse plugins",capability:"plugins"},{id:"mcp",label:"/mcp",hint:"Browse MCP servers",capability:"mcpServers"}];function Jb(t){return t.map(s=>({id:s.name,label:`/${s.name}`,hint:s.description,capability:null,insertAsText:!0}))}function eT(t,s,r=[]){const o=[...Zb,...Jb(r)],l=new Set;return o.filter(u=>!(l.has(u.label)||(l.add(u.label),u.capability&&!s[u.capability])||t&&!u.label.toLowerCase().includes(t.toLowerCase())))}function tT({commands:t,selectedIndex:s,onSelect:r,onHover:o}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),t.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),t.map((l,u)=>a.jsxs("div",{className:`slash-popup-item ${u===s?"selected":""}`,onMouseEnter:()=>o(u),onClick:()=>r(l),children:[a.jsx("span",{className:"slash-popup-label",children:l.label}),a.jsx("span",{className:"slash-popup-hint",children:l.hint})]},l.id))]})}function Ou({title:t,options:s,currentValue:r,onSelect:o,onClose:l}){return a.jsxs("div",{className:"slash-popup",children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:l,children:"← Back"}),a.jsx("span",{children:t})]}),s.map(u=>a.jsxs("div",{className:`slash-popup-item ${u.value===r?"selected":""}`,onClick:()=>o(u.value),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:u.label}),u.description&&a.jsx("span",{className:"slash-popup-hint",children:u.description})]}),u.value===r&&a.jsx("span",{className:"slash-popup-check",children:"✓"})]},u.value))]})}function nT(t){return Wt("/skills")}function sT({filter:t,onSelect:s,onClose:r}){const[o,l]=x.useState([]),[u,f]=x.useState(!0),[p,g]=x.useState(0),m=x.useRef(null);x.useEffect(()=>{nT().then(l).catch(()=>l([])).finally(()=>f(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(t.toLowerCase())||k.description.toLowerCase().includes(t.toLowerCase()));return x.useEffect(()=>{g(0)},[t]),x.useEffect(()=>{function k(w){w.key==="ArrowDown"?(w.preventDefault(),g(S=>Math.min(S+1,v.length-1))):w.key==="ArrowUp"?(w.preventDefault(),g(S=>Math.max(S-1,0))):w.key==="Enter"?(w.preventDefault(),v[p]&&s(v[p])):w.key==="Escape"&&(w.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,p,s,r]),a.jsxs("div",{className:"slash-popup",ref:m,children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:r,children:"← Back"}),a.jsx("span",{children:"Skills"})]}),u&&a.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!u&&v.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching skills"}),v.map((k,w)=>a.jsxs("div",{className:`slash-popup-item ${w===p?"selected":""}`,onMouseEnter:()=>g(w),onClick:()=>s(k),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:k.name}),k.description&&a.jsx("span",{className:"slash-popup-hint",children:k.description})]}),!!k.metadata.isSystem&&a.jsx("span",{className:"slash-popup-hint",children:"system"})]},k.id))]})}function rT(){return Wt("/providers")}function iT(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return Wt(`/providers/${t}/commands${r}`)}const oT={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function aT(t){const[s,r]=x.useState([]),[o,l]=x.useState(!0);x.useEffect(()=>{rT().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const u=s.find(f=>f.id===t)??null;return{provider:u,capabilities:(u==null?void 0:u.capabilities)??oT,loading:o}}const pi=32,$u=200;function Lm(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function Pm(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}let Om=0;function lT(){return Om+=1,`att-${Date.now()}-${Om}`}function cT(){Dt.trackRender("CommandInputBar");const[t,s]=x.useState(""),r=x.useRef(null),o=x.useRef(pi),l=x.useRef(null),{submitPrompt:u,cancelTurn:f,updateRuntimeConfig:p,setShowModelSelector:g}=M(),m=M(q=>q.activeSessionId),v=M(q=>q.activeSessionId?q.sessionDetails[q.activeSessionId]:null),k=M(q=>q.quotedText),w=dg(v),S=!!(v!=null&&v.turns.some(q=>q.status==="pending"&&q.resume_state==="waiting")),C=!m,{capabilities:E}=aT(v==null?void 0:v.runtime_type),T=(v==null?void 0:v.runtime_type)??null,A=E.imageAttachments,[_,B]=x.useState([]),[I,W]=x.useState(!1),[Y,K]=x.useState(null),[F,re]=x.useState([]);x.useEffect(()=>{if(!T){re([]);return}let q=!1;return iT(T,(v==null?void 0:v.cwd)??void 0).then(pe=>{q||re(pe)}).catch(()=>{q||re([])}),()=>{q=!0}},[T,v==null?void 0:v.cwd]);const[he,G]=x.useState(!1),[Ne,Se]=x.useState(""),[Pe,te]=x.useState(0),[oe,ae]=x.useState(void 0),[O,Q]=x.useState(!1),[U,j]=x.useState(""),[P,ne]=x.useState([]),de=he?eT(Ne,E,F):[];x.useEffect(()=>{k!==null&&(s(q=>q+k),setTimeout(()=>{if(r.current){De(),r.current.focus();const q=r.current.value.length;r.current.setSelectionRange(q,q)}},0),M.setState({quotedText:null}))},[k]),x.useEffect(()=>{if(!w)return;function q(pe){pe.key==="Escape"&&(pe.preventDefault(),f())}return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[w,f]),x.useEffect(()=>{G(!1),ae(void 0),Q(!1),ne([]),B(q=>{for(const pe of q)pe.previewUrl&&URL.revokeObjectURL(pe.previewUrl);return[]})},[m]),x.useEffect(()=>{if(!Y)return;function q(pe){pe.key==="Escape"&&(pe.preventDefault(),K(null))}return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[Y]);const X=x.useCallback(q=>{if(!q)return;const pe=Array.from(q);for(const Ue of pe){const tt=new FileReader;tt.onload=()=>{const gt=tt.result.split(",")[1]??"",Ct=Ue.type.startsWith("image/")?URL.createObjectURL(Ue):void 0;B(an=>[...an,{id:lT(),name:Ue.name,media_type:Ue.type||"application/octet-stream",data:gt,previewUrl:Ct,size:Ue.size}])},tt.readAsDataURL(Ue)}},[]),fe=x.useCallback(q=>{B(pe=>{const Ue=pe.find(tt=>tt.id===q);return Ue!=null&&Ue.previewUrl&&URL.revokeObjectURL(Ue.previewUrl),pe.filter(tt=>tt.id!==q)})},[]),be=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),!(!A||w)&&W(!0)},[A,w]),Ee=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),W(!1)},[]),Re=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),W(!1),!(!A||w)&&X(q.dataTransfer.files)},[A,w,X]),Ce=x.useCallback(q=>{var tt;if(!A)return;const pe=(tt=q.clipboardData)==null?void 0:tt.items;if(!pe)return;const Ue=[];for(let mt=0;mt<pe.length;mt++){const gt=pe[mt];if(gt.type.startsWith("image/")){const Ct=gt.getAsFile();Ct&&Ue.push(Ct)}}Ue.length>0&&(q.preventDefault(),X(Ue))},[A,X]);function at(q){const pe=r.current;pe&&(pe.style.height=`${q}px`,o.current=q)}function De(){const q=r.current;if(q){if(q.scrollHeight>q.clientHeight){const pe=Math.min(q.scrollHeight,$u);pe!==o.current&&at(pe);return}o.current>pi&&(q.style.height="auto",at(Math.min(q.scrollHeight,$u)))}}function lt(){const q=t.trim();if(!q||w)return;let pe=q;P.length>0&&(pe=`${P.map(mt=>`$${mt.name}`).join(" ")}
|
|
488
|
+
`)}function Am({item:t,turn:s}){var S;const r=t.data??{},o=x.useMemo(()=>Array.isArray(r.groups)?r.groups.filter(C=>!!C&&Array.isArray(C.selections)&&C.selections.length>0):[],[r.groups]),l=_b(s.id),u=M(C=>s.session_id?C.sessionDetails[s.session_id]:null),f=M(C=>C.activeSessionId),p=s.items.findIndex(C=>C.id===t.id),g=u?((S=u.turns[u.turns.length-1])==null?void 0:S.id)===s.id:!0,m=Ev.has(s.id),v=m||dg(u)||!g||s.session_id!==f,k=(C,E,T)=>{v||jb(s.id,p,C,E,T)},w=()=>{const C=[...l.values()];if(C.length===0)return;const E=Rb(C);Eb(s.id),M.getState().submitPrompt(E)};return a.jsxs("div",{className:"render-content ask-user-card",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Sw,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Question"}),m&&a.jsx("span",{className:"turn-header-meta",children:"answered"})]}),o.length>0?a.jsxs("div",{className:"ask-user-groups",children:[o.map((C,E)=>a.jsxs("div",{className:"ask-user-group",children:[C.question&&a.jsx("div",{className:"ask-user-question",children:C.question}),a.jsx("div",{className:"ask-user-options",children:C.selections.map(T=>{var _;const A=((_=l.get(Rv(p,E)))==null?void 0:_.answer)===T;return a.jsx("button",{type:"button",className:`ask-user-option ${A?"selected":""}`,disabled:v,onClick:()=>k(E,C.question,T),children:T},T)})})]},E)),v?m&&a.jsx("div",{className:"ask-user-submitted",children:"Answer sent"}):a.jsxs("button",{type:"button",className:"ask-user-send",disabled:l.size===0,onClick:w,children:[a.jsx(_o,{size:12}),"Send"]})]}):r.question?a.jsx("p",{className:"user-message",children:r.question}):a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Waiting for user response"})]})}const Ab={host_shutdown:"host shutdown",host_restart:"host restart",process_exit:"agent process stopped",network:"network error"};function mo(t){return t&&Ab[t]||"interrupted"}function bl(t){if(!t)return"";const s=new Date(t);return Number.isNaN(s.getTime())?"":s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function Ib(t){switch(t){case"network":return"Interrupted — network error. Will resume when the connection is back.";case"process_exit":return"Interrupted — the agent process stopped. Resuming automatically…";case"host_shutdown":return"Interrupted — the agent host shut down. Resuming automatically…";default:return"Interrupted — the agent host restarted. Resuming automatically…"}}function Db(t){return t.items.filter(s=>s.type==="interruption").map(s=>s.data)}function Mb({item:t}){const s=t.data,r=bl(s.interrupted_at);let o="";switch(s.outcome){case"waiting":o="waiting to resume";break;case"resuming":o="resuming…";break;case"resumed":o=s.resumed_at?`resumed ${bl(s.resumed_at)}`:"resumed";break;case"cancelled":o="stopped";break;case"unsupported":o="cannot be resumed";break;default:o="not resumed"}return a.jsx("div",{className:"interruption-marker",title:s.detail??void 0,children:a.jsxs("span",{children:["Interrupted",r?` ${r}`:""," (",mo(s.reason),") · ",o]})})}function Lb({turn:t,label:s}){const[r,o]=x.useState(!1),l=M(f=>f.addToast),u=()=>{o(!0),Wx(t.session_id,t.id).catch(f=>l("error",`Could not resume the turn — ${f.message}`)).finally(()=>o(!1))};return a.jsxs("button",{type:"button",className:"banner-action",onClick:u,disabled:r,children:[a.jsx(Pg,{size:12}),s]})}function Pb({turn:t}){const s=t.resume_state;if(!s||s==="cancelled")return null;const r=t.interrupt_reason,o=Db(t),l=o[o.length-1],u=bl(t.interrupted_at??(l==null?void 0:l.interrupted_at));if(s==="resumed"){const m=bl(l==null?void 0:l.resumed_at),v=t.status==="running"||t.status==="pending";return a.jsxs("div",{className:"interruption-banner resumed","data-state":"resumed",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Pg,{size:12})}),a.jsxs("span",{className:"banner-text",children:["Interrupted",u?` ${u}`:""," (",mo(r),") · resumed",m?` ${m}`:"",v?" — continuing…":""]})]})}let f,p=null,g=null;switch(s){case"waiting":f=Ib(r),g="Resume now";break;case"resuming":f=`Interrupted (${mo(r)}) — resuming from where it left off…`;break;case"gave_up":{const m=Math.max(o.length,1);f=`Interrupted ${m===1?"once":`${m} times`} — automatic resume stopped.`,p=t.error&&!t.error.startsWith("Automatic resume stopped")?t.error:null,g="Resume";break}case"skipped":f=`Interrupted${u?` ${u}`:""} (${mo(r)}) — too long ago to resume automatically.`,g="Resume";break;default:f=`Interrupted (${mo(r)}) — this turn cannot be resumed.`,p=t.error}return a.jsxs("div",{className:"interruption-banner","data-state":s,children:[a.jsx("span",{className:"banner-icon",children:r==="network"?a.jsx(Fg,{size:12}):a.jsx(Rl,{size:12})}),a.jsxs("span",{className:"banner-text",children:[f,p&&a.jsx("span",{className:"banner-detail",children:p})]}),g&&a.jsx(Lb,{turn:t,label:g})]})}function Ob({turnId:t}){const s=M(o=>o.retryStates[t]);if(!s)return null;const r=s.errorStatus?`API error ${s.errorStatus}`:"Connection problem";return a.jsxs("div",{className:"retry-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Fg,{size:12})}),a.jsxs("span",{className:"banner-text",children:[r," — retrying (attempt ",s.attempt," of ",s.maxRetries,")…"]})]})}Ve.setOptions({breaks:!0,gfm:!0});const $b=10,zb=100;function Fb({attachments:t}){const[s,r]=x.useState(null);return x.useEffect(()=>{if(!s)return;function o(l){l.key==="Escape"&&r(null)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[s]),!Array.isArray(t)||t.length===0?null:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"attachment-pills",children:t.map((o,l)=>{const u=o.media_type.startsWith("image/"),f=`data:${o.media_type};base64,${o.data}`;return a.jsxs("span",{className:"attachment-pill",title:o.name,onClick:u?()=>r(f):void 0,style:u?{cursor:"pointer"}:void 0,children:[u?a.jsx("img",{src:f,alt:o.name,className:"attachment-pill-thumb"}):a.jsx(_g,{size:12,className:"attachment-pill-icon"}),a.jsx("span",{className:"attachment-pill-name",children:o.name})]},l)})}),s&&a.jsx("div",{className:"image-preview-modal",onClick:()=>r(null),children:a.jsxs("div",{className:"image-preview-content",onClick:o=>o.stopPropagation(),children:[a.jsx("img",{src:s,alt:"preview"}),a.jsx("button",{className:"image-preview-close",onClick:()=>r(null),children:a.jsx(gn,{size:20})})]})})]})}function Ub(t){const s=Ve.parse(t);return Ld.sanitize(s)}function Im(t){var s;return(s=t.data)!=null&&s.text?t.data.text:""}function Bb(t){const s=t.match(/^\/bin\/\w+\s+-\w+\s+"(.*)"$/s);return s?s[1]:t}const Dm='<script>(function(){function report(){var h=Math.max(document.documentElement.scrollHeight,document.body?document.body.scrollHeight:0);if(h>0)parent.postMessage(Math.ceil(h),"*");}window.addEventListener("load",report);new ResizeObserver(report).observe(document.documentElement);report();})();<\/script>';function Wb(t){return/<\/body>/i.test(t)?t.replace(/<\/body>/i,`${Dm}</body>`):t+Dm}function Hb({html:t}){const[s,r]=x.useState(480),o=x.useRef(null);return x.useEffect(()=>{function l(u){var f;u.source===((f=o.current)==null?void 0:f.contentWindow)&&typeof u.data=="number"&&u.data>0&&r(u.data)}return window.addEventListener("message",l),()=>window.removeEventListener("message",l)},[]),a.jsx("iframe",{ref:o,sandbox:"allow-scripts",srcDoc:Wb(t),title:"HTML content",style:{width:"100%",height:`${s}px`,border:"1px solid var(--border)",borderRadius:"var(--r-md)",background:"#fff",marginTop:"8px"}})}const Mm=1e4;function Vb({item:t,runtimeType:s,turn:r,threads:o}){var p,g,m,v,k,w,S,C;const l=t.status==="in_progress",[u,f]=x.useState(!1);switch(t.type){case"agent_message":{const{iconClass:E,iconText:T}=Wu(s??"codex");return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${E}`,children:T}),a.jsx("span",{className:"turn-header-title",children:"Agent"}),l&&a.jsx("span",{className:"turn-header-meta",children:"writing…"})]}),a.jsx(_m,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:Im(t)||"…",threads:o,runtimeType:s})]})}case"reasoning":return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(ww,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Reasoning"})]}),a.jsx("div",{dangerouslySetInnerHTML:{__html:Ub(Im(t))}})]});case"command_execution":{const E=t.data||{},T=Bb(E.command||""),A=E.aggregated_output||"",_=E.exit_code,B=l?"running…":_!==null?`exit ${_}`:"",I=A.length>Mm,W=I&&!u?A.slice(0,Mm)+`
|
|
489
|
+
… (truncated, click to expand)`:A;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx($g,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Command"}),B&&a.jsx("span",{className:"turn-header-meta",children:B})]}),a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:T})}),A&&a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:W})}),I&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>f(Y=>!Y),children:u?"Show less":`Show full output (${(A.length/1024).toFixed(0)}KB)`})]})]})}case"file_change":{const E=(p=t.data)==null?void 0:p.changes,T=Array.isArray(E)?E:[],A=`${T.length} file${T.length!==1?"s":""}`;return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Cw,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"File Changes"}),a.jsx("span",{className:"turn-header-meta",children:A})]}),a.jsx("div",{className:"file-change-list",children:T.map((_,B)=>{const I=_.kind==="add"?"A":_.kind==="delete"?"D":"M",W=_.kind==="add"?"fc-add":_.kind==="delete"?"fc-del":"fc-mod";return a.jsxs("div",{className:"file-change",children:[a.jsx("span",{className:`fc-status ${W}`,children:I}),a.jsx("span",{className:"fc-name",children:_.path})]},B)})})]})}case"mcp_tool_call":{const E=t.data||{},T=E.tool||"mcp";if(T==="Agent"){const F=E.arguments,re=(F==null?void 0:F.description)||(F==null?void 0:F.prompt)||"Subagent",he=t.status==="failed",G=l?"running…":he?"failed":"done";return a.jsxs("div",{className:"agent-call-card",children:[a.jsx("span",{className:"agent-call-icon",children:a.jsx(hr,{size:14})}),a.jsx("span",{className:"agent-call-desc",children:re}),a.jsx("span",{className:`agent-call-status ${l?"running":he?"failed":"done"}`,children:G})]})}const A=E.server||"",_=E.arguments,B=E.result,I=E.error,W=t.status==="failed"||!!I,Y=l?"running…":W?"failed":"done",K=((g=B==null?void 0:B.content)==null?void 0:g.filter(F=>F.type==="text").map(F=>F.text))??[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Vw,{size:14})}),a.jsxs("span",{className:"turn-header-title",children:["MCP: ",T]}),A&&a.jsx("span",{className:"turn-header-meta",children:A}),a.jsx("span",{className:"turn-header-meta",style:W?{color:"var(--red)"}:void 0,children:Y})]}),_&&Object.keys(_).length>0&&a.jsx("div",{className:"mcp-args",children:Object.entries(_).map(([F,re])=>a.jsxs("div",{className:"mcp-arg",children:[a.jsx("span",{className:"mcp-arg-key",children:F}),F==="code"?a.jsx("pre",{className:"cmd-block",children:a.jsx("code",{children:String(re)})}):a.jsx("span",{className:"mcp-arg-value",children:typeof re=="string"?re:JSON.stringify(re,null,2)})]},F))}),K.length>0&&K.map((F,re)=>a.jsx("pre",{className:"cmd-output",children:a.jsx("code",{children:F})},re)),I&&a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:I})})]})}case"web_search":{const E=((m=t.data)==null?void 0:m.query)||"";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Kw,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Web Search"})]}),a.jsx("p",{className:"user-message",children:E})]})}case"todo_list":{const E=((v=t.data)==null?void 0:v.items)||[];return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(Mw,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Todo List"})]}),a.jsx("ul",{className:"todo-list",children:E.map((T,A)=>a.jsxs("li",{className:T.completed?"todo-done":"todo-pending",children:[T.completed?a.jsx(Ts,{size:14}):a.jsx(Or,{size:14})," ",T.text]},A))})]})}case"ask_user":return a.jsx(Am,{item:t,turn:r});case"final_result":{const E=t.data??{},T=E.text||"",A=E.html||null,_=Array.isArray(E.groups)?E.groups.filter(W=>!!W&&Array.isArray(W.selections)&&W.selections.length>0):[],{iconClass:B,iconText:I}=Wu(s??"codex");return a.jsxs(a.Fragment,{children:[(T||A)&&a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:`turn-header-icon ${B}`,children:I}),a.jsx("span",{className:"turn-header-title",children:"Agent"})]}),T&&a.jsx(_m,{itemId:t.id,turnId:r.id,sessionId:r.session_id,content:T,threads:o,runtimeType:s}),A&&a.jsx(Hb,{html:A})]}),_.length>0&&a.jsx(Am,{item:t,turn:r})]})}case"background_task":{const E=t.data||{},T=E.task_type||"unknown",A=E.subagent_type||null,_=E.description||"",B=E.status||"running",I=E.last_tool_name||null,W=E.token_count||null,Y=T==="local_agent",K=T==="local_bash",F=Y?hr:K?Og:Eg,re=Y?`Subagent${A?`: ${A}`:""}`:K?"Monitor":"Background Task",he=B==="running"?"running…":B==="completed"?"done":B==="failed"?"failed":B==="stopped"?"stopped":B,G=t.status==="failed"||B==="failed";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx(F,{size:14})}),a.jsx("span",{className:"turn-header-title",children:re}),a.jsx("span",{className:"turn-header-meta",style:G?{color:"var(--red)"}:void 0,children:he})]}),_&&a.jsx("p",{className:"user-message",style:{fontSize:"13px"},children:_}),I&&l&&a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)",fontSize:"12px"},children:["last tool: ",I,W!=null&&` · ${W.toLocaleString()} tokens`]}),a.jsx("div",{className:"cmd-output",style:{color:"var(--text-muted)",fontSize:"11px"},children:"Output available in Tasks panel — click the status bar indicator or the Tasks tab."})]})}case"context_compaction":{const E=((k=t.data)==null?void 0:k.trigger)??"auto",T=((w=t.data)==null?void 0:w.pre_tokens)??0,A=((S=t.data)==null?void 0:S.post_tokens)??0,_=T>0?Math.round((1-A/T)*100):0,B=E==="manual"?"Context compacted (/compact)":"Context auto-compacted";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--surface-2)",color:"var(--text-3)"},children:a.jsx($w,{size:14})}),a.jsx("span",{className:"turn-header-title",children:B})]}),a.jsxs("div",{className:"cmd-output",style:{color:"var(--text-3)"},children:[T.toLocaleString()," → ",A.toLocaleString()," tokens (",_,"% reduction)"]})]})}case"interruption":return a.jsx(Mb,{item:t});case"error":{const E=((C=t.data)==null?void 0:C.message)||"Unknown error";return a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--red)",color:"#fff"},children:a.jsx(Rl,{size:14})}),a.jsx("span",{className:"turn-header-title",children:"Error"})]}),a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:E})})]})}default:return null}}const Ps=x.memo(Vb,(t,s)=>t.item===s.item&&t.runtimeType===s.runtimeType&&t.threads===s.threads&&t.turn.id===s.turn.id);function Gb({turn:t,runtimeType:s,threads:r=[]}){Dt.trackRender("TurnContent");const[o,l]=x.useState(!1),[u,f]=x.useState(!1),[p,g]=x.useState(!1);x.useEffect(()=>{const G=t.items.some(Ne=>Ne.type==="background_task"&&Ne.status==="in_progress");t.status==="running"||t.status==="pending"?l(!0):t.status==="completed"&&!G&&l(!1)},[t.status,t.items]);let m=-1;for(let G=t.items.length-1;G>=0;G--)if(t.items[G].type==="agent_message"){m=G;break}const v=m>=0,k=v?t.items.slice(0,m):t.items,w=t.items.some(G=>G.type==="final_result"||G.type==="ask_user"),S=!v&&t.status==="completed"&&t.agent_response&&!w?{id:`response-${t.id}`,turn_id:t.id,external_item_id:`response-${t.id}`,type:"agent_message",data:{text:t.agent_response},status:"completed",created_at:t.created_at,updated_at:t.updated_at}:null,E=k.filter(G=>{var Ne;return!(G.type==="reasoning"&&(!((Ne=G.data)!=null&&Ne.text)||G.data.text===""))}).filter(G=>!(G.type==="background_task"||G.type==="ask_user"||G.type==="final_result")),T=u?0:Math.max(0,E.length-zb),A=T>0?E.slice(T):E,_=[];let B=null;for(const G of A)G.type==="agent_message"?(B&&_.push(B),B={agentMessage:G,toolItems:[],otherItems:[]}):G.type==="interruption"||G.type==="error"?(B&&_.push(B),_.push({agentMessage:null,toolItems:[],otherItems:[G]}),B=null):(B||(B={agentMessage:null,toolItems:[],otherItems:[]}),Cm(G)?B.toolItems.push(G):B.otherItems.push(G));B&&_.push(B);const I=t.items.filter(G=>G.type==="background_task"),W=p?0:Math.max(0,I.length-$b),Y=W>0?I.slice(W):I,K=E.filter(G=>Cm(G)).length,F=K>0||E.length>0&&(t.status==="running"||t.status==="pending"),re=t.status==="pending"&&t.resume_state==="waiting",he=t.resume_state==="gave_up"||t.resume_state==="skipped"||t.resume_state==="unsupported";return a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:t.user_prompt}),Array.isArray(t.attachments)&&t.attachments.length>0&&a.jsx(Fb,{attachments:t.attachments})]}),F&&a.jsxs("div",{className:"tool-calls",children:[a.jsxs("div",{className:"tool-calls-header",onClick:()=>l(G=>!G),children:[a.jsx("span",{className:"tool-calls-icon",children:a.jsx(Aw,{size:12})}),a.jsx("span",{className:"tool-calls-summary",children:K>0?`${K} tool call${K>1?"s":""}`:re?"interrupted":"thinking…"}),a.jsx(bo,{size:14,className:"tool-calls-chevron",style:{transform:o?"rotate(90deg)":"none"}})]}),o&&a.jsxs("div",{className:"tool-calls-body",children:[T>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>f(!0),children:["Show ",T," earlier step",T>1?"s":""]})}),_.map((G,Ne)=>a.jsxs("div",{className:"intermediate-segment",children:[G.agentMessage&&a.jsx(Ps,{item:G.agentMessage,runtimeType:s,turn:t,threads:r}),G.otherItems.map(Se=>a.jsx(Ps,{item:Se,runtimeType:s,turn:t,threads:r},Se.id)),G.toolItems.length>0&&a.jsx(wb,{items:G.toolItems,runtimeType:s,turn:t,threads:r})]},Ne))]})]}),W>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>g(!0),children:["Show ",W," earlier background task",W>1?"s":""]})}),Y.map(G=>a.jsx(Ps,{item:G,runtimeType:s,turn:t,threads:r},`task-${G.id}`)),v&&a.jsx(Ps,{item:t.items[m],runtimeType:s,turn:t,threads:r},t.items[m].id),S&&a.jsx(Ps,{item:S,runtimeType:s,turn:t,threads:r},S.id),v&&t.items.slice(m+1).filter(G=>G.type!=="ask_user"&&G.type!=="background_task"&&G.type!=="final_result").map(G=>a.jsx(Ps,{item:G,runtimeType:s,turn:t,threads:r},G.id)),t.items.filter(G=>G.type==="final_result").map(G=>a.jsx(Ps,{item:G,runtimeType:s,turn:t,threads:r},`final-${G.id}`)),t.items.filter(G=>G.type==="ask_user").map(G=>a.jsx(Ps,{item:G,runtimeType:s,turn:t,threads:r},`ask-${G.id}`)),t.items.length===0&&!t.error&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:t.status==="running"?"Agent is thinking…":"Waiting to start…"})}),t.error&&!he&&a.jsx("div",{className:"render-content",children:a.jsx("pre",{className:"cmd-output",style:{color:"var(--red)"},children:a.jsx("code",{children:t.error})})}),t.status==="running"&&a.jsx(Ob,{turnId:t.id}),a.jsx(Pb,{turn:t}),t.status==="aborted"&&a.jsxs("div",{className:"aborted-banner",children:[a.jsx("span",{className:"banner-icon",children:a.jsx(Or,{size:12})}),a.jsx("span",{className:"banner-text",children:"Turn stopped — work generated so far is kept."})]})]})}const qb=x.memo(Gb),Kb=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.userAgent)?"⌘K":"Ctrl+K";function Yb(){const t=M(T=>T.workspaces),s=M(T=>T.loadPickerSupport),r=M(T=>T.pickAndAddWorkspace),o=M(T=>T.createSessionInWorkspace),l=M(T=>T.setImportSessionsWorkspace);x.useEffect(()=>{s()},[s]);const u=t.filter(T=>T.deleted===0),[f,p]=x.useState(null),g=u.find(T=>T.path===f)??u[u.length-1]??null,m=(g==null?void 0:g.path)??null,[v,k]=x.useState(null);x.useEffect(()=>{if(!m)return;let T=!1;return mg(m).then(A=>{T||k({path:m,count:A.length})}).catch(()=>{}),()=>{T=!0}},[m]);const w=v&&v.path===m?v.count:0,[S,C]=x.useState(!1);async function E(T){C(!0);try{await o(T)}finally{C(!1)}}return a.jsx("div",{className:"render-scroll welcome-scroll",children:a.jsxs("main",{className:"welcome","aria-labelledby":"welcome-title",children:[a.jsx("h1",{className:"welcome-title",id:"welcome-title",children:"Welcome to Repoburg"}),a.jsx("p",{className:"welcome-lead",children:"Run Claude Code and Codex agents on your projects, side by side. Each session works in a workspace: one of your project folders."}),a.jsxs("ol",{className:"welcome-steps",children:[a.jsxs("li",{className:`welcome-step${g?" done":" current"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:g?a.jsx(Ts,{size:13}):"1"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Add a workspace"}),g?a.jsx("p",{className:"welcome-step-text",children:a.jsx("code",{title:g.path,children:g.path})}):a.jsxs("button",{className:"dialog-btn-create welcome-primary",onClick:()=>void r(),children:[a.jsx(_w,{size:14})," Open folder…"]})]})]}),a.jsxs("li",{className:`welcome-step${g?" current":" upcoming"}`,children:[a.jsx("span",{className:"welcome-step-mark","aria-hidden":"true",children:"2"}),a.jsxs("div",{className:"welcome-step-body",children:[a.jsx("h2",{className:"welcome-step-title",children:"Start your first session"}),g&&m?a.jsxs(a.Fragment,{children:[u.length>1&&a.jsxs("label",{className:"welcome-step-text welcome-target",children:["In",a.jsx("select",{className:"dialog-input dialog-select",value:m,onChange:T=>p(T.target.value),children:u.map(T=>a.jsx("option",{value:T.path,children:T.label||T.path},T.id))})]}),a.jsxs("div",{className:"welcome-actions",children:[a.jsxs("button",{className:"dialog-btn-create welcome-primary",disabled:S,onClick:()=>void E(m),children:[a.jsx(dr,{size:14})," New session"]}),w>0&&a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>l(m),children:[a.jsx(Ig,{size:14})," Import ",w," Claude Code"," ",w===1?"session":"sessions"]})]}),w>0&&a.jsxs("p",{className:"welcome-step-text",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," in this folder continue right where they left off."]})]}):a.jsx("p",{className:"welcome-step-text",children:"Then start an agent session in it."})]})]})]}),a.jsxs("p",{className:"welcome-tip",children:["Later: right-click a workspace to import its Claude Code sessions, and press ",a.jsx("kbd",{children:Kb})," for the command palette."]})]})})}const Xb=[],Ga=50;function Qb(){Dt.trackRender("RenderArea");const t=M(S=>S.activeSessionId),s=M(S=>S.activeSessionId?S.sessionDetails[S.activeSessionId]:null),r=M(S=>S.submittingPrompt),o=M(S=>S.loading),l=M(S=>!S.activeSessionId&&!Zk(S.workspaces,S.sessions,S.appsRootPath)),u=(s==null?void 0:s.turns)??[],f=(s==null?void 0:s.threads)??Xb,p=x.useRef(null),[g,m]=x.useState(Ga);x.useEffect(()=>{m(Ga)},[t]);const v=u.filter(S=>!S.thread_id),k=Math.max(0,v.length-g),w=v.slice(k);return x.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[t,u.length]),o&&!s?a.jsx("div",{className:"render-scroll",children:a.jsxs("div",{className:"skeleton-bars",children:[a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"}),a.jsx("div",{className:"skeleton-bar"})]})}):s?a.jsxs("div",{className:"render-scroll",ref:p,children:[r&&a.jsx("div",{className:"turn-block",children:a.jsxs("div",{className:"turn-group",children:[a.jsxs("div",{className:"render-content",children:[a.jsxs("div",{className:"turn-header",children:[a.jsx("span",{className:"turn-header-icon",style:{background:"var(--amber)",color:"#fff"},children:"U"}),a.jsx("span",{className:"turn-header-title",children:"You"})]}),a.jsx("p",{className:"user-message",children:r})]}),a.jsx("div",{className:"render-content",children:a.jsx("p",{style:{color:"var(--text-muted)",fontStyle:"italic"},children:"Sending…"})})]})}),u.length===0&&!r&&a.jsx("div",{className:"empty-state",children:"No turns yet. Send a message below to start."}),k>0&&a.jsx("div",{className:"render-load-earlier",children:a.jsxs("button",{className:"render-load-earlier-btn",onClick:()=>m(S=>S+Ga),children:["Show ",Math.min(Ga,k)," earlier turns (",k," hidden)"]})}),w.map((S,C)=>a.jsx("div",{id:`turn-${k+C}`,className:"turn-block",children:a.jsx(qb,{turn:S,runtimeType:s.runtime_type,threads:f})},S.id))]}):l?a.jsx(Yb,{}):a.jsx("div",{className:"render-scroll",children:a.jsx("div",{className:"empty-state",children:"No session selected"})})}const Zb=x.memo(Qb),Jb=[{id:"model",label:"/model",hint:"Change model",capability:"dynamicModels"},{id:"sandbox",label:"/sandbox",hint:"Sandbox mode",capability:"sandbox",subPopup:"sandbox"},{id:"websearch",label:"/websearch",hint:"Web search mode",capability:"webSearch",subPopup:"websearch"},{id:"network",label:"/network",hint:"Network access",capability:"networkAccess",subPopup:"network"},{id:"skills",label:"/skills",hint:"Browse skills",capability:"skills"},{id:"plugins",label:"/plugins",hint:"Browse plugins",capability:"plugins"},{id:"mcp",label:"/mcp",hint:"Browse MCP servers",capability:"mcpServers"}];function eT(t){return t.map(s=>({id:s.name,label:`/${s.name}`,hint:s.description,capability:null,insertAsText:!0}))}function tT(t,s,r=[]){const o=[...Jb,...eT(r)],l=new Set;return o.filter(u=>!(l.has(u.label)||(l.add(u.label),u.capability&&!s[u.capability])||t&&!u.label.toLowerCase().includes(t.toLowerCase())))}function nT({commands:t,selectedIndex:s,onSelect:r,onHover:o}){return a.jsxs("div",{className:"slash-popup",children:[a.jsx("div",{className:"slash-popup-header",children:"Commands"}),t.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching commands"}),t.map((l,u)=>a.jsxs("div",{className:`slash-popup-item ${u===s?"selected":""}`,onMouseEnter:()=>o(u),onClick:()=>r(l),children:[a.jsx("span",{className:"slash-popup-label",children:l.label}),a.jsx("span",{className:"slash-popup-hint",children:l.hint})]},l.id))]})}function Ou({title:t,options:s,currentValue:r,onSelect:o,onClose:l}){return a.jsxs("div",{className:"slash-popup",children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:l,children:"← Back"}),a.jsx("span",{children:t})]}),s.map(u=>a.jsxs("div",{className:`slash-popup-item ${u.value===r?"selected":""}`,onClick:()=>o(u.value),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:u.label}),u.description&&a.jsx("span",{className:"slash-popup-hint",children:u.description})]}),u.value===r&&a.jsx("span",{className:"slash-popup-check",children:"✓"})]},u.value))]})}function sT(t){return Wt("/skills")}function rT({filter:t,onSelect:s,onClose:r}){const[o,l]=x.useState([]),[u,f]=x.useState(!0),[p,g]=x.useState(0),m=x.useRef(null);x.useEffect(()=>{sT().then(l).catch(()=>l([])).finally(()=>f(!1))},[]);const v=o.filter(k=>k.name.toLowerCase().includes(t.toLowerCase())||k.description.toLowerCase().includes(t.toLowerCase()));return x.useEffect(()=>{g(0)},[t]),x.useEffect(()=>{function k(w){w.key==="ArrowDown"?(w.preventDefault(),g(S=>Math.min(S+1,v.length-1))):w.key==="ArrowUp"?(w.preventDefault(),g(S=>Math.max(S-1,0))):w.key==="Enter"?(w.preventDefault(),v[p]&&s(v[p])):w.key==="Escape"&&(w.preventDefault(),r())}return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[v,p,s,r]),a.jsxs("div",{className:"slash-popup",ref:m,children:[a.jsxs("div",{className:"slash-popup-header",children:[a.jsx("button",{className:"slash-popup-back",onClick:r,children:"← Back"}),a.jsx("span",{children:"Skills"})]}),u&&a.jsx("div",{className:"slash-popup-empty",children:"Loading skills…"}),!u&&v.length===0&&a.jsx("div",{className:"slash-popup-empty",children:"No matching skills"}),v.map((k,w)=>a.jsxs("div",{className:`slash-popup-item ${w===p?"selected":""}`,onMouseEnter:()=>g(w),onClick:()=>s(k),children:[a.jsxs("div",{className:"slash-popup-item-main",children:[a.jsx("span",{className:"slash-popup-label",children:k.name}),k.description&&a.jsx("span",{className:"slash-popup-hint",children:k.description})]}),!!k.metadata.isSystem&&a.jsx("span",{className:"slash-popup-hint",children:"system"})]},k.id))]})}function iT(){return Wt("/providers")}function oT(t,s){const r=s?`?cwd=${encodeURIComponent(s)}`:"";return Wt(`/providers/${t}/commands${r}`)}const aT={dynamicModels:!1,skills:!1,plugins:!1,mcpServers:!1,imageAttachments:!1,sandbox:!1,webSearch:!1,networkAccess:!1,fileReferences:!1};function lT(t){const[s,r]=x.useState([]),[o,l]=x.useState(!0);x.useEffect(()=>{iT().then(r).catch(()=>r([])).finally(()=>l(!1))},[]);const u=s.find(f=>f.id===t)??null;return{provider:u,capabilities:(u==null?void 0:u.capabilities)??aT,loading:o}}const pi=32,$u=200;function Lm(t){if(!t)return{};try{return JSON.parse(t)}catch{return{}}}function Pm(t){return t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}let Om=0;function cT(){return Om+=1,`att-${Date.now()}-${Om}`}function uT(){Dt.trackRender("CommandInputBar");const[t,s]=x.useState(""),r=x.useRef(null),o=x.useRef(pi),l=x.useRef(null),{submitPrompt:u,cancelTurn:f,updateRuntimeConfig:p,setShowModelSelector:g}=M(),m=M(q=>q.activeSessionId),v=M(q=>q.activeSessionId?q.sessionDetails[q.activeSessionId]:null),k=M(q=>q.quotedText),w=dg(v),S=!!(v!=null&&v.turns.some(q=>q.status==="pending"&&q.resume_state==="waiting")),C=!m,{capabilities:E}=lT(v==null?void 0:v.runtime_type),T=(v==null?void 0:v.runtime_type)??null,A=E.imageAttachments,[_,B]=x.useState([]),[I,W]=x.useState(!1),[Y,K]=x.useState(null),[F,re]=x.useState([]);x.useEffect(()=>{if(!T){re([]);return}let q=!1;return oT(T,(v==null?void 0:v.cwd)??void 0).then(pe=>{q||re(pe)}).catch(()=>{q||re([])}),()=>{q=!0}},[T,v==null?void 0:v.cwd]);const[he,G]=x.useState(!1),[Ne,Se]=x.useState(""),[Pe,te]=x.useState(0),[oe,ae]=x.useState(void 0),[O,Q]=x.useState(!1),[U,j]=x.useState(""),[P,ne]=x.useState([]),de=he?tT(Ne,E,F):[];x.useEffect(()=>{k!==null&&(s(q=>q+k),setTimeout(()=>{if(r.current){De(),r.current.focus();const q=r.current.value.length;r.current.setSelectionRange(q,q)}},0),M.setState({quotedText:null}))},[k]),x.useEffect(()=>{if(!w)return;function q(pe){pe.key==="Escape"&&(pe.preventDefault(),f())}return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[w,f]),x.useEffect(()=>{G(!1),ae(void 0),Q(!1),ne([]),B(q=>{for(const pe of q)pe.previewUrl&&URL.revokeObjectURL(pe.previewUrl);return[]})},[m]),x.useEffect(()=>{if(!Y)return;function q(pe){pe.key==="Escape"&&(pe.preventDefault(),K(null))}return window.addEventListener("keydown",q),()=>window.removeEventListener("keydown",q)},[Y]);const X=x.useCallback(q=>{if(!q)return;const pe=Array.from(q);for(const Ue of pe){const tt=new FileReader;tt.onload=()=>{const gt=tt.result.split(",")[1]??"",Ct=Ue.type.startsWith("image/")?URL.createObjectURL(Ue):void 0;B(an=>[...an,{id:cT(),name:Ue.name,media_type:Ue.type||"application/octet-stream",data:gt,previewUrl:Ct,size:Ue.size}])},tt.readAsDataURL(Ue)}},[]),fe=x.useCallback(q=>{B(pe=>{const Ue=pe.find(tt=>tt.id===q);return Ue!=null&&Ue.previewUrl&&URL.revokeObjectURL(Ue.previewUrl),pe.filter(tt=>tt.id!==q)})},[]),be=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),!(!A||w)&&W(!0)},[A,w]),Ee=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),W(!1)},[]),Re=x.useCallback(q=>{q.preventDefault(),q.stopPropagation(),W(!1),!(!A||w)&&X(q.dataTransfer.files)},[A,w,X]),Ce=x.useCallback(q=>{var tt;if(!A)return;const pe=(tt=q.clipboardData)==null?void 0:tt.items;if(!pe)return;const Ue=[];for(let mt=0;mt<pe.length;mt++){const gt=pe[mt];if(gt.type.startsWith("image/")){const Ct=gt.getAsFile();Ct&&Ue.push(Ct)}}Ue.length>0&&(q.preventDefault(),X(Ue))},[A,X]);function at(q){const pe=r.current;pe&&(pe.style.height=`${q}px`,o.current=q)}function De(){const q=r.current;if(q){if(q.scrollHeight>q.clientHeight){const pe=Math.min(q.scrollHeight,$u);pe!==o.current&&at(pe);return}o.current>pi&&(q.style.height="auto",at(Math.min(q.scrollHeight,$u)))}}function lt(){const q=t.trim();if(!q||w)return;let pe=q;P.length>0&&(pe=`${P.map(mt=>`$${mt.name}`).join(" ")}
|
|
490
490
|
|
|
491
|
-
${q}`);const Ue=_.map(({id:tt,previewUrl:mt,size:gt,...Ct})=>Ct);s(""),ne([]),at(pi),G(!1),ae(void 0),Q(!1);for(const tt of _)tt.previewUrl&&URL.revokeObjectURL(tt.previewUrl);B([]),u(pe,Ue.length>0?Ue:void 0)}function $e(q){if(q.insertAsText){const pe=`/${q.id} `;s(pe),G(!1),ae(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Ue=pe.length;r.current.setSelectionRange(Ue,Ue),De()}});return}q.subPopup?ae(q.subPopup):q.id==="skills"?(Q(!0),j(""),G(!1),s("")):q.id==="model"?(g(!0),G(!1),s("")):(G(!1),s(""))}function en(q){ne(pe=>[...pe,q]),Q(!1),s(""),at(pi)}function Fe(q){const pe=Lm(v==null?void 0:v.runtime_config);oe==="sandbox"?pe.sandboxMode=q:oe==="websearch"?pe.webSearchMode=q:oe==="network"&&(pe.networkAccessEnabled=q==="true"),p(pe),ae(void 0),G(!1),s(""),at(pi)}function Ht(q){if(Dt.markKeystroke(),he&&!oe){if(q.key==="ArrowDown"){q.preventDefault(),te(pe=>Math.min(pe+1,de.length-1));return}if(q.key==="ArrowUp"){q.preventDefault(),te(pe=>Math.max(pe-1,0));return}if(q.key==="Enter"){q.preventDefault(),de[Pe]&&$e(de[Pe]);return}if(q.key==="Escape"){q.preventDefault(),G(!1),s("");return}}if(oe&&q.key==="Escape"){q.preventDefault(),ae(void 0);return}if(q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&!w){q.preventDefault(),lt();return}q.key==="Escape"&&w&&(q.preventDefault(),f())}function tn(q){Dt.markInputChange();const pe=q.target.value;s(pe),De(),pe.startsWith("/")&&!pe.includes(" ")&&!w?(G(!0),Se(pe.slice(1)),te(0)):(G(!1),ae(void 0)),pe.startsWith("$")&&!w?(Q(!0),j(pe.slice(1))):pe.startsWith("$")||Q(!1)}const wt=Lm(v==null?void 0:v.runtime_config),jt=[{value:"read-only",label:"Read Only",description:"Agent can only read files"},{value:"workspace-write",label:"Workspace Write",description:"Agent can read and write in workspace"},{value:"danger-full-access",label:"Danger Full Access",description:"Agent has unrestricted access"}],$t=[{value:"disabled",label:"Disabled",description:"No web search"},{value:"cached",label:"Cached",description:"Use cached search results"},{value:"live",label:"Live",description:"Perform live web searches"}],Mt=[{value:"false",label:"Disabled",description:"No network access"},{value:"true",label:"Enabled",description:"Allow network access in sandbox"}];return a.jsxs("div",{className:`cmd-bar${I?" drag-over":""}`,onDragOver:be,onDragLeave:Ee,onDrop:Re,children:[he&&!oe&&a.jsx(
|
|
492
|
-
… (truncated, click to expand)`:k,Ne=w?null:C==="completed"?a.jsx(Ts,{size:12}):I?a.jsx(Rl,{size:12}):a.jsx(Or,{size:12});return a.jsxs("div",{className:`task-card ${w?"task-running":""} ${I?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>Y(Se=>!Se),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(A,{size:14})}),a.jsx("span",{className:"task-card-type",children:_}),a.jsxs("span",{className:`task-card-status ${I?"task-status-failed":w?"task-status-running":"task-status-done"}`,children:[Ne," ",B]}),a.jsx(bo,{size:14,className:"task-card-chevron",style:{transform:W?"rotate(90deg)":"none",marginLeft:"auto"}})]}),p&&a.jsx("div",{className:"task-card-desc",children:p}),w&&m&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",m,v!=null&&` · ${v.toLocaleString()} tokens`]}),W&&a.jsxs("div",{className:"task-card-body",children:[k?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:re,children:a.jsx("code",{children:G})}),he&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>F(Se=>!Se),children:K?"Show less":`Show full output (${(k.length/1024).toFixed(0)}KB)`})]}):g?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:g})}):w?a.jsx("div",{className:"task-card-placeholder",children:"Waiting for output…"}):a.jsx("div",{className:"task-card-placeholder",children:"No output captured."}),a.jsxs("div",{className:"task-card-context",title:o,children:["from turn ",r+1,": ",o.length>60?o.slice(0,60)+"…":o]})]})]})}const
|
|
491
|
+
${q}`);const Ue=_.map(({id:tt,previewUrl:mt,size:gt,...Ct})=>Ct);s(""),ne([]),at(pi),G(!1),ae(void 0),Q(!1);for(const tt of _)tt.previewUrl&&URL.revokeObjectURL(tt.previewUrl);B([]),u(pe,Ue.length>0?Ue:void 0)}function $e(q){if(q.insertAsText){const pe=`/${q.id} `;s(pe),G(!1),ae(void 0),requestAnimationFrame(()=>{if(r.current){r.current.focus();const Ue=pe.length;r.current.setSelectionRange(Ue,Ue),De()}});return}q.subPopup?ae(q.subPopup):q.id==="skills"?(Q(!0),j(""),G(!1),s("")):q.id==="model"?(g(!0),G(!1),s("")):(G(!1),s(""))}function en(q){ne(pe=>[...pe,q]),Q(!1),s(""),at(pi)}function Fe(q){const pe=Lm(v==null?void 0:v.runtime_config);oe==="sandbox"?pe.sandboxMode=q:oe==="websearch"?pe.webSearchMode=q:oe==="network"&&(pe.networkAccessEnabled=q==="true"),p(pe),ae(void 0),G(!1),s(""),at(pi)}function Ht(q){if(Dt.markKeystroke(),he&&!oe){if(q.key==="ArrowDown"){q.preventDefault(),te(pe=>Math.min(pe+1,de.length-1));return}if(q.key==="ArrowUp"){q.preventDefault(),te(pe=>Math.max(pe-1,0));return}if(q.key==="Enter"){q.preventDefault(),de[Pe]&&$e(de[Pe]);return}if(q.key==="Escape"){q.preventDefault(),G(!1),s("");return}}if(oe&&q.key==="Escape"){q.preventDefault(),ae(void 0);return}if(q.key==="Enter"&&(q.metaKey||q.ctrlKey)&&!w){q.preventDefault(),lt();return}q.key==="Escape"&&w&&(q.preventDefault(),f())}function tn(q){Dt.markInputChange();const pe=q.target.value;s(pe),De(),pe.startsWith("/")&&!pe.includes(" ")&&!w?(G(!0),Se(pe.slice(1)),te(0)):(G(!1),ae(void 0)),pe.startsWith("$")&&!w?(Q(!0),j(pe.slice(1))):pe.startsWith("$")||Q(!1)}const wt=Lm(v==null?void 0:v.runtime_config),jt=[{value:"read-only",label:"Read Only",description:"Agent can only read files"},{value:"workspace-write",label:"Workspace Write",description:"Agent can read and write in workspace"},{value:"danger-full-access",label:"Danger Full Access",description:"Agent has unrestricted access"}],$t=[{value:"disabled",label:"Disabled",description:"No web search"},{value:"cached",label:"Cached",description:"Use cached search results"},{value:"live",label:"Live",description:"Perform live web searches"}],Mt=[{value:"false",label:"Disabled",description:"No network access"},{value:"true",label:"Enabled",description:"Allow network access in sandbox"}];return a.jsxs("div",{className:`cmd-bar${I?" drag-over":""}`,onDragOver:be,onDragLeave:Ee,onDrop:Re,children:[he&&!oe&&a.jsx(nT,{commands:de,selectedIndex:Pe,onSelect:$e,onHover:te}),he&&oe==="sandbox"&&a.jsx(Ou,{title:"Sandbox Mode",options:jt,currentValue:wt.sandboxMode,onSelect:Fe,onClose:()=>ae(void 0)}),he&&oe==="websearch"&&a.jsx(Ou,{title:"Web Search",options:$t,currentValue:wt.webSearchMode,onSelect:Fe,onClose:()=>ae(void 0)}),he&&oe==="network"&&a.jsx(Ou,{title:"Network Access",options:Mt,currentValue:wt.networkAccessEnabled===!0?"true":"false",onSelect:Fe,onClose:()=>ae(void 0)}),O&&a.jsx(rT,{filter:U,onSelect:en,onClose:()=>{Q(!1),s("")}}),P.length>0&&a.jsx("div",{className:"skill-badges",children:P.map(q=>a.jsxs("span",{className:"skill-badge",children:["$",q.name,a.jsx("button",{className:"skill-badge-remove",onClick:()=>ne(pe=>pe.filter(Ue=>Ue.id!==q.id)),children:"×"})]},q.id))}),_.length>0&&a.jsx("div",{className:"attachment-preview-area",children:_.map(q=>a.jsxs("div",{className:"attachment-chip",title:q.name,children:[q.previewUrl?a.jsx("img",{src:q.previewUrl,alt:q.name,className:"attachment-thumb",onClick:()=>K(q),style:{cursor:"pointer"}}):a.jsx(_g,{size:20,className:"attachment-file-icon"}),a.jsxs("div",{className:"attachment-info",children:[a.jsx("span",{className:"attachment-name",children:q.name}),a.jsx("span",{className:"attachment-size",children:Pm(q.size)})]}),a.jsx("button",{className:"attachment-remove",onClick:()=>fe(q.id),title:"Remove attachment",children:a.jsx(gn,{size:14})})]},q.id))}),A&&!w&&!C&&a.jsx("input",{ref:l,type:"file",multiple:!0,accept:"image/*,application/pdf,text/*,.ts,.js,.tsx,.jsx,.py,.go,.rs,.java,.c,.cpp,.h,.css,.html,.xml,.yml,.yaml,.toml,.ini,.sh,.sql",style:{display:"none"},onChange:q=>{X(q.target.files),q.target.value=""}}),a.jsxs("div",{className:"cmd-input-row",children:[A&&!w&&!C&&a.jsx("button",{className:"attachment-clip-btn",onClick:()=>{var q;return(q=l.current)==null?void 0:q.click()},title:"Attach files",disabled:w,children:a.jsx(Ww,{size:16})}),a.jsx("textarea",{ref:r,className:"cmd-textarea",placeholder:C?"Select or create a session…":S?"Interrupted — waiting to resume…":w?"Agent is running…":"Type a message… Use / for commands",autoComplete:"off",value:t,disabled:w||C,rows:1,style:{minHeight:pi,maxHeight:$u},onChange:tn,onKeyDown:Ht,onPaste:Ce}),w?a.jsx("button",{className:"cmd-stop-btn",onClick:()=>f(),title:"Stop (Esc)",children:a.jsx(Or,{size:15})}):a.jsx("button",{className:"cmd-send-btn",onClick:lt,disabled:!t.trim()||C,title:"Send (⌘↵)",children:a.jsx(Cg,{size:16})})]}),Y&&a.jsx("div",{className:"image-preview-modal",onClick:()=>K(null),children:a.jsxs("div",{className:"image-preview-content",onClick:q=>q.stopPropagation(),children:[a.jsx("img",{src:Y.previewUrl,alt:Y.name}),a.jsxs("div",{className:"image-preview-info",children:[a.jsx("span",{children:Y.name}),a.jsx("span",{children:Pm(Y.size)})]}),a.jsx("button",{className:"image-preview-close",onClick:()=>K(null),children:a.jsx(gn,{size:20})})]})})]})}function dT(){const t=M(T=>T.activeSessionId),s=M(T=>T.activeSessionId?T.sessionDetails[T.activeSessionId]:null),r=M(T=>T.activeTurnIndex),o=M(T=>T.setActiveTurnIndex),l=M(T=>T.rewindToTurn),u=M(T=>T.restoreSession),f=M(T=>T.branchFromTurn),p=(s==null?void 0:s.turns)??[],g=Nl(s),m=!!(s!=null&&s.rewound_at_turn_id),v=(s==null?void 0:s.runtime_type)==="repoburg",k=v?"Rewind to this turn? Runtime history after this point is PERMANENTLY deleted and cannot be restored.":"Rewind to this turn? Hidden turns can be restored later.",[w,S]=x.useState(null),C=x.useRef(null);if(_l(C,()=>S(null),!!w),Eo(()=>S(null),!!w),p.length===0)return a.jsx("div",{className:"empty-state",children:"No turns yet"});function E(T){o(T),requestAnimationFrame(()=>{var A;(A=document.getElementById(`turn-${T}`))==null||A.scrollIntoView({behavior:"smooth",block:"start"})})}return a.jsxs("div",{className:"right-section",children:[a.jsx("div",{className:"right-section-title",children:"Conversation"}),p.map((T,A)=>{const _=A===r,B=T.user_prompt.length>50?T.user_prompt.slice(0,50)+"…":T.user_prompt,I=T.status==="running"||T.status==="pending";return a.jsx("div",{children:a.jsxs("div",{className:`turn-item ${_?"active":""}`,onClick:()=>E(A),onContextMenu:W=>{W.preventDefault(),S({x:W.clientX,y:W.clientY,turnId:T.id,turnIndex:A,isLast:A===p.length-1,isSlashCommand:T.user_prompt.trimStart().startsWith("/")})},children:[a.jsx("span",{className:"turn-item-icon",style:{background:"var(--amber)",color:"#fff"},children:a.jsx(Zw,{size:12})}),a.jsx("span",{className:"turn-item-label",children:B}),I&&a.jsx("span",{className:"turn-item-status",children:T.status==="pending"&&T.resume_state==="waiting"?"interrupted":"running…"})]})},T.id)}),w&&a.jsxs("div",{ref:C,className:"ctx-menu",style:{position:"fixed",left:w.x,top:w.y,zIndex:500},children:[a.jsxs("div",{className:`ctx-menu-item ${w.isLast||g||w.isSlashCommand?"ctx-disabled":""}`,onClick:()=>{w.isLast||g||w.isSlashCommand||(window.confirm(k)&&l(t,w.turnId),S(null))},children:[a.jsx(qw,{size:12})," Rewind to Here",w.isSlashCommand?" (slash command)":""]}),m&&!v&&a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{u(t),S(null)},children:[a.jsx(To,{size:12})," Restore Rewind"]}),a.jsxs("div",{className:"ctx-menu-item",onClick:()=>{f(t,w.turnId),S(null)},children:[a.jsx(Ag,{size:12})," Branch from Here"]})]})]})}function Pd(t){return(t??[]).filter(s=>s.task_type!=="local_agent").length}const $m=2e4;function fT(t){const s=[];return t.forEach((r,o)=>{var l;for(const u of r.items)if(u.type==="background_task"){if((((l=u.data)==null?void 0:l.task_type)||"unknown")==="local_agent")continue;s.push({item:u,turnIndex:o,turnPrompt:r.user_prompt})}}),s}function pT({entry:t}){const{item:s,turnIndex:r,turnPrompt:o}=t,l=s.data||{},u=l.task_type||"unknown",f=l.subagent_type||null,p=l.description||"",g=l.summary||null,m=l.last_tool_name||null,v=l.token_count||null,k=l.output||"",w=s.status==="in_progress",S=l.status||"running",C=!w&&S==="running"?"stopped":S,E=u==="local_agent",T=u==="local_bash",A=E?hr:T?Og:Eg,_=E?`Subagent${f?`: ${f}`:""}`:T?"Monitor":"Background Task",B=C==="running"?"running…":C==="completed"?"done":C==="failed"?"failed":C==="stopped"?"stopped":C,I=C==="failed"||s.status==="failed"&&C!=="stopped",[W,Y]=x.useState(w),[K,F]=x.useState(!1),re=x.useRef(null);x.useEffect(()=>{w&&Y(!0)},[w]),x.useEffect(()=>{W&&w&&re.current&&(re.current.scrollTop=re.current.scrollHeight)},[W,w,k]);const he=k.length>$m,G=he&&!K?k.slice(0,$m)+`
|
|
492
|
+
… (truncated, click to expand)`:k,Ne=w?null:C==="completed"?a.jsx(Ts,{size:12}):I?a.jsx(Rl,{size:12}):a.jsx(Or,{size:12});return a.jsxs("div",{className:`task-card ${w?"task-running":""} ${I?"task-failed":""}`,children:[a.jsxs("div",{className:"task-card-header",onClick:()=>Y(Se=>!Se),style:{cursor:"pointer"},children:[a.jsx("span",{className:"task-card-icon",children:a.jsx(A,{size:14})}),a.jsx("span",{className:"task-card-type",children:_}),a.jsxs("span",{className:`task-card-status ${I?"task-status-failed":w?"task-status-running":"task-status-done"}`,children:[Ne," ",B]}),a.jsx(bo,{size:14,className:"task-card-chevron",style:{transform:W?"rotate(90deg)":"none",marginLeft:"auto"}})]}),p&&a.jsx("div",{className:"task-card-desc",children:p}),w&&m&&a.jsxs("div",{className:"task-card-meta",children:["last tool: ",m,v!=null&&` · ${v.toLocaleString()} tokens`]}),W&&a.jsxs("div",{className:"task-card-body",children:[k?a.jsxs(a.Fragment,{children:[a.jsx("pre",{className:"cmd-output task-output",ref:re,children:a.jsx("code",{children:G})}),he&&a.jsx("button",{className:"cmd-output-toggle",onClick:()=>F(Se=>!Se),children:K?"Show less":`Show full output (${(k.length/1024).toFixed(0)}KB)`})]}):g?a.jsx("pre",{className:"cmd-output task-output",children:a.jsx("code",{children:g})}):w?a.jsx("div",{className:"task-card-placeholder",children:"Waiting for output…"}):a.jsx("div",{className:"task-card-placeholder",children:"No output captured."}),a.jsxs("div",{className:"task-card-context",title:o,children:["from turn ",r+1,": ",o.length>60?o.slice(0,60)+"…":o]})]})]})}const hT=x.memo(pT);function mT(){const t=M(f=>f.activeSessionId?f.sessionDetails[f.activeSessionId]:null),s=M(f=>f.activeSessionId?f.backgroundTasks[f.activeSessionId]:void 0),r=(t==null?void 0:t.turns)??[],o=fT(r),l=[...o].sort((f,p)=>{const g=f.item.status==="in_progress",m=p.item.status==="in_progress";return g&&!m?-1:!g&&m?1:p.turnIndex-f.turnIndex}),u=Pd(s);return o.length===0?a.jsx("div",{className:"empty-state",children:"No background tasks yet"}):a.jsxs("div",{className:"right-section",children:[a.jsxs("div",{className:"right-section-title",children:["Background Tasks (",o.length,")",u>0&&a.jsxs("span",{className:"task-count-badge",style:{color:"var(--amber)"},children:[" ",u," running"]})]}),l.map(f=>a.jsx(hT,{entry:f},f.item.id))]})}const gT=x.memo(mT),vT="Your job is to answer questions about this session:",zm="Understand the user's question below, read the session file given above, and answer.",yT=new Set(["claude"]);function xT(t){return yT.has(t)}function Od(t){return t.kind==="sidecar"}function wT(t){const s=(t??[]).filter(Od);return s.length?s[s.length-1]:null}function kT(t){if(!t.startsWith(vT))return t;const s=t.indexOf(zm);return s<0?t:t.slice(s+zm.length).replace(/^\n+/,"")}function ST({thread:t,onClose:s}){const{activeSessionId:r,resolveThread:o,shareThread:l}=M(),[u,f]=x.useState(""),[p,g]=x.useState(!1),[m,v]=x.useState(!1);async function k(){if(!r||p)return;g(!0),await l(r,t.id,u)?s():g(!1)}async function w(){!r||m||(v(!0),await o(r,t.id),s())}const S=p||m;return a.jsx("div",{className:"dialog-overlay",onClick:S?void 0:s,children:a.jsxs("div",{className:"dialog",onClick:C=>C.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Resolve thread"}),a.jsx("button",{className:"dialog-close",onClick:s,disabled:S,children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsx("div",{className:"dialog-hint",children:"Share this thread's findings with the main session? The discussion will be summarized and the summary is added to your input as a quote."}),a.jsxs("label",{className:"dialog-label",children:["Summarization directives (optional)",a.jsx("textarea",{className:"dialog-input share-directives-input",placeholder:"e.g. focus on the performance findings, keep file paths",value:u,onChange:C=>f(C.target.value),rows:3,disabled:S,autoFocus:!0})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:s,disabled:S,children:"Cancel"}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:w,disabled:S,title:"Resolve without sharing",children:[m?a.jsx(hn,{size:13,className:"spin"}):a.jsx(al,{size:13}),"Resolve only"]}),a.jsxs("button",{className:"dialog-btn-create",onClick:k,disabled:S,children:[p?a.jsx(hn,{size:13,className:"spin"}):a.jsx(Yw,{size:13}),p?"Summarizing…":"Share & Resolve"]})]})]})})}const Fm=[];Ve.setOptions({breaks:!0,gfm:!0});function bT(t){const s=Ve.parse(t);return Ld.sanitize(s)}function TT(t){var s,r,o;if(t.type==="agent_message"||t.type==="final_result"){const l=(s=t.data)==null?void 0:s.text;return typeof l=="string"&&l?l:null}if(t.type==="ask_user"){const l=Array.isArray((r=t.data)==null?void 0:r.groups)?t.data.groups:[],u=[(o=t.data)==null?void 0:o.question,...l.map(f=>f.question)].filter(f=>typeof f=="string"&&!!f);return u.length?u.join(`
|
|
493
493
|
|
|
494
|
-
`):null}return null}function
|
|
494
|
+
`):null}return null}function NT(t){const s=t.match(/^\[Quoting from your previous response\]:\n> .*\n\n([\s\S]*)$/);return s?s[1]:t}function Av({turn:t,formatPrompt:s=NT}){const r=s(t.user_prompt),o=t.items.map(TT).filter(l=>l!==null);return o.length===0&&t.status==="completed"&&t.agent_response&&o.push(t.agent_response),a.jsxs("div",{className:"thread-card-turn",children:[a.jsx("div",{className:"thread-card-user-message",children:r}),o.map((l,u)=>a.jsx("div",{className:"thread-card-ai-response",dangerouslySetInnerHTML:{__html:bT(l)}},u)),o.length===0&&(t.status==="pending"||t.status==="running")&&a.jsx("div",{className:"thread-card-pending",children:t.status==="running"?"AI is responding…":"Waiting…"}),t.status==="failed"&&a.jsx("div",{className:"thread-card-pending",children:t.error||"Turn failed"})]})}function jT({thread:t,threadTurns:s,onStop:r,onResolve:o,onReopen:l,onDelete:u,onFollowup:f,onLocate:p}){var Se,Pe,te;const[g,m]=x.useState(""),[v,k]=x.useState(!0),w=x.useRef(null),S=x.useRef(null),[C,E]=x.useState(!1),[T,A]=x.useState({x:0,y:0}),[_,B]=x.useState(""),I=s.some(pr),W=28,Y=120,K=x.useRef(W);x.useEffect(()=>{const oe=S.current;oe&&(oe.scrollTop=oe.scrollHeight)},[s.length,v]);function F(oe){const ae=w.current;ae&&(ae.style.height=`${oe}px`,K.current=oe)}function re(){const oe=w.current;if(oe){if(oe.scrollHeight>oe.clientHeight){const ae=Math.min(oe.scrollHeight,Y);ae!==K.current&&F(ae);return}K.current>W&&(oe.style.height="auto",F(Math.min(oe.scrollHeight,Y)))}}const he=x.useCallback(()=>{E(!1)},[]),G=x.useCallback(()=>{const oe=S.current;if(!oe)return;const ae=window.getSelection();if(!ae||ae.rangeCount===0||ae.isCollapsed){E(!1);return}const O=ae.getRangeAt(0);if(!oe.contains(O.commonAncestorContainer)){E(!1);return}const Q=O.commonAncestorContainer.nodeType===Node.TEXT_NODE?O.commonAncestorContainer.parentElement:O.commonAncestorContainer;if(!(Q!=null&&Q.closest(".thread-card-ai-response"))){E(!1);return}const U=ae.toString();if(!U.trim()){E(!1);return}const j=O.getBoundingClientRect(),P=28,ne=6,de=170;let X=!1;if(ae.anchorNode&&ae.focusNode)try{const Ee=document.createRange();Ee.setStart(ae.focusNode,ae.focusOffset),Ee.setEnd(ae.focusNode,ae.focusOffset);const Re=document.createRange();Re.setStart(ae.anchorNode,ae.anchorOffset),Re.setEnd(ae.anchorNode,ae.anchorOffset),X=Re.compareBoundaryPoints(Range.START_TO_START,Ee)>0}catch{X=!1}let fe=j.top-P-ne;fe<8&&(fe=j.bottom+ne);let be=X?j.left-de:j.right;be=Math.max(8,Math.min(be,window.innerWidth-de-8)),A({x:be,y:fe}),B(U),E(!0)},[]);x.useEffect(()=>{function oe(ae){const O=ae.target;O&&O.closest(".selection-actions")||G()}return document.addEventListener("mouseup",oe),()=>document.removeEventListener("mouseup",oe)},[G]);const Ne=x.useCallback(()=>{var ae;const oe=`
|
|
495
495
|
\`\`\`QUOTE
|
|
496
496
|
${_}
|
|
497
497
|
\`\`\`
|
|
498
498
|
|
|
499
|
-
`;m(O=>O+oe),E(!1),B(""),(ae=window.getSelection())==null||ae.removeAllRanges(),setTimeout(()=>{if(w.current){re(),w.current.focus();const O=w.current.value.length;w.current.setSelectionRange(O,O)}},0)},[_]);return a.jsxs("div",{className:`thread-card ${t.status==="resolved"?"thread-resolved":""}`,id:`thread-${t.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(oe=>!oe),children:[a.jsx("div",{className:"thread-card-quote",children:t.selected_text===null?((te=(Pe=(Se=t.turns)==null?void 0:Se[0])==null?void 0:Pe.user_prompt)==null?void 0:te.slice(0,100))||"Quick question":`“${t.selected_text.slice(0,100)}${t.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[t.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:oe=>{oe.stopPropagation(),p()},title:"Scroll to text",children:a.jsx($w,{size:12})}),a.jsx("span",{className:`thread-status-badge ${t.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:t.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:he,children:[s.map(oe=>a.jsx(Av,{turn:oe},oe.id)),s.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),C&&a.jsx("div",{className:"selection-actions",style:{left:T.x,top:T.y},children:a.jsxs("button",{className:"discuss-button",onClick:Ne,title:"Quote this text in your follow-up",children:[a.jsx(Lg,{size:14}),a.jsx("span",{children:"Quote"})]})}),t.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:w,className:"thread-card-followup-input",placeholder:I?"Agent is running…":"Type a follow-up…",value:g,onChange:oe=>{Dt.markInputChange(),m(oe.target.value),re()},disabled:I,rows:1,style:{minHeight:W,maxHeight:Y},onKeyDown:oe=>{Dt.markKeystroke(),oe.key==="Enter"&&(oe.metaKey||oe.ctrlKey)&&!I&&g.trim()&&(oe.preventDefault(),f(g.trim()),m(""),F(W))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:I||!g.trim(),onClick:()=>{f(g.trim()),m("")},children:a.jsx(_o,{size:13})}),I&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(Or,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[t.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[a.jsx(al,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx(To,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:u,title:"Delete thread",children:[a.jsx(us,{size:13})," Delete"]})]})]})]})}function jT(){Dt.trackRender("ThreadsPanel");const t=M(A=>A.activeSessionId),s=M(A=>{var _;return A.activeSessionId?((_=A.sessionDetails[A.activeSessionId])==null?void 0:_.threads)??Fm:Fm}),r=x.useMemo(()=>s.filter(A=>!Od(A)),[s]),o=M(A=>A.followupThread),l=M(A=>A.cancelThreadTurn),u=M(A=>A.reopenThread),f=M(A=>A.deleteThread),p=M(A=>A.deepLinkThreadId),g=M(A=>A.setDeepLinkThreadId),[m,v]=x.useState("open"),[k,w]=x.useState(null);x.useEffect(()=>{if(!p)return;const A=p;g(null),v(B=>r.some(I=>I.id===A&&I.status==="open")?B:"all");const _=setTimeout(()=>{const B=document.getElementById(`thread-${A}`);B&&(B.scrollIntoView({behavior:"smooth",block:"center"}),B.classList.add("thread-card-highlighted"),setTimeout(()=>B.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(_)},[p,g,r]);const S=r.filter(A=>m==="open"?A.status==="open":m==="resolved"?A.status==="resolved":!0),C=r.filter(A=>A.status==="open").length,E=r.filter(A=>A.status==="resolved").length;function T(A){setTimeout(()=>{const _=document.querySelector(`mark[data-thread-id="${A}"]`);_&&(_.scrollIntoView({behavior:"smooth",block:"center"}),_.classList.add("thread-mark-flash"),setTimeout(()=>_.classList.remove("thread-mark-flash"),1500))},50)}return t?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(Mg,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"No threads yet."}),a.jsx("div",{style:{fontSize:"11px",marginTop:"4px"},children:"Select text in an agent response to start a discussion."})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"thread-filter-tabs",children:[a.jsxs("button",{className:`thread-filter-tab ${m==="open"?"active":""}`,onClick:()=>v("open"),children:["Open (",C,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",E,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),S.length===0?a.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):S.map(A=>a.jsx(NT,{thread:A,threadTurns:A.turns??[],onStop:()=>l(t,A.id),onResolve:()=>w(A),onReopen:()=>u(t,A.id),onDelete:()=>f(t,A.id),onFollowup:_=>o(t,A.id,_),onLocate:()=>T(A.id)},A.id)),k&&a.jsx(kT,{thread:k,onClose:()=>w(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function CT(){const t=M(f=>f.apps),s=M(f=>f.activeAppTabId),r=M(f=>f.openAppTab),o=M(f=>f.startAppEdit),l=M(f=>f.toggleAppPin),u=M(f=>f.deleteApp);return t.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No mini apps yet. Add one with the + button in the sidebar Apps section."}):a.jsx("div",{className:"apps-panel",children:t.map(f=>a.jsxs("div",{className:`apps-panel-row${s===f.id?" active":""}`,onClick:()=>r(f.id),title:f.description??void 0,children:[a.jsx(bi,{iconNode:f.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:f.title}),f.description&&a.jsx("span",{className:"apps-panel-desc",children:f.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:p=>{p.stopPropagation(),o(f.id)},children:a.jsx(Qa,{size:12})}),a.jsx("button",{className:`apps-panel-action${f.pinned?" pinned":""}`,title:f.pinned?"Unpin app":"Pin app (sorts first)",onClick:p=>{p.stopPropagation(),l(f.id)},children:a.jsx(ul,{size:12,fill:f.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:p=>{p.stopPropagation(),u(f.id)},children:a.jsx(us,{size:12})})]},f.id))})}function ET(){Dt.trackRender("SidecarPanel");const t=M(T=>T.activeSessionId),s=M(T=>{var A;return T.activeSessionId?(A=T.sessionDetails[T.activeSessionId])==null?void 0:A.runtime_type:void 0}),r=M(T=>{var A;return T.activeSessionId?xT((A=T.sessionDetails[T.activeSessionId])==null?void 0:A.threads):null}),o=M(T=>T.askSidecar),l=M(T=>T.cancelThreadTurn),u=M(T=>T.deleteThread),[f,p]=x.useState(""),[g,m]=x.useState(!1),v=x.useRef(null),k=(r==null?void 0:r.turns)??[],w=k[k.length-1],S=k.some(pr);if(x.useEffect(()=>{var T,A;(A=(T=v.current)==null?void 0:T.scrollIntoView)==null||A.call(T,{block:"end"})},[k.length,w==null?void 0:w.items.length,w==null?void 0:w.status]),!t||!s)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!yT(s))return a.jsxs("div",{className:"empty-state",children:[a.jsx(hr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",s," sessions yet."]})]});const C=!S&&!g&&f.trim().length>0;async function E(){if(!t||!C)return;m(!0);const T=await o(t,f.trim());m(!1),T&&p("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsxs("div",{className:"sidecar-conversation",children:[k.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(hr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"Ask about this session."}),a.jsx("div",{className:"sidecar-hint",children:"Where does it stand? Is it stuck? When will it finish? What is done and what is left?"})]}):k.map(T=>a.jsx(Av,{turn:T,formatPrompt:wT},T.id)),a.jsx("div",{ref:v})]}),a.jsxs("div",{className:"sidecar-footer",children:[a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{className:"thread-card-followup-input","aria-label":"Ask the sidecar",placeholder:S?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:f,rows:2,disabled:S,onChange:T=>{Dt.markInputChange(),p(T.target.value)},onKeyDown:T=>{Dt.markKeystroke(),T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),E())}}),S&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(t,r.id),children:a.jsx(Or,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!C,onClick:()=>void E(),children:a.jsx(_o,{size:13})})]}),r&&a.jsx("div",{className:"thread-card-actions",children:a.jsxs("button",{className:"thread-action-btn thread-action-danger",title:"Clear the sidecar conversation",disabled:S,onClick:()=>u(t,r.id),children:[a.jsx(us,{size:13})," Clear"]})})]})]})}function _T(){var g;Dt.trackRender("RightPanel");const t=M(m=>m.activeRightTab),s=M(m=>m.switchRightTab),r=M(m=>m.rightPanelCollapsed),o=M(m=>m.toggleRightPanel),l=M(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),u=M(m=>m.activeSessionId?Pd(m.backgroundTasks[m.activeSessionId]):0),f=((g=l==null?void 0:l.threads)==null?void 0:g.filter(m=>m.status==="open"&&!Od(m)).length)??0,p=[{id:"turns",label:"Turns",icon:Iw},{id:"sidecar",label:"Sidecar",icon:hr},{id:"tasks",label:"Tasks",icon:Aw,badge:u||void 0},{id:"threads",label:"Threads",icon:Mg,badge:f||void 0},{id:"apps",label:"Apps",icon:Dg}];return r?a.jsxs("div",{className:"ide-right collapsed",children:[a.jsx("button",{type:"button",className:"right-icon-btn",title:"Expand panel","aria-label":"Expand panel","aria-expanded":!1,onClick:o,children:a.jsx(Fw,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),p.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return a.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${t===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>s(m.id),children:[a.jsx(v,{size:15}),m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):a.jsxs("div",{className:"ide-right",children:[a.jsxs("div",{className:"right-header",children:[a.jsx("div",{className:"right-tabs",children:p.map(m=>a.jsxs("div",{className:`right-tab ${t===m.id?"active":""}`,onClick:()=>s(m.id),children:[m.label,m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id))}),a.jsx("button",{type:"button",className:"right-icon-btn right-collapse-btn",title:"Collapse panel","aria-label":"Collapse panel","aria-expanded":!0,onClick:o,children:a.jsx(zw,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[t==="turns"&&a.jsx(uT,{}),t==="sidecar"&&a.jsx(ET,{}),t==="tasks"&&a.jsx(mT,{}),t==="threads"&&a.jsx(jT,{}),t==="apps"&&a.jsx(CT,{})]})]})}const _e={low:{effort:"low",label:"Low"},medium:{effort:"medium",label:"Medium"},high:{effort:"high",label:"High"},xhigh:{effort:"xhigh",label:"Extra High"},max:{effort:"max",label:"Max"},ultra:{effort:"ultra",label:"Ultra"}},td=[{id:"codex",label:"Codex",available:!0,models:[{slug:"gpt-5.6-sol",displayName:"GPT-5.6-Sol",description:"Flagship — complex, open-ended work",defaultReasoning:"low",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max,_e.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max,_e.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh]}]},{id:"claude",label:"Claude",available:!0,models:[{slug:"claude-sonnet-5-5",displayName:"Claude Sonnet 5.5",description:"Best combination of speed and intelligence",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high]}]}];function RT(t){return td.find(s=>s.id===t)}function $d(t){const s=RT(t);return(s==null?void 0:s.models)??[]}function Iv(t,s){return $d(t).find(r=>r.slug===s)}function nd(t,s){var r;return((r=Iv(t,s))==null?void 0:r.reasoningLevels)??[]}function sd(t,s){var r;return(r=Iv(t,s))==null?void 0:r.defaultReasoning}function AT(){const{activeSessionId:t,sessions:s,updateModelConfig:r}=M(),o=M(te=>te.showModelSelector),l=M(te=>te.setShowModelSelector),u=s.find(te=>te.id===t),f=M(te=>te.models),p=M(te=>te.modelsLoading),g=M(te=>te.loadModels),[m,v]=x.useState(!1),k=x.useRef(null);if(_l(k,()=>v(!1),m),Eo(()=>v(!1),m),x.useEffect(()=>{o&&(v(!0),l(!1))},[o,l]),x.useEffect(()=>{u!=null&&u.runtime_type&&g(u.runtime_type,u.cwd??void 0)},[u==null?void 0:u.runtime_type,u==null?void 0:u.cwd,g]),!u)return null;const w=u.runtime_type,S=u.model??"",C=u.model_reasoning_effort??"",E=f.length>0?f:[],T=$d(w),_=[...E.length>0?E:T];if(S&&!_.some(te=>te.slug===S)){const te=T[0];_.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:(te==null?void 0:te.defaultReasoning)??"medium",reasoningLevels:(te==null?void 0:te.reasoningLevels)??[]})}function B(te){return _.find(oe=>oe.slug===te)}function I(te){var oe;return E.length>0?((oe=B(te))==null?void 0:oe.reasoningLevels)??[]:nd(w,te)}function W(te){var oe;return E.length>0?(oe=B(te))==null?void 0:oe.defaultReasoning:sd(w,te)}const Y=td.find(te=>te.id===w),K=B(S),F=S?I(S):[],re=(Y==null?void 0:Y.label)??w,he=(K==null?void 0:K.displayName)??(S||"Default"),G=F.find(te=>te.effort===C),Ne=(G==null?void 0:G.label)??(C||"Default");function Se(te){var Q;const oe=I(te),O=oe.some(U=>U.effort===C)?C:W(te)??((Q=oe[0])==null?void 0:Q.effort)??"";r(te,O),v(!1)}function Pe(te){r(S,te),v(!1)}return a.jsxs("div",{className:"model-selector",ref:k,children:[a.jsxs("button",{className:"model-selector-btn",onClick:()=>v(!m),title:"Change model and thinking level",children:[a.jsx("span",{className:"model-selector-provider",children:re}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:he}),Ne!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:Ne})]}),a.jsx(wi,{size:12,className:"model-selector-chevron"})]}),m&&a.jsxs("div",{className:"model-selector-popover",children:[a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Provider"}),td.map(te=>a.jsxs("div",{className:`model-selector-item ${te.id===w?"selected":""} ${te.available?"":"disabled"}`,onClick:()=>{if(te.available){if(te.id===w){v(!1);return}r("","",te.id)}},children:[a.jsx("span",{children:te.label}),!te.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx(Lw,{size:10})," Soon"]}),te.id===w&&a.jsx(Ts,{size:12})]},te.id))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),p&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!p&&_.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),_.map(te=>a.jsxs("div",{className:`model-selector-item ${te.slug===S?"selected":""}`,onClick:()=>Se(te.slug),children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:te.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:te.description})]}),te.slug===S&&a.jsx(Ts,{size:12})]},te.slug))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),F.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),F.map(te=>a.jsxs("div",{className:`model-selector-item ${te.effort===C?"selected":""}`,onClick:()=>Pe(te.effort),children:[a.jsx("span",{children:te.label}),te.effort===C&&a.jsx(Ts,{size:12})]},te.effort))]})]})]})}function fo(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Um(){const t=M(s=>s.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>t(!0),children:[a.jsx(Jw,{size:14})," Repoburg"]})}function Bm(){const t=M(r=>r.usageViewOpen),s=M(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Usage Center",onClick:s,children:[a.jsx(Rg,{size:14})," Usage"]})}function Wm(){const t=M(r=>r.vscodeViewOpen),s=M(r=>r.toggleVscodeView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open VS Code",onClick:s,children:[a.jsx(bw,{size:14})," Code"]})}function IT(){Dt.trackRender("StatusBar");const t=M(v=>v.activeSessionId),s=M(v=>t?v.sessions.find(k=>k.id===t)??null:null),r=M(v=>t?v.sessionDetails[t]??null:null),o=M(v=>t?v.backgroundTasks[t]:void 0),l=M(v=>v.wsConnected),u=M(v=>v.switchRightTab),f=(r==null?void 0:r.contextUsage)??null;if(!s)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Um,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Wm,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Bm,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-spacer"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Uh,{size:14})," K"]})]});const p=o??[],g=El(s,p.length),m=Pd(p);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Um,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Wm,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Bm,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(AT,{}),m>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",style:{color:"var(--amber)",cursor:"pointer"},title:`${m} Monitor task${m>1?"s":""} running — click to view`,onClick:()=>u("tasks"),children:[a.jsx($g,{size:14})," ",m]})]}),a.jsx("div",{className:"sb-spacer"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",style:g.dot==="background"?{color:"var(--purple)"}:s.status==="failed"?{color:"var(--red)"}:void 0,title:g.dot==="background"?g.dotTitle:void 0,children:g.label}),f&&a.jsx(DT,{usage:f}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Uh,{size:14})," K"]})]})}function DT({usage:t}){const s=t.percentage>=85?"var(--red)":t.percentage>=60?"var(--amber)":"var(--green)",r=`${fo(t.totalTokens)} / ${fo(t.contextWindow)} tokens`+(t.autoCompactThreshold?` · auto-compacts at ${fo(t.autoCompactThreshold)}`:"");return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-context",title:r,children:a.jsxs("span",{className:"sb-context-text",style:{color:s},children:[Math.round(t.percentage),"% / ",fo(t.totalTokens)," / ",fo(t.contextWindow)]})})]})}function Hm(t){return Wt(`/vscode-web/status?folder=${encodeURIComponent(t??"")}`)}function MT(t){return ut("/vscode-web/start",{folder:t})}function LT(t){return ut("/vscode-web/heartbeat",{id:t})}const PT=1e3,OT=5*6e4;function Vm({children:t}){const s=M(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[t,a.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:s,children:a.jsx(gn,{size:16})})]})}function $T(){const t=M(C=>C.vscodeState),s=M(C=>C.vscodeId),r=M(C=>C.vscodeToken),o=M(C=>C.setVscodeView),l=M(C=>{var T;const E=C.activeSessionId?C.sessions.find(A=>A.id===C.activeSessionId):null;return E!=null&&E.cwd?E.cwd:((T=C.workspaces.find(A=>A.deleted===0))==null?void 0:T.path)??null}),[u,f]=x.useState(!1),[p,g]=x.useState(0),m=x.useRef(null),v=mn(),k=v===""||v===window.location.origin,w=`${v}/vscode/${s??""}/?tkn=${r??""}${l?`&folder=${encodeURIComponent(l)}`:""}`;x.useEffect(()=>{let C=!1;function E(){m.current&&(clearInterval(m.current),m.current=null)}async function T(){try{let _=await Hm(l);if((_.state==="stopped"||_.state==="error")&&(_=await MT(l)),C||(o(_.state,_.id,_.token),_.state==="running"||_.state==="error"))return;m.current=setInterval(async()=>{const B=await Hm(l);C||(o(B.state,B.id,B.token),(B.state==="running"||B.state==="error"||B.state==="stopped")&&E())},PT)}catch{C||o("error",null,null)}}T();const A=setInterval(()=>{const _=M.getState().vscodeId;_&<(_).catch(()=>{})},OT);return()=>{C=!0,E(),clearInterval(A)}},[p,l,o]);function S(){f(!1),o("starting",null,null),g(C=>C+1)}return t!=="running"||!r||!s?a.jsx(Vm,{children:t==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:S,children:[a.jsx(To,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(hn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?a.jsxs("div",{className:"vscode-view",children:[!u&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(hn,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:w,title:"VS Code",className:"vscode-view-frame",onLoad:()=>f(!0)},s)]}):a.jsxs(Vm,{children:[a.jsx("span",{children:"VS Code cannot be embedded on this host — serve-web allows same-origin frames only."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>window.open(w,"_blank","noopener"),children:[a.jsx(Nw,{size:14})," Open VS Code in a new tab"]})]})}function Gm(t,s){const r=new URLSearchParams;t&&r.set("since",t),s&&r.set("until",s);const o=r.toString();return Wt(`/usage/summary${o?`?${o}`:""}`)}const Dv="agentpane:usage-budget";function cs(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Lr(t){return`$${t>=100?t.toFixed(0):t>=1?t.toFixed(2):t.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}`}function zT(t,s=new Date){if(t==="all")return{since:null,until:null};const r=new Date(s);return t==="today"?r.setHours(0,0,0,0):r.setDate(r.getDate()-(t==="7d"?7:30)),{since:r.toISOString(),until:null}}function FT(t=new Date){return new Date(t.getFullYear(),t.getMonth(),1).toISOString()}function UT(){try{const t=Number(localStorage.getItem(Dv));return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function BT(t){try{localStorage.setItem(Dv,String(t))}catch{}}const WT={claude:"Claude",codex:"Codex",repoburg:"Repoburg"};function qa({label:t,value:s,sub:r,tone:o}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:t}),a.jsx("div",{className:"usage-kpi-value",style:o?{color:o}:void 0,children:s}),r&&a.jsx("div",{className:"usage-kpi-sub",children:r})]})}function HT({day:t,max:s}){const r=o=>s>0?o/s*100:0;return a.jsxs("div",{className:"usage-day",title:`${t.date} · ${cs(t.input_tokens)} input · ${cs(t.cached_input_tokens)} cached · ${cs(t.output_tokens)} output · ${Lr(t.cost_usd)}`,children:[a.jsxs("div",{className:"usage-day-bar",children:[a.jsx("div",{className:"usage-seg usage-seg-output",style:{height:`${r(t.output_tokens)}%`}}),a.jsx("div",{className:"usage-seg usage-seg-cached",style:{height:`${r(t.cached_input_tokens+t.cache_write_input_tokens)}%`}}),a.jsx("div",{className:"usage-seg usage-seg-input",style:{height:`${r(t.input_tokens)}%`}})]}),a.jsx("div",{className:"usage-day-label",children:t.date.slice(5)})]})}function VT(){const t=M(_=>_.toggleUsageView),[s,r]=x.useState("30d"),[o,l]=x.useState(null),[u,f]=x.useState(null),[p,g]=x.useState(UT),[m,v]=x.useState(null),[k,w]=x.useState(!1),S=x.useCallback(async()=>{w(!0),v(null);try{const{since:_,until:B}=zT(s),[I,W]=await Promise.all([Gm(_,B),Gm(FT(),null)]);l(I),f(W.totals.cost_usd)}catch(_){v(_.message)}finally{w(!1)}},[s]);x.useEffect(()=>{S()},[S]);const C=o==null?void 0:o.totals,E=p>0&&u!==null?p-u:null,T=x.useMemo(()=>Math.max(0,...((o==null?void 0:o.daily)??[]).map(_=>_.input_tokens+_.cached_input_tokens+_.output_tokens)),[o]),A=_=>{const B=Number(_.replace(",",".")),I=Number.isFinite(B)&&B>0?B:0;g(I),BT(I)};return a.jsxs("div",{className:"usage-view",children:[a.jsxs("div",{className:"usage-header",children:[a.jsxs("div",{className:"usage-title",children:[a.jsx(Rg,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[["today","7d","30d","all"].map(_=>a.jsx("button",{className:`usage-range-btn${s===_?" usage-range-btn-active":""}`,onClick:()=>r(_),children:_==="today"?"Today":_==="7d"?"7 days":_==="30d"?"30 days":"All"},_)),a.jsx("button",{className:"usage-range-btn",onClick:()=>void S(),title:"Refresh",children:a.jsx(Vw,{size:13,className:k?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:t,children:a.jsx(gn,{size:16})})]})]}),m&&a.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",m]}),!o&&!m&&a.jsx("div",{className:"usage-empty",children:"Loading…"}),o&&C&&a.jsxs("div",{className:"usage-body",children:[a.jsxs("div",{className:"usage-kpis",children:[a.jsx(qa,{label:"Spend",value:Lr(C.cost_usd),sub:C.unpriced_models.length>0?"excluding unpriced models":void 0}),a.jsx(qa,{label:"Remaining (monthly)",value:E===null?"—":E>=0?Lr(E):Lr(0),sub:p>0&&u!==null?`this month ${Lr(u)} / budget ${Lr(p)}`:"no budget set",tone:E!==null&&E<0?"var(--red)":void 0}),a.jsx(qa,{label:"Tokens",value:cs(C.input_tokens+C.cached_input_tokens+C.cache_write_input_tokens+C.output_tokens),sub:`input ${cs(C.input_tokens)} · cached ${cs(C.cached_input_tokens)} · write ${cs(C.cache_write_input_tokens)} · output ${cs(C.output_tokens)}`}),a.jsx(qa,{label:"Calls",value:String(C.calls),sub:C.errors>0?`${C.errors} failed`:void 0,tone:C.errors>0?"var(--amber)":void 0})]}),a.jsxs("div",{className:"usage-budget",children:[a.jsx("label",{htmlFor:"usage-budget-input",children:"Monthly budget (USD)"}),a.jsx("input",{id:"usage-budget-input",type:"number",min:"0",step:"1",defaultValue:p>0?p:"",placeholder:"e.g. 50",onBlur:_=>A(_.target.value)}),p>0&&u!==null&&a.jsx("div",{className:"usage-budget-bar",children:a.jsx("div",{className:"usage-budget-fill",style:{width:`${Math.min(100,u/p*100)}%`,background:u>=p?"var(--red)":void 0}})})]}),C.unpriced_models.length>0&&a.jsxs("div",{className:"usage-note",children:["Unpriced models: ",C.unpriced_models.join(", ")]}),a.jsxs("div",{className:"usage-chart",children:[a.jsx("div",{className:"usage-section-title",children:"Daily usage"}),o.daily.length===0?a.jsx("div",{className:"usage-empty",children:"No usage in this range."}):a.jsx("div",{className:"usage-days",children:o.daily.map(_=>a.jsx(HT,{day:_,max:T},_.date))}),a.jsxs("div",{className:"usage-legend",children:[a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-input"})," input"]}),a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-cached"})," cached"]}),a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-output"})," output"]})]})]}),a.jsxs("div",{className:"usage-table-wrap",children:[a.jsx("div",{className:"usage-section-title",children:"By model"}),a.jsxs("table",{className:"usage-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Runtime"}),a.jsx("th",{children:"Provider"}),a.jsx("th",{children:"Model"}),a.jsx("th",{children:"Effort"}),a.jsx("th",{children:"Calls"}),a.jsx("th",{children:"Input"}),a.jsx("th",{children:"Cached"}),a.jsx("th",{children:"Output"}),a.jsx("th",{children:"Cost"})]})}),a.jsxs("tbody",{children:[o.by_model.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"usage-empty",children:"No usage records yet."})}),o.by_model.map(_=>a.jsxs("tr",{children:[a.jsx("td",{children:WT[_.runtime_type]??_.runtime_type}),a.jsx("td",{children:_.provider??"—"}),a.jsx("td",{title:_.model,children:_.model}),a.jsx("td",{children:_.reasoning_effort??"default"}),a.jsxs("td",{children:[_.calls,_.errors>0&&a.jsxs("span",{className:"usage-err",children:[" (",_.errors," failed)"]})]}),a.jsx("td",{children:cs(_.input_tokens)}),a.jsx("td",{children:cs(_.cached_input_tokens+_.cache_write_input_tokens)}),a.jsx("td",{children:cs(_.output_tokens)}),a.jsx("td",{children:_.cost_usd===null?a.jsx("span",{className:"usage-unpriced",children:"unknown"}):Lr(_.cost_usd)})]},`${_.runtime_type}|${_.provider??""}|${_.model}|${_.reasoning_effort??""}`))]})]})]})]})]})}const qm=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,GT=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,qT={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function Mv(){return mn()||window.location.origin}function Lv(t,s){let r=s;if(r&&typeof r=="object"){const f=r;r=typeof f.id=="string"?f.id:f.url}if(typeof r!="string")return null;const o=r.trim();if(qm.test(o))return o;const l=GT.exec(o);if(!l)return null;let u;try{u=decodeURIComponent(l[1])}catch{return null}return u===t&&qm.test(l[2])?l[2]:null}function Km(t){return/^https?:\/\//i.test(t.url)?t:{...t,url:`${Mv()}${t.url}`}}function KT(t){return qT[t.slice(t.lastIndexOf(".")+1)]??"application/octet-stream"}function Pv(t){return new Promise((s,r)=>{const o=new FileReader;o.onload=()=>{const l=String(o.result??"");s(l.slice(l.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(t)})}function YT(t,s){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(t);return r?{type:s||r[1]||void 0,data:t.slice(r[0].length)}:{type:s,data:t}}async function Ov(t){if(t instanceof Blob){const s=t.name;return{name:typeof s=="string"&&s?s:void 0,type:t.type||void 0,data:await Pv(t)}}if(t&&typeof t=="object"&&typeof t.data=="string"){const s=t;return{name:typeof s.name=="string"&&s.name?s.name:void 0,type:typeof s.type=="string"&&s.type?s.type:void 0,data:s.data}}return null}async function XT(t){const s=await Ov(t);if(!s)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return s}async function QT(t,s,r){if(s==null)return[];if(!Array.isArray(s))throw new Error("submitTurn: attachments must be an array");const o=[];for(let l=0;l<s.length;l++){const u=s[l],f=await Ov(u);if(f){const{type:m,data:v}=YT(f.data,f.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);o.push({name:f.name??`attachment-${l+1}`,media_type:m,data:v});continue}const p=Lv(t,u);if(!p)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const g=await r(p);o.push({name:p,media_type:KT(p),data:await Pv(g)})}return o}const ZT=`function (config) {
|
|
499
|
+
`;m(O=>O+oe),E(!1),B(""),(ae=window.getSelection())==null||ae.removeAllRanges(),setTimeout(()=>{if(w.current){re(),w.current.focus();const O=w.current.value.length;w.current.setSelectionRange(O,O)}},0)},[_]);return a.jsxs("div",{className:`thread-card ${t.status==="resolved"?"thread-resolved":""}`,id:`thread-${t.id}`,children:[a.jsxs("div",{className:"thread-card-header",onClick:()=>k(oe=>!oe),children:[a.jsx("div",{className:"thread-card-quote",children:t.selected_text===null?((te=(Pe=(Se=t.turns)==null?void 0:Se[0])==null?void 0:Pe.user_prompt)==null?void 0:te.slice(0,100))||"Quick question":`“${t.selected_text.slice(0,100)}${t.selected_text.length>100?"…":""}”`}),a.jsxs("div",{className:"thread-card-header-right",children:[t.selected_text!==null&&a.jsx("button",{className:"thread-locate-btn",onClick:oe=>{oe.stopPropagation(),p()},title:"Scroll to text",children:a.jsx(zw,{size:12})}),a.jsx("span",{className:`thread-status-badge ${t.status==="open"?"thread-status-open":"thread-status-resolved"}`,children:t.status==="open"?"Open":"Resolved"})]})]}),v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"thread-card-conversation",ref:S,onMouseDown:he,children:[s.map(oe=>a.jsx(Av,{turn:oe},oe.id)),s.length===0&&a.jsx("div",{className:"thread-card-placeholder",children:"No messages yet."})]}),C&&a.jsx("div",{className:"selection-actions",style:{left:T.x,top:T.y},children:a.jsxs("button",{className:"discuss-button",onClick:Ne,title:"Quote this text in your follow-up",children:[a.jsx(Lg,{size:14}),a.jsx("span",{children:"Quote"})]})}),t.status==="open"&&a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{ref:w,className:"thread-card-followup-input",placeholder:I?"Agent is running…":"Type a follow-up…",value:g,onChange:oe=>{Dt.markInputChange(),m(oe.target.value),re()},disabled:I,rows:1,style:{minHeight:W,maxHeight:Y},onKeyDown:oe=>{Dt.markKeystroke(),oe.key==="Enter"&&(oe.metaKey||oe.ctrlKey)&&!I&&g.trim()&&(oe.preventDefault(),f(g.trim()),m(""),F(W))}}),a.jsx("button",{className:"thread-card-followup-send",disabled:I||!g.trim(),onClick:()=>{f(g.trim()),m("")},children:a.jsx(_o,{size:13})}),I&&a.jsx("button",{className:"thread-card-followup-stop",onClick:r,title:"Stop this thread's turn (Esc)",children:a.jsx(Or,{size:13})})]}),a.jsxs("div",{className:"thread-card-actions",children:[t.status==="open"?a.jsxs("button",{className:"thread-action-btn",onClick:o,title:"Resolve thread",children:[a.jsx(al,{size:13})," Resolve"]}):a.jsxs("button",{className:"thread-action-btn",onClick:l,title:"Reopen thread",children:[a.jsx(To,{size:13})," Reopen"]}),a.jsxs("button",{className:"thread-action-btn thread-action-danger",onClick:u,title:"Delete thread",children:[a.jsx(us,{size:13})," Delete"]})]})]})]})}function CT(){Dt.trackRender("ThreadsPanel");const t=M(A=>A.activeSessionId),s=M(A=>{var _;return A.activeSessionId?((_=A.sessionDetails[A.activeSessionId])==null?void 0:_.threads)??Fm:Fm}),r=x.useMemo(()=>s.filter(A=>!Od(A)),[s]),o=M(A=>A.followupThread),l=M(A=>A.cancelThreadTurn),u=M(A=>A.reopenThread),f=M(A=>A.deleteThread),p=M(A=>A.deepLinkThreadId),g=M(A=>A.setDeepLinkThreadId),[m,v]=x.useState("open"),[k,w]=x.useState(null);x.useEffect(()=>{if(!p)return;const A=p;g(null),v(B=>r.some(I=>I.id===A&&I.status==="open")?B:"all");const _=setTimeout(()=>{const B=document.getElementById(`thread-${A}`);B&&(B.scrollIntoView({behavior:"smooth",block:"center"}),B.classList.add("thread-card-highlighted"),setTimeout(()=>B.classList.remove("thread-card-highlighted"),1500))},100);return()=>clearTimeout(_)},[p,g,r]);const S=r.filter(A=>m==="open"?A.status==="open":m==="resolved"?A.status==="resolved":!0),C=r.filter(A=>A.status==="open").length,E=r.filter(A=>A.status==="resolved").length;function T(A){setTimeout(()=>{const _=document.querySelector(`mark[data-thread-id="${A}"]`);_&&(_.scrollIntoView({behavior:"smooth",block:"center"}),_.classList.add("thread-mark-flash"),setTimeout(()=>_.classList.remove("thread-mark-flash"),1500))},50)}return t?r.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(Mg,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"No threads yet."}),a.jsx("div",{style:{fontSize:"11px",marginTop:"4px"},children:"Select text in an agent response to start a discussion."})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"thread-filter-tabs",children:[a.jsxs("button",{className:`thread-filter-tab ${m==="open"?"active":""}`,onClick:()=>v("open"),children:["Open (",C,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="resolved"?"active":""}`,onClick:()=>v("resolved"),children:["Resolved (",E,")"]}),a.jsxs("button",{className:`thread-filter-tab ${m==="all"?"active":""}`,onClick:()=>v("all"),children:["All (",r.length,")"]})]}),S.length===0?a.jsxs("div",{className:"empty-state",style:{padding:"20px 0"},children:["No ",m," threads."]}):S.map(A=>a.jsx(jT,{thread:A,threadTurns:A.turns??[],onStop:()=>l(t,A.id),onResolve:()=>w(A),onReopen:()=>u(t,A.id),onDelete:()=>f(t,A.id),onFollowup:_=>o(t,A.id,_),onLocate:()=>T(A.id)},A.id)),k&&a.jsx(ST,{thread:k,onClose:()=>w(null)})]}):a.jsx("div",{className:"empty-state",children:"No session selected"})}function ET(){const t=M(f=>f.apps),s=M(f=>f.activeAppTabId),r=M(f=>f.openAppTab),o=M(f=>f.startAppEdit),l=M(f=>f.toggleAppPin),u=M(f=>f.deleteApp);return t.length===0?a.jsx("div",{className:"empty-state",style:{padding:"16px"},children:"No mini apps yet. Add one with the + button in the sidebar Apps section."}):a.jsx("div",{className:"apps-panel",children:t.map(f=>a.jsxs("div",{className:`apps-panel-row${s===f.id?" active":""}`,onClick:()=>r(f.id),title:f.description??void 0,children:[a.jsx(bi,{iconNode:f.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"apps-panel-info",children:[a.jsx("span",{className:"apps-panel-title",children:f.title}),f.description&&a.jsx("span",{className:"apps-panel-desc",children:f.description})]}),a.jsx("button",{className:"apps-panel-action",title:"Edit app with the agent",onClick:p=>{p.stopPropagation(),o(f.id)},children:a.jsx(Qa,{size:12})}),a.jsx("button",{className:`apps-panel-action${f.pinned?" pinned":""}`,title:f.pinned?"Unpin app":"Pin app (sorts first)",onClick:p=>{p.stopPropagation(),l(f.id)},children:a.jsx(ul,{size:12,fill:f.pinned?"currentColor":"none"})}),a.jsx("button",{className:"apps-panel-action apps-panel-danger",title:"Delete app",onClick:p=>{p.stopPropagation(),u(f.id)},children:a.jsx(us,{size:12})})]},f.id))})}function _T(){Dt.trackRender("SidecarPanel");const t=M(T=>T.activeSessionId),s=M(T=>{var A;return T.activeSessionId?(A=T.sessionDetails[T.activeSessionId])==null?void 0:A.runtime_type:void 0}),r=M(T=>{var A;return T.activeSessionId?wT((A=T.sessionDetails[T.activeSessionId])==null?void 0:A.threads):null}),o=M(T=>T.askSidecar),l=M(T=>T.cancelThreadTurn),u=M(T=>T.deleteThread),[f,p]=x.useState(""),[g,m]=x.useState(!1),v=x.useRef(null),k=(r==null?void 0:r.turns)??[],w=k[k.length-1],S=k.some(pr);if(x.useEffect(()=>{var T,A;(A=(T=v.current)==null?void 0:T.scrollIntoView)==null||A.call(T,{block:"end"})},[k.length,w==null?void 0:w.items.length,w==null?void 0:w.status]),!t||!s)return a.jsx("div",{className:"empty-state",children:"No session selected"});if(!xT(s))return a.jsxs("div",{className:"empty-state",children:[a.jsx(hr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsxs("div",{children:["The sidecar is not available for ",s," sessions yet."]})]});const C=!S&&!g&&f.trim().length>0;async function E(){if(!t||!C)return;m(!0);const T=await o(t,f.trim());m(!1),T&&p("")}return a.jsxs("div",{className:"sidecar-panel",children:[a.jsxs("div",{className:"sidecar-conversation",children:[k.length===0?a.jsxs("div",{className:"empty-state",children:[a.jsx(hr,{size:24,style:{opacity:.3,marginBottom:8}}),a.jsx("div",{children:"Ask about this session."}),a.jsx("div",{className:"sidecar-hint",children:"Where does it stand? Is it stuck? When will it finish? What is done and what is left?"})]}):k.map(T=>a.jsx(Av,{turn:T,formatPrompt:kT},T.id)),a.jsx("div",{ref:v})]}),a.jsxs("div",{className:"sidecar-footer",children:[a.jsxs("div",{className:"thread-card-followup",children:[a.jsx("textarea",{className:"thread-card-followup-input","aria-label":"Ask the sidecar",placeholder:S?"Sidecar is answering…":"Ask about this session… (⌘/Ctrl+Enter)",value:f,rows:2,disabled:S,onChange:T=>{Dt.markInputChange(),p(T.target.value)},onKeyDown:T=>{Dt.markKeystroke(),T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),E())}}),S&&r?a.jsx("button",{className:"thread-card-followup-stop",title:"Stop the answer","aria-label":"Stop the answer",onClick:()=>l(t,r.id),children:a.jsx(Or,{size:13})}):a.jsx("button",{className:"thread-card-followup-send",title:"Ask","aria-label":"Ask",disabled:!C,onClick:()=>void E(),children:a.jsx(_o,{size:13})})]}),r&&a.jsx("div",{className:"thread-card-actions",children:a.jsxs("button",{className:"thread-action-btn thread-action-danger",title:"Clear the sidecar conversation",disabled:S,onClick:()=>u(t,r.id),children:[a.jsx(us,{size:13})," Clear"]})})]})]})}function RT(){var g;Dt.trackRender("RightPanel");const t=M(m=>m.activeRightTab),s=M(m=>m.switchRightTab),r=M(m=>m.rightPanelCollapsed),o=M(m=>m.toggleRightPanel),l=M(m=>m.activeSessionId?m.sessionDetails[m.activeSessionId]:null),u=M(m=>m.activeSessionId?Pd(m.backgroundTasks[m.activeSessionId]):0),f=((g=l==null?void 0:l.threads)==null?void 0:g.filter(m=>m.status==="open"&&!Od(m)).length)??0,p=[{id:"turns",label:"Turns",icon:Dw},{id:"sidecar",label:"Sidecar",icon:hr},{id:"tasks",label:"Tasks",icon:Iw,badge:u||void 0},{id:"threads",label:"Threads",icon:Mg,badge:f||void 0},{id:"apps",label:"Apps",icon:Dg}];return r?a.jsxs("div",{className:"ide-right collapsed",children:[a.jsx("button",{type:"button",className:"right-icon-btn",title:"Expand panel","aria-label":"Expand panel","aria-expanded":!1,onClick:o,children:a.jsx(Uw,{size:15})}),a.jsx("div",{className:"right-rail-divider"}),p.map(m=>{const v=m.icon,k=m.badge?`${m.label} (${m.badge})`:m.label;return a.jsxs("button",{type:"button",className:`right-icon-btn right-rail-tab ${t===m.id?"active":""}`,title:k,"aria-label":k,onClick:()=>s(m.id),children:[a.jsx(v,{size:15}),m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id)})]}):a.jsxs("div",{className:"ide-right",children:[a.jsxs("div",{className:"right-header",children:[a.jsx("div",{className:"right-tabs",children:p.map(m=>a.jsxs("div",{className:`right-tab ${t===m.id?"active":""}`,onClick:()=>s(m.id),children:[m.label,m.badge?a.jsx("span",{className:"right-tab-badge",children:m.badge}):null]},m.id))}),a.jsx("button",{type:"button",className:"right-icon-btn right-collapse-btn",title:"Collapse panel","aria-label":"Collapse panel","aria-expanded":!0,onClick:o,children:a.jsx(Fw,{size:14})})]}),a.jsxs("div",{className:"right-content",children:[t==="turns"&&a.jsx(dT,{}),t==="sidecar"&&a.jsx(_T,{}),t==="tasks"&&a.jsx(gT,{}),t==="threads"&&a.jsx(CT,{}),t==="apps"&&a.jsx(ET,{})]})]})}const _e={low:{effort:"low",label:"Low"},medium:{effort:"medium",label:"Medium"},high:{effort:"high",label:"High"},xhigh:{effort:"xhigh",label:"Extra High"},max:{effort:"max",label:"Max"},ultra:{effort:"ultra",label:"Ultra"}},td=[{id:"codex",label:"Codex",available:!0,models:[{slug:"gpt-5.6-sol",displayName:"GPT-5.6-Sol",description:"Flagship — complex, open-ended work",defaultReasoning:"low",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max,_e.ultra]},{slug:"gpt-5.6-terra",displayName:"GPT-5.6-Terra",description:"Balanced all-rounder for everyday work",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max,_e.ultra]},{slug:"gpt-5.6-luna",displayName:"GPT-5.6-Luna",description:"Fast, affordable — clear, repeatable tasks",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]},{slug:"gpt-5.5",displayName:"GPT-5.5",description:"Previous-gen frontier model",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh]}]},{id:"claude",label:"Claude",available:!0,models:[{slug:"claude-sonnet-5-5",displayName:"Claude Sonnet 5.5",description:"Best combination of speed and intelligence",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]},{slug:"claude-sonnet-5",displayName:"Claude Sonnet 5",description:"Previous-gen balanced all-rounder",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]},{slug:"claude-opus-5",displayName:"Claude Opus 5",description:"Deep reasoning for complex tasks",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]},{slug:"claude-fable-5",displayName:"Claude Fable 5",description:"Fast and efficient for simple tasks",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high,_e.xhigh,_e.max]}]},{id:"repoburg",label:"Repoburg",available:!0,models:[{slug:"ollama/glm-5.3:cloud",displayName:"GLM-5.3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high]},{slug:"ollama/glm-5.3-flash:cloud",displayName:"GLM-5.3 Flash",description:"Ollama Cloud — fast",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high]},{slug:"ollama/minimax-m3:cloud",displayName:"MiniMax M3",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high]},{slug:"ollama/deepseek-v4-pro:cloud",displayName:"DeepSeek V4 Pro",description:"Ollama Cloud",defaultReasoning:"medium",reasoningLevels:[_e.low,_e.medium,_e.high]}]}];function AT(t){return td.find(s=>s.id===t)}function $d(t){const s=AT(t);return(s==null?void 0:s.models)??[]}function Iv(t,s){return $d(t).find(r=>r.slug===s)}function nd(t,s){var r;return((r=Iv(t,s))==null?void 0:r.reasoningLevels)??[]}function sd(t,s){var r;return(r=Iv(t,s))==null?void 0:r.defaultReasoning}function IT(){const{activeSessionId:t,sessions:s,updateModelConfig:r}=M(),o=M(te=>te.showModelSelector),l=M(te=>te.setShowModelSelector),u=s.find(te=>te.id===t),f=M(te=>te.models),p=M(te=>te.modelsLoading),g=M(te=>te.loadModels),[m,v]=x.useState(!1),k=x.useRef(null);if(_l(k,()=>v(!1),m),Eo(()=>v(!1),m),x.useEffect(()=>{o&&(v(!0),l(!1))},[o,l]),x.useEffect(()=>{u!=null&&u.runtime_type&&g(u.runtime_type,u.cwd??void 0)},[u==null?void 0:u.runtime_type,u==null?void 0:u.cwd,g]),!u)return null;const w=u.runtime_type,S=u.model??"",C=u.model_reasoning_effort??"",E=f.length>0?f:[],T=$d(w),_=[...E.length>0?E:T];if(S&&!_.some(te=>te.slug===S)){const te=T[0];_.unshift({slug:S,displayName:S,description:"Custom model",defaultReasoning:(te==null?void 0:te.defaultReasoning)??"medium",reasoningLevels:(te==null?void 0:te.reasoningLevels)??[]})}function B(te){return _.find(oe=>oe.slug===te)}function I(te){var oe;return E.length>0?((oe=B(te))==null?void 0:oe.reasoningLevels)??[]:nd(w,te)}function W(te){var oe;return E.length>0?(oe=B(te))==null?void 0:oe.defaultReasoning:sd(w,te)}const Y=td.find(te=>te.id===w),K=B(S),F=S?I(S):[],re=(Y==null?void 0:Y.label)??w,he=(K==null?void 0:K.displayName)??(S||"Default"),G=F.find(te=>te.effort===C),Ne=(G==null?void 0:G.label)??(C||"Default");function Se(te){var Q;const oe=I(te),O=oe.some(U=>U.effort===C)?C:W(te)??((Q=oe[0])==null?void 0:Q.effort)??"";r(te,O),v(!1)}function Pe(te){r(S,te),v(!1)}return a.jsxs("div",{className:"model-selector",ref:k,children:[a.jsxs("button",{className:"model-selector-btn",onClick:()=>v(!m),title:"Change model and thinking level",children:[a.jsx("span",{className:"model-selector-provider",children:re}),a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-model",children:he}),Ne!=="Default"&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"model-selector-sep",children:"›"}),a.jsx("span",{className:"model-selector-reasoning",children:Ne})]}),a.jsx(wi,{size:12,className:"model-selector-chevron"})]}),m&&a.jsxs("div",{className:"model-selector-popover",children:[a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Provider"}),td.map(te=>a.jsxs("div",{className:`model-selector-item ${te.id===w?"selected":""} ${te.available?"":"disabled"}`,onClick:()=>{if(te.available){if(te.id===w){v(!1);return}r("","",te.id)}},children:[a.jsx("span",{children:te.label}),!te.available&&a.jsxs("span",{className:"model-selector-coming-soon",children:[a.jsx(Pw,{size:10})," Soon"]}),te.id===w&&a.jsx(Ts,{size:12})]},te.id))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Model"}),p&&a.jsx("div",{className:"model-selector-empty",children:"Loading models…"}),!p&&_.length===0&&a.jsx("div",{className:"model-selector-empty",children:"No models available"}),_.map(te=>a.jsxs("div",{className:`model-selector-item ${te.slug===S?"selected":""}`,onClick:()=>Se(te.slug),children:[a.jsxs("div",{className:"model-selector-item-main",children:[a.jsx("span",{className:"model-selector-item-name",children:te.displayName}),a.jsx("span",{className:"model-selector-item-desc",children:te.description})]}),te.slug===S&&a.jsx(Ts,{size:12})]},te.slug))]}),a.jsxs("div",{className:"model-selector-column",children:[a.jsx("div",{className:"model-selector-col-header",children:"Thinking"}),F.length===0&&a.jsx("div",{className:"model-selector-empty",children:"Select a model first"}),F.map(te=>a.jsxs("div",{className:`model-selector-item ${te.effort===C?"selected":""}`,onClick:()=>Pe(te.effort),children:[a.jsx("span",{children:te.label}),te.effort===C&&a.jsx(Ts,{size:12})]},te.effort))]})]})]})}function fo(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Um(){const t=M(s=>s.setShowRemoteModal);return a.jsxs("div",{className:"sb-item",style:{cursor:"pointer"},title:"Remote access — make this machine remote",onClick:()=>t(!0),children:[a.jsx(e1,{size:14})," Repoburg"]})}function Bm(){const t=M(r=>r.usageViewOpen),s=M(r=>r.toggleUsageView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Usage Center",onClick:s,children:[a.jsx(Rg,{size:14})," Usage"]})}function Wm(){const t=M(r=>r.vscodeViewOpen),s=M(r=>r.toggleVscodeView);return a.jsxs("button",{className:`sb-item sb-btn${t?" sb-item-active":""}`,title:t?"Back to the agent view":"Open VS Code",onClick:s,children:[a.jsx(Tw,{size:14})," Code"]})}function DT(){Dt.trackRender("StatusBar");const t=M(v=>v.activeSessionId),s=M(v=>t?v.sessions.find(k=>k.id===t)??null:null),r=M(v=>t?v.sessionDetails[t]??null:null),o=M(v=>t?v.backgroundTasks[t]:void 0),l=M(v=>v.wsConnected),u=M(v=>v.switchRightTab),f=(r==null?void 0:r.contextUsage)??null;if(!s)return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Um,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Wm,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Bm,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-spacer"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Uh,{size:14})," K"]})]});const p=o??[],g=El(s,p.length),m=Pd(p);return a.jsxs("div",{className:"ide-statusbar",children:[a.jsx(Um,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Wm,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(Bm,{}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx(IT,{}),m>0&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",style:{color:"var(--amber)",cursor:"pointer"},title:`${m} Monitor task${m>1?"s":""} running — click to view`,onClick:()=>u("tasks"),children:[a.jsx($g,{size:14})," ",m]})]}),a.jsx("div",{className:"sb-spacer"}),a.jsx("div",{className:"sb-item",title:l?"WebSocket connected":"WebSocket disconnected",children:l?"Live":"Offline"}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-item",style:g.dot==="background"?{color:"var(--purple)"}:s.status==="failed"?{color:"var(--red)"}:void 0,title:g.dot==="background"?g.dotTitle:void 0,children:g.label}),f&&a.jsx(MT,{usage:f}),a.jsx("div",{className:"sb-divider",children:"|"}),a.jsxs("div",{className:"sb-item",children:[a.jsx(Uh,{size:14})," K"]})]})}function MT({usage:t}){const s=t.percentage>=85?"var(--red)":t.percentage>=60?"var(--amber)":"var(--green)",r=`${fo(t.totalTokens)} / ${fo(t.contextWindow)} tokens`+(t.autoCompactThreshold?` · auto-compacts at ${fo(t.autoCompactThreshold)}`:"");return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"sb-divider",children:"|"}),a.jsx("div",{className:"sb-context",title:r,children:a.jsxs("span",{className:"sb-context-text",style:{color:s},children:[Math.round(t.percentage),"% / ",fo(t.totalTokens)," / ",fo(t.contextWindow)]})})]})}function Hm(t){return Wt(`/vscode-web/status?folder=${encodeURIComponent(t??"")}`)}function LT(t){return ut("/vscode-web/start",{folder:t})}function PT(t){return ut("/vscode-web/heartbeat",{id:t})}const OT=1e3,$T=5*6e4;function Vm({children:t}){const s=M(r=>r.toggleVscodeView);return a.jsxs("div",{className:"vscode-view vscode-view--loading",children:[t,a.jsx("button",{className:"dialog-close vscode-view-close",title:"Close VS Code view","aria-label":"Close VS Code view",onClick:s,children:a.jsx(gn,{size:16})})]})}function zT(){const t=M(C=>C.vscodeState),s=M(C=>C.vscodeId),r=M(C=>C.vscodeToken),o=M(C=>C.setVscodeView),l=M(C=>{var T;const E=C.activeSessionId?C.sessions.find(A=>A.id===C.activeSessionId):null;return E!=null&&E.cwd?E.cwd:((T=C.workspaces.find(A=>A.deleted===0))==null?void 0:T.path)??null}),[u,f]=x.useState(!1),[p,g]=x.useState(0),m=x.useRef(null),v=mn(),k=v===""||v===window.location.origin,w=`${v}/vscode/${s??""}/?tkn=${r??""}${l?`&folder=${encodeURIComponent(l)}`:""}`;x.useEffect(()=>{let C=!1;function E(){m.current&&(clearInterval(m.current),m.current=null)}async function T(){try{let _=await Hm(l);if((_.state==="stopped"||_.state==="error")&&(_=await LT(l)),C||(o(_.state,_.id,_.token),_.state==="running"||_.state==="error"))return;m.current=setInterval(async()=>{const B=await Hm(l);C||(o(B.state,B.id,B.token),(B.state==="running"||B.state==="error"||B.state==="stopped")&&E())},OT)}catch{C||o("error",null,null)}}T();const A=setInterval(()=>{const _=M.getState().vscodeId;_&&PT(_).catch(()=>{})},$T);return()=>{C=!0,E(),clearInterval(A)}},[p,l,o]);function S(){f(!1),o("starting",null,null),g(C=>C+1)}return t!=="running"||!r||!s?a.jsx(Vm,{children:t==="error"?a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"VS Code could not start."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:S,children:[a.jsx(To,{size:14})," Retry"]})]}):a.jsxs("span",{className:"vscode-view-hint",children:[a.jsx(hn,{size:16,className:"spin"})," Starting VS Code — first start downloads the server component (~20 s)."]})}):k?a.jsxs("div",{className:"vscode-view",children:[!u&&a.jsxs("div",{className:"vscode-view-overlay",children:[a.jsx(hn,{size:16,className:"spin"})," Loading VS Code…"]}),a.jsx("iframe",{src:w,title:"VS Code",className:"vscode-view-frame",onLoad:()=>f(!0)},s)]}):a.jsxs(Vm,{children:[a.jsx("span",{children:"VS Code cannot be embedded on this host — serve-web allows same-origin frames only."}),a.jsxs("button",{className:"dialog-btn-cancel",onClick:()=>window.open(w,"_blank","noopener"),children:[a.jsx(jw,{size:14})," Open VS Code in a new tab"]})]})}function Gm(t,s){const r=new URLSearchParams;t&&r.set("since",t),s&&r.set("until",s);const o=r.toString();return Wt(`/usage/summary${o?`?${o}`:""}`)}const Dv="agentpane:usage-budget";function cs(t){return t>=1e6?`${(t/1e6).toFixed(t%1e6===0?0:1)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}function Lr(t){return`$${t>=100?t.toFixed(0):t>=1?t.toFixed(2):t.toFixed(4).replace(/0+$/,"").replace(/\.$/,"")}`}function FT(t,s=new Date){if(t==="all")return{since:null,until:null};const r=new Date(s);return t==="today"?r.setHours(0,0,0,0):r.setDate(r.getDate()-(t==="7d"?7:30)),{since:r.toISOString(),until:null}}function UT(t=new Date){return new Date(t.getFullYear(),t.getMonth(),1).toISOString()}function BT(){try{const t=Number(localStorage.getItem(Dv));return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function WT(t){try{localStorage.setItem(Dv,String(t))}catch{}}const HT={claude:"Claude",codex:"Codex",repoburg:"Repoburg"};function qa({label:t,value:s,sub:r,tone:o}){return a.jsxs("div",{className:"usage-kpi",children:[a.jsx("div",{className:"usage-kpi-label",children:t}),a.jsx("div",{className:"usage-kpi-value",style:o?{color:o}:void 0,children:s}),r&&a.jsx("div",{className:"usage-kpi-sub",children:r})]})}function VT({day:t,max:s}){const r=o=>s>0?o/s*100:0;return a.jsxs("div",{className:"usage-day",title:`${t.date} · ${cs(t.input_tokens)} input · ${cs(t.cached_input_tokens)} cached · ${cs(t.output_tokens)} output · ${Lr(t.cost_usd)}`,children:[a.jsxs("div",{className:"usage-day-bar",children:[a.jsx("div",{className:"usage-seg usage-seg-output",style:{height:`${r(t.output_tokens)}%`}}),a.jsx("div",{className:"usage-seg usage-seg-cached",style:{height:`${r(t.cached_input_tokens+t.cache_write_input_tokens)}%`}}),a.jsx("div",{className:"usage-seg usage-seg-input",style:{height:`${r(t.input_tokens)}%`}})]}),a.jsx("div",{className:"usage-day-label",children:t.date.slice(5)})]})}function GT(){const t=M(_=>_.toggleUsageView),[s,r]=x.useState("30d"),[o,l]=x.useState(null),[u,f]=x.useState(null),[p,g]=x.useState(BT),[m,v]=x.useState(null),[k,w]=x.useState(!1),S=x.useCallback(async()=>{w(!0),v(null);try{const{since:_,until:B}=FT(s),[I,W]=await Promise.all([Gm(_,B),Gm(UT(),null)]);l(I),f(W.totals.cost_usd)}catch(_){v(_.message)}finally{w(!1)}},[s]);x.useEffect(()=>{S()},[S]);const C=o==null?void 0:o.totals,E=p>0&&u!==null?p-u:null,T=x.useMemo(()=>Math.max(0,...((o==null?void 0:o.daily)??[]).map(_=>_.input_tokens+_.cached_input_tokens+_.output_tokens)),[o]),A=_=>{const B=Number(_.replace(",",".")),I=Number.isFinite(B)&&B>0?B:0;g(I),WT(I)};return a.jsxs("div",{className:"usage-view",children:[a.jsxs("div",{className:"usage-header",children:[a.jsxs("div",{className:"usage-title",children:[a.jsx(Rg,{size:18})," Usage Center"]}),a.jsxs("div",{className:"usage-controls",children:[["today","7d","30d","all"].map(_=>a.jsx("button",{className:`usage-range-btn${s===_?" usage-range-btn-active":""}`,onClick:()=>r(_),children:_==="today"?"Today":_==="7d"?"7 days":_==="30d"?"30 days":"All"},_)),a.jsx("button",{className:"usage-range-btn",onClick:()=>void S(),title:"Refresh",children:a.jsx(Gw,{size:13,className:k?"spin":void 0})}),a.jsx("button",{className:"dialog-close",title:"Close usage view","aria-label":"Close usage view",onClick:t,children:a.jsx(gn,{size:16})})]})]}),m&&a.jsxs("div",{className:"usage-error",children:["Could not load usage data: ",m]}),!o&&!m&&a.jsx("div",{className:"usage-empty",children:"Loading…"}),o&&C&&a.jsxs("div",{className:"usage-body",children:[a.jsxs("div",{className:"usage-kpis",children:[a.jsx(qa,{label:"Spend",value:Lr(C.cost_usd),sub:C.unpriced_models.length>0?"excluding unpriced models":void 0}),a.jsx(qa,{label:"Remaining (monthly)",value:E===null?"—":E>=0?Lr(E):Lr(0),sub:p>0&&u!==null?`this month ${Lr(u)} / budget ${Lr(p)}`:"no budget set",tone:E!==null&&E<0?"var(--red)":void 0}),a.jsx(qa,{label:"Tokens",value:cs(C.input_tokens+C.cached_input_tokens+C.cache_write_input_tokens+C.output_tokens),sub:`input ${cs(C.input_tokens)} · cached ${cs(C.cached_input_tokens)} · write ${cs(C.cache_write_input_tokens)} · output ${cs(C.output_tokens)}`}),a.jsx(qa,{label:"Calls",value:String(C.calls),sub:C.errors>0?`${C.errors} failed`:void 0,tone:C.errors>0?"var(--amber)":void 0})]}),a.jsxs("div",{className:"usage-budget",children:[a.jsx("label",{htmlFor:"usage-budget-input",children:"Monthly budget (USD)"}),a.jsx("input",{id:"usage-budget-input",type:"number",min:"0",step:"1",defaultValue:p>0?p:"",placeholder:"e.g. 50",onBlur:_=>A(_.target.value)}),p>0&&u!==null&&a.jsx("div",{className:"usage-budget-bar",children:a.jsx("div",{className:"usage-budget-fill",style:{width:`${Math.min(100,u/p*100)}%`,background:u>=p?"var(--red)":void 0}})})]}),C.unpriced_models.length>0&&a.jsxs("div",{className:"usage-note",children:["Unpriced models: ",C.unpriced_models.join(", ")]}),a.jsxs("div",{className:"usage-chart",children:[a.jsx("div",{className:"usage-section-title",children:"Daily usage"}),o.daily.length===0?a.jsx("div",{className:"usage-empty",children:"No usage in this range."}):a.jsx("div",{className:"usage-days",children:o.daily.map(_=>a.jsx(VT,{day:_,max:T},_.date))}),a.jsxs("div",{className:"usage-legend",children:[a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-input"})," input"]}),a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-cached"})," cached"]}),a.jsxs("span",{children:[a.jsx("span",{className:"usage-dot usage-seg-output"})," output"]})]})]}),a.jsxs("div",{className:"usage-table-wrap",children:[a.jsx("div",{className:"usage-section-title",children:"By model"}),a.jsxs("table",{className:"usage-table",children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Runtime"}),a.jsx("th",{children:"Provider"}),a.jsx("th",{children:"Model"}),a.jsx("th",{children:"Effort"}),a.jsx("th",{children:"Calls"}),a.jsx("th",{children:"Input"}),a.jsx("th",{children:"Cached"}),a.jsx("th",{children:"Output"}),a.jsx("th",{children:"Cost"})]})}),a.jsxs("tbody",{children:[o.by_model.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:9,className:"usage-empty",children:"No usage records yet."})}),o.by_model.map(_=>a.jsxs("tr",{children:[a.jsx("td",{children:HT[_.runtime_type]??_.runtime_type}),a.jsx("td",{children:_.provider??"—"}),a.jsx("td",{title:_.model,children:_.model}),a.jsx("td",{children:_.reasoning_effort??"default"}),a.jsxs("td",{children:[_.calls,_.errors>0&&a.jsxs("span",{className:"usage-err",children:[" (",_.errors," failed)"]})]}),a.jsx("td",{children:cs(_.input_tokens)}),a.jsx("td",{children:cs(_.cached_input_tokens+_.cache_write_input_tokens)}),a.jsx("td",{children:cs(_.output_tokens)}),a.jsx("td",{children:_.cost_usd===null?a.jsx("span",{className:"usage-unpriced",children:"unknown"}):Lr(_.cost_usd)})]},`${_.runtime_type}|${_.provider??""}|${_.model}|${_.reasoning_effort??""}`))]})]})]})]})]})}const qm=/^[a-f0-9]{64}\.(?:png|jpg|gif|webp)$/,qT=/^(?:https?:\/\/[^/?#]+)?\/api\/apps\/([^/?#]+)\/files\/([^/?#]+)$/i,KT={png:"image/png",jpg:"image/jpeg",gif:"image/gif",webp:"image/webp"};function Mv(){return mn()||window.location.origin}function Lv(t,s){let r=s;if(r&&typeof r=="object"){const f=r;r=typeof f.id=="string"?f.id:f.url}if(typeof r!="string")return null;const o=r.trim();if(qm.test(o))return o;const l=qT.exec(o);if(!l)return null;let u;try{u=decodeURIComponent(l[1])}catch{return null}return u===t&&qm.test(l[2])?l[2]:null}function Km(t){return/^https?:\/\//i.test(t.url)?t:{...t,url:`${Mv()}${t.url}`}}function YT(t){return KT[t.slice(t.lastIndexOf(".")+1)]??"application/octet-stream"}function Pv(t){return new Promise((s,r)=>{const o=new FileReader;o.onload=()=>{const l=String(o.result??"");s(l.slice(l.indexOf(",")+1))},o.onerror=()=>r(o.error??new Error("Could not read the file")),o.readAsDataURL(t)})}function XT(t,s){const r=/^data:([^;,]*)(?:;[^;,]*)*;base64,/i.exec(t);return r?{type:s||r[1]||void 0,data:t.slice(r[0].length)}:{type:s,data:t}}async function Ov(t){if(t instanceof Blob){const s=t.name;return{name:typeof s=="string"&&s?s:void 0,type:t.type||void 0,data:await Pv(t)}}if(t&&typeof t=="object"&&typeof t.data=="string"){const s=t;return{name:typeof s.name=="string"&&s.name?s.name:void 0,type:typeof s.type=="string"&&s.type?s.type:void 0,data:s.data}}return null}async function QT(t){const s=await Ov(t);if(!s)throw new Error("uploadFile: expected a Blob/File or { name, type, data }");return s}async function ZT(t,s,r){if(s==null)return[];if(!Array.isArray(s))throw new Error("submitTurn: attachments must be an array");const o=[];for(let l=0;l<s.length;l++){const u=s[l],f=await Ov(u);if(f){const{type:m,data:v}=XT(f.data,f.type);if(!m)throw new Error(`submitTurn: attachment ${l+1} has no type`);o.push({name:f.name??`attachment-${l+1}`,media_type:m,data:v});continue}const p=Lv(t,u);if(!p)throw new Error(`submitTurn: attachment ${l+1} is not a file of this app`);const g=await r(p);o.push({name:p,media_type:YT(p),data:await Pv(g)})}return o}const JT=`function (config) {
|
|
500
500
|
var nextId = 1;
|
|
501
501
|
var pending = new Map();
|
|
502
502
|
var listeners = [];
|
|
@@ -631,9 +631,9 @@ ${_}
|
|
|
631
631
|
stack: (r && r.stack) || '', line: 0, col: 0
|
|
632
632
|
}, '*');
|
|
633
633
|
});
|
|
634
|
-
}`;function JT(t){return`(${ZT})(${JSON.stringify(t)});`}function Ym(t){return t.replace(/<\/script/gi,"<\\/script")}function eN(t,s){const r=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let l=-1,u;for(;(u=o.exec(t))!==null;)l=u.index;return l}function Xm(t,s,r){const o=eN(t,s);return o===-1?t+r:t.slice(0,o)+r+t.slice(o)}function tN(t,s,r){let o=t;const l=`<script>${Ym(s)}<\/script>`;if(/<\/head>/i.test(o)?o=Xm(o,"</head>",l):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):o=`${l}${o}`,r){const u=`<script>${Ym(r)}<\/script>`;o=Xm(o,"</body>",u)}return o}function nN(){const t=globalThis.crypto;return t&&typeof t.randomUUID=="function"?`tab-${t.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function sN(t){var r;if(!(t instanceof ld)||t.status!==409)return null;const s=(r=t.body)==null?void 0:r.state;return s&&typeof s=="object"?s:null}function rN({appId:t,workspace:s=""}){const r=x.useRef(null),o=x.useRef({pinned:!1,data:null}),[l,u]=x.useState(null),[f,p]=x.useState(null),[g,m]=x.useState([]);x.useEffect(()=>{let S=!0;const C=nN(),E=A=>{const _=o.current.version;typeof A.version=="number"&&typeof _=="number"&&A.version<_||(o.current=A)};m0(t,A=>{var _,B;return(B=(_=r.current)==null?void 0:_.contentWindow)==null?void 0:B.postMessage(A,"*")},s);const T=async A=>{var K,F,re,he,G,Ne,Se,Pe,te,oe,ae,O,Q;if(A.source!==((K=r.current)==null?void 0:K.contentWindow))return;const _=A.data;if(!_||_.source!=="agentpane-app")return;if(_.report==="error"){const U={message:String(_.message??"Unknown error"),stack:String(_.stack??"")};m(j=>{const P=j[j.length-1];return P&&P.message===U.message?j:[...j,U].slice(-20)});return}if(typeof _.method!="string")return;let B=!0,I,W,Y=null;try{switch(_.method){case"getApp":I={id:t};break;case"getState":try{const U=await Oh(t,s);E(U),I=U}catch{I=o.current}break;case"setState":{const U=((F=_.params)==null?void 0:F.data)??null,j=(re=_.params)==null?void 0:re.ifVersion,P={data:U,writer:C};typeof j=="number"&&(P.ifVersion=j);try{const ne=await xg(t,P,s);E(ne),I=ne}catch(ne){if(Y=sN(ne),!Y)throw ne;E(Y);const de=ne.body;throw new Error(typeof(de==null?void 0:de.error)=="string"?de.error:"App state changed since that version")}break}case"createSession":{const U=_.params??{},j=await cd({title:typeof U.title=="string"?U.title:void 0,runtime_type:typeof U.runtime_type=="string"?U.runtime_type:void 0,model:typeof U.model=="string"?U.model:void 0,model_reasoning_effort:typeof U.model_reasoning_effort=="string"?U.model_reasoning_effort:void 0,cwd:typeof U.cwd=="string"?U.cwd:void 0,origin_app_id:t});wu(j.id,t),M.getState().addSession(j),I=j;break}case"submitTurn":{const U=String(((he=_.params)==null?void 0:he.sessionId)??""),j=String(((G=_.params)==null?void 0:G.prompt)??""),P=await QT(t,(Ne=_.params)==null?void 0:Ne.attachments,de=>ew(t,de)),ne=await lg(U,j,P.length?P:void 0,{originAppId:t});wu(U,t),I=ne;break}case"resolveToolCall":{const U=String(((Se=_.params)==null?void 0:Se.callId)??""),j=(Pe=_.params)==null?void 0:Pe.result;await X0(U,j),I={ok:!0};break}case"openSession":{if(M.getState().activeAppTabId!==t)throw new Error("openSession: the app is not on screen — call it from a click in the app");const U=typeof((te=_.params)==null?void 0:te.sessionId)=="string"?_.params.sessionId.trim():"";if(!U)throw new Error("openSession: sessionId is required");try{await M.getState().revealSession(U)}catch(j){throw new Error(`openSession: ${j instanceof Error?j.message:String(j)}`)}I={ok:!0};break}case"uploadFile":{const U=await XT((oe=_.params)==null?void 0:oe.file);try{I=Km(await Z0(t,U))}catch(j){throw new Error(`uploadFile: ${j instanceof Error?j.message:String(j)}`)}break}case"getFile":{const U=Lv(t,(ae=_.params)==null?void 0:ae.ref),j=U?await J0(t,U):null;I=j?Km(j):null;break}default:throw new Error(`Unknown bridge method: ${_.method}`)}}catch(U){B=!1,W=U instanceof Error?U.message:String(U)}(Q=(O=r.current)==null?void 0:O.contentWindow)==null||Q.postMessage(Y?{source:"agentpane-host",id:_.id,ok:B,error:W,code:"conflict",state:Y}:{source:"agentpane-host",id:_.id,ok:B,result:I,error:W},"*")};return window.addEventListener("message",T),k0(t,A=>{var _,B;typeof A.workspace=="string"&&A.workspace!==s||A.writer!==C&&((B=(_=r.current)==null?void 0:_.contentWindow)==null||B.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof A.version=="number"?{version:A.version}:{}},"*"))}),x0(t,()=>{Ph(t).then(A=>{S&&(u(A),m([]))}).catch(()=>{})}),(async()=>{try{const[A,_,B]=await Promise.all([Ph(t),Oh(t,s),V0(t).catch(()=>[])]);if(!S)return;o.current=_,B.forEach(I=>wu(I.id,t)),u(A)}catch(A){S&&p(A instanceof Error?A.message:String(A))}})(),()=>{S=!1,g0(t),w0(t),S0(t),window.removeEventListener("message",T)}},[t,s]);const v=x.useMemo(()=>l?tN(l.html,JT({appId:t,apiOrigin:Mv()}),l.js):"",[l,t]);if(f)return a.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",f]});if(!v)return a.jsx("div",{className:"empty-state",style:{padding:"24px"},children:"Loading mini app…"});const k=(l==null?void 0:l.diagnostics)??[],w=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${w?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:w?`Compile errors in ${(l==null?void 0:l.sourceFile)??"the app logic"} — the pane serves the last code that parsed:`:"Warnings — the app runs, but fix these:"}),k.map((S,C)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},C))]}),a.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",allow:"loopback-network; local-network; local-network-access",title:`Mini app: ${t}`,srcDoc:v}),g.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:g.map((S,C)=>a.jsxs("div",{className:"miniapp-rt-error",children:[a.jsx("div",{className:"miniapp-rt-error-message",children:S.message}),S.stack&&a.jsx("pre",{className:"miniapp-rt-error-stack",children:S.stack})]},C))})]})}function iN({appId:t,active:s}){const r=M(w=>w.apps),o=M(w=>w.workspaces),l=M(w=>w.appWorkspaces),u=M(w=>w.setAppWorkspace),f=M(w=>w.setActiveAppTab),p=M(w=>w.startAppEdit),g=r.find(w=>w.id===t),m=l[t]??"",v=o.filter(w=>w.deleted!==1),k=m!==""&&!v.some(w=>w.path===m)?m:null;return a.jsxs("div",{className:`miniapp-view ${s?"":"miniapp-view-hidden"}`,children:[a.jsxs("div",{className:"miniapp-header",children:[a.jsx(bi,{iconNode:g==null?void 0:g.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(g==null?void 0:g.title)??t}),a.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:w=>u(t,w.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(w=>a.jsx("option",{value:w.path,children:w.label||w.path.split("/").pop()||w.path},w.path)),k&&a.jsx("option",{value:k,children:`${k} (unknown workspace)`})]}),a.jsxs("button",{className:"miniapp-header-btn",title:"Edit this app with the agent (opens an edit session on the app folder)",onClick:()=>void p(t),children:[a.jsx(Ww,{size:13}),"Edit"]}),a.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>f(null),children:a.jsx(gn,{size:14})})]}),a.jsx("div",{className:"miniapp-body",children:a.jsx(rN,{appId:t,workspace:m},`${t}:${m}`)})]})}function oN({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l}){const[u,f]=x.useState(!1),p=x.useRef(0),g=x.useRef(0),m=x.useCallback(w=>{const S=w.clientX-p.current,C=t==="left"?g.current+S:g.current-S,E=Math.min(r,Math.max(s,C));l(E)},[t,s,r,l]),v=x.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),f(!1)},[m]);return{onPointerDown:x.useCallback(w=>{var S,C;w.preventDefault(),w.stopPropagation();try{(C=(S=w.currentTarget)==null?void 0:S.setPointerCapture)==null||C.call(S,w.pointerId)}catch{}p.current=w.clientX,g.current=o(),f(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:u}}function Qm({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l}){const{onPointerDown:u,dragging:f}=oN({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l});return a.jsx("div",{className:`resize-handle ${t}${f?" dragging":""}`,onPointerDown:u,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${t} panel`,"data-resizing":f?"":void 0})}function aN(){Dt.trackRender("IdeWorkspace");const t=M(v=>v.sidebarWidth),s=M(v=>v.rightPanelWidth),r=M(v=>v.setSidebarWidth),o=M(v=>v.setRightPanelWidth),l=M(v=>v.rightPanelCollapsed),u=M(v=>v.vscodeViewOpen),f=M(v=>v.usageViewOpen),p=M(v=>v.activeAppTabId),g=M(v=>v.openAppTabs);x.useEffect(()=>{const v=()=>{const k=nl(),{rightPanelWidth:w,setRightPanelWidth:S}=M.getState();w>k&&S(k)};return window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[]);const m=l?`${t}px 6px 1fr ${$0}px`:`${t}px 6px 1fr 6px ${s}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsxs("div",{className:`ide-layout ${u||f?"ide-hidden":""}`,style:{gridTemplateColumns:m},children:[a.jsx(tS,{}),a.jsx(Qm,{side:"left",minWidth:Fu,maxWidth:Uu,getWidth:()=>M.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(nS,{}),a.jsxs("div",{className:"ide-render",children:[g.map(v=>a.jsx(iN,{appId:v,active:p===v},v)),p==null&&a.jsx(Qb,{})]}),a.jsx(cT,{})]}),!l&&a.jsx(Qm,{side:"right",minWidth:tl,maxWidth:nl(),getWidth:()=>M.getState().rightPanelWidth,setWidth:o}),a.jsx(_T,{})]}),u&&a.jsx($T,{}),f&&a.jsx(VT,{}),a.jsx(IT,{})]})}function lN(){const{showNewSessionDialog:t,setShowNewSessionDialog:s,createSession:r,lastModelConfig:o}=M(),l=(o==null?void 0:o.provider)??"codex",u=(o==null?void 0:o.model)??"",f=(o==null?void 0:o.reasoning)??"",[p,g]=x.useState(""),[m,v]=x.useState(u),[k,w]=x.useState(f),[S,C]=x.useState("");if(!t)return null;const E=$d(l),T=m?nd(l,m):[];function A(){r({title:p.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),g(""),C("")}function _(I){I.key==="Escape"&&s(!1)}function B(I){var K;v(I);const W=nd(l,I);W.some(F=>F.effort===k)||w(sd(l,I)??((K=W[0])==null?void 0:K.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"dialog",onClick:I=>I.stopPropagation(),onKeyDown:_,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"New Session"}),a.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("label",{className:"dialog-label",children:["Title (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:p,onChange:I=>g(I.target.value),placeholder:"e.g. refactor auth module",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Model",a.jsxs("select",{className:"dialog-input dialog-select",value:m,onChange:I=>B(I.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),E.map(I=>a.jsxs("option",{value:I.slug,children:[I.displayName," — ",I.description]},I.slug))]})]}),T.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:I=>w(I.target.value),children:[a.jsxs("option",{value:"",children:["Default (",sd(l,m),")"]}),T.map(I=>a.jsx("option",{value:I.effort,children:I.label},I.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:I=>C(I.target.value),placeholder:"e.g. /Users/me/projects/my-app"})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>s(!1),children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:A,children:"Create"})]})]})})}function cN(t,s){const r=s!==""&&(t===s||t.startsWith(`${s}/`)),o=[r?{label:"~",path:s}:{label:"/",path:"/"}],l=t.slice(r?s.length:0);let u=o[0].path;for(const f of l.split("/").filter(Boolean))u=u==="/"?`/${f}`:`${u}/${f}`,o.push({label:f,path:u});return o}function uN(t){const s=t.filter(l=>l.deleted===0).at(-1);if(!s)return;const r=fr(s.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function dN(){return M(s=>s.showAddWorkspaceDialog)?a.jsx(fN,{}):null}function fN(){var K;const t=M(F=>F.setShowAddWorkspaceDialog),s=M(F=>F.workspaces),r=M(F=>F.createWorkspaceAt),o=M(F=>F.addToast),[l,u]=x.useState(null),[f,p]=x.useState(!0),[g,m]=x.useState(null),[v,k]=x.useState(!1),w=x.useRef(0),[S]=x.useState(()=>uN(M.getState().workspaces)),C=x.useRef(null),E=x.useCallback(()=>{v||t(!1)},[v,t]);Eo(E);const T=x.useCallback(async(F,re=!1)=>{const he=++w.current;p(!0);let G=null,Ne=null;try{G=await yh(F)}catch(Se){if(Ne=vi(Se),re&&F)try{G=await yh(),Ne=null}catch(Pe){Ne=vi(Pe)}}he===w.current&&(G&&u(G),m(Ne),p(!1))},[]);x.useEffect(()=>{T(S,!0)},[T,S]);const A=l==null?void 0:l.path;x.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[A]);const _=new Set(s.filter(F=>F.deleted===0).map(F=>fr(F.path)));async function B(F){if(!v){k(!0),m(null);try{const re=await r(F);t(!1),o("success",`Workspace added — ${re.path}`)}catch(re){m(vi(re)),k(!1)}}}const I=l?cN(l.path,l.home):[],W=((K=I.at(-1))==null?void 0:K.label)??"",Y=l!==null&&_.has(fr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:E,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"folder-dialog-title",children:"Add workspace"}),a.jsx("button",{className:"dialog-close",onClick:E,"aria-label":"Close",disabled:v,children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Choose a project folder",l&&a.jsxs(a.Fragment,{children:[" ","on ",a.jsx("strong",{children:l.hostname})]}),"."]}),a.jsxs("div",{className:"folder-nav",children:[a.jsx("button",{className:"folder-up",onClick:()=>(l==null?void 0:l.parent)&&void T(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(Cg,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:I.map((F,re)=>a.jsxs(x.Fragment,{children:[re>0&&a.jsx(bo,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),re===I.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:F.path,children:F.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void T(F.path),title:F.path,children:F.label})]},F.path))}),f&&l&&a.jsx(hn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:C,className:`folder-list${f&&l?" loading":""}`,"aria-label":"Folders",children:l?l.folders.length===0?a.jsx("li",{className:"folder-empty",children:"No folders here."}):l.folders.map(F=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void T(F.path),title:F.path,"aria-label":F.git?`${F.name} (git repository)`:F.name,children:[F.git?a.jsx(Cw,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(cl,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:F.name}),a.jsx(bo,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),_.has(fr(F.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void B(F.path),disabled:v,"aria-label":`Add ${F.name}`,children:"Add"})]},F.path)):f&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Loading folders…"]})}),(l==null?void 0:l.truncated)&&a.jsxs("p",{className:"folder-note",children:["Showing the first ",l.folders.length," folders."]}),g&&a.jsx("p",{className:"folder-error",role:"alert",children:g})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:E,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void B(l.path),disabled:!l||f||v||Y,children:v?"Adding…":Y?"Already added":`Add “${W}”`})]})]})})}const rd=6e4,id=60*rd,Ka=24*id;function pN(t,s=Date.now()){const r=Date.parse(t);if(Number.isNaN(r))return"";const o=Math.max(0,s-r);return o<rd?"just now":o<id?`${Math.floor(o/rd)} min ago`:o<Ka?`${Math.floor(o/id)} h ago`:o<2*Ka?"yesterday":o<7*Ka?`${Math.floor(o/Ka)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function hN(){const t=M(s=>s.importSessionsWorkspace);return t?a.jsx(mN,{workspace:t},t):null}function mN({workspace:t}){const s=M(I=>I.setImportSessionsWorkspace),r=M(I=>I.importClaudeSessions),[o,l]=x.useState(null),[u,f]=x.useState(null),[p,g]=x.useState(new Set),[m,v]=x.useState(!1),[k,w]=x.useState(new Map),S=x.useCallback(()=>{m||s(null)},[m,s]);Eo(S),x.useEffect(()=>{let I=!1;return mg(t).then(W=>{I||l(W)}).catch(W=>{I||f(vi(W))}),()=>{I=!0}},[t]);function C(I){g(W=>{const Y=new Set(W);return Y.has(I)?Y.delete(I):Y.add(I),Y})}const E=o??[],T=E.length>0&&E.every(I=>p.has(I.session_id));async function A(){const I=E.filter(F=>p.has(F.session_id)).map(F=>F.session_id);if(I.length===0)return;v(!0);const{imported:W,failed:Y}=await r(t,I);if(v(!1),Y.length===0){s(null);return}const K=new Set(W.map(F=>F.import_source_id));l(F=>(F??[]).filter(re=>!K.has(re.session_id))),g(new Set(Y.map(F=>F.id))),w(new Map(Y.map(F=>[F.id,F.error])))}const _=t.split("/").pop()||t,B=p.size;return a.jsx("div",{className:"dialog-overlay",onClick:S,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import Claude Code sessions"}),a.jsx("button",{className:"dialog-close",onClick:S,"aria-label":"Close",disabled:m,children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," in ",a.jsx("strong",{title:t,children:_}),", in a terminal or an IDE. An imported session keeps its history and continues the same Claude conversation."]}),u?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",u]}):o===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Looking for sessions…"]}):o.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," in this folder will show up here."]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:T,disabled:m,onChange:()=>g(T?new Set:new Set(E.map(I=>I.session_id)))}),"Select all (",o.length,")"]}),a.jsx("ul",{className:"import-list",children:o.map(I=>{const W=k.get(I.session_id);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${p.has(I.session_id)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:p.has(I.session_id),disabled:m,onChange:()=>C(I.session_id)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:I.title,children:I.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{title:new Date(I.last_modified).toLocaleString(),children:pN(I.last_modified)}),I.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(Ag,{size:10})," ",I.git_branch]})]}),I.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(zg,{size:11})," Active in the last few minutes. If it is still open in a terminal, close it there first: both would write to the same session."]}),W&&a.jsx("span",{className:"import-row-error",role:"alert",children:W})]})]})},I.session_id)})})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:S,disabled:m,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void A(),disabled:B===0||m,children:m?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12,className:"spin"})," Importing…"]}):B>1?`Import ${B} sessions`:"Import"})]})]})})}const gN=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,vN=512*1024;function yN(t){const s=t.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(s)?s:""}function xN(){const{appCatalogOpen:t,closeAppCatalog:s,apps:r,installExampleApp:o,createSkeletonApp:l,importAppFolder:u}=M(),[f,p]=x.useState("examples"),[g,m]=x.useState(null),[v,k]=x.useState(null),[w,S]=x.useState(!1),[C,E]=x.useState(""),[T,A]=x.useState(""),[_,B]=x.useState(""),[I,W]=x.useState(""),[Y,K]=x.useState(null),[F,re]=x.useState(""),he=x.useRef(null);if(x.useEffect(()=>{t&&(m(null),G0().then(m).catch(()=>m([])))},[t]),x.useEffect(()=>{he.current&&(he.current.webkitdirectory=!0)},[f]),!t)return null;const G=new Set(r.map(O=>O.id));async function Ne(O){k(O);try{await o(O)&&s()}finally{k(null)}}async function Se(){if(w)return;const O=C.trim(),Q=T.trim();if(!(!O||!Q)){S(!0);try{await l({id:O,title:Q,description:_.trim()||void 0,icon:I.trim()||void 0})&&(E(""),A(""),B(""),W(""),s())}finally{S(!1)}}}async function Pe(O){const Q=Array.from(O.target.files??[]),U={};let j="";for(const P of Q){const de=(P.webkitRelativePath??"").split("/");!j&&de.length>1&&(j=de[0]);const X=de[de.length-1];if(!(!X||!gN.test(X))&&!(P.size>vN))try{U[X]=await P.text()}catch{}}K(Object.keys(U).length>0?U:null),re(yN(j))}async function te(){if(!(w||!Y||!F.trim())){S(!0);try{await u(F.trim(),Y)&&(K(null),re(""),s())}finally{S(!1)}}}function oe(O){O.key==="Escape"&&s()}const ae=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return a.jsx("div",{className:"dialog-overlay",onClick:s,children:a.jsxs("div",{className:"dialog app-catalog",onClick:O=>O.stopPropagation(),onKeyDown:oe,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Add Mini App"}),a.jsx("button",{className:"dialog-close",onClick:s,children:"✕"})]}),a.jsx("div",{className:"catalog-tabs",children:ae.map(O=>a.jsx("button",{className:`catalog-tab${f===O.key?" active":""}`,onClick:()=>p(O.key),children:O.label},O.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[f==="examples"&&a.jsx("div",{className:"catalog-examples",children:g===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):g.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):g.map(O=>{const Q=G.has(O.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(bi,{iconNode:O.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:O.title}),O.description&&a.jsx("span",{className:"example-desc",children:O.description})]}),a.jsx("button",{className:"example-install",disabled:Q||v===O.id,onClick:()=>Ne(O.id),title:Q?"Already installed":"Install this example",children:Q?"Installed":v===O.id?"Installing…":"Install"})]},O.id)})}),f==="new"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id (folder name)",a.jsx("input",{className:"dialog-input",type:"text",value:C,onChange:O=>E(O.target.value),placeholder:"e.g. todo-list",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Title",a.jsx("input",{className:"dialog-input",type:"text",value:T,onChange:O=>A(O.target.value),placeholder:"e.g. Todo List"})]}),a.jsxs("label",{className:"dialog-label",children:["Description (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:_,onChange:O=>B(O.target.value),placeholder:"What does this app do?"})]}),a.jsxs("label",{className:"dialog-label",children:[a.jsxs("span",{children:["Icon (optional, a"," ",a.jsx("a",{href:"https://lucide.dev/icons",target:"_blank",rel:"noreferrer",children:"Lucide icon"})," ","name)"]}),a.jsx("input",{className:"dialog-input",type:"text",value:I,onChange:O=>W(O.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:w||!C.trim()||!T.trim(),onClick:Se,children:[a.jsx(dr,{size:13})," Create App"]})]}),f==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Select an app folder from disk. Text files only (manifest.json, index.html, app.ts (or legacy app.js), …). A missing manifest.json is generated from the folder name."}),a.jsx("input",{ref:he,type:"file",multiple:!0,onChange:Pe}),Y&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:F,onChange:O=>re(O.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(Y).length," file(s):"," ",Object.keys(Y).slice(0,6).join(", "),Object.keys(Y).length>6?", …":""]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:w||!Y||!F.trim(),onClick:te,children:[a.jsx(Xw,{size:13})," Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:s,children:"Close"})})]})})}function wN(){const t=M(k=>k.showCommandPalette),s=M(k=>k.setShowCommandPalette),r=M(),[o,l]=x.useState(""),[u,f]=x.useState(0),p=x.useRef(null),g=x.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,w=Nl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:dr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:us,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:_o,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!w},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:Or,action:()=>r.cancelTurn(),available:w},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:Mw,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:hr,action:()=>r.switchRightTab("sidecar"),available:!!r.activeSessionId},{id:"toggle-right-panel",label:"Toggle Right Panel",hint:r.rightPanelCollapsed?"Expand the right panel":"Collapse the right panel to its icon rail",icon:Uw,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:gn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=x.useMemo(()=>{const k=o.toLowerCase().trim(),w=g.filter(S=>S.available);return k?w.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):w},[g,o]);x.useEffect(()=>{t&&(l(""),f(0),setTimeout(()=>{var k;return(k=p.current)==null?void 0:k.focus()},50))},[t]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),f(w=>Math.min(w+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),f(w=>Math.max(w-1,0));else if(k.key==="Enter"){k.preventDefault();const w=m[u];w&&(w.action(),s(!1))}else k.key==="Escape"&&s(!1)}return t?a.jsx("div",{className:"palette-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"palette-search",children:[a.jsx("input",{ref:p,type:"text",placeholder:"Type a command…",value:o,onChange:k=>{l(k.target.value),f(0)},onKeyDown:v}),a.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?a.jsx("div",{className:"palette-empty",children:"No matching commands"}):a.jsx("div",{className:"palette-list",children:m.map((k,w)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${w===u?"selected":""}`,onClick:()=>{k.action(),s(!1)},onMouseEnter:()=>f(w),children:[a.jsx("span",{className:"palette-item-icon",children:a.jsx(S,{size:16})}),a.jsx("span",{className:"palette-item-label",children:k.label}),a.jsx("span",{className:"palette-item-hint",children:k.hint}),w===u&&a.jsx(Tw,{size:12,className:"palette-item-enter"})]},k.id)})}),a.jsxs("div",{className:"palette-footer",children:[a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↑"}),a.jsx("span",{className:"kbd",children:"↓"})," Navigate"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↵"})," Select"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"Esc"})," Close"]})]})]})}):null}const Zm=/^[a-z][a-z0-9-]{1,30}$/,kN=2e3;function SN(){const{showRemoteModal:t,setShowRemoteModal:s,selectSession:r}=M(),[o,l]=x.useState(null),[u,f]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(!1),[k,w]=x.useState(!1),[S,C]=x.useState(!1),[E,T]=x.useState("main"),[A,_]=x.useState(""),[B,I]=x.useState(!1),[W,Y]=x.useState(null),K=x.useRef(null);_l(K,()=>C(!1),S);const F=m||k,re=x.useCallback(async()=>{g(!0),f(null);try{const O=await fetch(`${mn()}/remote/status`,{headers:{Accept:"application/json"}});if(!O.ok)throw new Error(`status ${O.status}`);l(await O.json())}catch{l(null),f("Machine management is only available from this machine's local pane.")}finally{g(!1)}},[]);x.useEffect(()=>{t&&(T("main"),Y(null),re())},[t,re]);const he=W!==null&&W.state==="running";if(x.useEffect(()=>{if(!he)return;const O=setInterval(async()=>{try{const Q=await fetch(`${mn()}/remote/enable`,{headers:{Accept:"application/json"}});Q.ok&&Y(await Q.json())}catch{}},kN);return()=>clearInterval(O)},[he]),!t)return null;const G=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function Ne(O){O.key==="Escape"&&s(!1)}async function Se(O){if(Zm.test(O)){I(!0);try{const Q=await fetch(`${mn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:O})});if(!Q.ok)throw new Error(`enable ${Q.status}`);Y(await Q.json()),T("setup")}catch{f("Could not start the setup — check the daemon logs.")}finally{I(!1)}}}function Pe(){W!=null&&W.troubleshootingSessionId&&(r(W.troubleshootingSessionId),s(!1))}async function te(){v(!0);try{await fetch(`${mn()}/remote/disable`,{method:"POST"}),await re()}catch{f("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function oe(){if(C(!1),!!window.confirm(`Remove the tunnel completely?
|
|
634
|
+
}`;function eN(t){return`(${JT})(${JSON.stringify(t)});`}function Ym(t){return t.replace(/<\/script/gi,"<\\/script")}function tN(t,s){const r=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=new RegExp(r,"gi");let l=-1,u;for(;(u=o.exec(t))!==null;)l=u.index;return l}function Xm(t,s,r){const o=tN(t,s);return o===-1?t+r:t.slice(0,o)+r+t.slice(o)}function nN(t,s,r){let o=t;const l=`<script>${Ym(s)}<\/script>`;if(/<\/head>/i.test(o)?o=Xm(o,"</head>",l):/<html[^>]*>/i.test(o)?o=o.replace(/(<html[^>]*>)/i,`$1<head>${l}</head>`):o=`${l}${o}`,r){const u=`<script>${Ym(r)}<\/script>`;o=Xm(o,"</body>",u)}return o}function sN(){const t=globalThis.crypto;return t&&typeof t.randomUUID=="function"?`tab-${t.randomUUID()}`:`tab-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function rN(t){var r;if(!(t instanceof ld)||t.status!==409)return null;const s=(r=t.body)==null?void 0:r.state;return s&&typeof s=="object"?s:null}function iN({appId:t,workspace:s=""}){const r=x.useRef(null),o=x.useRef({pinned:!1,data:null}),[l,u]=x.useState(null),[f,p]=x.useState(null),[g,m]=x.useState([]);x.useEffect(()=>{let S=!0;const C=sN(),E=A=>{const _=o.current.version;typeof A.version=="number"&&typeof _=="number"&&A.version<_||(o.current=A)};g0(t,A=>{var _,B;return(B=(_=r.current)==null?void 0:_.contentWindow)==null?void 0:B.postMessage(A,"*")},s);const T=async A=>{var K,F,re,he,G,Ne,Se,Pe,te,oe,ae,O,Q;if(A.source!==((K=r.current)==null?void 0:K.contentWindow))return;const _=A.data;if(!_||_.source!=="agentpane-app")return;if(_.report==="error"){const U={message:String(_.message??"Unknown error"),stack:String(_.stack??"")};m(j=>{const P=j[j.length-1];return P&&P.message===U.message?j:[...j,U].slice(-20)});return}if(typeof _.method!="string")return;let B=!0,I,W,Y=null;try{switch(_.method){case"getApp":I={id:t};break;case"getState":try{const U=await Oh(t,s);E(U),I=U}catch{I=o.current}break;case"setState":{const U=((F=_.params)==null?void 0:F.data)??null,j=(re=_.params)==null?void 0:re.ifVersion,P={data:U,writer:C};typeof j=="number"&&(P.ifVersion=j);try{const ne=await xg(t,P,s);E(ne),I=ne}catch(ne){if(Y=rN(ne),!Y)throw ne;E(Y);const de=ne.body;throw new Error(typeof(de==null?void 0:de.error)=="string"?de.error:"App state changed since that version")}break}case"createSession":{const U=_.params??{},j=await cd({title:typeof U.title=="string"?U.title:void 0,runtime_type:typeof U.runtime_type=="string"?U.runtime_type:void 0,model:typeof U.model=="string"?U.model:void 0,model_reasoning_effort:typeof U.model_reasoning_effort=="string"?U.model_reasoning_effort:void 0,cwd:typeof U.cwd=="string"?U.cwd:void 0,origin_app_id:t});wu(j.id,t),M.getState().addSession(j),I=j;break}case"submitTurn":{const U=String(((he=_.params)==null?void 0:he.sessionId)??""),j=String(((G=_.params)==null?void 0:G.prompt)??""),P=await ZT(t,(Ne=_.params)==null?void 0:Ne.attachments,de=>tw(t,de)),ne=await lg(U,j,P.length?P:void 0,{originAppId:t});wu(U,t),I=ne;break}case"resolveToolCall":{const U=String(((Se=_.params)==null?void 0:Se.callId)??""),j=(Pe=_.params)==null?void 0:Pe.result;await Q0(U,j),I={ok:!0};break}case"openSession":{if(M.getState().activeAppTabId!==t)throw new Error("openSession: the app is not on screen — call it from a click in the app");const U=typeof((te=_.params)==null?void 0:te.sessionId)=="string"?_.params.sessionId.trim():"";if(!U)throw new Error("openSession: sessionId is required");try{await M.getState().revealSession(U)}catch(j){throw new Error(`openSession: ${j instanceof Error?j.message:String(j)}`)}I={ok:!0};break}case"uploadFile":{const U=await QT((oe=_.params)==null?void 0:oe.file);try{I=Km(await J0(t,U))}catch(j){throw new Error(`uploadFile: ${j instanceof Error?j.message:String(j)}`)}break}case"getFile":{const U=Lv(t,(ae=_.params)==null?void 0:ae.ref),j=U?await ew(t,U):null;I=j?Km(j):null;break}default:throw new Error(`Unknown bridge method: ${_.method}`)}}catch(U){B=!1,W=U instanceof Error?U.message:String(U)}(Q=(O=r.current)==null?void 0:O.contentWindow)==null||Q.postMessage(Y?{source:"agentpane-host",id:_.id,ok:B,error:W,code:"conflict",state:Y}:{source:"agentpane-host",id:_.id,ok:B,result:I,error:W},"*")};return window.addEventListener("message",T),S0(t,A=>{var _,B;typeof A.workspace=="string"&&A.workspace!==s||A.writer!==C&&((B=(_=r.current)==null?void 0:_.contentWindow)==null||B.postMessage({source:"agentpane-host",event:"state_changed",payload:typeof A.version=="number"?{version:A.version}:{}},"*"))}),w0(t,()=>{Ph(t).then(A=>{S&&(u(A),m([]))}).catch(()=>{})}),(async()=>{try{const[A,_,B]=await Promise.all([Ph(t),Oh(t,s),G0(t).catch(()=>[])]);if(!S)return;o.current=_,B.forEach(I=>wu(I.id,t)),u(A)}catch(A){S&&p(A instanceof Error?A.message:String(A))}})(),()=>{S=!1,v0(t),k0(t),b0(t),window.removeEventListener("message",T)}},[t,s]);const v=x.useMemo(()=>l?nN(l.html,eN({appId:t,apiOrigin:Mv()}),l.js):"",[l,t]);if(f)return a.jsxs("div",{className:"empty-state",style:{padding:"24px"},children:["Mini app failed to load: ",f]});if(!v)return a.jsx("div",{className:"empty-state",style:{padding:"24px"},children:"Loading mini app…"});const k=(l==null?void 0:l.diagnostics)??[],w=k.some(S=>S.severity==="error");return a.jsxs("div",{className:"miniapp-runtime",children:[k.length>0&&a.jsxs("div",{className:`miniapp-diagnostics${w?"":" miniapp-diagnostics-warn"}`,"data-testid":"miniapp-diagnostics",children:[a.jsx("div",{className:"miniapp-diagnostics-title",children:w?`Compile errors in ${(l==null?void 0:l.sourceFile)??"the app logic"} — the pane serves the last code that parsed:`:"Warnings — the app runs, but fix these:"}),k.map((S,C)=>a.jsxs("div",{className:"miniapp-diag",children:[S.file,":",S.line,":",S.column," — ",S.message]},C))]}),a.jsx("iframe",{ref:r,className:"miniapp-frame",sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",allow:"loopback-network; local-network; local-network-access",title:`Mini app: ${t}`,srcDoc:v}),g.length>0&&a.jsx("div",{className:"miniapp-rt-errors","data-testid":"miniapp-rt-errors",children:g.map((S,C)=>a.jsxs("div",{className:"miniapp-rt-error",children:[a.jsx("div",{className:"miniapp-rt-error-message",children:S.message}),S.stack&&a.jsx("pre",{className:"miniapp-rt-error-stack",children:S.stack})]},C))})]})}function oN({appId:t,active:s}){const r=M(w=>w.apps),o=M(w=>w.workspaces),l=M(w=>w.appWorkspaces),u=M(w=>w.setAppWorkspace),f=M(w=>w.setActiveAppTab),p=M(w=>w.startAppEdit),g=r.find(w=>w.id===t),m=l[t]??"",v=o.filter(w=>w.deleted!==1),k=m!==""&&!v.some(w=>w.path===m)?m:null;return a.jsxs("div",{className:`miniapp-view ${s?"":"miniapp-view-hidden"}`,children:[a.jsxs("div",{className:"miniapp-header",children:[a.jsx(bi,{iconNode:g==null?void 0:g.iconNode,size:14,className:"miniapp-header-icon"}),a.jsx("span",{className:"miniapp-header-title",children:(g==null?void 0:g.title)??t}),a.jsxs("select",{className:"miniapp-workspace-select",title:"Workspace this app instance is bound to (state and pinning are scoped per workspace)",value:m,onChange:w=>u(t,w.target.value),children:[a.jsx("option",{value:"",children:"All workspaces (global)"}),v.map(w=>a.jsx("option",{value:w.path,children:w.label||w.path.split("/").pop()||w.path},w.path)),k&&a.jsx("option",{value:k,children:`${k} (unknown workspace)`})]}),a.jsxs("button",{className:"miniapp-header-btn",title:"Edit this app with the agent (opens an edit session on the app folder)",onClick:()=>void p(t),children:[a.jsx(Hw,{size:13}),"Edit"]}),a.jsx("button",{className:"miniapp-header-close",title:"Close app",onClick:()=>f(null),children:a.jsx(gn,{size:14})})]}),a.jsx("div",{className:"miniapp-body",children:a.jsx(iN,{appId:t,workspace:m},`${t}:${m}`)})]})}function aN({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l}){const[u,f]=x.useState(!1),p=x.useRef(0),g=x.useRef(0),m=x.useCallback(w=>{const S=w.clientX-p.current,C=t==="left"?g.current+S:g.current-S,E=Math.min(r,Math.max(s,C));l(E)},[t,s,r,l]),v=x.useCallback(()=>{window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",v),document.body.classList.remove("is-resizing"),f(!1)},[m]);return{onPointerDown:x.useCallback(w=>{var S,C;w.preventDefault(),w.stopPropagation();try{(C=(S=w.currentTarget)==null?void 0:S.setPointerCapture)==null||C.call(S,w.pointerId)}catch{}p.current=w.clientX,g.current=o(),f(!0),document.body.classList.add("is-resizing"),window.addEventListener("pointermove",m),window.addEventListener("pointerup",v)},[o,m,v]),dragging:u}}function Qm({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l}){const{onPointerDown:u,dragging:f}=aN({side:t,minWidth:s,maxWidth:r,getWidth:o,setWidth:l});return a.jsx("div",{className:`resize-handle ${t}${f?" dragging":""}`,onPointerDown:u,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${t} panel`,"data-resizing":f?"":void 0})}function lN(){Dt.trackRender("IdeWorkspace");const t=M(v=>v.sidebarWidth),s=M(v=>v.rightPanelWidth),r=M(v=>v.setSidebarWidth),o=M(v=>v.setRightPanelWidth),l=M(v=>v.rightPanelCollapsed),u=M(v=>v.vscodeViewOpen),f=M(v=>v.usageViewOpen),p=M(v=>v.activeAppTabId),g=M(v=>v.openAppTabs);x.useEffect(()=>{const v=()=>{const k=nl(),{rightPanelWidth:w,setRightPanelWidth:S}=M.getState();w>k&&S(k)};return window.addEventListener("resize",v),()=>window.removeEventListener("resize",v)},[]);const m=l?`${t}px 6px 1fr ${z0}px`:`${t}px 6px 1fr 6px ${s}px`;return a.jsxs("div",{className:"ide-root",children:[a.jsxs("div",{className:`ide-layout ${u||f?"ide-hidden":""}`,style:{gridTemplateColumns:m},children:[a.jsx(nS,{}),a.jsx(Qm,{side:"left",minWidth:Fu,maxWidth:Uu,getWidth:()=>M.getState().sidebarWidth,setWidth:r}),a.jsxs("div",{className:"ide-center",children:[a.jsx(sS,{}),a.jsxs("div",{className:"ide-render",children:[g.map(v=>a.jsx(oN,{appId:v,active:p===v},v)),p==null&&a.jsx(Zb,{})]}),a.jsx(uT,{})]}),!l&&a.jsx(Qm,{side:"right",minWidth:tl,maxWidth:nl(),getWidth:()=>M.getState().rightPanelWidth,setWidth:o}),a.jsx(RT,{})]}),u&&a.jsx(zT,{}),f&&a.jsx(GT,{}),a.jsx(DT,{})]})}function cN(){const{showNewSessionDialog:t,setShowNewSessionDialog:s,createSession:r,lastModelConfig:o}=M(),l=(o==null?void 0:o.provider)??"codex",u=(o==null?void 0:o.model)??"",f=(o==null?void 0:o.reasoning)??"",[p,g]=x.useState(""),[m,v]=x.useState(u),[k,w]=x.useState(f),[S,C]=x.useState("");if(!t)return null;const E=$d(l),T=m?nd(l,m):[];function A(){r({title:p.trim()||void 0,model:m||void 0,model_reasoning_effort:k||void 0,cwd:S.trim()||void 0,runtime_type:l}),g(""),C("")}function _(I){I.key==="Escape"&&s(!1)}function B(I){var K;v(I);const W=nd(l,I);W.some(F=>F.effort===k)||w(sd(l,I)??((K=W[0])==null?void 0:K.effort)??"")}return a.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"dialog",onClick:I=>I.stopPropagation(),onKeyDown:_,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"New Session"}),a.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("label",{className:"dialog-label",children:["Title (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:p,onChange:I=>g(I.target.value),placeholder:"e.g. refactor auth module",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Model",a.jsxs("select",{className:"dialog-input dialog-select",value:m,onChange:I=>B(I.target.value),children:[a.jsx("option",{value:"",children:"Default (Codex picks)"}),E.map(I=>a.jsxs("option",{value:I.slug,children:[I.displayName," — ",I.description]},I.slug))]})]}),T.length>0&&a.jsxs("label",{className:"dialog-label",children:["Thinking Level",a.jsxs("select",{className:"dialog-input dialog-select",value:k,onChange:I=>w(I.target.value),children:[a.jsxs("option",{value:"",children:["Default (",sd(l,m),")"]}),T.map(I=>a.jsx("option",{value:I.effort,children:I.label},I.effort))]})]}),a.jsxs("label",{className:"dialog-label",children:["Working Directory (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:S,onChange:I=>C(I.target.value),placeholder:"e.g. /Users/me/projects/my-app"})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>s(!1),children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:A,children:"Create"})]})]})})}function uN(t,s){const r=s!==""&&(t===s||t.startsWith(`${s}/`)),o=[r?{label:"~",path:s}:{label:"/",path:"/"}],l=t.slice(r?s.length:0);let u=o[0].path;for(const f of l.split("/").filter(Boolean))u=u==="/"?`/${f}`:`${u}/${f}`,o.push({label:f,path:u});return o}function dN(t){const s=t.filter(l=>l.deleted===0).at(-1);if(!s)return;const r=fr(s.path),o=r.lastIndexOf("/");return o>0?r.slice(0,o):void 0}function fN(){return M(s=>s.showAddWorkspaceDialog)?a.jsx(pN,{}):null}function pN(){var K;const t=M(F=>F.setShowAddWorkspaceDialog),s=M(F=>F.workspaces),r=M(F=>F.createWorkspaceAt),o=M(F=>F.addToast),[l,u]=x.useState(null),[f,p]=x.useState(!0),[g,m]=x.useState(null),[v,k]=x.useState(!1),w=x.useRef(0),[S]=x.useState(()=>dN(M.getState().workspaces)),C=x.useRef(null),E=x.useCallback(()=>{v||t(!1)},[v,t]);Eo(E);const T=x.useCallback(async(F,re=!1)=>{const he=++w.current;p(!0);let G=null,Ne=null;try{G=await yh(F)}catch(Se){if(Ne=vi(Se),re&&F)try{G=await yh(),Ne=null}catch(Pe){Ne=vi(Pe)}}he===w.current&&(G&&u(G),m(Ne),p(!1))},[]);x.useEffect(()=>{T(S,!0)},[T,S]);const A=l==null?void 0:l.path;x.useEffect(()=>{C.current&&(C.current.scrollTop=0)},[A]);const _=new Set(s.filter(F=>F.deleted===0).map(F=>fr(F.path)));async function B(F){if(!v){k(!0),m(null);try{const re=await r(F);t(!1),o("success",`Workspace added — ${re.path}`)}catch(re){m(vi(re)),k(!1)}}}const I=l?uN(l.path,l.home):[],W=((K=I.at(-1))==null?void 0:K.label)??"",Y=l!==null&&_.has(fr(l.path));return a.jsx("div",{className:"dialog-overlay",onClick:E,children:a.jsxs("div",{className:"dialog folder-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"folder-dialog-title",onClick:F=>F.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"folder-dialog-title",children:"Add workspace"}),a.jsx("button",{className:"dialog-close",onClick:E,"aria-label":"Close",disabled:v,children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Choose a project folder",l&&a.jsxs(a.Fragment,{children:[" ","on ",a.jsx("strong",{children:l.hostname})]}),"."]}),a.jsxs("div",{className:"folder-nav",children:[a.jsx("button",{className:"folder-up",onClick:()=>(l==null?void 0:l.parent)&&void T(l.parent),disabled:!(l!=null&&l.parent),"aria-label":"Parent folder",title:"Parent folder",children:a.jsx(Cg,{size:14})}),a.jsx("nav",{className:"folder-crumbs","aria-label":"Folder path",children:I.map((F,re)=>a.jsxs(x.Fragment,{children:[re>0&&a.jsx(bo,{size:12,className:"folder-crumb-sep","aria-hidden":"true"}),re===I.length-1?a.jsx("span",{className:"folder-crumb current","aria-current":"location",title:F.path,children:F.label}):a.jsx("button",{className:"folder-crumb",onClick:()=>void T(F.path),title:F.path,children:F.label})]},F.path))}),f&&l&&a.jsx(hn,{size:14,className:"spin folder-spinner","aria-label":"Loading"})]}),a.jsx("ul",{ref:C,className:`folder-list${f&&l?" loading":""}`,"aria-label":"Folders",children:l?l.folders.length===0?a.jsx("li",{className:"folder-empty",children:"No folders here."}):l.folders.map(F=>a.jsxs("li",{className:"folder-item",children:[a.jsxs("button",{className:"folder-row",onClick:()=>void T(F.path),title:F.path,"aria-label":F.git?`${F.name} (git repository)`:F.name,children:[F.git?a.jsx(Ew,{size:15,className:"folder-icon git","aria-hidden":"true"}):a.jsx(cl,{size:15,className:"folder-icon","aria-hidden":"true"}),a.jsx("span",{className:"folder-name",children:F.name}),a.jsx(bo,{size:13,className:"folder-chevron","aria-hidden":"true"})]}),_.has(fr(F.path))?a.jsx("span",{className:"folder-tag",children:"Added"}):a.jsx("button",{className:"folder-add",onClick:()=>void B(F.path),disabled:v,"aria-label":`Add ${F.name}`,children:"Add"})]},F.path)):f&&a.jsxs("li",{className:"folder-empty",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Loading folders…"]})}),(l==null?void 0:l.truncated)&&a.jsxs("p",{className:"folder-note",children:["Showing the first ",l.folders.length," folders."]}),g&&a.jsx("p",{className:"folder-error",role:"alert",children:g})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:E,disabled:v,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>l&&void B(l.path),disabled:!l||f||v||Y,children:v?"Adding…":Y?"Already added":`Add “${W}”`})]})]})})}const rd=6e4,id=60*rd,Ka=24*id;function hN(t,s=Date.now()){const r=Date.parse(t);if(Number.isNaN(r))return"";const o=Math.max(0,s-r);return o<rd?"just now":o<id?`${Math.floor(o/rd)} min ago`:o<Ka?`${Math.floor(o/id)} h ago`:o<2*Ka?"yesterday":o<7*Ka?`${Math.floor(o/Ka)} days ago`:new Date(r).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function mN(){const t=M(s=>s.importSessionsWorkspace);return t?a.jsx(gN,{workspace:t},t):null}function gN({workspace:t}){const s=M(I=>I.setImportSessionsWorkspace),r=M(I=>I.importClaudeSessions),[o,l]=x.useState(null),[u,f]=x.useState(null),[p,g]=x.useState(new Set),[m,v]=x.useState(!1),[k,w]=x.useState(new Map),S=x.useCallback(()=>{m||s(null)},[m,s]);Eo(S),x.useEffect(()=>{let I=!1;return mg(t).then(W=>{I||l(W)}).catch(W=>{I||f(vi(W))}),()=>{I=!0}},[t]);function C(I){g(W=>{const Y=new Set(W);return Y.has(I)?Y.delete(I):Y.add(I),Y})}const E=o??[],T=E.length>0&&E.every(I=>p.has(I.session_id));async function A(){const I=E.filter(F=>p.has(F.session_id)).map(F=>F.session_id);if(I.length===0)return;v(!0);const{imported:W,failed:Y}=await r(t,I);if(v(!1),Y.length===0){s(null);return}const K=new Set(W.map(F=>F.import_source_id));l(F=>(F??[]).filter(re=>!K.has(re.session_id))),g(new Set(Y.map(F=>F.id))),w(new Map(Y.map(F=>[F.id,F.error])))}const _=t.split("/").pop()||t,B=p.size;return a.jsx("div",{className:"dialog-overlay",onClick:S,children:a.jsxs("div",{className:"dialog import-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"import-dialog-title",onClick:I=>I.stopPropagation(),children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",id:"import-dialog-title",children:"Import Claude Code sessions"}),a.jsx("button",{className:"dialog-close",onClick:S,"aria-label":"Close",disabled:m,children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[a.jsxs("p",{className:"dialog-hint",children:["Sessions you started with ",a.jsx("code",{children:"claude"})," in ",a.jsx("strong",{title:t,children:_}),", in a terminal or an IDE. An imported session keeps its history and continues the same Claude conversation."]}),u?a.jsxs("p",{className:"import-error",role:"alert",children:["Could not list the sessions — ",u]}):o===null?a.jsxs("div",{className:"import-loading",role:"status",children:[a.jsx(hn,{size:14,className:"spin"})," Looking for sessions…"]}):o.length===0?a.jsxs("div",{className:"import-empty",children:["No Claude Code sessions to import here. Sessions you start with ",a.jsx("code",{children:"claude"})," in this folder will show up here."]}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"import-select-all",children:[a.jsx("input",{type:"checkbox",checked:T,disabled:m,onChange:()=>g(T?new Set:new Set(E.map(I=>I.session_id)))}),"Select all (",o.length,")"]}),a.jsx("ul",{className:"import-list",children:o.map(I=>{const W=k.get(I.session_id);return a.jsx("li",{children:a.jsxs("label",{className:`import-row${p.has(I.session_id)?" selected":""}`,children:[a.jsx("input",{type:"checkbox",checked:p.has(I.session_id),disabled:m,onChange:()=>C(I.session_id)}),a.jsxs("span",{className:"import-row-main",children:[a.jsx("span",{className:"import-row-title",title:I.title,children:I.title}),a.jsxs("span",{className:"import-row-meta",children:[a.jsx("span",{title:new Date(I.last_modified).toLocaleString(),children:hN(I.last_modified)}),I.git_branch&&a.jsxs("span",{className:"import-row-branch",title:"Git branch",children:[a.jsx(Ag,{size:10})," ",I.git_branch]})]}),I.recently_active&&a.jsxs("span",{className:"import-row-warn",children:[a.jsx(zg,{size:11})," Active in the last few minutes. If it is still open in a terminal, close it there first: both would write to the same session."]}),W&&a.jsx("span",{className:"import-row-error",role:"alert",children:W})]})]})},I.session_id)})})]})]}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:S,disabled:m,children:"Cancel"}),a.jsx("button",{className:"dialog-btn-create",onClick:()=>void A(),disabled:B===0||m,children:m?a.jsxs(a.Fragment,{children:[a.jsx(hn,{size:12,className:"spin"})," Importing…"]}):B>1?`Import ${B} sessions`:"Import"})]})]})})}const vN=/^[A-Za-z0-9][A-Za-z0-9._-]*$/,yN=512*1024;function xN(t){const s=t.toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"");return/^[a-z0-9]/.test(s)?s:""}function wN(){const{appCatalogOpen:t,closeAppCatalog:s,apps:r,installExampleApp:o,createSkeletonApp:l,importAppFolder:u}=M(),[f,p]=x.useState("examples"),[g,m]=x.useState(null),[v,k]=x.useState(null),[w,S]=x.useState(!1),[C,E]=x.useState(""),[T,A]=x.useState(""),[_,B]=x.useState(""),[I,W]=x.useState(""),[Y,K]=x.useState(null),[F,re]=x.useState(""),he=x.useRef(null);if(x.useEffect(()=>{t&&(m(null),q0().then(m).catch(()=>m([])))},[t]),x.useEffect(()=>{he.current&&(he.current.webkitdirectory=!0)},[f]),!t)return null;const G=new Set(r.map(O=>O.id));async function Ne(O){k(O);try{await o(O)&&s()}finally{k(null)}}async function Se(){if(w)return;const O=C.trim(),Q=T.trim();if(!(!O||!Q)){S(!0);try{await l({id:O,title:Q,description:_.trim()||void 0,icon:I.trim()||void 0})&&(E(""),A(""),B(""),W(""),s())}finally{S(!1)}}}async function Pe(O){const Q=Array.from(O.target.files??[]),U={};let j="";for(const P of Q){const de=(P.webkitRelativePath??"").split("/");!j&&de.length>1&&(j=de[0]);const X=de[de.length-1];if(!(!X||!vN.test(X))&&!(P.size>yN))try{U[X]=await P.text()}catch{}}K(Object.keys(U).length>0?U:null),re(xN(j))}async function te(){if(!(w||!Y||!F.trim())){S(!0);try{await u(F.trim(),Y)&&(K(null),re(""),s())}finally{S(!1)}}}function oe(O){O.key==="Escape"&&s()}const ae=[{key:"examples",label:"Examples"},{key:"new",label:"New App"},{key:"upload",label:"Upload"}];return a.jsx("div",{className:"dialog-overlay",onClick:s,children:a.jsxs("div",{className:"dialog app-catalog",onClick:O=>O.stopPropagation(),onKeyDown:oe,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Add Mini App"}),a.jsx("button",{className:"dialog-close",onClick:s,children:"✕"})]}),a.jsx("div",{className:"catalog-tabs",children:ae.map(O=>a.jsx("button",{className:`catalog-tab${f===O.key?" active":""}`,onClick:()=>p(O.key),children:O.label},O.key))}),a.jsxs("div",{className:"dialog-body catalog-body",children:[f==="examples"&&a.jsx("div",{className:"catalog-examples",children:g===null?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"Loading examples…"}):g.length===0?a.jsx("div",{className:"empty-state",style:{padding:"12px"},children:"No example apps available."}):g.map(O=>{const Q=G.has(O.id);return a.jsxs("div",{className:"example-row",children:[a.jsx(bi,{iconNode:O.iconNode,size:14,className:"sidebar-app-icon"}),a.jsxs("div",{className:"example-info",children:[a.jsx("span",{className:"example-title",children:O.title}),O.description&&a.jsx("span",{className:"example-desc",children:O.description})]}),a.jsx("button",{className:"example-install",disabled:Q||v===O.id,onClick:()=>Ne(O.id),title:Q?"Already installed":"Install this example",children:Q?"Installed":v===O.id?"Installing…":"Install"})]},O.id)})}),f==="new"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id (folder name)",a.jsx("input",{className:"dialog-input",type:"text",value:C,onChange:O=>E(O.target.value),placeholder:"e.g. todo-list",autoFocus:!0})]}),a.jsxs("label",{className:"dialog-label",children:["Title",a.jsx("input",{className:"dialog-input",type:"text",value:T,onChange:O=>A(O.target.value),placeholder:"e.g. Todo List"})]}),a.jsxs("label",{className:"dialog-label",children:["Description (optional)",a.jsx("input",{className:"dialog-input",type:"text",value:_,onChange:O=>B(O.target.value),placeholder:"What does this app do?"})]}),a.jsxs("label",{className:"dialog-label",children:[a.jsxs("span",{children:["Icon (optional, a"," ",a.jsx("a",{href:"https://lucide.dev/icons",target:"_blank",rel:"noreferrer",children:"Lucide icon"})," ","name)"]}),a.jsx("input",{className:"dialog-input",type:"text",value:I,onChange:O=>W(O.target.value),placeholder:"e.g. notebook-pen",spellCheck:!1,autoCapitalize:"off"})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:w||!C.trim()||!T.trim(),onClick:Se,children:[a.jsx(dr,{size:13})," Create App"]})]}),f==="upload"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"catalog-upload-hint",children:"Select an app folder from disk. Text files only (manifest.json, index.html, app.ts (or legacy app.js), …). A missing manifest.json is generated from the folder name."}),a.jsx("input",{ref:he,type:"file",multiple:!0,onChange:Pe}),Y&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["App id",a.jsx("input",{className:"dialog-input",type:"text",value:F,onChange:O=>re(O.target.value)})]}),a.jsxs("div",{className:"catalog-upload-summary",children:[Object.keys(Y).length," file(s):"," ",Object.keys(Y).slice(0,6).join(", "),Object.keys(Y).length>6?", …":""]})]}),a.jsxs("button",{className:"dialog-btn-create catalog-action-btn",disabled:w||!Y||!F.trim(),onClick:te,children:[a.jsx(Qw,{size:13})," Import App"]})]})]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:s,children:"Close"})})]})})}function kN(){const t=M(k=>k.showCommandPalette),s=M(k=>k.setShowCommandPalette),r=M(),[o,l]=x.useState(""),[u,f]=x.useState(0),p=x.useRef(null),g=x.useMemo(()=>{const k=r.activeSessionId?r.sessionDetails[r.activeSessionId]:null,w=Nl(k);return[{id:"new-session",label:"New Session",hint:"Create a new Codex session",icon:dr,action:()=>r.setShowNewSessionDialog(!0),available:!0},{id:"delete-session",label:"Delete Session",hint:"Delete the active session",icon:us,action:()=>{r.activeSessionId&&r.deleteSession(r.activeSessionId)},available:!!r.activeSessionId},{id:"send-message",label:"Send Message",hint:"Focus the message input",icon:_o,action:()=>{const S=document.querySelector(".cmd-input");S==null||S.focus()},available:!!r.activeSessionId&&!w},{id:"cancel-turn",label:"Cancel Turn",hint:"Cancel the running turn",icon:Or,action:()=>r.cancelTurn(),available:w},{id:"tab-turns",label:"Switch to Turns Tab",hint:"View conversation timeline",icon:Lw,action:()=>r.switchRightTab("turns"),available:!!r.activeSessionId},{id:"tab-sidecar",label:"Ask Sidecar",hint:"Ask about this session — status, blockers, what is left",icon:hr,action:()=>r.switchRightTab("sidecar"),available:!!r.activeSessionId},{id:"toggle-right-panel",label:"Toggle Right Panel",hint:r.rightPanelCollapsed?"Expand the right panel":"Collapse the right panel to its icon rail",icon:Bw,action:()=>r.toggleRightPanel(),available:!0},{id:"close-tab",label:"Close Tab",hint:"Close the active session tab",icon:gn,action:()=>{r.activeSessionId&&r.closeTab(r.activeSessionId)},available:!!r.activeSessionId}]},[r]),m=x.useMemo(()=>{const k=o.toLowerCase().trim(),w=g.filter(S=>S.available);return k?w.filter(S=>S.label.toLowerCase().includes(k)||S.hint.toLowerCase().includes(k)):w},[g,o]);x.useEffect(()=>{t&&(l(""),f(0),setTimeout(()=>{var k;return(k=p.current)==null?void 0:k.focus()},50))},[t]);function v(k){if(k.key==="ArrowDown")k.preventDefault(),f(w=>Math.min(w+1,m.length-1));else if(k.key==="ArrowUp")k.preventDefault(),f(w=>Math.max(w-1,0));else if(k.key==="Enter"){k.preventDefault();const w=m[u];w&&(w.action(),s(!1))}else k.key==="Escape"&&s(!1)}return t?a.jsx("div",{className:"palette-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"palette",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"palette-search",children:[a.jsx("input",{ref:p,type:"text",placeholder:"Type a command…",value:o,onChange:k=>{l(k.target.value),f(0)},onKeyDown:v}),a.jsx("span",{className:"palette-esc",children:"ESC"})]}),m.length===0?a.jsx("div",{className:"palette-empty",children:"No matching commands"}):a.jsx("div",{className:"palette-list",children:m.map((k,w)=>{const S=k.icon;return a.jsxs("div",{className:`palette-item ${w===u?"selected":""}`,onClick:()=>{k.action(),s(!1)},onMouseEnter:()=>f(w),children:[a.jsx("span",{className:"palette-item-icon",children:a.jsx(S,{size:16})}),a.jsx("span",{className:"palette-item-label",children:k.label}),a.jsx("span",{className:"palette-item-hint",children:k.hint}),w===u&&a.jsx(Nw,{size:12,className:"palette-item-enter"})]},k.id)})}),a.jsxs("div",{className:"palette-footer",children:[a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↑"}),a.jsx("span",{className:"kbd",children:"↓"})," Navigate"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"↵"})," Select"]}),a.jsxs("span",{className:"palette-footer-hint",children:[a.jsx("span",{className:"kbd",children:"Esc"})," Close"]})]})]})}):null}const Zm=/^[a-z][a-z0-9-]{1,30}$/,SN=2e3;function bN(){const{showRemoteModal:t,setShowRemoteModal:s,selectSession:r}=M(),[o,l]=x.useState(null),[u,f]=x.useState(null),[p,g]=x.useState(!1),[m,v]=x.useState(!1),[k,w]=x.useState(!1),[S,C]=x.useState(!1),[E,T]=x.useState("main"),[A,_]=x.useState(""),[B,I]=x.useState(!1),[W,Y]=x.useState(null),K=x.useRef(null);_l(K,()=>C(!1),S);const F=m||k,re=x.useCallback(async()=>{g(!0),f(null);try{const O=await fetch(`${mn()}/remote/status`,{headers:{Accept:"application/json"}});if(!O.ok)throw new Error(`status ${O.status}`);l(await O.json())}catch{l(null),f("Machine management is only available from this machine's local pane.")}finally{g(!1)}},[]);x.useEffect(()=>{t&&(T("main"),Y(null),re())},[t,re]);const he=W!==null&&W.state==="running";if(x.useEffect(()=>{if(!he)return;const O=setInterval(async()=>{try{const Q=await fetch(`${mn()}/remote/enable`,{headers:{Accept:"application/json"}});Q.ok&&Y(await Q.json())}catch{}},SN);return()=>clearInterval(O)},[he]),!t)return null;const G=!!(o!=null&&o.tunnel.provisioned)&&!!(o!=null&&o.service.running)&&!!(o!=null&&o.connection.ok);function Ne(O){O.key==="Escape"&&s(!1)}async function Se(O){if(Zm.test(O)){I(!0);try{const Q=await fetch(`${mn()}/remote/enable`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mahlas:O})});if(!Q.ok)throw new Error(`enable ${Q.status}`);Y(await Q.json()),T("setup")}catch{f("Could not start the setup — check the daemon logs.")}finally{I(!1)}}}function Pe(){W!=null&&W.troubleshootingSessionId&&(r(W.troubleshootingSessionId),s(!1))}async function te(){v(!0);try{await fetch(`${mn()}/remote/disable`,{method:"POST"}),await re()}catch{f("Could not stop the tunnel service — check the service logs.")}finally{v(!1)}}async function oe(){if(C(!1),!!window.confirm(`Remove the tunnel completely?
|
|
635
635
|
|
|
636
636
|
This deletes the Cloudflare tunnel, its DNS record and Access app, and this machine's remote state. The mahlas is released.
|
|
637
637
|
|
|
638
|
-
This cannot be undone.`)){w(!0);try{const Q=await fetch(`${mn()}/remote/uninstall`,{method:"DELETE"});if(!Q.ok)throw new Error(`uninstall ${Q.status}`);await re()}catch{f("Could not remove the tunnel — check the daemon logs.")}finally{w(!1)}}}function ae(){if(!W)return a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:A,onChange:j=>_(j.target.value.toLowerCase()),placeholder:"my-macbook",autoFocus:!0})]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The machine will be reachable at https://<name>.repoburg.com"}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>T("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!Zm.test(A)||B,onClick:()=>void Se(A),children:[B?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const O=["detect","provision","install","verify","ready"],Q=O.indexOf(W.step),U=W.state==="ready";return a.jsxs(a.Fragment,{children:[W.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),W.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(Ts,{size:14})," Setup complete — you can close this window."]}),W.state==="ready"&&W.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${W.hostname}`,target:"_blank",rel:"noreferrer",children:W.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:O.map((j,P)=>{const ne=U||Q>-1&&P<Q,de=!U&&P===Q&&W.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:ne||de?1:.4,color:ne?"var(--green)":void 0},children:[ne?a.jsx(Ts,{size:13}):de?a.jsx(hn,{size:13,className:"spin"}):a.jsx(
|
|
639
|
-
`)}),W.state==="troubleshooting"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:"Setup failed — a troubleshooting session is open and the agent is working on the fix in the background."}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-create",onClick:Pe,children:"Open troubleshooting session"})})]}),W.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",W.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void re(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"dialog",onClick:O=>O.stopPropagation(),onKeyDown:Ne,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Remote Access"}),a.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[p&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Loading machine status…"]}),u&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:u}),E==="setup"?ae():a.jsxs(a.Fragment,{children:[G&&(o==null?void 0:o.tunnel.hostname)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})]}),a.jsxs("div",{style:{position:"relative",display:"flex",marginTop:8},children:[a.jsxs("button",{className:"dialog-btn-cancel",style:{flex:1,borderTopRightRadius:0,borderBottomRightRadius:0},onClick:()=>void te(),disabled:F,children:[m?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Stop tunnel connection"]}),a.jsx("button",{className:"dialog-btn-cancel",style:{width:30,borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(O=>!O),disabled:F,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(hn,{size:14,className:"spin"}):a.jsx(wi,{size:14})}),S&&a.jsx("div",{ref:K,className:"ctx-menu",role:"menu",style:{position:"absolute",right:0,top:"calc(100% + 4px)",zIndex:10},children:a.jsxs("div",{className:"ctx-menu-item ctx-danger",role:"menuitem",onClick:()=>void oe(),children:[a.jsx(us,{size:12})," Remove tunnel"]})})]})]}),!G&&a.jsx(a.Fragment,{children:o!=null&&o.tunnel.provisioned&&o.tunnel.mahlas&&o.tunnel.hostname?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})," ","but the connection is stopped."]}),a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void Se(o.tunnel.mahlas),disabled:B,children:[B?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(Bh,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Resume tunnel connection"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>T("setup"),children:[a.jsx(Bh,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Make this machine remote"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The daemon sets everything up and shows the progress here."})]})})]})]})]})})}const bN={success:ww,error:Rl,info:_w,warn:zg},TN=4e3;function NN({toast:t}){const s=M(f=>f.removeToast),r=bN[t.type],o=x.useRef(null);x.useEffect(()=>{function f(){o.current=setTimeout(()=>s(t.id),TN)}return f(),()=>{o.current&&clearTimeout(o.current)}},[t.id,s]);function l(){o.current&&(clearTimeout(o.current),o.current=null)}function u(){o.current=setTimeout(()=>s(t.id),2e3)}return a.jsxs("div",{className:`toast toast-${t.type}`,onMouseEnter:l,onMouseLeave:u,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:t.message}),t.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var f;(f=t.undoAction)==null||f.call(t),s(t.id)},children:[a.jsx(Yw,{size:12})," ",t.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>s(t.id),children:a.jsx(gn,{size:14})})]})}function jN(){const t=M(s=>s.toasts);return t.length===0?null:a.jsx("div",{className:"toast-container",children:t.map(s=>a.jsx(NN,{toast:s},s.id))})}function CN(){const[t]=x.useState(I0),[s,r]=x.useState(!1),[o,l]=x.useState(!1),u=x.useRef(void 0);x.useEffect(()=>()=>clearTimeout(u.current),[]);async function f(){await vl(_h)&&(r(!0),l(!0),clearTimeout(u.current),u.current=setTimeout(()=>r(!1),1500))}return a.jsxs("main",{className:"daemon-download",children:[a.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),t&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[t&&a.jsx("p",{className:"daemon-download-label",children:"Not installed? Run this in Terminal:"}),a.jsxs("div",{className:"daemon-download-cmd",onCopy:()=>l(!0),children:[a.jsx("span",{className:"daemon-download-prompt","aria-hidden":"true",children:"$"}),a.jsx("code",{children:_h}),a.jsx("button",{type:"button",className:`daemon-download-copy${s?" copied":""}`,onClick:()=>void f(),"aria-label":"Copy the install command",title:s?"Copied":"Copy",children:s?a.jsx(Ts,{size:15}):a.jsx(ll,{size:15})})]}),!t&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),o&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(t||o)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(hn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Si=null,wo=1e3;const EN=1e4;function _N(){const t=mn();return t?`${t.replace(/^http/,"ws")}/ws`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function od(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(_N()),Jn.onopen=()=>{const t=wo>1e3;if(wo=1e3,M.getState().setWsConnected(!0),M.getState().addLogEntry("INFO","WebSocket connected"),t){b0();const s=M.getState();s.activeSessionId&&(s.refreshActiveSession(),s.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{M.getState().setWsConnected(!1),M.getState().addLogEntry("WARN","WebSocket disconnected"),M.getState().addToast("warn","WebSocket disconnected — reconnecting…"),AN()},Jn.onerror=()=>{},Jn.onmessage=t=>{try{const s=JSON.parse(t.data);Dt.trackWsEvent(typeof s.event=="string"?s.event:"unknown",typeof t.data=="string"?t.data.length:0);const r=IN[s.event];r&&r(s.data)}catch{}})}function RN(){Si&&(clearTimeout(Si),Si=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),M.getState().setWsConnected(!1)}function AN(){Si||(Si=window.setTimeout(()=>{Si=null,od()},wo),wo=Math.min(wo*2,EN))}const IN={"turn:created":t=>{const s=t;M.getState().onTurnCreated(s.sessionId,s.turn)},"turn:started":t=>{const s=t;Dt.note(`turn:started — ${s.turnId.slice(0,8)}`),M.getState().onTurnStarted(s.sessionId,s.turnId)},"item:started":t=>{const s=t;M.getState().onItemStarted(s.sessionId,s.turnId,s.item)},"item:updated":t=>{const s=t;M.getState().onItemUpdated(s.sessionId,s.turnId,s.item)},"item:completed":t=>{const s=t;M.getState().onItemCompleted(s.sessionId,s.turnId,s.item)},"item:delta":t=>{const s=t;M.getState().onItemDelta(s.sessionId,s.turnId,s.itemId,s.delta)},"turn:completed":t=>{const s=t;Dt.note(`turn:completed — ${s.turnId.slice(0,8)}`),M.getState().onTurnCompleted(s.sessionId,s.turnId,s.usage,s.hasUnreviewed,s.response??void 0)},"turn:tokenUsage":t=>{const s=t;M.getState().onTokenUsageUpdated(s.sessionId,s.turnId,s.usage)},"turn:contextUsage":t=>{const s=t,r={totalTokens:s.totalTokens,contextWindow:s.contextWindow,percentage:s.percentage,...s.autoCompactThreshold?{autoCompactThreshold:s.autoCompactThreshold}:{}};M.getState().onContextUsageUpdated(s.sessionId,r)},"turn:failed":t=>{const s=t;M.getState().onTurnFailed(s.sessionId,s.turnId,s.error,s.resumeState)},"turn:interrupted":t=>{const s=t;Dt.note(`turn:interrupted — ${s.turnId.slice(0,8)} (${s.reason})`),M.getState().onTurnInterrupted(s.sessionId,s.turnId,{reason:s.reason,interruptedAt:s.interruptedAt,attempts:s.attempts,detail:s.detail??null})},"turn:resuming":t=>{const s=t;M.getState().onTurnResuming(s.sessionId,s.turnId,s.attempt)},"turn:resumed":t=>{const s=t;M.getState().onTurnResumed(s.sessionId,s.turnId)},"turn:retrying":t=>{const s=t;M.getState().onTurnRetrying(s.sessionId,s.turnId,{attempt:s.attempt,maxRetries:s.maxRetries,retryDelayMs:s.retryDelayMs,errorStatus:s.errorStatus??null,error:s.error??null})},"turn:cancelled":t=>{const s=t;M.getState().onTurnCancelled(s.sessionId,s.turnId)},"session:title":t=>{const s=t;M.getState().onSessionTitle(s.sessionId,s.title)},"session:touched":t=>{const s=t;M.getState().onSessionTouched(s.sessionId)},"session:updated":t=>{const s=t;M.getState().onSessionUpdated(s.session)},background_tasks:t=>{const s=t;Dt.note(`background_tasks — ${s.tasks.length} live (${s.tasks.map(r=>r.task_type).join(", ")||"none"})`),M.getState().onBackgroundTasksChanged(s.sessionId,s.tasks)},"background_tasks:snapshot":t=>{const s=t;M.getState().onBackgroundTasksSnapshot(s.sessions??{})},"thread:created":t=>{const s=t;M.getState().onThreadCreated(s.sessionId,s.thread,s.turn)},"thread:followup":t=>{const s=t;M.getState().onThreadFollowup(s.sessionId,s.threadId,s.turn)},"thread:resolved":t=>{const s=t;M.getState().onThreadResolved(s.sessionId,s.threadId,s.status)},"thread:deleted":t=>{const s=t;M.getState().onThreadDeleted(s.sessionId,s.threadId)},"app:tool_call":t=>{const s=t;v0(s.appId,s.callId,s.tool,s.args??{},s.workspace)},"app:source:updated":t=>{T0(t.appId),M.getState().refreshApps()},"app:state_changed":t=>{const{appId:s,...r}=t;gg(s,r)}};function DN(){const t=M(s=>s.init);return x.useEffect(()=>{Px();function s(){t(),od()}const{daemonStatus:r,setDaemonStatus:o}=M.getState();let l=null;r==="ready"?s():l=M0({onMissing:()=>o("missing"),onReady:()=>{o("ready"),s()}});function u(){if(document.visibilityState!=="visible")return;const f=M.getState(),p=f.activeSessionId;if(!p)return;const g=f.sessionDetails[p];f.wsConnected||od(),g&&g.is_running===1&&(f.refreshActiveSession(),f.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",u),()=>{l==null||l(),RN(),document.removeEventListener("visibilitychange",u)}},[t]),null}function MN(){const t=M(u=>u.loading),s=M(u=>u.error),r=M(u=>u.sessions),o=M(u=>u.daemonStatus),l=M(u=>u.setShowCommandPalette);return x.useEffect(()=>Dt.start(),[]),x.useEffect(()=>{function u(f){(f.metaKey||f.ctrlKey)&&f.key==="k"&&(f.preventDefault(),l(!0))}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[l]),a.jsxs(a.Fragment,{children:[a.jsx(DN,{}),o==="missing"?a.jsx(CN,{}):o==="checking"||t&&r.length===0?a.jsx("div",{className:"empty-state",children:"Loading sessions…"}):s&&r.length===0?a.jsxs("div",{className:"empty-state",children:["Error: ",s]}):a.jsxs(a.Fragment,{children:[a.jsx(aN,{}),a.jsx(lN,{}),a.jsx(dN,{}),a.jsx(hN,{}),a.jsx(xN,{}),a.jsx(SN,{}),a.jsx(wN,{}),a.jsx(jN,{})]})]})}jx.createRoot(document.getElementById("root")).render(a.jsx(ot.StrictMode,{children:a.jsx(MN,{})}));
|
|
638
|
+
This cannot be undone.`)){w(!0);try{const Q=await fetch(`${mn()}/remote/uninstall`,{method:"DELETE"});if(!Q.ok)throw new Error(`uninstall ${Q.status}`);await re()}catch{f("Could not remove the tunnel — check the daemon logs.")}finally{w(!1)}}}function ae(){if(!W)return a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"dialog-label",children:["Machine name (mahlas)",a.jsx("input",{className:"dialog-input",value:A,onChange:j=>_(j.target.value.toLowerCase()),placeholder:"my-macbook",autoFocus:!0})]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The machine will be reachable at https://<name>.repoburg.com"}),a.jsxs("div",{className:"dialog-footer",children:[a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>T("main"),children:"Back"}),a.jsxs("button",{className:"dialog-btn-create",disabled:!Zm.test(A)||B,onClick:()=>void Se(A),children:[B?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Start setup"]})]})]});const O=["detect","provision","install","verify","ready"],Q=O.indexOf(W.step),U=W.state==="ready";return a.jsxs(a.Fragment,{children:[W.state==="running"&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Setting up the remote tunnel…"]}),W.state==="ready"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--green)",display:"flex",alignItems:"center",gap:6},children:[a.jsx(Ts,{size:14})," Setup complete — you can close this window."]}),W.state==="ready"&&W.hostname&&a.jsxs("div",{className:"dialog-label",children:["This machine is accessible at"," ",a.jsx("a",{href:`https://${W.hostname}`,target:"_blank",rel:"noreferrer",children:W.hostname})]}),a.jsx("ol",{className:"dialog-label",style:{margin:"4px 0",paddingLeft:0,listStyle:"none"},children:O.map((j,P)=>{const ne=U||Q>-1&&P<Q,de=!U&&P===Q&&W.state==="running";return a.jsxs("li",{style:{display:"flex",alignItems:"center",gap:6,opacity:ne||de?1:.4,color:ne?"var(--green)":void 0},children:[ne?a.jsx(Ts,{size:13}):de?a.jsx(hn,{size:13,className:"spin"}):a.jsx(bw,{size:9,style:{marginLeft:2,marginRight:2}}),j]},j)})}),W.logs.length>0&&a.jsx("div",{className:"dialog-label",style:{opacity:.7,fontSize:12,whiteSpace:"pre-wrap"},children:W.logs.slice(-3).map(j=>j.message).join(`
|
|
639
|
+
`)}),W.state==="troubleshooting"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:"Setup failed — a troubleshooting session is open and the agent is working on the fix in the background."}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-create",onClick:Pe,children:"Open troubleshooting session"})})]}),W.state==="failed"&&a.jsxs("div",{className:"dialog-label",style:{color:"var(--red)"},children:["Setup failed: ",W.error]}),a.jsx("div",{className:"dialog-footer",children:a.jsx("button",{className:"dialog-btn-cancel",onClick:()=>void re(),children:"Refresh status"})})]})}return a.jsx("div",{className:"dialog-overlay",onClick:()=>s(!1),children:a.jsxs("div",{className:"dialog",onClick:O=>O.stopPropagation(),onKeyDown:Ne,children:[a.jsxs("div",{className:"dialog-header",children:[a.jsx("span",{className:"dialog-title",children:"Remote Access"}),a.jsx("button",{className:"dialog-close",onClick:()=>s(!1),children:a.jsx(gn,{size:16})})]}),a.jsxs("div",{className:"dialog-body",children:[p&&a.jsxs("div",{className:"dialog-label",style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(hn,{size:14,className:"spin"})," Loading machine status…"]}),u&&a.jsx("div",{className:"dialog-label",style:{color:"var(--red)"},children:u}),E==="setup"?ae():a.jsxs(a.Fragment,{children:[G&&(o==null?void 0:o.tunnel.hostname)&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["This machine is reachable at"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})]}),a.jsxs("div",{style:{position:"relative",display:"flex",marginTop:8},children:[a.jsxs("button",{className:"dialog-btn-cancel",style:{flex:1,borderTopRightRadius:0,borderBottomRightRadius:0},onClick:()=>void te(),disabled:F,children:[m?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):null,"Stop tunnel connection"]}),a.jsx("button",{className:"dialog-btn-cancel",style:{width:30,borderLeft:"none",borderTopLeftRadius:0,borderBottomLeftRadius:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:()=>C(O=>!O),disabled:F,"aria-label":"More tunnel actions","aria-haspopup":"menu","aria-expanded":S,children:k?a.jsx(hn,{size:14,className:"spin"}):a.jsx(wi,{size:14})}),S&&a.jsx("div",{ref:K,className:"ctx-menu",role:"menu",style:{position:"absolute",right:0,top:"calc(100% + 4px)",zIndex:10},children:a.jsxs("div",{className:"ctx-menu-item ctx-danger",role:"menuitem",onClick:()=>void oe(),children:[a.jsx(us,{size:12})," Remove tunnel"]})})]})]}),!G&&a.jsx(a.Fragment,{children:o!=null&&o.tunnel.provisioned&&o.tunnel.mahlas&&o.tunnel.hostname?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"dialog-label",children:["Tunnel exists as"," ",a.jsx("a",{href:`https://${o.tunnel.hostname}`,target:"_blank",rel:"noreferrer",children:o.tunnel.hostname})," ","but the connection is stopped."]}),a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>void Se(o.tunnel.mahlas),disabled:B,children:[B?a.jsx(hn,{size:14,className:"spin",style:{verticalAlign:"middle",marginRight:6}}):a.jsx(Bh,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Resume tunnel connection"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{className:"dialog-btn-create",style:{width:"100%"},onClick:()=>T("setup"),children:[a.jsx(Bh,{size:16,style:{verticalAlign:"middle",marginRight:6}}),"Make this machine remote"]}),a.jsx("div",{className:"dialog-label",style:{opacity:.7,marginTop:-4},children:"The daemon sets everything up and shows the progress here."})]})})]})]})]})})}const TN={success:kw,error:Rl,info:Rw,warn:zg},NN=4e3;function jN({toast:t}){const s=M(f=>f.removeToast),r=TN[t.type],o=x.useRef(null);x.useEffect(()=>{function f(){o.current=setTimeout(()=>s(t.id),NN)}return f(),()=>{o.current&&clearTimeout(o.current)}},[t.id,s]);function l(){o.current&&(clearTimeout(o.current),o.current=null)}function u(){o.current=setTimeout(()=>s(t.id),2e3)}return a.jsxs("div",{className:`toast toast-${t.type}`,onMouseEnter:l,onMouseLeave:u,children:[a.jsx(r,{size:16}),a.jsx("span",{className:"toast-message",children:t.message}),t.undoAction&&a.jsxs("button",{className:"toast-undo",onClick:()=>{var f;(f=t.undoAction)==null||f.call(t),s(t.id)},children:[a.jsx(Xw,{size:12})," ",t.undoLabel||"Undo"]}),a.jsx("button",{className:"toast-close",onClick:()=>s(t.id),children:a.jsx(gn,{size:14})})]})}function CN(){const t=M(s=>s.toasts);return t.length===0?null:a.jsx("div",{className:"toast-container",children:t.map(s=>a.jsx(jN,{toast:s},s.id))})}function EN(){const[t]=x.useState(D0),[s,r]=x.useState(!1),[o,l]=x.useState(!1),u=x.useRef(void 0);x.useEffect(()=>()=>clearTimeout(u.current),[]);async function f(){await vl(_h)&&(r(!0),l(!0),clearTimeout(u.current),u.current=setTimeout(()=>r(!1),1500))}return a.jsxs("main",{className:"daemon-download",children:[a.jsx("h1",{className:"daemon-download-title",children:"Repoburg"}),t&&a.jsx("p",{className:"daemon-download-text",children:"Open the Repoburg app to continue."}),a.jsxs("div",{className:"daemon-download-install",children:[t&&a.jsx("p",{className:"daemon-download-label",children:"Not installed? Run this in Terminal:"}),a.jsxs("div",{className:"daemon-download-cmd",onCopy:()=>l(!0),children:[a.jsx("span",{className:"daemon-download-prompt","aria-hidden":"true",children:"$"}),a.jsx("code",{children:_h}),a.jsx("button",{type:"button",className:`daemon-download-copy${s?" copied":""}`,onClick:()=>void f(),"aria-label":"Copy the install command",title:s?"Copied":"Copy",children:s?a.jsx(Ts,{size:15}):a.jsx(ll,{size:15})})]}),!t&&a.jsx("p",{className:"daemon-download-meta",children:"Apple Silicon · macOS 13+"})]}),o&&a.jsx("p",{className:"daemon-download-hint",children:"Paste it into Terminal and press Return. Repoburg installs and opens in your menu bar."}),(t||o)&&a.jsxs("p",{className:"daemon-download-waiting",role:"status",children:[a.jsx(hn,{size:13,className:"spin"}),"Waiting for Repoburg to start…"]})]})}let Jn=null,Si=null,wo=1e3;const _N=1e4;function RN(){const t=mn();return t?`${t.replace(/^http/,"ws")}/ws`:`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`}function od(){Jn&&(Jn.readyState===WebSocket.OPEN||Jn.readyState===WebSocket.CONNECTING)||(Jn=new WebSocket(RN()),Jn.onopen=()=>{const t=wo>1e3;if(wo=1e3,M.getState().setWsConnected(!0),M.getState().addLogEntry("INFO","WebSocket connected"),t){T0();const s=M.getState();s.activeSessionId&&(s.refreshActiveSession(),s.addToast("info","WebSocket reconnected — session state reconciled"))}},Jn.onclose=()=>{M.getState().setWsConnected(!1),M.getState().addLogEntry("WARN","WebSocket disconnected"),M.getState().addToast("warn","WebSocket disconnected — reconnecting…"),IN()},Jn.onerror=()=>{},Jn.onmessage=t=>{try{const s=JSON.parse(t.data);Dt.trackWsEvent(typeof s.event=="string"?s.event:"unknown",typeof t.data=="string"?t.data.length:0);const r=DN[s.event];r&&r(s.data)}catch{}})}function AN(){Si&&(clearTimeout(Si),Si=null),Jn&&(Jn.onclose=null,Jn.close(),Jn=null),M.getState().setWsConnected(!1)}function IN(){Si||(Si=window.setTimeout(()=>{Si=null,od()},wo),wo=Math.min(wo*2,_N))}const DN={"turn:created":t=>{const s=t;M.getState().onTurnCreated(s.sessionId,s.turn)},"turn:started":t=>{const s=t;Dt.note(`turn:started — ${s.turnId.slice(0,8)}`),M.getState().onTurnStarted(s.sessionId,s.turnId)},"item:started":t=>{const s=t;M.getState().onItemStarted(s.sessionId,s.turnId,s.item)},"item:updated":t=>{const s=t;M.getState().onItemUpdated(s.sessionId,s.turnId,s.item)},"item:completed":t=>{const s=t;M.getState().onItemCompleted(s.sessionId,s.turnId,s.item)},"item:delta":t=>{const s=t;M.getState().onItemDelta(s.sessionId,s.turnId,s.itemId,s.delta)},"turn:completed":t=>{const s=t;Dt.note(`turn:completed — ${s.turnId.slice(0,8)}`),M.getState().onTurnCompleted(s.sessionId,s.turnId,s.usage,s.hasUnreviewed,s.response??void 0)},"turn:tokenUsage":t=>{const s=t;M.getState().onTokenUsageUpdated(s.sessionId,s.turnId,s.usage)},"turn:contextUsage":t=>{const s=t,r={totalTokens:s.totalTokens,contextWindow:s.contextWindow,percentage:s.percentage,...s.autoCompactThreshold?{autoCompactThreshold:s.autoCompactThreshold}:{}};M.getState().onContextUsageUpdated(s.sessionId,r)},"turn:failed":t=>{const s=t;M.getState().onTurnFailed(s.sessionId,s.turnId,s.error,s.resumeState)},"turn:interrupted":t=>{const s=t;Dt.note(`turn:interrupted — ${s.turnId.slice(0,8)} (${s.reason})`),M.getState().onTurnInterrupted(s.sessionId,s.turnId,{reason:s.reason,interruptedAt:s.interruptedAt,attempts:s.attempts,detail:s.detail??null})},"turn:resuming":t=>{const s=t;M.getState().onTurnResuming(s.sessionId,s.turnId,s.attempt)},"turn:resumed":t=>{const s=t;M.getState().onTurnResumed(s.sessionId,s.turnId)},"turn:retrying":t=>{const s=t;M.getState().onTurnRetrying(s.sessionId,s.turnId,{attempt:s.attempt,maxRetries:s.maxRetries,retryDelayMs:s.retryDelayMs,errorStatus:s.errorStatus??null,error:s.error??null})},"turn:cancelled":t=>{const s=t;M.getState().onTurnCancelled(s.sessionId,s.turnId)},"session:title":t=>{const s=t;M.getState().onSessionTitle(s.sessionId,s.title)},"session:touched":t=>{const s=t;M.getState().onSessionTouched(s.sessionId)},"session:updated":t=>{const s=t;M.getState().onSessionUpdated(s.session)},background_tasks:t=>{const s=t;Dt.note(`background_tasks — ${s.tasks.length} live (${s.tasks.map(r=>r.task_type).join(", ")||"none"})`),M.getState().onBackgroundTasksChanged(s.sessionId,s.tasks)},"background_tasks:snapshot":t=>{const s=t;M.getState().onBackgroundTasksSnapshot(s.sessions??{})},"thread:created":t=>{const s=t;M.getState().onThreadCreated(s.sessionId,s.thread,s.turn)},"thread:followup":t=>{const s=t;M.getState().onThreadFollowup(s.sessionId,s.threadId,s.turn)},"thread:resolved":t=>{const s=t;M.getState().onThreadResolved(s.sessionId,s.threadId,s.status)},"thread:deleted":t=>{const s=t;M.getState().onThreadDeleted(s.sessionId,s.threadId)},"app:tool_call":t=>{const s=t;y0(s.appId,s.callId,s.tool,s.args??{},s.workspace)},"app:source:updated":t=>{N0(t.appId),M.getState().refreshApps()},"app:state_changed":t=>{const{appId:s,...r}=t;gg(s,r)}};function MN(){const t=M(s=>s.init);return x.useEffect(()=>{Ox();function s(){t(),od()}const{daemonStatus:r,setDaemonStatus:o}=M.getState();let l=null;r==="ready"?s():l=L0({onMissing:()=>o("missing"),onReady:()=>{o("ready"),s()}});function u(){if(document.visibilityState!=="visible")return;const f=M.getState(),p=f.activeSessionId;if(!p)return;const g=f.sessionDetails[p];f.wsConnected||od(),g&&g.is_running===1&&(f.refreshActiveSession(),f.addLogEntry("INFO","Tab returned — reconciling session state"))}return document.addEventListener("visibilitychange",u),()=>{l==null||l(),AN(),document.removeEventListener("visibilitychange",u)}},[t]),null}function LN(){const t=M(u=>u.loading),s=M(u=>u.error),r=M(u=>u.sessions),o=M(u=>u.daemonStatus),l=M(u=>u.setShowCommandPalette);return x.useEffect(()=>Dt.start(),[]),x.useEffect(()=>{function u(f){(f.metaKey||f.ctrlKey)&&f.key==="k"&&(f.preventDefault(),l(!0))}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[l]),a.jsxs(a.Fragment,{children:[a.jsx(MN,{}),o==="missing"?a.jsx(EN,{}):o==="checking"||t&&r.length===0?a.jsx("div",{className:"empty-state",children:"Loading sessions…"}):s&&r.length===0?a.jsxs("div",{className:"empty-state",children:["Error: ",s]}):a.jsxs(a.Fragment,{children:[a.jsx(lN,{}),a.jsx(cN,{}),a.jsx(fN,{}),a.jsx(mN,{}),a.jsx(wN,{}),a.jsx(bN,{}),a.jsx(kN,{}),a.jsx(CN,{})]})]})}jx.createRoot(document.getElementById("root")).render(a.jsx(ot.StrictMode,{children:a.jsx(LN,{})}));
|