@cnrai/pave 0.11.77 → 0.11.78

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.
Files changed (66) hide show
  1. package/package.json +1 -1
  2. package/pave.js +2 -2
  3. package/sandbox/permission.js +1 -1
  4. package/web/assets/{abnfDiagram-N423BO3Z-DNaZFbnQ.js → abnfDiagram-N423BO3Z-CVM2D1rH.js} +1 -1
  5. package/web/assets/{arc-BBjnZAjs.js → arc-B3Wrf-kz.js} +1 -1
  6. package/web/assets/{architectureDiagram-T3A2C74G-CRqHj6Ck.js → architectureDiagram-T3A2C74G-CfQ1X14r.js} +1 -1
  7. package/web/assets/{blockDiagram-VBNYF7ZC-BGymdfZe.js → blockDiagram-VBNYF7ZC--pWK_tkb.js} +1 -1
  8. package/web/assets/{c4Diagram-5PPSVZJV-DHm1U-vQ.js → c4Diagram-5PPSVZJV-CZY7Jmwr.js} +1 -1
  9. package/web/assets/channel-BCS8v52J.js +1 -0
  10. package/web/assets/{chunk-2GRJ4B5K-CYRSqRZj.js → chunk-2GRJ4B5K-DozES9Z6.js} +1 -1
  11. package/web/assets/{chunk-2Q5K7J3B-Cnc9JyYe.js → chunk-2Q5K7J3B-LkzIcNlR.js} +1 -1
  12. package/web/assets/{chunk-5RXB4S5H-Dk8yyxBX.js → chunk-5RXB4S5H-Ds4AKGaR.js} +1 -1
  13. package/web/assets/{chunk-5VM5RSS4-CUxUltN5.js → chunk-5VM5RSS4-CHz7_P-8.js} +1 -1
  14. package/web/assets/{chunk-6Q2QTUOP-D_XAzpG5.js → chunk-6Q2QTUOP-BB4Gw1E1.js} +1 -1
  15. package/web/assets/{chunk-GF5L2VYU-BygLhC0b.js → chunk-GF5L2VYU-Dj3rKg2U.js} +1 -1
  16. package/web/assets/{chunk-JWPE2WC7-Daf2PmiF.js → chunk-JWPE2WC7-BGtvKnVf.js} +1 -1
  17. package/web/assets/{chunk-KBJHAD2P-Dacfg8Vm.js → chunk-KBJHAD2P-Bqmng1ni.js} +1 -1
  18. package/web/assets/{chunk-RYQCIY6F-CTqPiw-E.js → chunk-RYQCIY6F-CXJ8Ea0S.js} +1 -1
  19. package/web/assets/{chunk-XXDRQBXY-BcdL-i6k.js → chunk-XXDRQBXY-RSuvd__s.js} +1 -1
  20. package/web/assets/classDiagram-JCYQIIEL-C-cXmCgK.js +1 -0
  21. package/web/assets/classDiagram-v2-OCEON4UE-C-cXmCgK.js +1 -0
  22. package/web/assets/{cose-bilkent-JH36ORCC-CvG-qT7o.js → cose-bilkent-JH36ORCC-BnkTm26D.js} +1 -1
  23. package/web/assets/{cynefin-VYW2F7L2-BL1D6Zap.js → cynefin-VYW2F7L2-o49zEYB2.js} +1 -1
  24. package/web/assets/{cynefinDiagram-MW4NZA55-MfeGrxw5.js → cynefinDiagram-MW4NZA55-DBONbfCd.js} +1 -1
  25. package/web/assets/{dagre-VZM6K2ZE-CPj1vSJ1.js → dagre-VZM6K2ZE-D2HW7GAY.js} +1 -1
  26. package/web/assets/{diagram-7IWD3JNH-PuLn-9zm.js → diagram-7IWD3JNH-BREW2Ur4.js} +1 -1
  27. package/web/assets/{diagram-B4RE2ZJO-CkIZwq5c.js → diagram-B4RE2ZJO-Ab_yq5_K.js} +1 -1
  28. package/web/assets/{diagram-LBJQPF4R-DoqMV830.js → diagram-LBJQPF4R-Bf23Z2Jr.js} +1 -1
  29. package/web/assets/{diagram-Q27KOJAE-mo3Qhf-E.js → diagram-Q27KOJAE-D7h_MzT7.js} +1 -1
  30. package/web/assets/{diagram-UB23O5K3-OkIIheXv.js → diagram-UB23O5K3-DgmDLUPH.js} +1 -1
  31. package/web/assets/{ebnfDiagram-BXEA7PRR-BtrnFNZ5.js → ebnfDiagram-BXEA7PRR-DPEz1-8t.js} +1 -1
  32. package/web/assets/{erDiagram-JOGREHBK-Do2qkPJ6.js → erDiagram-JOGREHBK-CZohS7RU.js} +1 -1
  33. package/web/assets/{flowDiagram-UKHOOZJN-CO05QYxY.js → flowDiagram-UKHOOZJN-BfgUxroe.js} +1 -1
  34. package/web/assets/{ganttDiagram-PKOTCBZU-CsDUxXgM.js → ganttDiagram-PKOTCBZU-9luI4rIq.js} +1 -1
  35. package/web/assets/{gitGraphDiagram-DS77QQ5N-D_JRbJnn.js → gitGraphDiagram-DS77QQ5N-DmbotyM-.js} +1 -1
  36. package/web/assets/{index-DqSR1Tzn.js → index-BvpIakAk.js} +2 -2
  37. package/web/assets/{infoDiagram-6WML65LV-Bm51MVeD.js → infoDiagram-6WML65LV-DxxXgG-3.js} +1 -1
  38. package/web/assets/{ishikawaDiagram-WSZJBQD7-hC73dV6-.js → ishikawaDiagram-WSZJBQD7-Bzzpo2aK.js} +1 -1
  39. package/web/assets/{journeyDiagram-NVQOT4AX-SrvvbJRK.js → journeyDiagram-NVQOT4AX-D_wOl95m.js} +1 -1
  40. package/web/assets/{kanban-definition-27J2QSJJ-NkVpEBib.js → kanban-definition-27J2QSJJ-xynPCnQS.js} +1 -1
  41. package/web/assets/{linear-DuFTppiB.js → linear-DplfrmAW.js} +1 -1
  42. package/web/assets/{mermaid.core-Csqy-TMM.js → mermaid.core-DO9mNo1y.js} +4 -4
  43. package/web/assets/{mindmap-definition-FAOFIHXS-u_GH4Qfd.js → mindmap-definition-FAOFIHXS-BdyxCTTP.js} +1 -1
  44. package/web/assets/{pegDiagram-VL7TDLO6-BhGIjN6A.js → pegDiagram-VL7TDLO6-CMzGLtjm.js} +1 -1
  45. package/web/assets/{pieDiagram-7S7Q4E2Y-B_M8PUaK.js → pieDiagram-7S7Q4E2Y-CWmErVvr.js} +1 -1
  46. package/web/assets/{quadrantDiagram-CIZ2JOQS-DSirVekl.js → quadrantDiagram-CIZ2JOQS-QpSZ059z.js} +1 -1
  47. package/web/assets/{railroadDiagram-AXF67PYL-Dy2zbnOk.js → railroadDiagram-AXF67PYL-BVizlNNW.js} +1 -1
  48. package/web/assets/{requirementDiagram-LRYGKXZP-BOm79sUC.js → requirementDiagram-LRYGKXZP-D0_XOx2M.js} +1 -1
  49. package/web/assets/{sankeyDiagram-W5VNT64P-CKvdTJMK.js → sankeyDiagram-W5VNT64P-C_klwzRO.js} +1 -1
  50. package/web/assets/{sequenceDiagram-SI44F4Z6-DMu0TdCJ.js → sequenceDiagram-SI44F4Z6-BAZUOOgC.js} +1 -1
  51. package/web/assets/{sizeCapture-X5ZJPWSS-bAw6BW35.js → sizeCapture-X5ZJPWSS-CZkMbpzZ.js} +1 -1
  52. package/web/assets/{stateDiagram-OKZ733FA-BY7brHbI.js → stateDiagram-OKZ733FA-miwvYfCr.js} +1 -1
  53. package/web/assets/stateDiagram-v2-UEYNNEHI-DbfvhyRG.js +1 -0
  54. package/web/assets/{swimlanes-SLNWSIFB-DxITDC19.js → swimlanes-SLNWSIFB-BfNQ_Uju.js} +2 -2
  55. package/web/assets/swimlanesDiagram-ULZ7WXOC-Ch4Bupaf.js +8 -0
  56. package/web/assets/{timeline-definition-Z64GVDOM-BmlqIPEF.js → timeline-definition-Z64GVDOM-CRvhYSNw.js} +1 -1
  57. package/web/assets/{vennDiagram-T6HMQDX7-BZTPZCF_.js → vennDiagram-T6HMQDX7-DvhQbjJN.js} +1 -1
  58. package/web/assets/{wardleyDiagram-T6FBY63Y-iNVTU5LZ.js → wardleyDiagram-T6FBY63Y-B-ZcuJDN.js} +1 -1
  59. package/web/assets/{xychartDiagram-ELKLHX3M-bmAoBhux.js → xychartDiagram-ELKLHX3M-BaWnwUAT.js} +1 -1
  60. package/web/assets/{zh-TW-B9YR1mTH.js → zh-TW-CnUPOrCw.js} +1 -1
  61. package/web/index.html +1 -1
  62. package/web/assets/channel-CzlEDRcP.js +0 -1
  63. package/web/assets/classDiagram-JCYQIIEL-DVilfxdw.js +0 -1
  64. package/web/assets/classDiagram-v2-OCEON4UE-DVilfxdw.js +0 -1
  65. package/web/assets/stateDiagram-v2-UEYNNEHI-DQllBEYE.js +0 -1
  66. package/web/assets/swimlanesDiagram-ULZ7WXOC-BEysfC0G.js +0 -8
@@ -37,7 +37,7 @@
37
37
  `+a[s].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=s&&0<=l);break}}}finally{og=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?il(e):""}function aL(e){switch(e.tag){case 5:return il(e.type);case 16:return il("Lazy");case 13:return il("Suspense");case 19:return il("SuspenseList");case 0:case 2:case 15:return e=lg(e.type,!1),e;case 11:return e=lg(e.type.render,!1),e;case 1:return e=lg(e.type,!0),e;default:return""}}function yy(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 Xs:return"Fragment";case Ys:return"Portal";case hy:return"Profiler";case Qb:return"StrictMode";case my:return"Suspense";case xy:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Oj:return(e.displayName||"Context")+".Consumer";case Lj:return(e._context.displayName||"Context")+".Provider";case Zb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Jb:return t=e.displayName||null,t!==null?t:yy(e.type)||"Memo";case ui:t=e._payload,e=e._init;try{return yy(e(t))}catch{}}return null}function iL(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return yy(t);case 8:return t===Qb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Ai(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Pj(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function sL(e){var t=Pj(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yc(e){e._valueTracker||(e._valueTracker=sL(e))}function Fj(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Pj(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ed(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 by(e,t){var n=t.checked;return pn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function _k(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ai(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Bj(e,t){t=t.checked,t!=null&&Xb(e,"checked",t,!1)}function vy(e,t){Bj(e,t);var n=Ai(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ky(e,t.type,n):t.hasOwnProperty("defaultValue")&&ky(e,t.type,Ai(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function wk(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ky(e,t,n){(t!=="number"||ed(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var sl=Array.isArray;function oo(e,t,n,r){if(e=e.options,t){t={};for(var a=0;a<n.length;a++)t["$"+n[a]]=!0;for(n=0;n<e.length;n++)a=t.hasOwnProperty("$"+e[n].value),e[n].selected!==a&&(e[n].selected=a),a&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Ai(n),t=null,a=0;a<e.length;a++){if(e[a].value===n){e[a].selected=!0,r&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function _y(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Pe(91));return pn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ek(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Pe(92));if(sl(n)){if(1<n.length)throw Error(Pe(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ai(n)}}function zj(e,t){var n=Ai(t.value),r=Ai(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Sk(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Uj(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 wy(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Uj(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Xc,$j=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,a){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,a)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Xc=Xc||document.createElement("div"),Xc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Xc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ll(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var xl={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},oL=["Webkit","ms","Moz","O"];Object.keys(xl).forEach(function(e){oL.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),xl[t]=xl[e]})});function Hj(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||xl.hasOwnProperty(e)&&xl[e]?(""+t).trim():t+"px"}function qj(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,a=Hj(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,a):e[n]=a}}var lL=pn({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 Ey(e,t){if(t){if(lL[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Pe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Pe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Pe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Pe(62))}}function Sy(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ny=null;function ev(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Cy=null,lo=null,co=null;function Nk(e){if(e=gc(e)){if(typeof Cy!="function")throw Error(Pe(280));var t=e.stateNode;t&&(t=Gd(t),Cy(e.stateNode,e.type,t))}}function Wj(e){lo?co?co.push(e):co=[e]:lo=e}function Vj(){if(lo){var e=lo,t=co;if(co=lo=null,Nk(e),t)for(e=0;e<t.length;e++)Nk(t[e])}}function Gj(e,t){return e(t)}function Kj(){}var cg=!1;function Yj(e,t,n){if(cg)return e(t,n);cg=!0;try{return Gj(e,t,n)}finally{cg=!1,(lo!==null||co!==null)&&(Kj(),Vj())}}function Ol(e,t){var n=e.stateNode;if(n===null)return null;var r=Gd(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(Pe(231,t,typeof n));return n}var jy=!1;if(Ha)try{var Vo={};Object.defineProperty(Vo,"passive",{get:function(){jy=!0}}),window.addEventListener("test",Vo,Vo),window.removeEventListener("test",Vo,Vo)}catch{jy=!1}function cL(e,t,n,r,a,i,s,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var yl=!1,td=null,nd=!1,Ty=null,uL={onError:function(e){yl=!0,td=e}};function dL(e,t,n,r,a,i,s,l,c){yl=!1,td=null,cL.apply(uL,arguments)}function fL(e,t,n,r,a,i,s,l,c){if(dL.apply(this,arguments),yl){if(yl){var u=td;yl=!1,td=null}else throw Error(Pe(198));nd||(nd=!0,Ty=u)}}function ys(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Xj(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ck(e){if(ys(e)!==e)throw Error(Pe(188))}function gL(e){var t=e.alternate;if(!t){if(t=ys(e),t===null)throw Error(Pe(188));return t!==e?null:e}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var i=a.alternate;if(i===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===n)return Ck(a),e;if(i===r)return Ck(a),t;i=i.sibling}throw Error(Pe(188))}if(n.return!==r.return)n=a,r=i;else{for(var s=!1,l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s)throw Error(Pe(189))}}if(n.alternate!==r)throw Error(Pe(190))}if(n.tag!==3)throw Error(Pe(188));return n.stateNode.current===n?e:t}function Qj(e){return e=gL(e),e!==null?Zj(e):null}function Zj(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Zj(e);if(t!==null)return t;e=e.sibling}return null}var Jj=Ir.unstable_scheduleCallback,jk=Ir.unstable_cancelCallback,pL=Ir.unstable_shouldYield,hL=Ir.unstable_requestPaint,bn=Ir.unstable_now,mL=Ir.unstable_getCurrentPriorityLevel,tv=Ir.unstable_ImmediatePriority,eT=Ir.unstable_UserBlockingPriority,rd=Ir.unstable_NormalPriority,xL=Ir.unstable_LowPriority,tT=Ir.unstable_IdlePriority,Hd=null,ka=null;function yL(e){if(ka&&typeof ka.onCommitFiberRoot=="function")try{ka.onCommitFiberRoot(Hd,e,void 0,(e.current.flags&128)===128)}catch{}}var ra=Math.clz32?Math.clz32:kL,bL=Math.log,vL=Math.LN2;function kL(e){return e>>>=0,e===0?32:31-(bL(e)/vL|0)|0}var Qc=64,Zc=4194304;function ol(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 ad(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,a=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~a;l!==0?r=ol(l):(i&=s,i!==0&&(r=ol(i)))}else s=n&~a,s!==0?r=ol(s):i!==0&&(r=ol(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&a)&&(a=r&-r,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-ra(t),a=1<<n,r|=e[n],t&=~a;return r}function _L(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function wL(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-ra(i),l=1<<s,c=a[s];c===-1?(!(l&n)||l&r)&&(a[s]=_L(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Ay(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function nT(){var e=Qc;return Qc<<=1,!(Qc&4194240)&&(Qc=64),e}function ug(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ra(t),e[t]=n}function EL(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var a=31-ra(n),i=1<<a;t[a]=0,r[a]=-1,e[a]=-1,n&=~i}}function nv(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ra(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}var Ht=0;function rT(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var aT,rv,iT,sT,oT,Ry=!1,Jc=[],ki=null,_i=null,wi=null,Dl=new Map,Pl=new Map,fi=[],SL="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 Tk(e,t){switch(e){case"focusin":case"focusout":ki=null;break;case"dragenter":case"dragleave":_i=null;break;case"mouseover":case"mouseout":wi=null;break;case"pointerover":case"pointerout":Dl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pl.delete(t.pointerId)}}function Go(e,t,n,r,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[a]},t!==null&&(t=gc(t),t!==null&&rv(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function NL(e,t,n,r,a){switch(t){case"focusin":return ki=Go(ki,e,t,n,r,a),!0;case"dragenter":return _i=Go(_i,e,t,n,r,a),!0;case"mouseover":return wi=Go(wi,e,t,n,r,a),!0;case"pointerover":var i=a.pointerId;return Dl.set(i,Go(Dl.get(i)||null,e,t,n,r,a)),!0;case"gotpointercapture":return i=a.pointerId,Pl.set(i,Go(Pl.get(i)||null,e,t,n,r,a)),!0}return!1}function lT(e){var t=Ji(e.target);if(t!==null){var n=ys(t);if(n!==null){if(t=n.tag,t===13){if(t=Xj(n),t!==null){e.blockedOn=t,oT(e.priority,function(){iT(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Pu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Iy(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ny=r,n.target.dispatchEvent(r),Ny=null}else return t=gc(n),t!==null&&rv(t),e.blockedOn=n,!1;t.shift()}return!0}function Ak(e,t,n){Pu(e)&&n.delete(t)}function CL(){Ry=!1,ki!==null&&Pu(ki)&&(ki=null),_i!==null&&Pu(_i)&&(_i=null),wi!==null&&Pu(wi)&&(wi=null),Dl.forEach(Ak),Pl.forEach(Ak)}function Ko(e,t){e.blockedOn===t&&(e.blockedOn=null,Ry||(Ry=!0,Ir.unstable_scheduleCallback(Ir.unstable_NormalPriority,CL)))}function Fl(e){function t(a){return Ko(a,e)}if(0<Jc.length){Ko(Jc[0],e);for(var n=1;n<Jc.length;n++){var r=Jc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ki!==null&&Ko(ki,e),_i!==null&&Ko(_i,e),wi!==null&&Ko(wi,e),Dl.forEach(t),Pl.forEach(t),n=0;n<fi.length;n++)r=fi[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<fi.length&&(n=fi[0],n.blockedOn===null);)lT(n),n.blockedOn===null&&fi.shift()}var uo=Ka.ReactCurrentBatchConfig,id=!0;function jL(e,t,n,r){var a=Ht,i=uo.transition;uo.transition=null;try{Ht=1,av(e,t,n,r)}finally{Ht=a,uo.transition=i}}function TL(e,t,n,r){var a=Ht,i=uo.transition;uo.transition=null;try{Ht=4,av(e,t,n,r)}finally{Ht=a,uo.transition=i}}function av(e,t,n,r){if(id){var a=Iy(e,t,n,r);if(a===null)vg(e,t,r,sd,n),Tk(e,r);else if(NL(a,e,t,n,r))r.stopPropagation();else if(Tk(e,r),t&4&&-1<SL.indexOf(e)){for(;a!==null;){var i=gc(a);if(i!==null&&aT(i),i=Iy(e,t,n,r),i===null&&vg(e,t,r,sd,n),i===a)break;a=i}a!==null&&r.stopPropagation()}else vg(e,t,r,null,n)}}var sd=null;function Iy(e,t,n,r){if(sd=null,e=ev(r),e=Ji(e),e!==null)if(t=ys(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Xj(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return sd=e,null}function cT(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(mL()){case tv:return 1;case eT:return 4;case rd:case xL:return 16;case tT:return 536870912;default:return 16}default:return 16}}var xi=null,iv=null,Fu=null;function uT(){if(Fu)return Fu;var e,t=iv,n=t.length,r,a="value"in xi?xi.value:xi.textContent,i=a.length;for(e=0;e<n&&t[e]===a[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===a[i-r];r++);return Fu=a.slice(e,1<r?1-r:void 0)}function Bu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function eu(){return!0}function Rk(){return!1}function Lr(e){function t(n,r,a,i,s){this._reactName=n,this._targetInst=a,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?eu:Rk,this.isPropagationStopped=Rk,this}return pn(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=eu)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=eu)},persist:function(){},isPersistent:eu}),t}var jo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},sv=Lr(jo),fc=pn({},jo,{view:0,detail:0}),AL=Lr(fc),dg,fg,Yo,qd=pn({},fc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ov,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!==Yo&&(Yo&&e.type==="mousemove"?(dg=e.screenX-Yo.screenX,fg=e.screenY-Yo.screenY):fg=dg=0,Yo=e),dg)},movementY:function(e){return"movementY"in e?e.movementY:fg}}),Ik=Lr(qd),RL=pn({},qd,{dataTransfer:0}),IL=Lr(RL),ML=pn({},fc,{relatedTarget:0}),gg=Lr(ML),LL=pn({},jo,{animationName:0,elapsedTime:0,pseudoElement:0}),OL=Lr(LL),DL=pn({},jo,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),PL=Lr(DL),FL=pn({},jo,{data:0}),Mk=Lr(FL),BL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zL={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"},UL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $L(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=UL[e])?!!t[e]:!1}function ov(){return $L}var HL=pn({},fc,{key:function(e){if(e.key){var t=BL[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Bu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?zL[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ov,charCode:function(e){return e.type==="keypress"?Bu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Bu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qL=Lr(HL),WL=pn({},qd,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lk=Lr(WL),VL=pn({},fc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ov}),GL=Lr(VL),KL=pn({},jo,{propertyName:0,elapsedTime:0,pseudoElement:0}),YL=Lr(KL),XL=pn({},qd,{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}),QL=Lr(XL),ZL=[9,13,27,32],lv=Ha&&"CompositionEvent"in window,bl=null;Ha&&"documentMode"in document&&(bl=document.documentMode);var JL=Ha&&"TextEvent"in window&&!bl,dT=Ha&&(!lv||bl&&8<bl&&11>=bl),Ok=" ",Dk=!1;function fT(e,t){switch(e){case"keyup":return ZL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gT(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Qs=!1;function eO(e,t){switch(e){case"compositionend":return gT(t);case"keypress":return t.which!==32?null:(Dk=!0,Ok);case"textInput":return e=t.data,e===Ok&&Dk?null:e;default:return null}}function tO(e,t){if(Qs)return e==="compositionend"||!lv&&fT(e,t)?(e=uT(),Fu=iv=xi=null,Qs=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return dT&&t.locale!=="ko"?null:t.data;default:return null}}var nO={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 Pk(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!nO[e.type]:t==="textarea"}function pT(e,t,n,r){Wj(r),t=od(t,"onChange"),0<t.length&&(n=new sv("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var vl=null,Bl=null;function rO(e){ST(e,0)}function Wd(e){var t=eo(e);if(Fj(t))return e}function aO(e,t){if(e==="change")return t}var hT=!1;if(Ha){var pg;if(Ha){var hg="oninput"in document;if(!hg){var Fk=document.createElement("div");Fk.setAttribute("oninput","return;"),hg=typeof Fk.oninput=="function"}pg=hg}else pg=!1;hT=pg&&(!document.documentMode||9<document.documentMode)}function Bk(){vl&&(vl.detachEvent("onpropertychange",mT),Bl=vl=null)}function mT(e){if(e.propertyName==="value"&&Wd(Bl)){var t=[];pT(t,Bl,e,ev(e)),Yj(rO,t)}}function iO(e,t,n){e==="focusin"?(Bk(),vl=t,Bl=n,vl.attachEvent("onpropertychange",mT)):e==="focusout"&&Bk()}function sO(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Wd(Bl)}function oO(e,t){if(e==="click")return Wd(t)}function lO(e,t){if(e==="input"||e==="change")return Wd(t)}function cO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oa=typeof Object.is=="function"?Object.is:cO;function zl(e,t){if(oa(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!py.call(t,a)||!oa(e[a],t[a]))return!1}return!0}function zk(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Uk(e,t){var n=zk(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=zk(n)}}function xT(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xT(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function yT(){for(var e=window,t=ed();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ed(e.document)}return t}function cv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function uO(e){var t=yT(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&xT(n.ownerDocument.documentElement,n)){if(r!==null&&cv(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,i=Math.min(r.start,a);r=r.end===void 0?i:Math.min(r.end,a),!e.extend&&i>r&&(a=r,r=i,i=a),a=Uk(n,i);var s=Uk(n,r);a&&s&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var dO=Ha&&"documentMode"in document&&11>=document.documentMode,Zs=null,My=null,kl=null,Ly=!1;function $k(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ly||Zs==null||Zs!==ed(r)||(r=Zs,"selectionStart"in r&&cv(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),kl&&zl(kl,r)||(kl=r,r=od(My,"onSelect"),0<r.length&&(t=new sv("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Zs)))}function tu(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Js={animationend:tu("Animation","AnimationEnd"),animationiteration:tu("Animation","AnimationIteration"),animationstart:tu("Animation","AnimationStart"),transitionend:tu("Transition","TransitionEnd")},mg={},bT={};Ha&&(bT=document.createElement("div").style,"AnimationEvent"in window||(delete Js.animationend.animation,delete Js.animationiteration.animation,delete Js.animationstart.animation),"TransitionEvent"in window||delete Js.transitionend.transition);function Vd(e){if(mg[e])return mg[e];if(!Js[e])return e;var t=Js[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in bT)return mg[e]=t[n];return e}var vT=Vd("animationend"),kT=Vd("animationiteration"),_T=Vd("animationstart"),wT=Vd("transitionend"),ET=new Map,Hk="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 Li(e,t){ET.set(e,t),xs(t,[e])}for(var xg=0;xg<Hk.length;xg++){var yg=Hk[xg],fO=yg.toLowerCase(),gO=yg[0].toUpperCase()+yg.slice(1);Li(fO,"on"+gO)}Li(vT,"onAnimationEnd");Li(kT,"onAnimationIteration");Li(_T,"onAnimationStart");Li("dblclick","onDoubleClick");Li("focusin","onFocus");Li("focusout","onBlur");Li(wT,"onTransitionEnd");xo("onMouseEnter",["mouseout","mouseover"]);xo("onMouseLeave",["mouseout","mouseover"]);xo("onPointerEnter",["pointerout","pointerover"]);xo("onPointerLeave",["pointerout","pointerover"]);xs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));xs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));xs("onBeforeInput",["compositionend","keypress","textInput","paste"]);xs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));xs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));xs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ll="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(" "),pO=new Set("cancel close invalid load scroll toggle".split(" ").concat(ll));function qk(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,fL(r,t,void 0,e),e.currentTarget=null}function ST(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],a=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var l=r[s],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&a.isPropagationStopped())break e;qk(a,l,u),i=c}else for(s=0;s<r.length;s++){if(l=r[s],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&a.isPropagationStopped())break e;qk(a,l,u),i=c}}}if(nd)throw e=Ty,nd=!1,Ty=null,e}function Zt(e,t){var n=t[By];n===void 0&&(n=t[By]=new Set);var r=e+"__bubble";n.has(r)||(NT(t,e,2,!1),n.add(r))}function bg(e,t,n){var r=0;t&&(r|=4),NT(n,e,r,t)}var nu="_reactListening"+Math.random().toString(36).slice(2);function Ul(e){if(!e[nu]){e[nu]=!0,Mj.forEach(function(n){n!=="selectionchange"&&(pO.has(n)||bg(n,!1,e),bg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[nu]||(t[nu]=!0,bg("selectionchange",!1,t))}}function NT(e,t,n,r){switch(cT(t)){case 1:var a=jL;break;case 4:a=TL;break;default:a=av}n=a.bind(null,t,n,e),a=void 0,!jy||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),r?a!==void 0?e.addEventListener(t,n,{capture:!0,passive:a}):e.addEventListener(t,n,!0):a!==void 0?e.addEventListener(t,n,{passive:a}):e.addEventListener(t,n,!1)}function vg(e,t,n,r,a){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===a||l.nodeType===8&&l.parentNode===a)break;if(s===4)for(s=r.return;s!==null;){var c=s.tag;if((c===3||c===4)&&(c=s.stateNode.containerInfo,c===a||c.nodeType===8&&c.parentNode===a))return;s=s.return}for(;l!==null;){if(s=Ji(l),s===null)return;if(c=s.tag,c===5||c===6){r=i=s;continue e}l=l.parentNode}}r=r.return}Yj(function(){var u=i,d=ev(n),f=[];e:{var g=ET.get(e);if(g!==void 0){var p=sv,m=e;switch(e){case"keypress":if(Bu(n)===0)break e;case"keydown":case"keyup":p=qL;break;case"focusin":m="focus",p=gg;break;case"focusout":m="blur",p=gg;break;case"beforeblur":case"afterblur":p=gg;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=Ik;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=IL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=GL;break;case vT:case kT:case _T:p=OL;break;case wT:p=YL;break;case"scroll":p=AL;break;case"wheel":p=QL;break;case"copy":case"cut":case"paste":p=PL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=Lk}var y=(t&4)!==0,v=!y&&e==="scroll",x=y?g!==null?g+"Capture":null:g;y=[];for(var b=u,k;b!==null;){k=b;var S=k.stateNode;if(k.tag===5&&S!==null&&(k=S,x!==null&&(S=Ol(b,x),S!=null&&y.push($l(b,S,k)))),v)break;b=b.return}0<y.length&&(g=new p(g,m,null,n,d),f.push({event:g,listeners:y}))}}if(!(t&7)){e:{if(g=e==="mouseover"||e==="pointerover",p=e==="mouseout"||e==="pointerout",g&&n!==Ny&&(m=n.relatedTarget||n.fromElement)&&(Ji(m)||m[qa]))break e;if((p||g)&&(g=d.window===d?d:(g=d.ownerDocument)?g.defaultView||g.parentWindow:window,p?(m=n.relatedTarget||n.toElement,p=u,m=m?Ji(m):null,m!==null&&(v=ys(m),m!==v||m.tag!==5&&m.tag!==6)&&(m=null)):(p=null,m=u),p!==m)){if(y=Ik,S="onMouseLeave",x="onMouseEnter",b="mouse",(e==="pointerout"||e==="pointerover")&&(y=Lk,S="onPointerLeave",x="onPointerEnter",b="pointer"),v=p==null?g:eo(p),k=m==null?g:eo(m),g=new y(S,b+"leave",p,n,d),g.target=v,g.relatedTarget=k,S=null,Ji(d)===u&&(y=new y(x,b+"enter",m,n,d),y.target=k,y.relatedTarget=v,S=y),v=S,p&&m)t:{for(y=p,x=m,b=0,k=y;k;k=Fs(k))b++;for(k=0,S=x;S;S=Fs(S))k++;for(;0<b-k;)y=Fs(y),b--;for(;0<k-b;)x=Fs(x),k--;for(;b--;){if(y===x||x!==null&&y===x.alternate)break t;y=Fs(y),x=Fs(x)}y=null}else y=null;p!==null&&Wk(f,g,p,y,!1),m!==null&&v!==null&&Wk(f,v,m,y,!0)}}e:{if(g=u?eo(u):window,p=g.nodeName&&g.nodeName.toLowerCase(),p==="select"||p==="input"&&g.type==="file")var E=aO;else if(Pk(g))if(hT)E=lO;else{E=sO;var _=iO}else(p=g.nodeName)&&p.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(E=oO);if(E&&(E=E(e,u))){pT(f,E,n,d);break e}_&&_(e,g,u),e==="focusout"&&(_=g._wrapperState)&&_.controlled&&g.type==="number"&&ky(g,"number",g.value)}switch(_=u?eo(u):window,e){case"focusin":(Pk(_)||_.contentEditable==="true")&&(Zs=_,My=u,kl=null);break;case"focusout":kl=My=Zs=null;break;case"mousedown":Ly=!0;break;case"contextmenu":case"mouseup":case"dragend":Ly=!1,$k(f,n,d);break;case"selectionchange":if(dO)break;case"keydown":case"keyup":$k(f,n,d)}var w;if(lv)e:{switch(e){case"compositionstart":var N="onCompositionStart";break e;case"compositionend":N="onCompositionEnd";break e;case"compositionupdate":N="onCompositionUpdate";break e}N=void 0}else Qs?fT(e,n)&&(N="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(N="onCompositionStart");N&&(dT&&n.locale!=="ko"&&(Qs||N!=="onCompositionStart"?N==="onCompositionEnd"&&Qs&&(w=uT()):(xi=d,iv="value"in xi?xi.value:xi.textContent,Qs=!0)),_=od(u,N),0<_.length&&(N=new Mk(N,e,null,n,d),f.push({event:N,listeners:_}),w?N.data=w:(w=gT(n),w!==null&&(N.data=w)))),(w=JL?eO(e,n):tO(e,n))&&(u=od(u,"onBeforeInput"),0<u.length&&(d=new Mk("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=w))}ST(f,t)})}function $l(e,t,n){return{instance:e,listener:t,currentTarget:n}}function od(e,t){for(var n=t+"Capture",r=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Ol(e,n),i!=null&&r.unshift($l(e,i,a)),i=Ol(e,t),i!=null&&r.push($l(e,i,a))),e=e.return}return r}function Fs(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Wk(e,t,n,r,a){for(var i=t._reactName,s=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,a?(c=Ol(n,i),c!=null&&s.unshift($l(n,c,l))):a||(c=Ol(n,i),c!=null&&s.push($l(n,c,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var hO=/\r\n?/g,mO=/\u0000|\uFFFD/g;function Vk(e){return(typeof e=="string"?e:""+e).replace(hO,`
38
38
  `).replace(mO,"")}function ru(e,t,n){if(t=Vk(t),Vk(e)!==t&&n)throw Error(Pe(425))}function ld(){}var Oy=null,Dy=null;function Py(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Fy=typeof setTimeout=="function"?setTimeout:void 0,xO=typeof clearTimeout=="function"?clearTimeout:void 0,Gk=typeof Promise=="function"?Promise:void 0,yO=typeof queueMicrotask=="function"?queueMicrotask:typeof Gk<"u"?function(e){return Gk.resolve(null).then(e).catch(bO)}:Fy;function bO(e){setTimeout(function(){throw e})}function kg(e,t){var n=t,r=0;do{var a=n.nextSibling;if(e.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"){if(r===0){e.removeChild(a),Fl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=a}while(n);Fl(t)}function Ei(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Kk(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var To=Math.random().toString(36).slice(2),ya="__reactFiber$"+To,Hl="__reactProps$"+To,qa="__reactContainer$"+To,By="__reactEvents$"+To,vO="__reactListeners$"+To,kO="__reactHandles$"+To;function Ji(e){var t=e[ya];if(t)return t;for(var n=e.parentNode;n;){if(t=n[qa]||n[ya]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Kk(e);e!==null;){if(n=e[ya])return n;e=Kk(e)}return t}e=n,n=e.parentNode}return null}function gc(e){return e=e[ya]||e[qa],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function eo(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Pe(33))}function Gd(e){return e[Hl]||null}var zy=[],to=-1;function Oi(e){return{current:e}}function tn(e){0>to||(e.current=zy[to],zy[to]=null,to--)}function Qt(e,t){to++,zy[to]=e.current,e.current=t}var Ri={},Xn=Oi(Ri),hr=Oi(!1),us=Ri;function yo(e,t){var n=e.type.contextTypes;if(!n)return Ri;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in n)a[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function mr(e){return e=e.childContextTypes,e!=null}function cd(){tn(hr),tn(Xn)}function Yk(e,t,n){if(Xn.current!==Ri)throw Error(Pe(168));Qt(Xn,t),Qt(hr,n)}function CT(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var a in r)if(!(a in t))throw Error(Pe(108,iL(e)||"Unknown",a));return pn({},n,r)}function ud(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ri,us=Xn.current,Qt(Xn,e),Qt(hr,hr.current),!0}function Xk(e,t,n){var r=e.stateNode;if(!r)throw Error(Pe(169));n?(e=CT(e,t,us),r.__reactInternalMemoizedMergedChildContext=e,tn(hr),tn(Xn),Qt(Xn,e)):tn(hr),Qt(hr,n)}var Oa=null,Kd=!1,_g=!1;function jT(e){Oa===null?Oa=[e]:Oa.push(e)}function _O(e){Kd=!0,jT(e)}function Di(){if(!_g&&Oa!==null){_g=!0;var e=0,t=Ht;try{var n=Oa;for(Ht=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Oa=null,Kd=!1}catch(a){throw Oa!==null&&(Oa=Oa.slice(e+1)),Jj(tv,Di),a}finally{Ht=t,_g=!1}}return null}var no=[],ro=0,dd=null,fd=0,Pr=[],Fr=0,ds=null,Da=1,Pa="";function Yi(e,t){no[ro++]=fd,no[ro++]=dd,dd=e,fd=t}function TT(e,t,n){Pr[Fr++]=Da,Pr[Fr++]=Pa,Pr[Fr++]=ds,ds=e;var r=Da;e=Pa;var a=32-ra(r)-1;r&=~(1<<a),n+=1;var i=32-ra(t)+a;if(30<i){var s=a-a%5;i=(r&(1<<s)-1).toString(32),r>>=s,a-=s,Da=1<<32-ra(t)+a|n<<a|r,Pa=i+e}else Da=1<<i|n<<a|r,Pa=e}function uv(e){e.return!==null&&(Yi(e,1),TT(e,1,0))}function dv(e){for(;e===dd;)dd=no[--ro],no[ro]=null,fd=no[--ro],no[ro]=null;for(;e===ds;)ds=Pr[--Fr],Pr[Fr]=null,Pa=Pr[--Fr],Pr[Fr]=null,Da=Pr[--Fr],Pr[Fr]=null}var Tr=null,jr=null,on=!1,na=null;function AT(e,t){var n=zr(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Qk(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Tr=e,jr=Ei(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Tr=e,jr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ds!==null?{id:Da,overflow:Pa}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=zr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Tr=e,jr=null,!0):!1;default:return!1}}function Uy(e){return(e.mode&1)!==0&&(e.flags&128)===0}function $y(e){if(on){var t=jr;if(t){var n=t;if(!Qk(e,t)){if(Uy(e))throw Error(Pe(418));t=Ei(n.nextSibling);var r=Tr;t&&Qk(e,t)?AT(r,n):(e.flags=e.flags&-4097|2,on=!1,Tr=e)}}else{if(Uy(e))throw Error(Pe(418));e.flags=e.flags&-4097|2,on=!1,Tr=e}}}function Zk(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Tr=e}function au(e){if(e!==Tr)return!1;if(!on)return Zk(e),on=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Py(e.type,e.memoizedProps)),t&&(t=jr)){if(Uy(e))throw RT(),Error(Pe(418));for(;t;)AT(e,t),t=Ei(t.nextSibling)}if(Zk(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Pe(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){jr=Ei(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}jr=null}}else jr=Tr?Ei(e.stateNode.nextSibling):null;return!0}function RT(){for(var e=jr;e;)e=Ei(e.nextSibling)}function bo(){jr=Tr=null,on=!1}function fv(e){na===null?na=[e]:na.push(e)}var wO=Ka.ReactCurrentBatchConfig;function Xo(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(Pe(309));var r=n.stateNode}if(!r)throw Error(Pe(147,e));var a=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var l=a.refs;s===null?delete l[i]:l[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(Pe(284));if(!n._owner)throw Error(Pe(290,e))}return e}function iu(e,t){throw e=Object.prototype.toString.call(t),Error(Pe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Jk(e){var t=e._init;return t(e._payload)}function IT(e){function t(x,b){if(e){var k=x.deletions;k===null?(x.deletions=[b],x.flags|=16):k.push(b)}}function n(x,b){if(!e)return null;for(;b!==null;)t(x,b),b=b.sibling;return null}function r(x,b){for(x=new Map;b!==null;)b.key!==null?x.set(b.key,b):x.set(b.index,b),b=b.sibling;return x}function a(x,b){return x=ji(x,b),x.index=0,x.sibling=null,x}function i(x,b,k){return x.index=k,e?(k=x.alternate,k!==null?(k=k.index,k<b?(x.flags|=2,b):k):(x.flags|=2,b)):(x.flags|=1048576,b)}function s(x){return e&&x.alternate===null&&(x.flags|=2),x}function l(x,b,k,S){return b===null||b.tag!==6?(b=Tg(k,x.mode,S),b.return=x,b):(b=a(b,k),b.return=x,b)}function c(x,b,k,S){var E=k.type;return E===Xs?d(x,b,k.props.children,S,k.key):b!==null&&(b.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===ui&&Jk(E)===b.type)?(S=a(b,k.props),S.ref=Xo(x,b,k),S.return=x,S):(S=Vu(k.type,k.key,k.props,null,x.mode,S),S.ref=Xo(x,b,k),S.return=x,S)}function u(x,b,k,S){return b===null||b.tag!==4||b.stateNode.containerInfo!==k.containerInfo||b.stateNode.implementation!==k.implementation?(b=Ag(k,x.mode,S),b.return=x,b):(b=a(b,k.children||[]),b.return=x,b)}function d(x,b,k,S,E){return b===null||b.tag!==7?(b=ss(k,x.mode,S,E),b.return=x,b):(b=a(b,k),b.return=x,b)}function f(x,b,k){if(typeof b=="string"&&b!==""||typeof b=="number")return b=Tg(""+b,x.mode,k),b.return=x,b;if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Kc:return k=Vu(b.type,b.key,b.props,null,x.mode,k),k.ref=Xo(x,null,b),k.return=x,k;case Ys:return b=Ag(b,x.mode,k),b.return=x,b;case ui:var S=b._init;return f(x,S(b._payload),k)}if(sl(b)||Wo(b))return b=ss(b,x.mode,k,null),b.return=x,b;iu(x,b)}return null}function g(x,b,k,S){var E=b!==null?b.key:null;if(typeof k=="string"&&k!==""||typeof k=="number")return E!==null?null:l(x,b,""+k,S);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Kc:return k.key===E?c(x,b,k,S):null;case Ys:return k.key===E?u(x,b,k,S):null;case ui:return E=k._init,g(x,b,E(k._payload),S)}if(sl(k)||Wo(k))return E!==null?null:d(x,b,k,S,null);iu(x,k)}return null}function p(x,b,k,S,E){if(typeof S=="string"&&S!==""||typeof S=="number")return x=x.get(k)||null,l(b,x,""+S,E);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Kc:return x=x.get(S.key===null?k:S.key)||null,c(b,x,S,E);case Ys:return x=x.get(S.key===null?k:S.key)||null,u(b,x,S,E);case ui:var _=S._init;return p(x,b,k,_(S._payload),E)}if(sl(S)||Wo(S))return x=x.get(k)||null,d(b,x,S,E,null);iu(b,S)}return null}function m(x,b,k,S){for(var E=null,_=null,w=b,N=b=0,R=null;w!==null&&N<k.length;N++){w.index>N?(R=w,w=null):R=w.sibling;var j=g(x,w,k[N],S);if(j===null){w===null&&(w=R);break}e&&w&&j.alternate===null&&t(x,w),b=i(j,b,N),_===null?E=j:_.sibling=j,_=j,w=R}if(N===k.length)return n(x,w),on&&Yi(x,N),E;if(w===null){for(;N<k.length;N++)w=f(x,k[N],S),w!==null&&(b=i(w,b,N),_===null?E=w:_.sibling=w,_=w);return on&&Yi(x,N),E}for(w=r(x,w);N<k.length;N++)R=p(w,x,N,k[N],S),R!==null&&(e&&R.alternate!==null&&w.delete(R.key===null?N:R.key),b=i(R,b,N),_===null?E=R:_.sibling=R,_=R);return e&&w.forEach(function(P){return t(x,P)}),on&&Yi(x,N),E}function y(x,b,k,S){var E=Wo(k);if(typeof E!="function")throw Error(Pe(150));if(k=E.call(k),k==null)throw Error(Pe(151));for(var _=E=null,w=b,N=b=0,R=null,j=k.next();w!==null&&!j.done;N++,j=k.next()){w.index>N?(R=w,w=null):R=w.sibling;var P=g(x,w,j.value,S);if(P===null){w===null&&(w=R);break}e&&w&&P.alternate===null&&t(x,w),b=i(P,b,N),_===null?E=P:_.sibling=P,_=P,w=R}if(j.done)return n(x,w),on&&Yi(x,N),E;if(w===null){for(;!j.done;N++,j=k.next())j=f(x,j.value,S),j!==null&&(b=i(j,b,N),_===null?E=j:_.sibling=j,_=j);return on&&Yi(x,N),E}for(w=r(x,w);!j.done;N++,j=k.next())j=p(w,x,N,j.value,S),j!==null&&(e&&j.alternate!==null&&w.delete(j.key===null?N:j.key),b=i(j,b,N),_===null?E=j:_.sibling=j,_=j);return e&&w.forEach(function(F){return t(x,F)}),on&&Yi(x,N),E}function v(x,b,k,S){if(typeof k=="object"&&k!==null&&k.type===Xs&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Kc:e:{for(var E=k.key,_=b;_!==null;){if(_.key===E){if(E=k.type,E===Xs){if(_.tag===7){n(x,_.sibling),b=a(_,k.props.children),b.return=x,x=b;break e}}else if(_.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===ui&&Jk(E)===_.type){n(x,_.sibling),b=a(_,k.props),b.ref=Xo(x,_,k),b.return=x,x=b;break e}n(x,_);break}else t(x,_);_=_.sibling}k.type===Xs?(b=ss(k.props.children,x.mode,S,k.key),b.return=x,x=b):(S=Vu(k.type,k.key,k.props,null,x.mode,S),S.ref=Xo(x,b,k),S.return=x,x=S)}return s(x);case Ys:e:{for(_=k.key;b!==null;){if(b.key===_)if(b.tag===4&&b.stateNode.containerInfo===k.containerInfo&&b.stateNode.implementation===k.implementation){n(x,b.sibling),b=a(b,k.children||[]),b.return=x,x=b;break e}else{n(x,b);break}else t(x,b);b=b.sibling}b=Ag(k,x.mode,S),b.return=x,x=b}return s(x);case ui:return _=k._init,v(x,b,_(k._payload),S)}if(sl(k))return m(x,b,k,S);if(Wo(k))return y(x,b,k,S);iu(x,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,b!==null&&b.tag===6?(n(x,b.sibling),b=a(b,k),b.return=x,x=b):(n(x,b),b=Tg(k,x.mode,S),b.return=x,x=b),s(x)):n(x,b)}return v}var vo=IT(!0),MT=IT(!1),gd=Oi(null),pd=null,ao=null,gv=null;function pv(){gv=ao=pd=null}function hv(e){var t=gd.current;tn(gd),e._currentValue=t}function Hy(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function fo(e,t){pd=e,gv=ao=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(pr=!0),e.firstContext=null)}function qr(e){var t=e._currentValue;if(gv!==e)if(e={context:e,memoizedValue:t,next:null},ao===null){if(pd===null)throw Error(Pe(308));ao=e,pd.dependencies={lanes:0,firstContext:e}}else ao=ao.next=e;return t}var es=null;function mv(e){es===null?es=[e]:es.push(e)}function LT(e,t,n,r){var a=t.interleaved;return a===null?(n.next=n,mv(t)):(n.next=a.next,a.next=n),t.interleaved=n,Wa(e,r)}function Wa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var di=!1;function xv(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function OT(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ua(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Si(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ft&2){var a=r.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),r.pending=t,Wa(e,n)}return a=r.interleaved,a===null?(t.next=t,mv(r)):(t.next=a.next,a.next=t),r.interleaved=t,Wa(e,n)}function zu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nv(e,n)}}function e_(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var a=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?a=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function hd(e,t,n,r){var a=e.updateQueue;di=!1;var i=a.firstBaseUpdate,s=a.lastBaseUpdate,l=a.shared.pending;if(l!==null){a.shared.pending=null;var c=l,u=c.next;c.next=null,s===null?i=u:s.next=u,s=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==s&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=a.baseState;s=0,d=u=c=null,l=i;do{var g=l.lane,p=l.eventTime;if((r&g)===g){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var m=e,y=l;switch(g=t,p=n,y.tag){case 1:if(m=y.payload,typeof m=="function"){f=m.call(p,f,g);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=y.payload,g=typeof m=="function"?m.call(p,f,g):m,g==null)break e;f=pn({},f,g);break e;case 2:di=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,g=a.effects,g===null?a.effects=[l]:g.push(l))}else p={eventTime:p,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,s|=g;if(l=l.next,l===null){if(l=a.shared.pending,l===null)break;g=l,l=g.next,g.next=null,a.lastBaseUpdate=g,a.shared.pending=null}}while(!0);if(d===null&&(c=f),a.baseState=c,a.firstBaseUpdate=u,a.lastBaseUpdate=d,t=a.shared.interleaved,t!==null){a=t;do s|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);gs|=s,e.lanes=s,e.memoizedState=f}}function t_(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],a=r.callback;if(a!==null){if(r.callback=null,r=n,typeof a!="function")throw Error(Pe(191,a));a.call(r)}}}var pc={},_a=Oi(pc),ql=Oi(pc),Wl=Oi(pc);function ts(e){if(e===pc)throw Error(Pe(174));return e}function yv(e,t){switch(Qt(Wl,t),Qt(ql,e),Qt(_a,pc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:wy(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=wy(t,e)}tn(_a),Qt(_a,t)}function ko(){tn(_a),tn(ql),tn(Wl)}function DT(e){ts(Wl.current);var t=ts(_a.current),n=wy(t,e.type);t!==n&&(Qt(ql,e),Qt(_a,n))}function bv(e){ql.current===e&&(tn(_a),tn(ql))}var fn=Oi(0);function md(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var wg=[];function vv(){for(var e=0;e<wg.length;e++)wg[e]._workInProgressVersionPrimary=null;wg.length=0}var Uu=Ka.ReactCurrentDispatcher,Eg=Ka.ReactCurrentBatchConfig,fs=0,gn=null,Nn=null,In=null,xd=!1,_l=!1,Vl=0,EO=0;function Hn(){throw Error(Pe(321))}function kv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!oa(e[n],t[n]))return!1;return!0}function _v(e,t,n,r,a,i){if(fs=i,gn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Uu.current=e===null||e.memoizedState===null?jO:TO,e=n(r,a),_l){i=0;do{if(_l=!1,Vl=0,25<=i)throw Error(Pe(301));i+=1,In=Nn=null,t.updateQueue=null,Uu.current=AO,e=n(r,a)}while(_l)}if(Uu.current=yd,t=Nn!==null&&Nn.next!==null,fs=0,In=Nn=gn=null,xd=!1,t)throw Error(Pe(300));return e}function wv(){var e=Vl!==0;return Vl=0,e}function ha(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return In===null?gn.memoizedState=In=e:In=In.next=e,In}function Wr(){if(Nn===null){var e=gn.alternate;e=e!==null?e.memoizedState:null}else e=Nn.next;var t=In===null?gn.memoizedState:In.next;if(t!==null)In=t,Nn=e;else{if(e===null)throw Error(Pe(310));Nn=e,e={memoizedState:Nn.memoizedState,baseState:Nn.baseState,baseQueue:Nn.baseQueue,queue:Nn.queue,next:null},In===null?gn.memoizedState=In=e:In=In.next=e}return In}function Gl(e,t){return typeof t=="function"?t(e):t}function Sg(e){var t=Wr(),n=t.queue;if(n===null)throw Error(Pe(311));n.lastRenderedReducer=e;var r=Nn,a=r.baseQueue,i=n.pending;if(i!==null){if(a!==null){var s=a.next;a.next=i.next,i.next=s}r.baseQueue=a=i,n.pending=null}if(a!==null){i=a.next,r=r.baseState;var l=s=null,c=null,u=i;do{var d=u.lane;if((fs&d)===d)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,s=r):c=c.next=f,gn.lanes|=d,gs|=d}u=u.next}while(u!==null&&u!==i);c===null?s=r:c.next=l,oa(r,t.memoizedState)||(pr=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){a=e;do i=a.lane,gn.lanes|=i,gs|=i,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ng(e){var t=Wr(),n=t.queue;if(n===null)throw Error(Pe(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,i=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do i=e(i,s.action),s=s.next;while(s!==a);oa(i,t.memoizedState)||(pr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function PT(){}function FT(e,t){var n=gn,r=Wr(),a=t(),i=!oa(r.memoizedState,a);if(i&&(r.memoizedState=a,pr=!0),r=r.queue,Ev(UT.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||In!==null&&In.memoizedState.tag&1){if(n.flags|=2048,Kl(9,zT.bind(null,n,r,a,t),void 0,null),Mn===null)throw Error(Pe(349));fs&30||BT(n,t,a)}return a}function BT(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=gn.updateQueue,t===null?(t={lastEffect:null,stores:null},gn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function zT(e,t,n,r){t.value=n,t.getSnapshot=r,$T(t)&&HT(e)}function UT(e,t,n){return n(function(){$T(t)&&HT(e)})}function $T(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!oa(e,n)}catch{return!0}}function HT(e){var t=Wa(e,1);t!==null&&aa(t,e,1,-1)}function n_(e){var t=ha();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Gl,lastRenderedState:e},t.queue=e,e=e.dispatch=CO.bind(null,gn,e),[t.memoizedState,e]}function Kl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=gn.updateQueue,t===null?(t={lastEffect:null,stores:null},gn.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function qT(){return Wr().memoizedState}function $u(e,t,n,r){var a=ha();gn.flags|=e,a.memoizedState=Kl(1|t,n,void 0,r===void 0?null:r)}function Yd(e,t,n,r){var a=Wr();r=r===void 0?null:r;var i=void 0;if(Nn!==null){var s=Nn.memoizedState;if(i=s.destroy,r!==null&&kv(r,s.deps)){a.memoizedState=Kl(t,n,i,r);return}}gn.flags|=e,a.memoizedState=Kl(1|t,n,i,r)}function r_(e,t){return $u(8390656,8,e,t)}function Ev(e,t){return Yd(2048,8,e,t)}function WT(e,t){return Yd(4,2,e,t)}function VT(e,t){return Yd(4,4,e,t)}function GT(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function KT(e,t,n){return n=n!=null?n.concat([e]):null,Yd(4,4,GT.bind(null,t,e),n)}function Sv(){}function YT(e,t){var n=Wr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&kv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function XT(e,t){var n=Wr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&kv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function QT(e,t,n){return fs&21?(oa(n,t)||(n=nT(),gn.lanes|=n,gs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,pr=!0),e.memoizedState=n)}function SO(e,t){var n=Ht;Ht=n!==0&&4>n?n:4,e(!0);var r=Eg.transition;Eg.transition={};try{e(!1),t()}finally{Ht=n,Eg.transition=r}}function ZT(){return Wr().memoizedState}function NO(e,t,n){var r=Ci(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},JT(e))e5(t,n);else if(n=LT(e,t,n,r),n!==null){var a=ir();aa(n,e,r,a),t5(n,t,r)}}function CO(e,t,n){var r=Ci(e),a={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(JT(e))e5(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,l=i(s,n);if(a.hasEagerState=!0,a.eagerState=l,oa(l,s)){var c=t.interleaved;c===null?(a.next=a,mv(t)):(a.next=c.next,c.next=a),t.interleaved=a;return}}catch{}finally{}n=LT(e,t,a,r),n!==null&&(a=ir(),aa(n,e,r,a),t5(n,t,r))}}function JT(e){var t=e.alternate;return e===gn||t!==null&&t===gn}function e5(e,t){_l=xd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function t5(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nv(e,n)}}var yd={readContext:qr,useCallback:Hn,useContext:Hn,useEffect:Hn,useImperativeHandle:Hn,useInsertionEffect:Hn,useLayoutEffect:Hn,useMemo:Hn,useReducer:Hn,useRef:Hn,useState:Hn,useDebugValue:Hn,useDeferredValue:Hn,useTransition:Hn,useMutableSource:Hn,useSyncExternalStore:Hn,useId:Hn,unstable_isNewReconciler:!1},jO={readContext:qr,useCallback:function(e,t){return ha().memoizedState=[e,t===void 0?null:t],e},useContext:qr,useEffect:r_,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,$u(4194308,4,GT.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $u(4194308,4,e,t)},useInsertionEffect:function(e,t){return $u(4,2,e,t)},useMemo:function(e,t){var n=ha();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ha();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=NO.bind(null,gn,e),[r.memoizedState,e]},useRef:function(e){var t=ha();return e={current:e},t.memoizedState=e},useState:n_,useDebugValue:Sv,useDeferredValue:function(e){return ha().memoizedState=e},useTransition:function(){var e=n_(!1),t=e[0];return e=SO.bind(null,e[1]),ha().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=gn,a=ha();if(on){if(n===void 0)throw Error(Pe(407));n=n()}else{if(n=t(),Mn===null)throw Error(Pe(349));fs&30||BT(r,t,n)}a.memoizedState=n;var i={value:n,getSnapshot:t};return a.queue=i,r_(UT.bind(null,r,i,e),[e]),r.flags|=2048,Kl(9,zT.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ha(),t=Mn.identifierPrefix;if(on){var n=Pa,r=Da;n=(r&~(1<<32-ra(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Vl++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=EO++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},TO={readContext:qr,useCallback:YT,useContext:qr,useEffect:Ev,useImperativeHandle:KT,useInsertionEffect:WT,useLayoutEffect:VT,useMemo:XT,useReducer:Sg,useRef:qT,useState:function(){return Sg(Gl)},useDebugValue:Sv,useDeferredValue:function(e){var t=Wr();return QT(t,Nn.memoizedState,e)},useTransition:function(){var e=Sg(Gl)[0],t=Wr().memoizedState;return[e,t]},useMutableSource:PT,useSyncExternalStore:FT,useId:ZT,unstable_isNewReconciler:!1},AO={readContext:qr,useCallback:YT,useContext:qr,useEffect:Ev,useImperativeHandle:KT,useInsertionEffect:WT,useLayoutEffect:VT,useMemo:XT,useReducer:Ng,useRef:qT,useState:function(){return Ng(Gl)},useDebugValue:Sv,useDeferredValue:function(e){var t=Wr();return Nn===null?t.memoizedState=e:QT(t,Nn.memoizedState,e)},useTransition:function(){var e=Ng(Gl)[0],t=Wr().memoizedState;return[e,t]},useMutableSource:PT,useSyncExternalStore:FT,useId:ZT,unstable_isNewReconciler:!1};function ea(e,t){if(e&&e.defaultProps){t=pn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function qy(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:pn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Xd={isMounted:function(e){return(e=e._reactInternals)?ys(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=ir(),a=Ci(e),i=Ua(r,a);i.payload=t,n!=null&&(i.callback=n),t=Si(e,i,a),t!==null&&(aa(t,e,a,r),zu(t,e,a))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=ir(),a=Ci(e),i=Ua(r,a);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Si(e,i,a),t!==null&&(aa(t,e,a,r),zu(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ir(),r=Ci(e),a=Ua(n,r);a.tag=2,t!=null&&(a.callback=t),t=Si(e,a,r),t!==null&&(aa(t,e,r,n),zu(t,e,r))}};function a_(e,t,n,r,a,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!zl(n,r)||!zl(a,i):!0}function n5(e,t,n){var r=!1,a=Ri,i=t.contextType;return typeof i=="object"&&i!==null?i=qr(i):(a=mr(t)?us:Xn.current,r=t.contextTypes,i=(r=r!=null)?yo(e,a):Ri),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Xd,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function i_(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Xd.enqueueReplaceState(t,t.state,null)}function Wy(e,t,n,r){var a=e.stateNode;a.props=n,a.state=e.memoizedState,a.refs={},xv(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=qr(i):(i=mr(t)?us:Xn.current,a.context=yo(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(qy(e,t,i,n),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&Xd.enqueueReplaceState(a,a.state,null),hd(e,n,a,r),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function _o(e,t){try{var n="",r=t;do n+=aL(r),r=r.return;while(r);var a=n}catch(i){a=`
39
39
  Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:a,digest:null}}function Cg(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Vy(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var RO=typeof WeakMap=="function"?WeakMap:Map;function r5(e,t,n){n=Ua(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){vd||(vd=!0,nb=r),Vy(e,t)},n}function a5(e,t,n){n=Ua(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){Vy(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Vy(e,t),typeof r!="function"&&(Ni===null?Ni=new Set([this]):Ni.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function s_(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new RO;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=WO.bind(null,e,t,n),t.then(e,e))}function o_(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function l_(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Ua(-1,1),t.tag=2,Si(n,t,1))),n.lanes|=1),e)}var IO=Ka.ReactCurrentOwner,pr=!1;function rr(e,t,n,r){t.child=e===null?MT(t,null,n,r):vo(t,e.child,n,r)}function c_(e,t,n,r,a){n=n.render;var i=t.ref;return fo(t,a),r=_v(e,t,n,r,i,a),n=wv(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Va(e,t,a)):(on&&n&&uv(t),t.flags|=1,rr(e,t,r,a),t.child)}function u_(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!Mv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,i5(e,t,i,r,a)):(e=Vu(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&a)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:zl,n(s,r)&&e.ref===t.ref)return Va(e,t,a)}return t.flags|=1,e=ji(i,r),e.ref=t.ref,e.return=t,t.child=e}function i5(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(zl(i,r)&&e.ref===t.ref)if(pr=!1,t.pendingProps=r=i,(e.lanes&a)!==0)e.flags&131072&&(pr=!0);else return t.lanes=e.lanes,Va(e,t,a)}return Gy(e,t,n,r,a)}function s5(e,t,n){var r=t.pendingProps,a=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qt(so,Sr),Sr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Qt(so,Sr),Sr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Qt(so,Sr),Sr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Qt(so,Sr),Sr|=r;return rr(e,t,a,n),t.child}function o5(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gy(e,t,n,r,a){var i=mr(n)?us:Xn.current;return i=yo(t,i),fo(t,a),n=_v(e,t,n,r,i,a),r=wv(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Va(e,t,a)):(on&&r&&uv(t),t.flags|=1,rr(e,t,n,a),t.child)}function d_(e,t,n,r,a){if(mr(n)){var i=!0;ud(t)}else i=!1;if(fo(t,a),t.stateNode===null)Hu(e,t),n5(t,n,r),Wy(t,n,r,a),r=!0;else if(e===null){var s=t.stateNode,l=t.memoizedProps;s.props=l;var c=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=qr(u):(u=mr(n)?us:Xn.current,u=yo(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||c!==u)&&i_(t,s,r,u),di=!1;var g=t.memoizedState;s.state=g,hd(t,r,s,a),c=t.memoizedState,l!==r||g!==c||hr.current||di?(typeof d=="function"&&(qy(t,n,d,r),c=t.memoizedState),(l=di||a_(t,n,l,r,g,c,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),s.props=r,s.state=c,s.context=u,r=l):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,OT(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ea(t.type,l),s.props=u,f=t.pendingProps,g=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=qr(c):(c=mr(n)?us:Xn.current,c=yo(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==f||g!==c)&&i_(t,s,r,c),di=!1,g=t.memoizedState,s.state=g,hd(t,r,s,a);var m=t.memoizedState;l!==f||g!==m||hr.current||di?(typeof p=="function"&&(qy(t,n,p,r),m=t.memoizedState),(u=di||a_(t,n,u,r,g,m,c)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,c)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),s.props=r,s.state=m,s.context=c,r=u):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),r=!1)}return Ky(e,t,n,r,i,a)}function Ky(e,t,n,r,a,i){o5(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return a&&Xk(t,n,!1),Va(e,t,i);r=t.stateNode,IO.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=vo(t,e.child,null,i),t.child=vo(t,null,l,i)):rr(e,t,l,i),t.memoizedState=r.state,a&&Xk(t,n,!0),t.child}function l5(e){var t=e.stateNode;t.pendingContext?Yk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Yk(e,t.context,!1),yv(e,t.containerInfo)}function f_(e,t,n,r,a){return bo(),fv(a),t.flags|=256,rr(e,t,n,r),t.child}var Yy={dehydrated:null,treeContext:null,retryLane:0};function Xy(e){return{baseLanes:e,cachePool:null,transitions:null}}function c5(e,t,n){var r=t.pendingProps,a=fn.current,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),Qt(fn,a&1),e===null)return $y(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Jd(s,r,0,null),e=ss(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Xy(n),t.memoizedState=Yy,e):Nv(t,s));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return MO(e,t,s,r,l,a,n);if(i){i=r.fallback,s=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(s&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=ji(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=ji(l,i):(i=ss(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Xy(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Yy,r}return i=e.child,e=i.sibling,r=ji(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Nv(e,t){return t=Jd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function su(e,t,n,r){return r!==null&&fv(r),vo(t,e.child,null,n),e=Nv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function MO(e,t,n,r,a,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Cg(Error(Pe(422))),su(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,a=t.mode,r=Jd({mode:"visible",children:r.children},a,0,null),i=ss(i,a,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&vo(t,e.child,null,s),t.child.memoizedState=Xy(s),t.memoizedState=Yy,i);if(!(t.mode&1))return su(e,t,s,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Pe(419)),r=Cg(i,r,void 0),su(e,t,s,r)}if(l=(s&e.childLanes)!==0,pr||l){if(r=Mn,r!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|s)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,Wa(e,a),aa(r,e,a,-1))}return Iv(),r=Cg(Error(Pe(421))),su(e,t,s,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=VO.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,jr=Ei(a.nextSibling),Tr=t,on=!0,na=null,e!==null&&(Pr[Fr++]=Da,Pr[Fr++]=Pa,Pr[Fr++]=ds,Da=e.id,Pa=e.overflow,ds=t),t=Nv(t,r.children),t.flags|=4096,t)}function g_(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hy(e.return,t,n)}function jg(e,t,n,r,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function u5(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(rr(e,t,r.children,n),r=fn.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&g_(e,n,t);else if(e.tag===19)g_(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Qt(fn,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&md(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),jg(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&md(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}jg(t,!0,n,null,i);break;case"together":jg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Va(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Pe(153));if(t.child!==null){for(e=t.child,n=ji(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ji(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function LO(e,t,n){switch(t.tag){case 3:l5(t),bo();break;case 5:DT(t);break;case 1:mr(t.type)&&ud(t);break;case 4:yv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;Qt(gd,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Qt(fn,fn.current&1),t.flags|=128,null):n&t.child.childLanes?c5(e,t,n):(Qt(fn,fn.current&1),e=Va(e,t,n),e!==null?e.sibling:null);Qt(fn,fn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return u5(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Qt(fn,fn.current),r)break;return null;case 22:case 23:return t.lanes=0,s5(e,t,n)}return Va(e,t,n)}var d5,Qy,f5,g5;d5=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Qy=function(){};f5=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,ts(_a.current);var i=null;switch(n){case"input":a=by(e,a),r=by(e,r),i=[];break;case"select":a=pn({},a,{value:void 0}),r=pn({},r,{value:void 0}),i=[];break;case"textarea":a=_y(e,a),r=_y(e,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ld)}Ey(n,r);var s;n=null;for(u in a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var l=a[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ml.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=a!=null?a[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in c)c.hasOwnProperty(s)&&l[s]!==c[s]&&(n||(n={}),n[s]=c[s])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ml.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Zt("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};g5=function(e,t,n,r){n!==r&&(t.flags|=4)};function Qo(e,t){if(!on)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function qn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function OO(e,t,n){var r=t.pendingProps;switch(dv(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qn(t),null;case 1:return mr(t.type)&&cd(),qn(t),null;case 3:return r=t.stateNode,ko(),tn(hr),tn(Xn),vv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(au(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,na!==null&&(ib(na),na=null))),Qy(e,t),qn(t),null;case 5:bv(t);var a=ts(Wl.current);if(n=t.type,e!==null&&t.stateNode!=null)f5(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Pe(166));return qn(t),null}if(e=ts(_a.current),au(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ya]=t,r[Hl]=i,e=(t.mode&1)!==0,n){case"dialog":Zt("cancel",r),Zt("close",r);break;case"iframe":case"object":case"embed":Zt("load",r);break;case"video":case"audio":for(a=0;a<ll.length;a++)Zt(ll[a],r);break;case"source":Zt("error",r);break;case"img":case"image":case"link":Zt("error",r),Zt("load",r);break;case"details":Zt("toggle",r);break;case"input":_k(r,i),Zt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Zt("invalid",r);break;case"textarea":Ek(r,i),Zt("invalid",r)}Ey(n,i),a=null;for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];s==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&ru(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&ru(r.textContent,l,e),a=["children",""+l]):Ml.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&Zt("scroll",r)}switch(n){case"input":Yc(r),wk(r,i,!0);break;case"textarea":Yc(r),Sk(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=ld)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Uj(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[ya]=t,e[Hl]=r,d5(e,t,!1,!1),t.stateNode=e;e:{switch(s=Sy(n,r),n){case"dialog":Zt("cancel",e),Zt("close",e),a=r;break;case"iframe":case"object":case"embed":Zt("load",e),a=r;break;case"video":case"audio":for(a=0;a<ll.length;a++)Zt(ll[a],e);a=r;break;case"source":Zt("error",e),a=r;break;case"img":case"image":case"link":Zt("error",e),Zt("load",e),a=r;break;case"details":Zt("toggle",e),a=r;break;case"input":_k(e,r),a=by(e,r),Zt("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=pn({},r,{value:void 0}),Zt("invalid",e);break;case"textarea":Ek(e,r),a=_y(e,r),Zt("invalid",e);break;default:a=r}Ey(n,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?qj(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&$j(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ll(e,c):typeof c=="number"&&Ll(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ml.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Zt("scroll",e):c!=null&&Xb(e,i,c,s))}switch(n){case"input":Yc(e),wk(e,r,!1);break;case"textarea":Yc(e),Sk(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ai(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?oo(e,!!r.multiple,i,!1):r.defaultValue!=null&&oo(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=ld)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return qn(t),null;case 6:if(e&&t.stateNode!=null)g5(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Pe(166));if(n=ts(Wl.current),ts(_a.current),au(t)){if(r=t.stateNode,n=t.memoizedProps,r[ya]=t,(i=r.nodeValue!==n)&&(e=Tr,e!==null))switch(e.tag){case 3:ru(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ru(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ya]=t,t.stateNode=r}return qn(t),null;case 13:if(tn(fn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(on&&jr!==null&&t.mode&1&&!(t.flags&128))RT(),bo(),t.flags|=98560,i=!1;else if(i=au(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Pe(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Pe(317));i[ya]=t}else bo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;qn(t),i=!1}else na!==null&&(ib(na),na=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||fn.current&1?jn===0&&(jn=3):Iv())),t.updateQueue!==null&&(t.flags|=4),qn(t),null);case 4:return ko(),Qy(e,t),e===null&&Ul(t.stateNode.containerInfo),qn(t),null;case 10:return hv(t.type._context),qn(t),null;case 17:return mr(t.type)&&cd(),qn(t),null;case 19:if(tn(fn),i=t.memoizedState,i===null)return qn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Qo(i,!1);else{if(jn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=md(e),s!==null){for(t.flags|=128,Qo(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Qt(fn,fn.current&1|2),t.child}e=e.sibling}i.tail!==null&&bn()>wo&&(t.flags|=128,r=!0,Qo(i,!1),t.lanes=4194304)}else{if(!r)if(e=md(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Qo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!on)return qn(t),null}else 2*bn()-i.renderingStartTime>wo&&n!==1073741824&&(t.flags|=128,r=!0,Qo(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=bn(),t.sibling=null,n=fn.current,Qt(fn,r?n&1|2:n&1),t):(qn(t),null);case 22:case 23:return Rv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Sr&1073741824&&(qn(t),t.subtreeFlags&6&&(t.flags|=8192)):qn(t),null;case 24:return null;case 25:return null}throw Error(Pe(156,t.tag))}function DO(e,t){switch(dv(t),t.tag){case 1:return mr(t.type)&&cd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ko(),tn(hr),tn(Xn),vv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bv(t),null;case 13:if(tn(fn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Pe(340));bo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return tn(fn),null;case 4:return ko(),null;case 10:return hv(t.type._context),null;case 22:case 23:return Rv(),null;case 24:return null;default:return null}}var ou=!1,Vn=!1,PO=typeof WeakSet=="function"?WeakSet:Set,Je=null;function io(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yn(e,t,r)}else n.current=null}function Zy(e,t,n){try{n()}catch(r){yn(e,t,r)}}var p_=!1;function FO(e,t){if(Oy=id,e=yT(),cv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,c=-1,u=0,d=0,f=e,g=null;t:for(;;){for(var p;f!==n||a!==0&&f.nodeType!==3||(l=s+a),f!==i||r!==0&&f.nodeType!==3||(c=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)g=f,f=p;for(;;){if(f===e)break t;if(g===n&&++u===a&&(l=s),g===i&&++d===r&&(c=s),(p=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Dy={focusedElem:e,selectionRange:n},id=!1,Je=t;Je!==null;)if(t=Je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Je=e;else for(;Je!==null;){t=Je;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,v=m.memoizedState,x=t.stateNode,b=x.getSnapshotBeforeUpdate(t.elementType===t.type?y:ea(t.type,y),v);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Pe(163))}}catch(S){yn(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Je=e;break}Je=t.return}return m=p_,p_=!1,m}function wl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&Zy(t,n,i)}a=a.next}while(a!==r)}}function Qd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Jy(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function p5(e){var t=e.alternate;t!==null&&(e.alternate=null,p5(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ya],delete t[Hl],delete t[By],delete t[vO],delete t[kO])),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 h5(e){return e.tag===5||e.tag===3||e.tag===4}function h_(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||h5(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 eb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ld));else if(r!==4&&(e=e.child,e!==null))for(eb(e,t,n),e=e.sibling;e!==null;)eb(e,t,n),e=e.sibling}function tb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(tb(e,t,n),e=e.sibling;e!==null;)tb(e,t,n),e=e.sibling}var Dn=null,ta=!1;function ii(e,t,n){for(n=n.child;n!==null;)m5(e,t,n),n=n.sibling}function m5(e,t,n){if(ka&&typeof ka.onCommitFiberUnmount=="function")try{ka.onCommitFiberUnmount(Hd,n)}catch{}switch(n.tag){case 5:Vn||io(n,t);case 6:var r=Dn,a=ta;Dn=null,ii(e,t,n),Dn=r,ta=a,Dn!==null&&(ta?(e=Dn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dn.removeChild(n.stateNode));break;case 18:Dn!==null&&(ta?(e=Dn,n=n.stateNode,e.nodeType===8?kg(e.parentNode,n):e.nodeType===1&&kg(e,n),Fl(e)):kg(Dn,n.stateNode));break;case 4:r=Dn,a=ta,Dn=n.stateNode.containerInfo,ta=!0,ii(e,t,n),Dn=r,ta=a;break;case 0:case 11:case 14:case 15:if(!Vn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Zy(n,t,s),a=a.next}while(a!==r)}ii(e,t,n);break;case 1:if(!Vn&&(io(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){yn(n,t,l)}ii(e,t,n);break;case 21:ii(e,t,n);break;case 22:n.mode&1?(Vn=(r=Vn)||n.memoizedState!==null,ii(e,t,n),Vn=r):ii(e,t,n);break;default:ii(e,t,n)}}function m_(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new PO),t.forEach(function(r){var a=GO.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function Qr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var i=e,s=t,l=s;e:for(;l!==null;){switch(l.tag){case 5:Dn=l.stateNode,ta=!1;break e;case 3:Dn=l.stateNode.containerInfo,ta=!0;break e;case 4:Dn=l.stateNode.containerInfo,ta=!0;break e}l=l.return}if(Dn===null)throw Error(Pe(160));m5(i,s,a),Dn=null,ta=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){yn(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)x5(t,e),t=t.sibling}function x5(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Qr(t,e),ga(e),r&4){try{wl(3,e,e.return),Qd(3,e)}catch(y){yn(e,e.return,y)}try{wl(5,e,e.return)}catch(y){yn(e,e.return,y)}}break;case 1:Qr(t,e),ga(e),r&512&&n!==null&&io(n,n.return);break;case 5:if(Qr(t,e),ga(e),r&512&&n!==null&&io(n,n.return),e.flags&32){var a=e.stateNode;try{Ll(a,"")}catch(y){yn(e,e.return,y)}}if(r&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Bj(a,i),Sy(l,s);var u=Sy(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?qj(a,f):d==="dangerouslySetInnerHTML"?$j(a,f):d==="children"?Ll(a,f):Xb(a,d,f,u)}switch(l){case"input":vy(a,i);break;case"textarea":zj(a,i);break;case"select":var g=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?oo(a,!!i.multiple,p,!1):g!==!!i.multiple&&(i.defaultValue!=null?oo(a,!!i.multiple,i.defaultValue,!0):oo(a,!!i.multiple,i.multiple?[]:"",!1))}a[Hl]=i}catch(y){yn(e,e.return,y)}}break;case 6:if(Qr(t,e),ga(e),r&4){if(e.stateNode===null)throw Error(Pe(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(y){yn(e,e.return,y)}}break;case 3:if(Qr(t,e),ga(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fl(t.containerInfo)}catch(y){yn(e,e.return,y)}break;case 4:Qr(t,e),ga(e);break;case 13:Qr(t,e),ga(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(Tv=bn())),r&4&&m_(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(Vn=(u=Vn)||d,Qr(t,e),Vn=u):Qr(t,e),ga(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Je=e,d=e.child;d!==null;){for(f=Je=d;Je!==null;){switch(g=Je,p=g.child,g.tag){case 0:case 11:case 14:case 15:wl(4,g,g.return);break;case 1:io(g,g.return);var m=g.stateNode;if(typeof m.componentWillUnmount=="function"){r=g,n=g.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(y){yn(r,n,y)}}break;case 5:io(g,g.return);break;case 22:if(g.memoizedState!==null){y_(f);continue}}p!==null?(p.return=g,Je=p):y_(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,s=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Hj("display",s))}catch(y){yn(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){yn(e,e.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Qr(t,e),ga(e),r&4&&m_(e);break;case 21:break;default:Qr(t,e),ga(e)}}function ga(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(h5(n)){var r=n;break e}n=n.return}throw Error(Pe(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Ll(a,""),r.flags&=-33);var i=h_(e);tb(e,i,a);break;case 3:case 4:var s=r.stateNode.containerInfo,l=h_(e);eb(e,l,s);break;default:throw Error(Pe(161))}}catch(c){yn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function BO(e,t,n){Je=e,y5(e)}function y5(e,t,n){for(var r=(e.mode&1)!==0;Je!==null;){var a=Je,i=a.child;if(a.tag===22&&r){var s=a.memoizedState!==null||ou;if(!s){var l=a.alternate,c=l!==null&&l.memoizedState!==null||Vn;l=ou;var u=Vn;if(ou=s,(Vn=c)&&!u)for(Je=a;Je!==null;)s=Je,c=s.child,s.tag===22&&s.memoizedState!==null?b_(a):c!==null?(c.return=s,Je=c):b_(a);for(;i!==null;)Je=i,y5(i),i=i.sibling;Je=a,ou=l,Vn=u}x_(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,Je=i):x_(e)}}function x_(e){for(;Je!==null;){var t=Je;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Vn||Qd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Vn)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:ea(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&t_(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}t_(t,s,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Fl(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Pe(163))}Vn||t.flags&512&&Jy(t)}catch(g){yn(t,t.return,g)}}if(t===e){Je=null;break}if(n=t.sibling,n!==null){n.return=t.return,Je=n;break}Je=t.return}}function y_(e){for(;Je!==null;){var t=Je;if(t===e){Je=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Je=n;break}Je=t.return}}function b_(e){for(;Je!==null;){var t=Je;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Qd(4,t)}catch(c){yn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){yn(t,a,c)}}var i=t.return;try{Jy(t)}catch(c){yn(t,i,c)}break;case 5:var s=t.return;try{Jy(t)}catch(c){yn(t,s,c)}}}catch(c){yn(t,t.return,c)}if(t===e){Je=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Je=l;break}Je=t.return}}var zO=Math.ceil,bd=Ka.ReactCurrentDispatcher,Cv=Ka.ReactCurrentOwner,Hr=Ka.ReactCurrentBatchConfig,Ft=0,Mn=null,kn=null,Fn=0,Sr=0,so=Oi(0),jn=0,Yl=null,gs=0,Zd=0,jv=0,El=null,gr=null,Tv=0,wo=1/0,La=null,vd=!1,nb=null,Ni=null,lu=!1,yi=null,kd=0,Sl=0,rb=null,qu=-1,Wu=0;function ir(){return Ft&6?bn():qu!==-1?qu:qu=bn()}function Ci(e){return e.mode&1?Ft&2&&Fn!==0?Fn&-Fn:wO.transition!==null?(Wu===0&&(Wu=nT()),Wu):(e=Ht,e!==0||(e=window.event,e=e===void 0?16:cT(e.type)),e):1}function aa(e,t,n,r){if(50<Sl)throw Sl=0,rb=null,Error(Pe(185));dc(e,n,r),(!(Ft&2)||e!==Mn)&&(e===Mn&&(!(Ft&2)&&(Zd|=n),jn===4&&gi(e,Fn)),xr(e,r),n===1&&Ft===0&&!(t.mode&1)&&(wo=bn()+500,Kd&&Di()))}function xr(e,t){var n=e.callbackNode;wL(e,t);var r=ad(e,e===Mn?Fn:0);if(r===0)n!==null&&jk(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&jk(n),t===1)e.tag===0?_O(v_.bind(null,e)):jT(v_.bind(null,e)),yO(function(){!(Ft&6)&&Di()}),n=null;else{switch(rT(r)){case 1:n=tv;break;case 4:n=eT;break;case 16:n=rd;break;case 536870912:n=tT;break;default:n=rd}n=N5(n,b5.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function b5(e,t){if(qu=-1,Wu=0,Ft&6)throw Error(Pe(327));var n=e.callbackNode;if(go()&&e.callbackNode!==n)return null;var r=ad(e,e===Mn?Fn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=_d(e,r);else{t=r;var a=Ft;Ft|=2;var i=k5();(Mn!==e||Fn!==t)&&(La=null,wo=bn()+500,is(e,t));do try{HO();break}catch(l){v5(e,l)}while(!0);pv(),bd.current=i,Ft=a,kn!==null?t=0:(Mn=null,Fn=0,t=jn)}if(t!==0){if(t===2&&(a=Ay(e),a!==0&&(r=a,t=ab(e,a))),t===1)throw n=Yl,is(e,0),gi(e,r),xr(e,bn()),n;if(t===6)gi(e,r);else{if(a=e.current.alternate,!(r&30)&&!UO(a)&&(t=_d(e,r),t===2&&(i=Ay(e),i!==0&&(r=i,t=ab(e,i))),t===1))throw n=Yl,is(e,0),gi(e,r),xr(e,bn()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(Pe(345));case 2:Xi(e,gr,La);break;case 3:if(gi(e,r),(r&130023424)===r&&(t=Tv+500-bn(),10<t)){if(ad(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){ir(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Fy(Xi.bind(null,e,gr,La),t);break}Xi(e,gr,La);break;case 4:if(gi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var s=31-ra(r);i=1<<s,s=t[s],s>a&&(a=s),r&=~i}if(r=a,r=bn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*zO(r/1960))-r,10<r){e.timeoutHandle=Fy(Xi.bind(null,e,gr,La),r);break}Xi(e,gr,La);break;case 5:Xi(e,gr,La);break;default:throw Error(Pe(329))}}}return xr(e,bn()),e.callbackNode===n?b5.bind(null,e):null}function ab(e,t){var n=El;return e.current.memoizedState.isDehydrated&&(is(e,t).flags|=256),e=_d(e,t),e!==2&&(t=gr,gr=n,t!==null&&ib(t)),e}function ib(e){gr===null?gr=e:gr.push.apply(gr,e)}function UO(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!oa(i(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function gi(e,t){for(t&=~jv,t&=~Zd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ra(t),r=1<<n;e[n]=-1,t&=~r}}function v_(e){if(Ft&6)throw Error(Pe(327));go();var t=ad(e,0);if(!(t&1))return xr(e,bn()),null;var n=_d(e,t);if(e.tag!==0&&n===2){var r=Ay(e);r!==0&&(t=r,n=ab(e,r))}if(n===1)throw n=Yl,is(e,0),gi(e,t),xr(e,bn()),n;if(n===6)throw Error(Pe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Xi(e,gr,La),xr(e,bn()),null}function Av(e,t){var n=Ft;Ft|=1;try{return e(t)}finally{Ft=n,Ft===0&&(wo=bn()+500,Kd&&Di())}}function ps(e){yi!==null&&yi.tag===0&&!(Ft&6)&&go();var t=Ft;Ft|=1;var n=Hr.transition,r=Ht;try{if(Hr.transition=null,Ht=1,e)return e()}finally{Ht=r,Hr.transition=n,Ft=t,!(Ft&6)&&Di()}}function Rv(){Sr=so.current,tn(so)}function is(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xO(n)),kn!==null)for(n=kn.return;n!==null;){var r=n;switch(dv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&cd();break;case 3:ko(),tn(hr),tn(Xn),vv();break;case 5:bv(r);break;case 4:ko();break;case 13:tn(fn);break;case 19:tn(fn);break;case 10:hv(r.type._context);break;case 22:case 23:Rv()}n=n.return}if(Mn=e,kn=e=ji(e.current,null),Fn=Sr=t,jn=0,Yl=null,jv=Zd=gs=0,gr=El=null,es!==null){for(t=0;t<es.length;t++)if(n=es[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=a,r.next=s}n.pending=r}es=null}return e}function v5(e,t){do{var n=kn;try{if(pv(),Uu.current=yd,xd){for(var r=gn.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}xd=!1}if(fs=0,In=Nn=gn=null,_l=!1,Vl=0,Cv.current=null,n===null||n.return===null){jn=1,Yl=t,kn=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=Fn,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var g=d.alternate;g?(d.updateQueue=g.updateQueue,d.memoizedState=g.memoizedState,d.lanes=g.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=o_(s);if(p!==null){p.flags&=-257,l_(p,s,l,i,t),p.mode&1&&s_(i,u,t),t=p,c=u;var m=t.updateQueue;if(m===null){var y=new Set;y.add(c),t.updateQueue=y}else m.add(c);break e}else{if(!(t&1)){s_(i,u,t),Iv();break e}c=Error(Pe(426))}}else if(on&&l.mode&1){var v=o_(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),l_(v,s,l,i,t),fv(_o(c,l));break e}}i=c=_o(c,l),jn!==4&&(jn=2),El===null?El=[i]:El.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=r5(i,c,t);e_(i,x);break e;case 1:l=c;var b=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Ni===null||!Ni.has(k)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=a5(i,l,t);e_(i,S);break e}}i=i.return}while(i!==null)}w5(n)}catch(E){t=E,kn===n&&n!==null&&(kn=n=n.return);continue}break}while(!0)}function k5(){var e=bd.current;return bd.current=yd,e===null?yd:e}function Iv(){(jn===0||jn===3||jn===2)&&(jn=4),Mn===null||!(gs&268435455)&&!(Zd&268435455)||gi(Mn,Fn)}function _d(e,t){var n=Ft;Ft|=2;var r=k5();(Mn!==e||Fn!==t)&&(La=null,is(e,t));do try{$O();break}catch(a){v5(e,a)}while(!0);if(pv(),Ft=n,bd.current=r,kn!==null)throw Error(Pe(261));return Mn=null,Fn=0,jn}function $O(){for(;kn!==null;)_5(kn)}function HO(){for(;kn!==null&&!pL();)_5(kn)}function _5(e){var t=S5(e.alternate,e,Sr);e.memoizedProps=e.pendingProps,t===null?w5(e):kn=t,Cv.current=null}function w5(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=DO(n,t),n!==null){n.flags&=32767,kn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{jn=6,kn=null;return}}else if(n=OO(n,t,Sr),n!==null){kn=n;return}if(t=t.sibling,t!==null){kn=t;return}kn=t=e}while(t!==null);jn===0&&(jn=5)}function Xi(e,t,n){var r=Ht,a=Hr.transition;try{Hr.transition=null,Ht=1,qO(e,t,n,r)}finally{Hr.transition=a,Ht=r}return null}function qO(e,t,n,r){do go();while(yi!==null);if(Ft&6)throw Error(Pe(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Pe(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(EL(e,i),e===Mn&&(kn=Mn=null,Fn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||lu||(lu=!0,N5(rd,function(){return go(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Hr.transition,Hr.transition=null;var s=Ht;Ht=1;var l=Ft;Ft|=4,Cv.current=null,FO(e,n),x5(n,e),uO(Dy),id=!!Oy,Dy=Oy=null,e.current=n,BO(n),hL(),Ft=l,Ht=s,Hr.transition=i}else e.current=n;if(lu&&(lu=!1,yi=e,kd=a),i=e.pendingLanes,i===0&&(Ni=null),yL(n.stateNode),xr(e,bn()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(vd)throw vd=!1,e=nb,nb=null,e;return kd&1&&e.tag!==0&&go(),i=e.pendingLanes,i&1?e===rb?Sl++:(Sl=0,rb=e):Sl=0,Di(),null}function go(){if(yi!==null){var e=rT(kd),t=Hr.transition,n=Ht;try{if(Hr.transition=null,Ht=16>e?16:e,yi===null)var r=!1;else{if(e=yi,yi=null,kd=0,Ft&6)throw Error(Pe(331));var a=Ft;for(Ft|=4,Je=e.current;Je!==null;){var i=Je,s=i.child;if(Je.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Je=u;Je!==null;){var d=Je;switch(d.tag){case 0:case 11:case 15:wl(8,d,i)}var f=d.child;if(f!==null)f.return=d,Je=f;else for(;Je!==null;){d=Je;var g=d.sibling,p=d.return;if(p5(d),d===u){Je=null;break}if(g!==null){g.return=p,Je=g;break}Je=p}}}var m=i.alternate;if(m!==null){var y=m.child;if(y!==null){m.child=null;do{var v=y.sibling;y.sibling=null,y=v}while(y!==null)}}Je=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,Je=s;else e:for(;Je!==null;){if(i=Je,i.flags&2048)switch(i.tag){case 0:case 11:case 15:wl(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,Je=x;break e}Je=i.return}}var b=e.current;for(Je=b;Je!==null;){s=Je;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,Je=k;else e:for(s=b;Je!==null;){if(l=Je,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Qd(9,l)}}catch(E){yn(l,l.return,E)}if(l===s){Je=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,Je=S;break e}Je=l.return}}if(Ft=a,Di(),ka&&typeof ka.onPostCommitFiberRoot=="function")try{ka.onPostCommitFiberRoot(Hd,e)}catch{}r=!0}return r}finally{Ht=n,Hr.transition=t}}return!1}function k_(e,t,n){t=_o(n,t),t=r5(e,t,1),e=Si(e,t,1),t=ir(),e!==null&&(dc(e,1,t),xr(e,t))}function yn(e,t,n){if(e.tag===3)k_(e,e,n);else for(;t!==null;){if(t.tag===3){k_(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ni===null||!Ni.has(r))){e=_o(n,e),e=a5(t,e,1),t=Si(t,e,1),e=ir(),t!==null&&(dc(t,1,e),xr(t,e));break}}t=t.return}}function WO(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ir(),e.pingedLanes|=e.suspendedLanes&n,Mn===e&&(Fn&n)===n&&(jn===4||jn===3&&(Fn&130023424)===Fn&&500>bn()-Tv?is(e,0):jv|=n),xr(e,t)}function E5(e,t){t===0&&(e.mode&1?(t=Zc,Zc<<=1,!(Zc&130023424)&&(Zc=4194304)):t=1);var n=ir();e=Wa(e,t),e!==null&&(dc(e,t,n),xr(e,n))}function VO(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),E5(e,n)}function GO(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Pe(314))}r!==null&&r.delete(t),E5(e,n)}var S5;S5=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||hr.current)pr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pr=!1,LO(e,t,n);pr=!!(e.flags&131072)}else pr=!1,on&&t.flags&1048576&&TT(t,fd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hu(e,t),e=t.pendingProps;var a=yo(t,Xn.current);fo(t,n),a=_v(null,t,r,e,a,n);var i=wv();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,mr(r)?(i=!0,ud(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,xv(t),a.updater=Xd,t.stateNode=a,a._reactInternals=t,Wy(t,r,e,n),t=Ky(null,t,r,!0,i,n)):(t.tag=0,on&&i&&uv(t),rr(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hu(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=YO(r),e=ea(r,e),a){case 0:t=Gy(null,t,r,e,n);break e;case 1:t=d_(null,t,r,e,n);break e;case 11:t=c_(null,t,r,e,n);break e;case 14:t=u_(null,t,r,ea(r.type,e),n);break e}throw Error(Pe(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),Gy(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),d_(e,t,r,a,n);case 3:e:{if(l5(t),e===null)throw Error(Pe(387));r=t.pendingProps,i=t.memoizedState,a=i.element,OT(e,t),hd(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=_o(Error(Pe(423)),t),t=f_(e,t,r,n,a);break e}else if(r!==a){a=_o(Error(Pe(424)),t),t=f_(e,t,r,n,a);break e}else for(jr=Ei(t.stateNode.containerInfo.firstChild),Tr=t,on=!0,na=null,n=MT(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bo(),r===a){t=Va(e,t,n);break e}rr(e,t,r,n)}t=t.child}return t;case 5:return DT(t),e===null&&$y(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,s=a.children,Py(r,a)?s=null:i!==null&&Py(r,i)&&(t.flags|=32),o5(e,t),rr(e,t,s,n),t.child;case 6:return e===null&&$y(t),null;case 13:return c5(e,t,n);case 4:return yv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vo(t,null,r,n):rr(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),c_(e,t,r,a,n);case 7:return rr(e,t,t.pendingProps,n),t.child;case 8:return rr(e,t,t.pendingProps.children,n),t.child;case 12:return rr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,s=a.value,Qt(gd,r._currentValue),r._currentValue=s,i!==null)if(oa(i.value,s)){if(i.children===a.children&&!hr.current){t=Va(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Ua(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Hy(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(Pe(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Hy(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}rr(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,fo(t,n),a=qr(a),r=r(a),t.flags|=1,rr(e,t,r,n),t.child;case 14:return r=t.type,a=ea(r,t.pendingProps),a=ea(r.type,a),u_(e,t,r,a,n);case 15:return i5(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),Hu(e,t),t.tag=1,mr(r)?(e=!0,ud(t)):e=!1,fo(t,n),n5(t,r,a),Wy(t,r,a,n),Ky(null,t,r,!0,e,n);case 19:return u5(e,t,n);case 22:return s5(e,t,n)}throw Error(Pe(156,t.tag))};function N5(e,t){return Jj(e,t)}function KO(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zr(e,t,n,r){return new KO(e,t,n,r)}function Mv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function YO(e){if(typeof e=="function")return Mv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Zb)return 11;if(e===Jb)return 14}return 2}function ji(e,t){var n=e.alternate;return n===null?(n=zr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Vu(e,t,n,r,a,i){var s=2;if(r=e,typeof e=="function")Mv(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Xs:return ss(n.children,a,i,t);case Qb:s=8,a|=8;break;case hy:return e=zr(12,n,t,a|2),e.elementType=hy,e.lanes=i,e;case my:return e=zr(13,n,t,a),e.elementType=my,e.lanes=i,e;case xy:return e=zr(19,n,t,a),e.elementType=xy,e.lanes=i,e;case Dj:return Jd(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Lj:s=10;break e;case Oj:s=9;break e;case Zb:s=11;break e;case Jb:s=14;break e;case ui:s=16,r=null;break e}throw Error(Pe(130,e==null?e:typeof e,""))}return t=zr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function ss(e,t,n,r){return e=zr(7,e,r,t),e.lanes=n,e}function Jd(e,t,n,r){return e=zr(22,e,r,t),e.elementType=Dj,e.lanes=n,e.stateNode={isHidden:!1},e}function Tg(e,t,n){return e=zr(6,e,null,t),e.lanes=n,e}function Ag(e,t,n){return t=zr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function XO(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ug(0),this.expirationTimes=ug(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ug(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Lv(e,t,n,r,a,i,s,l,c){return e=new XO(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=zr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xv(i),e}function QO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ys,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function C5(e){if(!e)return Ri;e=e._reactInternals;e:{if(ys(e)!==e||e.tag!==1)throw Error(Pe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Pe(171))}if(e.tag===1){var n=e.type;if(mr(n))return CT(e,n,t)}return t}function j5(e,t,n,r,a,i,s,l,c){return e=Lv(n,r,!0,e,a,i,s,l,c),e.context=C5(null),n=e.current,r=ir(),a=Ci(n),i=Ua(r,a),i.callback=t??null,Si(n,i,a),e.current.lanes=a,dc(e,a,r),xr(e,r),e}function ef(e,t,n,r){var a=t.current,i=ir(),s=Ci(a);return n=C5(n),t.context===null?t.context=n:t.pendingContext=n,t=Ua(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Si(a,t,s),e!==null&&(aa(e,a,s,i),zu(e,a,s)),s}function wd(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 __(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ov(e,t){__(e,t),(e=e.alternate)&&__(e,t)}function ZO(){return null}var T5=typeof reportError=="function"?reportError:function(e){console.error(e)};function Dv(e){this._internalRoot=e}tf.prototype.render=Dv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Pe(409));ef(e,t,null,null)};tf.prototype.unmount=Dv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ps(function(){ef(null,e,null,null)}),t[qa]=null}};function tf(e){this._internalRoot=e}tf.prototype.unstable_scheduleHydration=function(e){if(e){var t=sT();e={blockedOn:null,target:e,priority:t};for(var n=0;n<fi.length&&t!==0&&t<fi[n].priority;n++);fi.splice(n,0,e),n===0&&lT(e)}};function Pv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function nf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function w_(){}function JO(e,t,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var u=wd(s);i.call(u)}}var s=j5(t,r,e,0,null,!1,!1,"",w_);return e._reactRootContainer=s,e[qa]=s.current,Ul(e.nodeType===8?e.parentNode:e),ps(),s}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var u=wd(c);l.call(u)}}var c=Lv(e,0,!1,null,null,!1,!1,"",w_);return e._reactRootContainer=c,e[qa]=c.current,Ul(e.nodeType===8?e.parentNode:e),ps(function(){ef(t,c,n,r)}),c}function rf(e,t,n,r,a){var i=n._reactRootContainer;if(i){var s=i;if(typeof a=="function"){var l=a;a=function(){var c=wd(s);l.call(c)}}ef(t,s,e,a)}else s=JO(n,t,e,a,r);return wd(s)}aT=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ol(t.pendingLanes);n!==0&&(nv(t,n|1),xr(t,bn()),!(Ft&6)&&(wo=bn()+500,Di()))}break;case 13:ps(function(){var r=Wa(e,1);if(r!==null){var a=ir();aa(r,e,1,a)}}),Ov(e,1)}};rv=function(e){if(e.tag===13){var t=Wa(e,134217728);if(t!==null){var n=ir();aa(t,e,134217728,n)}Ov(e,134217728)}};iT=function(e){if(e.tag===13){var t=Ci(e),n=Wa(e,t);if(n!==null){var r=ir();aa(n,e,t,r)}Ov(e,t)}};sT=function(){return Ht};oT=function(e,t){var n=Ht;try{return Ht=e,t()}finally{Ht=n}};Cy=function(e,t,n){switch(t){case"input":if(vy(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=Gd(r);if(!a)throw Error(Pe(90));Fj(r),vy(r,a)}}}break;case"textarea":zj(e,n);break;case"select":t=n.value,t!=null&&oo(e,!!n.multiple,t,!1)}};Gj=Av;Kj=ps;var eD={usingClientEntryPoint:!1,Events:[gc,eo,Gd,Wj,Vj,Av]},Zo={findFiberByHostInstance:Ji,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tD={bundleType:Zo.bundleType,version:Zo.version,rendererPackageName:Zo.rendererPackageName,rendererConfig:Zo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ka.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Qj(e),e===null?null:e.stateNode},findFiberByHostInstance:Zo.findFiberByHostInstance||ZO,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 cu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cu.isDisabled&&cu.supportsFiber)try{Hd=cu.inject(tD),ka=cu}catch{}}Mr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eD;Mr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Pv(t))throw Error(Pe(200));return QO(e,t,null,n)};Mr.createRoot=function(e,t){if(!Pv(e))throw Error(Pe(299));var n=!1,r="",a=T5;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=Lv(e,1,!1,null,null,n,!1,r,a),e[qa]=t.current,Ul(e.nodeType===8?e.parentNode:e),new Dv(t)};Mr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Pe(188)):(e=Object.keys(e).join(","),Error(Pe(268,e)));return e=Qj(t),e=e===null?null:e.stateNode,e};Mr.flushSync=function(e){return ps(e)};Mr.hydrate=function(e,t,n){if(!nf(t))throw Error(Pe(200));return rf(null,e,t,!0,n)};Mr.hydrateRoot=function(e,t,n){if(!Pv(e))throw Error(Pe(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",s=T5;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=j5(t,null,e,1,n??null,a,!1,i,s),e[qa]=t.current,Ul(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new tf(t)};Mr.render=function(e,t,n){if(!nf(t))throw Error(Pe(200));return rf(null,e,t,!1,n)};Mr.unmountComponentAtNode=function(e){if(!nf(e))throw Error(Pe(40));return e._reactRootContainer?(ps(function(){rf(null,null,e,!1,function(){e._reactRootContainer=null,e[qa]=null})}),!0):!1};Mr.unstable_batchedUpdates=Av;Mr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!nf(n))throw Error(Pe(200));if(e==null||e._reactInternals===void 0)throw Error(Pe(38));return rf(e,t,n,!1,r)};Mr.version="18.3.1-next-f1338f8080-20240426";function A5(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(A5)}catch(e){console.error(e)}}A5(),Aj.exports=Mr;var Fv=Aj.exports;const nD=No(Fv);var E_=Fv;gy.createRoot=E_.createRoot,gy.hydrateRoot=E_.hydrateRoot;const rD="modulepreload",aD=function(e){return"/"+e},S_={},R5=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),l=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));a=Promise.allSettled(n.map(c=>{if(c=aD(c),c in S_)return;S_[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":rD,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((g,p)=>{f.addEventListener("load",g),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return a.then(s=>{for(const l of s||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},$a={"planCard.heading":"Plan ready — what next?","planCard.showPlan":"Show the plan","planCard.execute":"Switch to build & execute","planCard.keepPlanning":"Keep planning","planCard.executedStatus":"Switched to build mode — executing the plan.","planCard.dismissedStatus":"Staying in plan mode.","planCard.close":"Close","planCard.loading":"Loading…","planCard.loadError":"Couldn't load the plan.","planCard.executePrompt":"Implement the plan in PLAN.md. Follow it step by step.","agent_conversation.back":"Back","agent_conversation.message_count":"{name} - {count} messages","agent_conversation.message_queued":"Message queued for agent","agent_conversation.no_messages":"No messages yet","agent_conversation.no_messages_hint":"Use the Send Message button to contact the agent","agent_conversation.compose_button":"Send Message","agent_conversation.modal_title":"Send Message to {name}","agent_conversation.reply_to_inbox":"Notify me when complete","agent_conversation.urgent_interrupt_button":"Send Urgent Interrupt","agent_conversation.urgent_warning":"This will interrupt the agent’s current work immediately. Click again to confirm.","agent_conversation.confirm_interrupt":"Confirm Interrupt","agent_conversation.priority":"Priority:","agent_conversation.priority_high":"High","agent_conversation.priority_normal":"Normal","agent_conversation.priority_urgent":"Urgent","agent_conversation.priority_urgent_confirm":"This will send an urgent interrupt that aborts the agent's current work. Continue?","agent_conversation.priority_urgent_title":"Send Urgent Interrupt","agent_conversation.priority_urgent_hint":"Urgent: This will interrupt the agent’s current work immediately","agent_conversation.interrupt_button":"Interrupt","agent_conversation.interrupt_sent":"Urgent interrupt sent to agent","agent_conversation.queue_hint":"Messages are queued in the agent's inbox and processed on next wake","agent_conversation.refresh":"Refresh","agent_conversation.send_button":"Send","agent_conversation.send_placeholder":"Send a message to the agent's inbox...","agent_conversation.sending":"Sending","agent_conversation.title":"Conversation","confirm_dialog.cancel":"Cancel","confirm_dialog.confirm":"Confirm","agent_create.cancel":"Cancel","agent_create.configure_subtitle":"Configure your autonomous agent","agent_create.custom_model":"Custom model...","agent_create.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_create.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_create.deselect_all":"Deselect All","agent_create.display_name_hint":"Human-friendly name shown in the UI","agent_create.display_name_label":"Display Name (optional)","agent_create.display_name_placeholder":"e.g., My Development Agent","agent_create.dormant_mode":"Start in dormant mode","agent_create.dormant_mode_desc":"Agent will not process AGENTS.md on startup. It waits until it receives an inbox message.","agent_create.instructions_label":"Agent Instructions (AGENTS.md)","agent_create.instructions_optional":"(optional)","agent_create.instructions_hint":"Instructions and context for the agent. Written to workspace/AGENTS.md if workspace is set.","agent_create.loading_models":"Loading models...","agent_create.loading_skills":"Loading skills...","agent_create.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_create.model_label":"Model *","agent_create.model_placeholder":"github-copilot/claude-opus-4.6","agent_create.name_generate":"Generate random name","agent_create.name_hint":"Lowercase letters, numbers, hyphens, and underscores only","agent_create.name_label":"Agent Name *","agent_create.name_placeholder":"e.g., swift-falcon","agent_create.no_skills":"No skills installed","agent_create.random":"Random","agent_create.reset_default":"Reset to Default","agent_create.select_all":"Select All","agent_create.skills_label":"Skills","agent_create.skills_selected":"Skills selected: {count}","agent_create.soul_label":"Soul / Instructions (AGENTS.md)","agent_create.soul_placeholder":"# AGENTS.md content...","agent_create.spawn":"Spawn Agent","agent_create.spawning":"Spawning...","agent_create.start_mode":"Start Mode","agent_create.title":"Spawn New Agent","agent_create.validate_model":"Please select a model","agent_create.validate_workspace":"Workspace directory is required","agent_create.working_dir_hint":"The agent's working directory for file operations","agent_create.working_dir_label":"Workspace Directory *","agent_create.working_dir_placeholder":"/path/to/project","agent_detail.action_deleted":"Agent deleted","agent_detail.action_updated":"Settings updated successfully","agent_detail.agent_info":"Agent Info","agent_detail.back":"Back to agents list","agent_detail.edit_settings":"Edit Settings","agent_detail.failed_to_load":"Failed to load agent:","agent_detail.iteration":"Iteration","agent_detail.model":"Model","agent_detail.pid":"PID","agent_detail.port":"Port","agent_detail.session_id":"Session ID","agent_detail.soul_file":"Soul File","agent_detail.start_mode":"Start mode","agent_detail.start_mode_dormant":"Dormant","agent_detail.start_mode_normal":"Normal","agent_detail.started":"Started","agent_detail.status":"Status","agent_detail.stopped":"stopped","agent_detail.token_cached":"Cached","agent_detail.token_input":"Input","agent_detail.token_output":"Output","agent_detail.token_usage":"Token Usage","agent_detail.total_cost":"Total Cost","agent_detail.unknown_agent":"Unknown Agent","agent_detail.uptime":"Uptime","agent_detail.view_conversation":"View Conversation","agent_detail.working_dir":"Working Dir","agent_detail.working_dir_label":"Working Dir:","agent_edit.cannot_change":"(cannot be changed)","agent_edit.custom_model":"Custom model...","agent_edit.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_edit.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_edit.deselect_all":"Deselect All","agent_edit.display_name_label":"Display Name","agent_edit.display_name_placeholder":"Human-friendly name","agent_edit.dormant_mode":"Start in dormant mode","agent_edit.dormant_mode_desc":"Agent will not process AGENTS.md on startup. Takes effect on next start.","agent_edit.instructions_label":"Agent Instructions (AGENTS.md)","agent_edit.instructions_hint":"Instructions and context for the agent. This file is re-read when the agent starts or when hot-reloaded.","agent_edit.loading_models":"Loading models...","agent_edit.loading_skills":"Loading skills...","agent_edit.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_edit.model_label":"Model","agent_edit.model_placeholder":"e.g., github-copilot/claude-opus-4.6","agent_edit.name_label":"Agent Name","agent_edit.no_skills":"No skills installed","agent_edit.no_workspace_warning":"No workspace configured. AGENTS.md cannot be edited without a workspace directory.","agent_edit.not_set":"Not set","agent_edit.running_warning":"Running - restart required for changes","agent_edit.save":"Save Changes","agent_edit.saved":"Settings saved successfully","agent_edit.saving":"Saving...","agent_edit.select_all":"Select All","agent_edit.skills_label":"Skills","agent_edit.skills_selected":"Skills selected: {count}","agent_edit.soul_placeholder":"# AGENTS.md content...","agent_edit.start_mode":"Start Mode","agent_edit.stop_to_change":"Stop the agent to change workspace","agent_edit.tab_general":"General","agent_edit.tab_soul":"AGENTS.md","agent_edit.title":"Edit Agent Settings","agent_edit.will_be_created":"(will be created)","agent_edit.working_dir_hint":"The agent's working directory for file operations","agent_edit.working_dir_label":"Workspace Directory *","agent_edit.working_dir_placeholder":"/path/to/project","agent_edit.workspace_changed_warning":"Workspace has changed. AGENTS.md editing is disabled to prevent overwriting files in the new workspace. Save your changes, then re-open settings to edit AGENTS.md in the new workspace.","agent_edit.workspace_move_warning":"Changing workspace will not move existing AGENTS.md. You may need to re-configure the agent's instructions.","agents.back_to_chat":"Back to Chat","agents.collapse_panel":"Collapse panel","agents.expand_panel":"Expand panel","agents.no_agents_desc":"Spawn your first autonomous agent to get started","agents.no_agents_title":"No agents yet","agents.model_label":"Model: {model}","agents.resize_terminal":"Resize terminal panel","agents.back":"Back","agents.iteration":"Iter","agents.pid":"PID","agents.port":"Port","agents.refresh":"Refresh","agents.restart":"Restart","agents.restarting":"Restarting...","agents.clean_restart":"Clean Restart","agents.clean_restart_tooltip":"Restart with a new session (starts a fresh conversation)","agents.spawn_button":"Spawn Agent","agents.start":"Start","agents.starting":"Starting...","agents.stop":"Stop","agents.stopping":"Stopping...","agents.subtitle":"Manage autonomous agents","agents.title":"Agents","agents.uptime":"Uptime","agents.drop_to_import":"Drop YAML file to import agent","agents.export":"Export","agents.export_error":"Failed to export agent","agents.import":"Import","agents.import_button":"Import Agent","agents.import_error":"Failed to import agent","agents.import_invalid_file":"Invalid file type. Please select a .yaml or .yml file.","agents.import_file_too_large":"File too large (max 10MB)","agents.import_read_error":"Failed to read file","agents.import_success":"Agent imported successfully","agents.view_details":"Agent details","agents.pause":"Pause","agents.pausing":"Pausing...","agents.unpause":"Unpause","agents.resume":"Resume","agents.resuming":"Resuming...","agents.paused":"Paused","agents.select":"Select","agents.selected":"{count} selected","agents.selectAll":"Select All","agents.deselectAll":"Deselect All","agents.pauseAll":"Pause All","agents.unpauseAll":"Unpause All","agents.stopAll":"Stop All","agents.restartAll":"Restart All","agents.startAll":"Start All","app.agents_tab":"Agents","app.chat_tab":"Chat","app.close_search":"Close search","app.activities_panel":"Activities","app.close_activities":"Close activities panel","app.dismiss_error":"Dismiss error","app.hacker_mode_enter":"Enter hacker mode (Ctrl+H or Ctrl+Shift+M)","app.hacker_mode_exit":"Exit hacker mode (Ctrl+H or Ctrl+Shift+M)","app.match_count":"{current} of {total}","app.new_chat":"New Chat","app.next_match":"Next match","app.no_matches":"No matches","app.previous_match":"Previous match","app.reconnecting":"Reconnecting to server...","app.resize_terminal":"Resize terminal panel","app.right_pane_hidden":"Activities panel hidden","app.right_pane_shown":"Activities panel shown","app.search_messages":"Search messages","app.search_placeholder":"Search in conversation...","app.settings_tab":"Settings","app.skills_tab":"Skills","app.toggle_right_pane":"Toggle activities panel ({shortcut})","app.welcome_start":"Start a conversation to get going.","app.welcome_subtitle":"Your AI-powered development assistant","app.welcome_title":"Welcome to PAVE","chat.attach_image":"Attach image","chat.attach_file":"Attach file (image, docx, pdf, text)","chat.attachment":"Attachment","chat.attachment_with_index":"Attachment {index}","chat.copied":"Copied!","chat.copy":"Copy","chat.copy_message":"Copy message","chat.cancel_queued":"Remove from queue","chat.queued":"Queued","chat.edit_queued":"Edit queued message","chat.edit_resend":"Edit and resend","chat.read_only":"Read-only","chat.read_only_desc":"This is a read-only session from the TUI. Messages cannot be sent.","chat.regenerate":"Regenerate response","chat.scroll_to_bottom":"Scroll to bottom","chat.send_button":"Send message","chat.send_hint":"Press Enter to send, Shift+Enter for new line. Type / for commands","chat.send_placeholder":"Send a message...","chat.stop_generating":"Stop generating","chat.tool_bash":"Running command","chat.tool_edit":"Editing file","chat.tool_glob":"Searching files","chat.tool_grep":"Searching code","chat.tool_preparing":"Preparing tool call","chat.tool_preparing_name":"Preparing {name}","chat.tool_read":"Reading file","chat.tool_write":"Writing file","chat.viewing_terminal":"Viewing Terminal session (read-only)","chat.yesterday":"Yesterday","chat.yesterday_time":"Yesterday {time}","chat.viewing_archive":"Viewing archived session (read-only)","chat.compacting_context":"Compacting context","chat.compacted_switch_to_new":"Compacted — switch to new session","chat.unpin_compacted":"Unpin — go back to original","chat.show_thinking":"Show thinking","chat.hide_thinking":"Hide thinking","chat.thinking":"Thinking","chat.whatsapp_enabled":"WhatsApp mode enabled - assistant replies will be sent to WhatsApp","chat.whatsapp_disabled":"Enable WhatsApp two-way mode","chat.whatsapp_no_chatid":"Set PAVE_WHATSAPP_CHAT_ID in Settings before enabling WhatsApp routing","chat.working_directory":"Working Directory","chat.working_directory_current":"Current:","chat.working_directory_recent":"Recent:","chat.working_directory_change":"Change","chat.working_directory_cancel":"Cancel","chat.working_directory_create":"Create Directory","chat.working_directory_not_found":"Directory does not exist","chat.working_directory_invalid":"Invalid path","chat.working_directory_checking":"Checking path...","chat.working_directory_changed":"Working directory changed to {path}","chat.working_directory_created":"Directory created: {path}","chat.working_directory_create_failed":"Failed to create directory: {error}","chat.working_directory_remove_recent":"Remove from recent","chat.working_directory_has_agents_md":"Contains AGENTS.md","chat.working_directory_no_agents_md":"No AGENTS.md in this directory","chat.working_directory_new_path":"New path","chat.working_directory_placeholder":"/path/to/directory or ~/projects/...","chat.working_directory_not_set":"(not set)","chat.idle_injection_title":"Idle Injection","chat.idle_injection_toggle":"Enable idle injection","chat.idle_injection_message":"Injection message","chat.idle_injection_message_placeholder":"Message to inject when idle","chat.idle_injection_interval":"Idle interval (seconds)","chat.idle_injection_interval_desc":"How long to wait after the LLM finishes responding before injecting.","chat.idle_injection_max":"Max injections (0 = unlimited)","chat.idle_injection_max_desc":"Stops injecting after this many times. 0 means no limit.","chat.idle_injection_timeout_toggle":"Enable LLM timeout detection","chat.idle_injection_timeout_toggle_desc":"Detect when the LLM is stuck (no response) and re-inject.","chat.idle_injection_timeout_threshold":"Timeout threshold (seconds)","chat.idle_injection_timeout_threshold_desc":"How long to wait for the first token before considering the LLM hung.","chat.idle_injection_timeout_cooldown":"Timeout cooldown (seconds)","chat.idle_injection_timeout_cooldown_desc":"How long to wait after a timeout before re-injecting.","chat.idle_injection_save":"Save","chat.idle_injection_disable":"Disable","chat.idle_injection_saving":"Saving...","chat.idle_injection_disabling":"Disabling...","chat.idle_injection_saved":"Settings saved","chat.idle_injection_disabled_toast":"Idle injection disabled","chat.idle_injection_enabled_toast":"Idle injection enabled","chat.idle_injection_fired_toast":"Idle injection fired","chat.idle_injection_timeout_toast":"LLM timeout detected — retrying","chat.idle_injection_auto_badge":"auto","scheduled_injection.title":"Scheduled Injections","scheduled_injection.subtitle":"Automatically inject messages at scheduled times","scheduled_injection.add":"Add Schedule","scheduled_injection.empty":"No schedules configured. Add one above.","scheduled_injection.time":"Time","scheduled_injection.repeat":"Repeat","scheduled_injection.repeat_every_day":"Every day","scheduled_injection.repeat_weekdays":"Weekdays","scheduled_injection.repeat_weekends":"Weekends","scheduled_injection.repeat_custom":"Custom","scheduled_injection.timezone":"Timezone","scheduled_injection.message":"Message (optional)","scheduled_injection.message_placeholder":"Leave empty for default check-in message","scheduled_injection.enabled":"Enabled","scheduled_injection.save":"Save Schedule","scheduled_injection.saving":"Saving...","scheduled_injection.delete":"Delete","scheduled_injection.day_sun":"Sun","scheduled_injection.day_mon":"Mon","scheduled_injection.day_tue":"Tue","scheduled_injection.day_wed":"Wed","scheduled_injection.day_thu":"Thu","scheduled_injection.day_fri":"Fri","scheduled_injection.day_sat":"Sat","scheduled_injection.fired_toast":"Scheduled injection fired","scheduled_injection.error_generic":"Failed to save schedule","chat.interrupted_badge":"Interrupted","chat.moe_auto":"Auto","chat.moe_fast":"Fast","chat.moe_fastest":"Fastest","chat.moe_tooltip":"Expert count — lower is faster but less accurate","chat.reasoning_max":"Max","chat.reasoning_high":"High","chat.reasoning_off":"Off","chat.reasoning_tooltip":"Reasoning effort — higher is smarter but slower","chat.idle_injection_mode":"Dispatch mode","chat.idle_injection_mode_desc":"How the injected message is queued.","chat.idle_injection_mode_urgent":"Urgent (between tool calls)","chat.idle_injection_mode_normal":"Normal (after turn)","chat.idle_injection_mode_idle":"Idle (after turn + delay)","chat.idle_injection_wait_ms":"Idle wait delay (seconds)","chat.idle_injection_wait_ms_desc":"Extra delay before dispatching when in Idle mode.","common.back":"Back","common.cancel":"Cancel","common.close":"Close","common.confirm":"Confirm","common.delete":"Delete","common.deleting":"Deleting...","common.edit":"Edit","common.error":"Error","common.loading":"Loading...","common.no":"No","common.optional":"(optional)","common.retry":"Retry","common.save":"Save","common.unknown_error":"Unknown error","common.success":"Success","common.yes":"Yes","login.email_placeholder":"Email","login.or":"or","login.password_placeholder":"Password","login.pave_subtitle":"Personal AI Virtual Environment","login.powered_by":"Powered by PAVE","login.sign_in":"Sign in to continue","login.sign_in_locally":"Sign in locally","login.signing_in":"Signing in...","login.terms":"By signing in, you agree to the terms of service.","permission.allow":"Allow","permission.allowing":"Allowing...","permission.action_clear_all":"Clear All","permission.action_grant":"Grant","permission.action_revoke":"Revoke","permission.clear_all":"Clear ALL permissions (lock down sandbox)","permission.deny":"Deny","permission.denying":"Denying...","permission.expired":"Request expired","permission.no_reason":"No reason provided","permission.reason_prefix":"Reason:","permission.request_desc":"{action} {type} permission for: {target}","permission.title":"Permission Request","permission.type_file_read":"File Read","permission.type_file_write":"File Write","permission.type_module":"Module","permission.type_network":"Network","permission.type_system":"System Command","question.already_answered":"Question already answered","question.custom_placeholder":"Or type a custom answer...","question.dismiss":"Dismiss","question.dismissing":"Dismissing...","question.expired":"Question expired","question.input_placeholder":"Type your answer...","question.select_all":"Select all that apply","question.submit":"Submit","question.submit_n":"Submit {count} answers","question.submitting":"Submitting...","question.reconnecting":"Reconnecting…","question.title":"Question from AI","pricing.add":"Add","pricing.add_model":"Add Model","pricing.add_model_placeholder":"Model name (e.g., gpt-4)","pricing.add_new_model":"Add New Model","pricing.cached_tokens":"Cached tokens (per 1M)","pricing.close":"Close pricing settings","pricing.configured_count":"Configured models: {count}","pricing.fallback_badge":"fallback","pricing.default_exists":'Cannot add "default" - it already exists as fallback',"pricing.discard_confirm":"Discard unsaved changes?","pricing.discard_title":"Discard Changes","pricing.heading":"Token Pricing","pricing.input_tokens":"Input tokens (per 1M)","pricing.label_cache":"Cache:","pricing.label_input":"In:","pricing.label_output":"Out:","pricing.model_column":"Model","pricing.model_exists":"Model already exists","pricing.model_required":"Model name is required","pricing.output_tokens":"Output tokens (per 1M)","pricing.rates_column":"Input / Output / Cached","pricing.rates_subtitle":"Prices in USD per 1M tokens","pricing.remove_model":"Remove model","pricing.remove_model_aria":"Remove {modelName}","pricing.remove_confirm":'Remove pricing for "{model}"?',"pricing.remove_title":"Remove Model Pricing","pricing.reset":"Reset to Defaults","pricing.reset_confirm":"Reset all pricing to default values? This cannot be undone.","pricing.reset_title":"Reset Pricing","pricing.save":"Save","pricing.save_changes":"Save Changes","pricing.subtitle":"Configure cost per 1 million tokens (USD)","pricing.title":"Token Pricing Settings","settings.back":"Back to chat","settings.category.display":"Display","settings.appearance":"Appearance","settings.mobile_frameless":"Frameless assistant messages","settings.mobile_frameless_label":"Mobile UX enhancement (experimental)","settings.mobile_frameless_desc":"Removes avatar and bubble background from assistant messages for a cleaner, full-width reading experience","settings.category.language":"Language","settings.category.marketplace":"Marketplace","settings.category.model":"AI Model & Provider","settings.category.prefillFallback":"Prefill Fallback","settings.category.models":"Models","settings.category.rate":"Rate Limiting","settings.category.systemPrompts":"System Prompts","settings.category.tools":"Tool Execution","settings.category.whatsapp":"WhatsApp","settings.category.lmstudio":"LM Studio","settings.category.compaction":"Compaction","settings.category.sessionBanner":"Session Banner","settings.category.sessionBehavior":"Session Behavior","settings.currently_set_to":"Currently set to: {path}","settings.default_prefix":"Default: {value}","settings.default_empty":"(empty)","settings.description":"Configure PAVE runtime settings. Most changes apply on save; some (e.g. timeouts) may require restarting PAVE.","settings.env_badge":"env","settings.env_override":"This value is currently overridden by the {envVar} environment variable.","settings.failed_to_load":"Failed to load settings: {error}","settings.language":"Language","settings.language_description":"Select your preferred language for the interface","settings.language_auto_applied":"✓ Language applied automatically","settings.no_changes":"No changes to save.","settings.not_set":"Not set","settings.enabled":"Enabled","settings.disabled":"Disabled","settings.notification_sound":"Notification Sound","settings.notification_sound_desc":"Play a sound when new inbox messages arrive","settings.native_notifications":"Native Notifications","settings.native_notifications_desc":"Show browser notifications for new inbox messages","settings.native_notifications_blocked":"Notifications blocked by browser — enable in browser settings","settings.native_notifications_permission":"Click to enable — permission will be requested","settings.native_notifications_unsupported":"Not supported in this browser","settings.auto_saved":"Changes apply immediately","settings.notifications":"Notifications","settings.partial_save":"Some settings could not be saved. See errors below.","settings.requires_restart":"(requires restart)","settings.reset":"Reset","settings.save":"Save","settings.save_failed":"Failed to save: {error}","settings.saved":"Settings saved successfully.","settings.saving":"Saving...","settings.source_default":"Default","settings.source_env":"ENV","settings.source_saved":"Saved","settings.title":"Settings","settings.validating":"Validating...","settings.apply":"Apply","settings.workspace":"Workspace","settings.working_dir":"Working Directory","settings.working_dir_desc":"Set a custom working directory for file operations and tool execution. Leave empty to use the server default.","settings.working_dir_reset":"Working directory reset to server default","settings.working_dir_updated":"Working directory updated to: {path}","settings.working_dir_invalid":"Invalid directory path: {error}","settings.version_title":"Version","settings.current_version":"Current version","settings.latest_version":"Latest version","settings.update_available":"Update available","settings.update_button":"Update","settings.no_updates":"No updates available","settings.check_updates":"Check for Updates","settings.checking_updates":"Checking for updates…","settings.update_in_progress":"Update in progress…","settings.update_success":"Update successful","settings.update_failed":"Update failed","settings.check_updates_failed":"Check for updates failed","settings.model_registry.title":"Model Registry","settings.model_registry.builtin":"Built-in Models","settings.model_registry.user":"User Models","settings.model_registry.add_model":"+ Add Model","settings.model_registry.no_user_models":'No user-defined models. Click "+ Add Model" to add one.',"settings.model_registry.name":"Model Name","settings.model_registry.name_placeholder":"Model name (e.g. my-custom-model)","settings.model_registry.provider":"Provider","settings.model_registry.provider_placeholder":"e.g. openai","settings.model_registry.displayName":"Display Name","settings.model_registry.displayName_placeholder":"My Model","settings.model_registry.url":"Endpoint URL","settings.model_registry.url_placeholder":"http(s)://… or pave(s)://…","settings.model_registry.tier":"Tier","settings.model_registry.tier_placeholder":"e.g. fast, premium","settings.model_registry.limit_context":"Context Limit","settings.model_registry.limit_output":"Output Limit","settings.model_registry.cost_input":"Input Cost ($/1M tokens)","settings.model_registry.cost_output":"Output Cost ($/1M tokens)","settings.model_registry.save":"Save","settings.model_registry.saving":"Saving...","settings.model_registry.cancel":"Cancel","settings.model_registry.add":"Add","settings.model_registry.adding":"Adding...","settings.model_registry.edit":"Edit model","settings.model_registry.delete":"Delete model","settings.model_registry.delete_confirm":'Remove model "{name}" from the registry?',"settings.model_registry.loading":"Loading model registry...","settings.model_registry.load_error":"Failed to load registry: {error}","settings.model_registry.context_k":"{value}K ctx","settings.model_registry.target":"Alias Target (optional)","settings.model_registry.target_placeholder":"e.g. github-copilot/claude-opus-4.7","settings.model_registry.target_hint":"If set, this entry is an alias — selections route to the target model. Leave empty for a self-contained model with its own endpoint URL.","settings.model_registry.spec":"Model Spec","settings.model_registry.spec_placeholder":"e.g. github-copilot/claude-opus-4.7 or pave://host/path?model=…","settings.model_registry.spec_hint":"Enter a provider/model alias (e.g. github-copilot/claude-opus-4.7) or a full pave://, paves://, http://, or https:// URL. URLs are detected automatically.","settings.model_registry.kind_alias":"Alias","settings.model_registry.advanced":"Advanced (limits & cost)","settings.model_registry.error_name_required":"Model name is required","settings.model_registry.error_name_reserved":'Model name "{name}" is reserved',"settings.model_registry.error_name_exists":'A model named "{name}" already exists',"settings.model_registry.error_rename_cleanup":"Renamed, but failed to remove old entry: {error}","settings.custom_model":"Custom model...","settings.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","sidebar.conversations":"Conversations","sidebar.delete":"Delete","sidebar.delete_all":"Delete All Conversations","sidebar.delete_all_confirm":"Delete the conversations listed here? Sessions belonging to other apps are left alone. This cannot be undone.","sidebar.delete_all_title":"Delete All Sessions","sidebar.delete_confirm":"Delete this conversation?","sidebar.delete_title":"Delete Session","sidebar.hide":"Hide sidebar","sidebar.load_more":"Load more conversations","sidebar.no_conversations":"No conversations yet","sidebar.no_matches":"No matches","sidebar.rename":"Rename","sidebar.regenerate_title":"Regenerate Title","sidebar.send_to_session":"Send to another session","send_to_session.title":"Send to another session","send_to_session.target_label":"Send to","send_to_session.message_label":"Message","send_to_session.delivery_note":"Delivered by the app that has that session open, usually within a couple of seconds. It may be a different app than this one.","send_to_session.queued":"Queued. It will be picked up by whichever app has that session open.","send_to_session.no_targets":"No other sessions to send to.","send_to_session.send":"Send","send_to_session.sending":"Sending...","send_to_session.cancel":"Cancel","send_to_session.close":"Close","sidebar.search_placeholder":"Search conversations...","sidebar.show":"Show conversations","sidebar.terminal":"Terminal","sidebar.studio":"PAVE Studio","sidebar.acp":"Connected editor","sidebar.legacy_sessions":"Older sessions","sidebar.untitled":"Untitled","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.archive":"Archive","sidebar.unarchive":"Unarchive","sidebar.confirmArchive":"Archive this session? It will be hidden from the sidebar.","sidebar.show_archived":"Show archived","sidebar.hide_archived":"Hide archived","sidebar.pinned":"Pinned","sidebar.today":"Today","sidebar.yesterday":"Yesterday","sidebar.this_week":"This Week","sidebar.this_month":"This Month","sidebar.older":"Older","sidebar.other":"Other","sidebar.archived":"Archived","sidebar.export":"Export as YAML","sidebar.import":"Import session","sidebar.drop_to_import":"Drop session file to import","sidebar.session_processing":"Session is processing","sidebar.more_actions":"More actions","sidebar.age_now":"now","sidebar.age_minutes":"{n}m","sidebar.age_hours":"{n}h","sidebar.age_days":"{n}d","sidebar.age_weeks":"{n}w","import.invalid_file_type":"Only .yaml or .yml session files can be imported","import.file_too_large":"Import file too large (max 10MB)","import.read_error":"Failed to read file. Please try again.","skills.back_to_chat":"Back to chat","skills.cancel":"Cancel","skills.clear_all":"Clear all","skills.clear_confirm":"Clear all credentials for {skill}?","skills.clear_title":"Clear Credentials","skills.close":"Close","skills.close_credential_editor":"Close credential editor","skills.configure":"Configure","skills.configure_skill":"Configure {skill}","skills.configured":"Configured","skills.current_value":"(current: {value})","skills.enter_token":"Enter at least one token value","skills.enter_value":"Enter value...","skills.install":"Install","skills.installed":"Installed","skills.installed_count":"{installed} installed, {available} available","skills.installing":"Installing...","skills.install_failed":"Install failed: {error}","skills.leave_blank":"Leave blank to keep current","skills.load_installed_failed":"Failed to load installed skills: {error}","skills.load_marketplace_failed":"Failed to load marketplace: {error}","skills.needs_setup":"Needs setup","skills.no_credentials_needed":"This skill does not require any credentials.","skills.no_description":"No description","skills.no_match":"No skills match your search.","skills.no_skills":"No skills found.","skills.not_installed":"Not installed","skills.oauth_connect":"Connect with {provider}","skills.oauth_connect_hint":"Use OAuth to authenticate with {provider}. Click the button below to open the authorization page.","skills.oauth_connected":"Connected to {provider}","skills.oauth_connecting":"Connecting...","skills.oauth_needs_credentials":"Enter Client ID and Client Secret above first, then you can connect to {provider}.","skills.save":"Save","skills.saving":"Saving...","skills.search_placeholder":"Search skills...","skills.skill_management":"Skill Management","skills.subtitle":"Manage AI tool capabilities","skills.tab_all":"All","skills.tab_available":"Available","skills.tab_installed":"Installed","skills.tab_marketplace":"Marketplace","skills.title":"Skills","skills.check_updates":"Check for Updates","skills.checking_updates":"Checking...","skills.update":"Update","skills.updating":"Updating...","skills.update_available":"Update available: v{version}","skills.update_success":"Updated to v{version}","skills.update_failed":"Update failed","skills.up_to_date":"Up to date","skills.updates_available":"{count} update(s) available","skills.no_updates":"All skills are up to date","skills.uninstall":"Uninstall","skills.uninstall_title":"Uninstall Skill","skills.uninstall_confirm":"Uninstall {skill}? Your saved credentials will be preserved.","skills.uninstalling":"Uninstalling...","skills.uninstall_failed":"Uninstall failed: {error}","skills.toggle_title":"Manage skills for this session","skills.toggle_header":"Session Skills","skills.toggle_hint":"Toggle skills on/off for this chat only","skills.builtin_tools":"Built-in Tools","skills.agent_comm":"Agent Communication","skills.default":"Default","skills.default_for_new_sessions":"Enable by default for new sessions","skills.reset_to_defaults":"Reset to defaults","auth.device_code_title":"GitHub Copilot Authentication","auth.device_code_instructions":"Open {url} and enter code: {code}","auth.device_code_waiting":"Waiting for authorization...","task.activity":"Activity","task.awaiting":"Awaiting approval","task.completed":"Completed","task.error":"Error","task.no_active":"No active tasks. Send a message to get started.","task.processing":"Processing...","task.tool_bash":"Bash","task.tool_edit":"Edit","task.tool_editing":"Editing {target}","task.tool_glob":"Glob","task.tool_glob_desc":"Searching for files","task.tool_grep":"Grep","task.tool_grep_desc":"Searching code","task.tool_read":"Read","task.tool_reading":"Reading {target}","task.tool_write":"Write","task.tool_writing":"Writing {target}","task.working":"Working on it...","terminal.decrease_font":"Decrease font size","terminal.increase_font":"Increase font size","terminal.matrix_mode":"Matrix","terminal.no_output":"No terminal output yet","terminal.prompt":"$","theme.dark":"Switch to dark mode","theme.light":"Switch to light mode","time.days":"{count}d ","time.hours":"{count}h ","time.just_now":"just now","time.milliseconds":"{count}ms","time.minutes":"{count}m ","time.seconds":"{count}s","token.cache_read":"Cache Read","token.cache_write":"Cache Write","token.generating":"Generating...","token.idle":"Idle","token.input":"Input","token.model":"Model","token.output":"Output","token.session_cost":"Session","token.tokens":"tokens","token.total_cost":"Total Cost","token_usage.generating":"Generating...","token_usage.idle":"Idle","token_usage.messages":"Messages","token_usage.model":"Model","token_usage.originally":"Originally","token_usage.session_info":"Session Info","token_usage.status":"Status","tool.completed":"Done","tool.error":"Error","tool.running":"Running...","tool.tool":"Tool","user_menu.agents":"Agent Management","user_menu.pricing":"Token Pricing","user_menu.settings":"Settings","user_menu.sign_out":"Sign Out","user_menu.skills":"Skill Management","user_menu.title":"User menu","user_inbox.clear_all":"Clear all","user_inbox.delete":"Delete","user_inbox.empty":"No notifications","user_inbox.high_priority":"urgent","user_inbox.mark_all_read":"Mark all read","user_inbox.mark_unread":"Mark as unread","user_inbox.next_message":"Next message","user_inbox.prev_message":"Previous message","user_inbox.title":"Notifications","user_inbox.unread":"Unread","user_inbox.view_agent":"View agent","user_inbox.view_message":"View message","user_inbox.close":"Close","user_inbox.mark_read":"Mark as read","voice.dismiss_error":"Dismiss voice error","voice.downloading_model":"Downloading speech model...","voice.loading_model":"Loading speech model...","voice.processing":"Transcribing audio...","voice.processing_backend":"Transcribing via cloud...","voice.processing_local":"Transcribing locally...","voice.processing_local_server":"Transcribing via local server...","voice.source_backend":"Transcribed via cloud","voice.source_local":"Transcribed locally","voice.source_local_server":"Transcribed via local server","voice.start_recording":"Start voice recording","voice.stop_recording":"Stop recording","voice.pause_recording":"Pause recording","voice.resume_recording":"Resume recording","voice.select_asr_model":"Select speech recognition model","model_selector.title":"Session model","model_selector.list_label":"Available models","model_selector.use_default":"Use default model","model_selector.no_models":"No models available","model_selector.default_label":"Default","model_selector.lmstudio_loading":"Loading LM Studio models...","spotlight.title":"Search Sessions","spotlight.new_chat":"New Chat","spotlight.placeholder":"Search sessions by title...","spotlight.results":"Session results","spotlight.recent_sessions":"Recent Sessions","spotlight.no_results":"No sessions found","spotlight.searching":"Searching...","spotlight.untitled":"Untitled Session","spotlight.current":"current","spotlight.navigate":"navigate","spotlight.select":"select","spotlight.close":"close","slashCommand.title":"Skills","slashCommand.skills":"Skills","slashCommand.commands":"commands","slashCommand.command":"command","slashCommand.noResults":"No matching commands","slashCommand.notConfigured":"not configured","slashCommand.back":"Back to skills","slashCommand.navigate":"navigate","slashCommand.select":"select","slashCommand.close":"close","slashCommand.hint":"Type / to see available commands","archiveViewer.title":"Original Conversation History","archiveViewer.messages":"messages","archiveViewer.loading":"Loading archived messages...","archiveViewer.noArchive":"No archived history available for this session.","archiveViewer.readOnly":"Read-only archive","archiveViewer.archivedAt":"Archived","archiveViewer.close":"Close","archiveViewer.loadError":"Failed to load archive","archiveViewer.you":"You","archiveViewer.assistant":"Assistant","compaction.title":"Conversation compacted","compaction.showSummary":"Show summary","compaction.viewOriginal":"View original history","compaction.viewInHistory":"View in History","compaction.server.title":"Server auto-compact","compaction.server.status":"Context auto-compacted by server","compaction.mode.client":"Client (PAVE summarizes)","compaction.mode.server":"Server (vllm-mlx auto-compact)","compaction.mode.auto":"Auto (detect from provider)","compaction.banner_title":"This session was compacted from a previous conversation.","compaction.view_original":"View original","compaction.dismiss":"Dismiss","compaction.user_message_label":"Summarizing our conversation to keep things efficient.","compaction.boundary":"Context compacted — messages above are no longer in the model’s context","compaction.show_history":"Show {count} messages before compaction","compaction.hide_history":"Hide messages before compaction","credits.limit_reached":"Credit Limit Reached","credits.limit_message":"You've used all your available credits. Add more to continue using the service.","credits.add_credits":"Add Credits","credits.dismiss":"Dismiss","dlp.heading":"Privacy & DLP Settings","dlp.subtitle":"Configure data loss prevention patterns and privacy mode","dlp.title":"DLP Settings","dlp.close":"Close DLP settings","dlp.cancel":"Cancel","dlp.save":"Save","dlp.saving":"Saving...","dlp.discard_title":"Discard Changes","dlp.discard_confirm":"Discard unsaved changes to DLP settings?","dlp.enable_label":"Enable Data Loss Prevention","dlp.enable_desc":"When enabled, outgoing messages are scanned for sensitive data before sending to the AI model.","dlp.default_action_label":"Default action on detection","dlp.default_action_desc":"What happens when a pattern matches. 'Ask' shows a modal, 'Always reroute' sends to the private model, 'Warn only' logs and proceeds.","dlp.reroute_model_label":"Private model (reroute target)","dlp.reroute_model_desc":"The model/provider used for private mode. Format: provider/modelID","dlp.builtin_patterns":"Built-in patterns","dlp.builtin_desc":"Always-available detection patterns. Toggle individual patterns on or off.","dlp.user_patterns":"Custom patterns","dlp.user_patterns_desc":"Patterns you define. These are saved to your policy file and persist across restarts.","dlp.no_user_patterns":"No custom patterns yet. Add one below.","dlp.add_pattern":"Add a pattern","dlp.pattern_name":"Name","dlp.regex_pattern":"Regex","dlp.severity":"Severity","dlp.add":"Add","dlp.remove_pattern":"Remove pattern","dlp.remove_pattern_aria":"Remove pattern {name}","dlp.pattern_exists":"Pattern '{name}' already exists","dlp.name_required":"Pattern name is required","dlp.regex_required":"Regex pattern is required","dlp.invalid_regex":"Invalid regex syntax","user_menu.privacy_dlp":"Privacy & DLP"},bi={en:$a},iD={"zh-TW":()=>R5(()=>import("./zh-TW-B9YR1mTH.js"),[])},po=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function N_(e){if(bi[e])return bi[e];const t=iD[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),$a;try{const n=await t();return bi[e]=n.default||n,bi[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),$a}}function I5(e,t,n){let r=e[t];return r===void 0&&e!==$a&&(r=$a[t]),r===void 0?t:n&&typeof n=="object"?r.replace(/\{(\w+)\}/g,(a,i)=>{const s=n[i];return s!==void 0?String(s):a}):r}const M5=h.createContext(null);function sD({initialLocale:e="en",children:t}){const r=po.map(g=>g.code).includes(e)?e:"en",[a,i]=h.useState(r),[s,l]=h.useState(bi[r]||$a),c=h.useRef(0);h.useEffect(()=>{let g=!1;if(r!=="en"&&!bi[r]){const p=++c.current;N_(r).then(m=>{if(g||c.current!==p)return;const y=m===$a&&r!=="en"?"en":r;bi[y]=m,l(m),y!==r&&i(y)})}return()=>{g=!0,c.current+=1}},[]);const u=h.useCallback(async g=>{const p=++c.current,m=await N_(g);if(c.current!==p)return;const y=m===$a&&g!=="en"?"en":g;bi[y]=m,l(m),i(y);try{localStorage.setItem("pave-locale",y)}catch{}},[]),d=h.useCallback((g,p)=>I5(s,g,p),[s]),f=h.useMemo(()=>({t:d,locale:a,setLocale:u,availableLocales:po}),[d,a,u]);return o.jsx(M5.Provider,{value:f,children:t})}function Ct(){const e=h.useContext(M5);return e||{t:(t,n)=>I5($a,t,n),locale:"en",setLocale:()=>{},availableLocales:po}}function oD(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&po.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=po.find(a=>a.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=po.find(a=>a.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function lD({darkMode:e,onToggle:t}){const{t:n}=Ct();return o.jsx("button",{onClick:t,className:"p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:n(e?"theme.light":"theme.dark"),"aria-label":n(e?"theme.light":"theme.dark"),"aria-pressed":e,children:e?o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}function cD({open:e,onClose:t,onConfirm:n,title:r,message:a,confirmLabel:i,cancelLabel:s,destructive:l}){var{t:c}=Ct(),u=h.useRef(null),d=h.useRef(null);if(h.useEffect(function(){e&&d.current&&d.current.focus()},[e]),h.useEffect(function(){if(!e)return;function m(y){y.key==="Escape"&&(typeof y.preventDefault=="function"&&y.preventDefault(),typeof y.stopImmediatePropagation=="function"?y.stopImmediatePropagation():typeof y.stopPropagation=="function"&&y.stopPropagation(),t())}return document.addEventListener("keydown",m,!0),function(){document.removeEventListener("keydown",m,!0)}},[e,t]),h.useEffect(function(){if(!e||!u.current)return;function m(y){if(y.key==="Tab"){var v=u.current.querySelectorAll("button:not([disabled])");if(v.length!==0){var x=v[0],b=v[v.length-1];y.shiftKey?document.activeElement===x&&(y.preventDefault(),b.focus()):document.activeElement===b&&(y.preventDefault(),x.focus())}}}return document.addEventListener("keydown",m),function(){document.removeEventListener("keydown",m)}},[e]),!e)return null;var f=i||c("confirm_dialog.confirm"),g=s||c("confirm_dialog.cancel"),p=l?"bg-red-600 hover:bg-red-700 focus:ring-red-500 text-white":"bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 text-white";return o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(m){m.target===m.currentTarget&&t()},children:o.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":r,className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-none transition-all duration-150",children:[o.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:o.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r})}),o.jsx("div",{className:"px-5 py-4",children:o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a})}),o.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[o.jsx("button",{ref:d,type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:g}),o.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 "+p,children:f})]})]})})}var L5=h.createContext(null);function uD({children:e}){var{t}=Ct(),n=h.useRef(null),r={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},a=h.useState(r),i=a[0],s=a[1],l=h.useCallback(function(d){n.current&&(n.current(!1),n.current=null);var f=d||{};return new Promise(function(g){n.current=g,s({open:!0,title:f.title||t("confirm_dialog.confirm"),message:f.message||"",confirmLabel:f.confirmLabel||"",cancelLabel:f.cancelLabel||"",destructive:f.destructive||!1})})},[t]),c=h.useCallback(function(){s(r),n.current&&(n.current(!1),n.current=null)},[]),u=h.useCallback(function(){s(r),n.current&&(n.current(!0),n.current=null)},[]);return o.jsxs(L5.Provider,{value:l,children:[e,o.jsx(cD,{open:i.open,onClose:c,onConfirm:u,title:i.title,message:i.message,confirmLabel:i.confirmLabel,cancelLabel:i.cancelLabel,destructive:i.destructive})]})}function hc(){var e=h.useContext(L5);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}const dD=["web","agent"],Gu="LEGACY",fD=["tui","acp"],gD={tui:"sidebar.terminal",studio:"sidebar.studio",acp:"sidebar.acp"};function O5(e){return e?e.client?dD.indexOf(e.client)!==-1:fD.indexOf(e.source)===-1:!1}function pD(e,t){if(e===Gu)return t("sidebar.legacy_sessions");const n=gD[e];if(n){const r=t(n);if(r&&r!==n)return r}return e.charAt(0).toUpperCase()+e.slice(1)}function hD(e,t){const n=[],r=Object.create(null),a=Array.isArray(e)?e:[];for(let l=0;l<a.length;l++){const c=a[l];if(!c)continue;if(O5(c)){n.push(c);continue}const u=c.client||Gu;r[u]||(r[u]=[]),r[u].push(c)}const i=Object.keys(r).sort((l,c)=>l===Gu?1:c===Gu?-1:l.localeCompare(c)),s=[];for(let l=0;l<i.length;l++)s.push({key:i[l],label:pD(i[l],t),sessions:r[i[l]]});return{own:n,groups:s}}function mD(e){const t=new Date,n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(n>=r)return"today";const a=new Date(r);if(a.setDate(a.getDate()-1),n>=a)return"yesterday";const i=new Date(r);if(i.setDate(i.getDate()-i.getDay()),n>=i)return"thisWeek";const s=new Date(t.getFullYear(),t.getMonth(),1);return n>=s?"thisMonth":"older"}function xD(e,t){const n={today:[],yesterday:[],thisWeek:[],thisMonth:[],older:[]},r={today:t("sidebar.today"),yesterday:t("sidebar.yesterday"),thisWeek:t("sidebar.this_week"),thisMonth:t("sidebar.this_month"),older:t("sidebar.older")};for(let s=0;s<e.length;s++){const l=e[s],c=mD(l.time&&l.time.updated?l.time.updated:0);n[c].push(l)}const a=["today","yesterday","thisWeek","thisMonth","older"],i=[];for(let s=0;s<a.length;s++){const l=a[s];n[l].length>0&&i.push({key:l,label:r[l],sessions:n[l]})}return i}const Jo="\0__other__";function yD(e,t){const n=Object.create(null);for(let i=0;i<e.length;i++){const s=e[i];let l;if(s.directory&&typeof s.directory=="string"&&s.directory.trim()){const u=s.directory.replace(/[\\/]+$/,"").split(/[\\/]/);l=u[u.length-1]||Jo}else l=Jo;n[l]||(n[l]=[]),n[l].push(s)}const r=Object.keys(n).sort(function(i,s){return i===Jo?1:s===Jo?-1:i.localeCompare(s)}),a=[];for(let i=0;i<r.length;i++){const s=r[i];n[s].sort(function(c,u){const d=c.time&&c.time.updated||0;return(u.time&&u.time.updated||0)-d});const l=s===Jo?t("sidebar.other"):s;a.push({key:s,label:l,sessions:n[s]})}return a}function bD(e,t){if(!e)return"";const n=Date.now()-e;if(n<60*1e3)return t("sidebar.age_now");const r=Math.floor(n/(60*1e3));if(r<60)return t("sidebar.age_minutes",{n:r});const a=Math.floor(r/60);if(a<24)return t("sidebar.age_hours",{n:a});const i=Math.floor(a/24);return i<7?t("sidebar.age_days",{n:i}):t("sidebar.age_weeks",{n:Math.floor(i/7)})}function C_(e){return e.source==="legacy"||e.source==="archive"||e._readOnly}const vD={rename:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z",regenerate:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15",export:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",archive:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4",unarchive:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4l3 3m0 0l3-3m-3 3V12",delete:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",more:"M6 12h.01M12 12h.01M18 12h.01",send:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"};function qi({name:e,className:t}){return o.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:vD[e]})})}function j_({className:e,filled:t}){return o.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:o.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})})}const Rg=216,uu=8;function kD({anchor:e,items:t,label:n,onClose:r}){const a=h.useRef(null),[i,s]=h.useState(null);h.useEffect(()=>{const c=a.current;if(!c)return;const u=c.offsetHeight;let d=e.align==="right"?e.x-Rg:e.x;d=Math.max(uu,Math.min(d,window.innerWidth-Rg-uu));let f=e.y;f+u>window.innerHeight-uu&&(f=Math.max(uu,e.flipY-u)),s({left:d,top:f})},[e]),h.useEffect(()=>{if(!i||!a.current)return;const c=a.current.querySelector("[data-menuitem]");c&&c.focus()},[i]),h.useEffect(()=>{function c(d){a.current&&!a.current.contains(d.target)&&r()}function u(d){d.key==="Escape"&&(d.stopPropagation(),r())}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u,!0),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u,!0),window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[r]);const l=c=>{if(c.key!=="ArrowDown"&&c.key!=="ArrowUp")return;c.preventDefault();const u=Array.from(a.current.querySelectorAll("[data-menuitem]"));if(u.length===0)return;const d=u.indexOf(document.activeElement),f=c.key==="ArrowDown"?(d+1)%u.length:(d-1+u.length)%u.length;u[f].focus()};return Fv.createPortal(o.jsx("div",{ref:a,role:"menu","aria-label":n,onKeyDown:l,className:"fixed z-50 py-1 rounded-lg bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 shadow-lg",style:{width:Rg,left:i?i.left:0,top:i?i.top:0,visibility:i?"visible":"hidden"},children:t.map(c=>c.separator?o.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},c.key):o.jsxs("button",{"data-menuitem":"",role:"menuitem",onClick:()=>{r(),c.onSelect()},className:`w-full flex items-center gap-2.5 px-3 py-1.5 text-left text-sm rounded-md ${c.danger?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:[o.jsx("span",{className:"flex-shrink-0 opacity-70",children:c.icon}),o.jsx("span",{className:"flex-1 truncate",children:c.label}),c.hint&&o.jsx("span",{className:"flex-shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:c.hint})]},c.key))}),document.body)}function _D({sessions:e,activeSessionId:t,busySessions:n={},onSelectSession:r,onNewChat:a,onDeleteSession:i,onDeleteAllSessions:s,onRenameSession:l,onRegenerateTitle:c,onPinSession:u,onArchiveSession:d,onExportSession:f,onSendToSession:g,onImportSession:p,onImportError:m,showArchived:y,onToggleShowArchived:v,isOpen:x,onClose:b,onToggle:k,hasMoreSessions:S,onLoadMoreSessions:E}){const{t:_}=Ct(),w=hc(),[N,R]=h.useState(""),[j,P]=h.useState(null),[F,H]=h.useState(""),[L,M]=h.useState({}),[T,O]=h.useState(null),$=h.useRef(null),Y=h.useCallback(()=>{const ee=$.current;$.current=null,O(null),ee&&ee.isConnected&&ee.focus()},[]),A=(ee,Ee,fe)=>{$.current=fe||null,O({id:ee.id,anchor:Ee})},K=ee=>!!L[ee]||!!N,V=ee=>M(Ee=>({...Ee,[ee]:!Ee[ee]})),{own:I,groups:q}=h.useMemo(()=>hD(e,_),[e,_]),ie=N?I.filter(function(ee){return(ee.title||_("sidebar.untitled")).toLowerCase().includes(N.toLowerCase())}):I,J=h.useMemo(()=>{const ee=N.toLowerCase(),Ee=[];for(let fe=0;fe<q.length;fe++){const ve=q[fe],de=N?ve.sessions.filter(function(pe){return(pe.title||_("sidebar.untitled")).toLowerCase().includes(ee)}):ve.sessions;de.length>0&&Ee.push({...ve,sessions:de,projectGroups:yD(de,_)})}return Ee},[q,N,_]),{pinnedSessions:je,regularSessions:X,archivedSessions:he}=h.useMemo(()=>{const ee=[],Ee=[],fe=[];for(let ve=0;ve<ie.length;ve++){const de=ie[ve];de.archived?fe.push(de):de.pinned?ee.push(de):Ee.push(de)}return{pinnedSessions:ee,regularSessions:Ee,archivedSessions:fe}},[ie]),Me=h.useMemo(()=>xD(X,_),[X,_]),we=ee=>{P(ee.id),H(ee.title||"")},ge=ee=>{F.trim()&&l(ee,F.trim()),P(null),H("")},Se=async ee=>{!ee.archived&&!await w({title:_("sidebar.archive"),message:_("sidebar.confirmArchive"),confirmLabel:_("sidebar.archive")})||d(ee.id,!ee.archived)},Re=async ee=>{await w({title:_("sidebar.delete_title"),message:_("sidebar.delete_confirm"),destructive:!0,confirmLabel:_("sidebar.delete")})&&i(ee.id)},me=ee=>{if(C_(ee))return[];const Ee=[{key:"rename",label:_("sidebar.rename"),hint:"F2",icon:o.jsx(qi,{name:"rename",className:"w-4 h-4"}),onSelect:()=>we(ee)}];c&&Ee.push({key:"regenerate",label:_("sidebar.regenerate_title"),icon:o.jsx(qi,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>c(ee.id)}),f&&Ee.push({key:"export",label:_("sidebar.export"),icon:o.jsx(qi,{name:"export",className:"w-4 h-4"}),onSelect:()=>f(ee.id)}),g&&Ee.push({key:"send-to-session",label:_("sidebar.send_to_session"),icon:o.jsx(qi,{name:"send",className:"w-4 h-4"}),onSelect:()=>g(ee.id)});const fe=[];return u&&(!ee.archived||ee.pinned)&&fe.push({key:"pin",label:ee.pinned?_("sidebar.unpin"):_("sidebar.pin"),icon:o.jsx(j_,{className:"w-4 h-4",filled:ee.pinned}),onSelect:()=>u(ee.id,!ee.pinned)}),d&&fe.push({key:"archive",label:ee.archived?_("sidebar.unarchive"):_("sidebar.archive"),icon:o.jsx(qi,{name:ee.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>Se(ee)}),fe.length>0&&(Ee.push({key:"sep-state",separator:!0}),Ee.push(...fe)),Ee.push({key:"sep-danger",separator:!0}),Ee.push({key:"delete",label:_("sidebar.delete"),hint:"Del",danger:!0,icon:o.jsx(qi,{name:"delete",className:"w-4 h-4"}),onSelect:()=>Re(ee)}),Ee},ye=h.useMemo(()=>T&&e.find(ee=>ee.id===T.id)||null,[T,e]);h.useEffect(()=>{T&&!ye&&Y()},[T,ye,Y]);const Oe=(ee,Ee)=>{const fe=Ee&&Ee.dimmed,ve=C_(ee),de=!!(T&&T.id===ee.id),pe=!ve,De=(B,D)=>A(ee,B,D);return o.jsx("div",{role:"button",tabIndex:0,className:`group relative flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer text-sm mb-0.5 transition-colors ${ee.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":fe?"text-gray-400 dark:text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-800":"text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-800"}`,onClick:()=>r(ee.id),onContextMenu:B=>{!pe||j===ee.id||(B.preventDefault(),De({x:B.clientX,y:B.clientY,flipY:B.clientY,align:"left"},B.currentTarget))},onKeyDown:B=>{if(B.currentTarget===B.target){if(B.key==="Enter"||B.key===" "){B.preventDefault(),r(ee.id);return}if(pe){if(B.key==="F2")B.preventDefault(),we(ee);else if(B.key==="Delete")B.preventDefault(),Re(ee);else if(B.key==="ContextMenu"){B.preventDefault();const D=B.currentTarget.getBoundingClientRect();De({x:D.right,y:D.bottom,flipY:D.top,align:"right"},B.currentTarget)}}}},children:j===ee.id?o.jsx("input",{autoFocus:!0,value:F,onChange:B=>H(B.target.value),onBlur:()=>ge(ee.id),onKeyDown:B=>{B.key==="Enter"?(B.preventDefault(),B.stopPropagation(),B.currentTarget.blur()):B.key==="Escape"?(B.stopPropagation(),P(null)):B.key===" "&&B.stopPropagation()},onClick:B=>B.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-none"}):o.jsxs(o.Fragment,{children:[ee.pinned&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})}),ee.source==="archive"&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-blue-400 dark:text-blue-500 opacity-70",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"})}),ee.compactedAt&&ee.source!=="archive"&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 dark:text-gray-500 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),n[ee.id]&&o.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse flex-shrink-0",role:"status",title:_("sidebar.session_processing"),"aria-label":_("sidebar.session_processing")}),o.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${fe?"italic":""}`,"data-menu-open":de?"true":"false",children:[o.jsx("span",{className:"truncate min-w-0",children:ee.title||_("sidebar.untitled")}),ee.archived&&o.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["(",_("sidebar.archived"),")"]})]}),o.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[o.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${de?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:bD(ee.time&&ee.time.updated,_)}),o.jsxs("div",{className:`items-center gap-0.5 ${de?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[u&&(!ee.archived||ee.pinned)&&o.jsx("button",{onClick:B=>{B.stopPropagation(),u(ee.id,!ee.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:ee.pinned?_("sidebar.unpin"):_("sidebar.pin"),"aria-label":ee.pinned?_("sidebar.unpin"):_("sidebar.pin"),children:o.jsx(j_,{className:`w-4 h-4 ${ee.pinned?"text-amber-500":""}`,filled:ee.pinned})}),pe&&o.jsx("button",{onClick:B=>{B.stopPropagation();const D=B.currentTarget.getBoundingClientRect();De({x:D.right,y:D.bottom+4,flipY:D.top-4,align:"right"},B.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${de?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":_("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":de,children:o.jsx(qi,{name:"more",className:"w-4 h-4"})})]})]})]})},ee.id)},be=ee=>o.jsx("div",{className:"px-2 pt-3 pb-1",children:o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:ee})});return o.jsxs(o.Fragment,{children:[x&&o.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:b}),!x&&o.jsx("div",{className:"flex-shrink-0 w-10 flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:o.jsx("button",{onClick:k,className:"p-1.5 rounded-lg bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:_("sidebar.show"),"aria-label":_("sidebar.show"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),o.jsxs("aside",{className:`
40
+ `+i.stack}return{value:e,source:t,stack:a,digest:null}}function Cg(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Vy(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var RO=typeof WeakMap=="function"?WeakMap:Map;function r5(e,t,n){n=Ua(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){vd||(vd=!0,nb=r),Vy(e,t)},n}function a5(e,t,n){n=Ua(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var a=t.value;n.payload=function(){return r(a)},n.callback=function(){Vy(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Vy(e,t),typeof r!="function"&&(Ni===null?Ni=new Set([this]):Ni.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function s_(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new RO;var a=new Set;r.set(t,a)}else a=r.get(t),a===void 0&&(a=new Set,r.set(t,a));a.has(n)||(a.add(n),e=WO.bind(null,e,t,n),t.then(e,e))}function o_(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function l_(e,t,n,r,a){return e.mode&1?(e.flags|=65536,e.lanes=a,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Ua(-1,1),t.tag=2,Si(n,t,1))),n.lanes|=1),e)}var IO=Ka.ReactCurrentOwner,pr=!1;function rr(e,t,n,r){t.child=e===null?MT(t,null,n,r):vo(t,e.child,n,r)}function c_(e,t,n,r,a){n=n.render;var i=t.ref;return fo(t,a),r=_v(e,t,n,r,i,a),n=wv(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Va(e,t,a)):(on&&n&&uv(t),t.flags|=1,rr(e,t,r,a),t.child)}function u_(e,t,n,r,a){if(e===null){var i=n.type;return typeof i=="function"&&!Mv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,i5(e,t,i,r,a)):(e=Vu(n.type,null,r,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&a)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:zl,n(s,r)&&e.ref===t.ref)return Va(e,t,a)}return t.flags|=1,e=ji(i,r),e.ref=t.ref,e.return=t,t.child=e}function i5(e,t,n,r,a){if(e!==null){var i=e.memoizedProps;if(zl(i,r)&&e.ref===t.ref)if(pr=!1,t.pendingProps=r=i,(e.lanes&a)!==0)e.flags&131072&&(pr=!0);else return t.lanes=e.lanes,Va(e,t,a)}return Gy(e,t,n,r,a)}function s5(e,t,n){var r=t.pendingProps,a=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qt(so,Sr),Sr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Qt(so,Sr),Sr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Qt(so,Sr),Sr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Qt(so,Sr),Sr|=r;return rr(e,t,a,n),t.child}function o5(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gy(e,t,n,r,a){var i=mr(n)?us:Xn.current;return i=yo(t,i),fo(t,a),n=_v(e,t,n,r,i,a),r=wv(),e!==null&&!pr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,Va(e,t,a)):(on&&r&&uv(t),t.flags|=1,rr(e,t,n,a),t.child)}function d_(e,t,n,r,a){if(mr(n)){var i=!0;ud(t)}else i=!1;if(fo(t,a),t.stateNode===null)Hu(e,t),n5(t,n,r),Wy(t,n,r,a),r=!0;else if(e===null){var s=t.stateNode,l=t.memoizedProps;s.props=l;var c=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=qr(u):(u=mr(n)?us:Xn.current,u=yo(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||c!==u)&&i_(t,s,r,u),di=!1;var g=t.memoizedState;s.state=g,hd(t,r,s,a),c=t.memoizedState,l!==r||g!==c||hr.current||di?(typeof d=="function"&&(qy(t,n,d,r),c=t.memoizedState),(l=di||a_(t,n,l,r,g,c,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),s.props=r,s.state=c,s.context=u,r=l):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,OT(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:ea(t.type,l),s.props=u,f=t.pendingProps,g=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=qr(c):(c=mr(n)?us:Xn.current,c=yo(t,c));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==f||g!==c)&&i_(t,s,r,c),di=!1,g=t.memoizedState,s.state=g,hd(t,r,s,a);var m=t.memoizedState;l!==f||g!==m||hr.current||di?(typeof p=="function"&&(qy(t,n,p,r),m=t.memoizedState),(u=di||a_(t,n,u,r,g,m,c)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,c),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,c)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),s.props=r,s.state=m,s.context=c,r=u):(typeof s.componentDidUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&g===e.memoizedState||(t.flags|=1024),r=!1)}return Ky(e,t,n,r,i,a)}function Ky(e,t,n,r,a,i){o5(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return a&&Xk(t,n,!1),Va(e,t,i);r=t.stateNode,IO.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=vo(t,e.child,null,i),t.child=vo(t,null,l,i)):rr(e,t,l,i),t.memoizedState=r.state,a&&Xk(t,n,!0),t.child}function l5(e){var t=e.stateNode;t.pendingContext?Yk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Yk(e,t.context,!1),yv(e,t.containerInfo)}function f_(e,t,n,r,a){return bo(),fv(a),t.flags|=256,rr(e,t,n,r),t.child}var Yy={dehydrated:null,treeContext:null,retryLane:0};function Xy(e){return{baseLanes:e,cachePool:null,transitions:null}}function c5(e,t,n){var r=t.pendingProps,a=fn.current,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(a&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),Qt(fn,a&1),e===null)return $y(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=Jd(s,r,0,null),e=ss(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Xy(n),t.memoizedState=Yy,e):Nv(t,s));if(a=e.memoizedState,a!==null&&(l=a.dehydrated,l!==null))return MO(e,t,s,r,l,a,n);if(i){i=r.fallback,s=t.mode,a=e.child,l=a.sibling;var c={mode:"hidden",children:r.children};return!(s&1)&&t.child!==a?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=ji(a,c),r.subtreeFlags=a.subtreeFlags&14680064),l!==null?i=ji(l,i):(i=ss(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Xy(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Yy,r}return i=e.child,e=i.sibling,r=ji(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Nv(e,t){return t=Jd({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function su(e,t,n,r){return r!==null&&fv(r),vo(t,e.child,null,n),e=Nv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function MO(e,t,n,r,a,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Cg(Error(Pe(422))),su(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,a=t.mode,r=Jd({mode:"visible",children:r.children},a,0,null),i=ss(i,a,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&vo(t,e.child,null,s),t.child.memoizedState=Xy(s),t.memoizedState=Yy,i);if(!(t.mode&1))return su(e,t,s,null);if(a.data==="$!"){if(r=a.nextSibling&&a.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Pe(419)),r=Cg(i,r,void 0),su(e,t,s,r)}if(l=(s&e.childLanes)!==0,pr||l){if(r=Mn,r!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=a&(r.suspendedLanes|s)?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,Wa(e,a),aa(r,e,a,-1))}return Iv(),r=Cg(Error(Pe(421))),su(e,t,s,r)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=VO.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,jr=Ei(a.nextSibling),Tr=t,on=!0,na=null,e!==null&&(Pr[Fr++]=Da,Pr[Fr++]=Pa,Pr[Fr++]=ds,Da=e.id,Pa=e.overflow,ds=t),t=Nv(t,r.children),t.flags|=4096,t)}function g_(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hy(e.return,t,n)}function jg(e,t,n,r,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=a)}function u5(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;if(rr(e,t,r.children,n),r=fn.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&g_(e,n,t);else if(e.tag===19)g_(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Qt(fn,r),!(t.mode&1))t.memoizedState=null;else switch(a){case"forwards":for(n=t.child,a=null;n!==null;)e=n.alternate,e!==null&&md(e)===null&&(a=n),n=n.sibling;n=a,n===null?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),jg(t,!1,a,n,i);break;case"backwards":for(n=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&md(e)===null){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}jg(t,!0,n,null,i);break;case"together":jg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Va(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),gs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Pe(153));if(t.child!==null){for(e=t.child,n=ji(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ji(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function LO(e,t,n){switch(t.tag){case 3:l5(t),bo();break;case 5:DT(t);break;case 1:mr(t.type)&&ud(t);break;case 4:yv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,a=t.memoizedProps.value;Qt(gd,r._currentValue),r._currentValue=a;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Qt(fn,fn.current&1),t.flags|=128,null):n&t.child.childLanes?c5(e,t,n):(Qt(fn,fn.current&1),e=Va(e,t,n),e!==null?e.sibling:null);Qt(fn,fn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return u5(e,t,n);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Qt(fn,fn.current),r)break;return null;case 22:case 23:return t.lanes=0,s5(e,t,n)}return Va(e,t,n)}var d5,Qy,f5,g5;d5=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Qy=function(){};f5=function(e,t,n,r){var a=e.memoizedProps;if(a!==r){e=t.stateNode,ts(_a.current);var i=null;switch(n){case"input":a=by(e,a),r=by(e,r),i=[];break;case"select":a=pn({},a,{value:void 0}),r=pn({},r,{value:void 0}),i=[];break;case"textarea":a=_y(e,a),r=_y(e,r),i=[];break;default:typeof a.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=ld)}Ey(n,r);var s;n=null;for(u in a)if(!r.hasOwnProperty(u)&&a.hasOwnProperty(u)&&a[u]!=null)if(u==="style"){var l=a[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ml.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=a!=null?a[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in c)c.hasOwnProperty(s)&&l[s]!==c[s]&&(n||(n={}),n[s]=c[s])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ml.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&Zt("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};g5=function(e,t,n,r){n!==r&&(t.flags|=4)};function Qo(e,t){if(!on)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function qn(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags&14680064,r|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function OO(e,t,n){var r=t.pendingProps;switch(dv(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qn(t),null;case 1:return mr(t.type)&&cd(),qn(t),null;case 3:return r=t.stateNode,ko(),tn(hr),tn(Xn),vv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(au(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,na!==null&&(ib(na),na=null))),Qy(e,t),qn(t),null;case 5:bv(t);var a=ts(Wl.current);if(n=t.type,e!==null&&t.stateNode!=null)f5(e,t,n,r,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Pe(166));return qn(t),null}if(e=ts(_a.current),au(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ya]=t,r[Hl]=i,e=(t.mode&1)!==0,n){case"dialog":Zt("cancel",r),Zt("close",r);break;case"iframe":case"object":case"embed":Zt("load",r);break;case"video":case"audio":for(a=0;a<ll.length;a++)Zt(ll[a],r);break;case"source":Zt("error",r);break;case"img":case"image":case"link":Zt("error",r),Zt("load",r);break;case"details":Zt("toggle",r);break;case"input":_k(r,i),Zt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Zt("invalid",r);break;case"textarea":Ek(r,i),Zt("invalid",r)}Ey(n,i),a=null;for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];s==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&ru(r.textContent,l,e),a=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&ru(r.textContent,l,e),a=["children",""+l]):Ml.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&Zt("scroll",r)}switch(n){case"input":Yc(r),wk(r,i,!0);break;case"textarea":Yc(r),Sk(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=ld)}r=a,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Uj(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[ya]=t,e[Hl]=r,d5(e,t,!1,!1),t.stateNode=e;e:{switch(s=Sy(n,r),n){case"dialog":Zt("cancel",e),Zt("close",e),a=r;break;case"iframe":case"object":case"embed":Zt("load",e),a=r;break;case"video":case"audio":for(a=0;a<ll.length;a++)Zt(ll[a],e);a=r;break;case"source":Zt("error",e),a=r;break;case"img":case"image":case"link":Zt("error",e),Zt("load",e),a=r;break;case"details":Zt("toggle",e),a=r;break;case"input":_k(e,r),a=by(e,r),Zt("invalid",e);break;case"option":a=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},a=pn({},r,{value:void 0}),Zt("invalid",e);break;case"textarea":Ek(e,r),a=_y(e,r),Zt("invalid",e);break;default:a=r}Ey(n,a),l=a;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?qj(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&$j(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Ll(e,c):typeof c=="number"&&Ll(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Ml.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Zt("scroll",e):c!=null&&Xb(e,i,c,s))}switch(n){case"input":Yc(e),wk(e,r,!1);break;case"textarea":Yc(e),Sk(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ai(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?oo(e,!!r.multiple,i,!1):r.defaultValue!=null&&oo(e,!!r.multiple,r.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=ld)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return qn(t),null;case 6:if(e&&t.stateNode!=null)g5(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Pe(166));if(n=ts(Wl.current),ts(_a.current),au(t)){if(r=t.stateNode,n=t.memoizedProps,r[ya]=t,(i=r.nodeValue!==n)&&(e=Tr,e!==null))switch(e.tag){case 3:ru(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&ru(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[ya]=t,t.stateNode=r}return qn(t),null;case 13:if(tn(fn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(on&&jr!==null&&t.mode&1&&!(t.flags&128))RT(),bo(),t.flags|=98560,i=!1;else if(i=au(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Pe(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Pe(317));i[ya]=t}else bo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;qn(t),i=!1}else na!==null&&(ib(na),na=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||fn.current&1?jn===0&&(jn=3):Iv())),t.updateQueue!==null&&(t.flags|=4),qn(t),null);case 4:return ko(),Qy(e,t),e===null&&Ul(t.stateNode.containerInfo),qn(t),null;case 10:return hv(t.type._context),qn(t),null;case 17:return mr(t.type)&&cd(),qn(t),null;case 19:if(tn(fn),i=t.memoizedState,i===null)return qn(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Qo(i,!1);else{if(jn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=md(e),s!==null){for(t.flags|=128,Qo(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Qt(fn,fn.current&1|2),t.child}e=e.sibling}i.tail!==null&&bn()>wo&&(t.flags|=128,r=!0,Qo(i,!1),t.lanes=4194304)}else{if(!r)if(e=md(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Qo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!on)return qn(t),null}else 2*bn()-i.renderingStartTime>wo&&n!==1073741824&&(t.flags|=128,r=!0,Qo(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=bn(),t.sibling=null,n=fn.current,Qt(fn,r?n&1|2:n&1),t):(qn(t),null);case 22:case 23:return Rv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Sr&1073741824&&(qn(t),t.subtreeFlags&6&&(t.flags|=8192)):qn(t),null;case 24:return null;case 25:return null}throw Error(Pe(156,t.tag))}function DO(e,t){switch(dv(t),t.tag){case 1:return mr(t.type)&&cd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ko(),tn(hr),tn(Xn),vv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bv(t),null;case 13:if(tn(fn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Pe(340));bo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return tn(fn),null;case 4:return ko(),null;case 10:return hv(t.type._context),null;case 22:case 23:return Rv(),null;case 24:return null;default:return null}}var ou=!1,Vn=!1,PO=typeof WeakSet=="function"?WeakSet:Set,Je=null;function io(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yn(e,t,r)}else n.current=null}function Zy(e,t,n){try{n()}catch(r){yn(e,t,r)}}var p_=!1;function FO(e,t){if(Oy=id,e=yT(),cv(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,l=-1,c=-1,u=0,d=0,f=e,g=null;t:for(;;){for(var p;f!==n||a!==0&&f.nodeType!==3||(l=s+a),f!==i||r!==0&&f.nodeType!==3||(c=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)g=f,f=p;for(;;){if(f===e)break t;if(g===n&&++u===a&&(l=s),g===i&&++d===r&&(c=s),(p=f.nextSibling)!==null)break;f=g,g=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Dy={focusedElem:e,selectionRange:n},id=!1,Je=t;Je!==null;)if(t=Je,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Je=e;else for(;Je!==null;){t=Je;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,v=m.memoizedState,x=t.stateNode,b=x.getSnapshotBeforeUpdate(t.elementType===t.type?y:ea(t.type,y),v);x.__reactInternalSnapshotBeforeUpdate=b}break;case 3:var k=t.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Pe(163))}}catch(S){yn(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,Je=e;break}Je=t.return}return m=p_,p_=!1,m}function wl(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var a=r=r.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&Zy(t,n,i)}a=a.next}while(a!==r)}}function Qd(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Jy(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function p5(e){var t=e.alternate;t!==null&&(e.alternate=null,p5(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ya],delete t[Hl],delete t[By],delete t[vO],delete t[kO])),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 h5(e){return e.tag===5||e.tag===3||e.tag===4}function h_(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||h5(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 eb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ld));else if(r!==4&&(e=e.child,e!==null))for(eb(e,t,n),e=e.sibling;e!==null;)eb(e,t,n),e=e.sibling}function tb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(tb(e,t,n),e=e.sibling;e!==null;)tb(e,t,n),e=e.sibling}var Dn=null,ta=!1;function ii(e,t,n){for(n=n.child;n!==null;)m5(e,t,n),n=n.sibling}function m5(e,t,n){if(ka&&typeof ka.onCommitFiberUnmount=="function")try{ka.onCommitFiberUnmount(Hd,n)}catch{}switch(n.tag){case 5:Vn||io(n,t);case 6:var r=Dn,a=ta;Dn=null,ii(e,t,n),Dn=r,ta=a,Dn!==null&&(ta?(e=Dn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Dn.removeChild(n.stateNode));break;case 18:Dn!==null&&(ta?(e=Dn,n=n.stateNode,e.nodeType===8?kg(e.parentNode,n):e.nodeType===1&&kg(e,n),Fl(e)):kg(Dn,n.stateNode));break;case 4:r=Dn,a=ta,Dn=n.stateNode.containerInfo,ta=!0,ii(e,t,n),Dn=r,ta=a;break;case 0:case 11:case 14:case 15:if(!Vn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){a=r=r.next;do{var i=a,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Zy(n,t,s),a=a.next}while(a!==r)}ii(e,t,n);break;case 1:if(!Vn&&(io(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){yn(n,t,l)}ii(e,t,n);break;case 21:ii(e,t,n);break;case 22:n.mode&1?(Vn=(r=Vn)||n.memoizedState!==null,ii(e,t,n),Vn=r):ii(e,t,n);break;default:ii(e,t,n)}}function m_(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new PO),t.forEach(function(r){var a=GO.bind(null,e,r);n.has(r)||(n.add(r),r.then(a,a))})}}function Qr(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r];try{var i=e,s=t,l=s;e:for(;l!==null;){switch(l.tag){case 5:Dn=l.stateNode,ta=!1;break e;case 3:Dn=l.stateNode.containerInfo,ta=!0;break e;case 4:Dn=l.stateNode.containerInfo,ta=!0;break e}l=l.return}if(Dn===null)throw Error(Pe(160));m5(i,s,a),Dn=null,ta=!1;var c=a.alternate;c!==null&&(c.return=null),a.return=null}catch(u){yn(a,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)x5(t,e),t=t.sibling}function x5(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Qr(t,e),ga(e),r&4){try{wl(3,e,e.return),Qd(3,e)}catch(y){yn(e,e.return,y)}try{wl(5,e,e.return)}catch(y){yn(e,e.return,y)}}break;case 1:Qr(t,e),ga(e),r&512&&n!==null&&io(n,n.return);break;case 5:if(Qr(t,e),ga(e),r&512&&n!==null&&io(n,n.return),e.flags&32){var a=e.stateNode;try{Ll(a,"")}catch(y){yn(e,e.return,y)}}if(r&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Bj(a,i),Sy(l,s);var u=Sy(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?qj(a,f):d==="dangerouslySetInnerHTML"?$j(a,f):d==="children"?Ll(a,f):Xb(a,d,f,u)}switch(l){case"input":vy(a,i);break;case"textarea":zj(a,i);break;case"select":var g=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var p=i.value;p!=null?oo(a,!!i.multiple,p,!1):g!==!!i.multiple&&(i.defaultValue!=null?oo(a,!!i.multiple,i.defaultValue,!0):oo(a,!!i.multiple,i.multiple?[]:"",!1))}a[Hl]=i}catch(y){yn(e,e.return,y)}}break;case 6:if(Qr(t,e),ga(e),r&4){if(e.stateNode===null)throw Error(Pe(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(y){yn(e,e.return,y)}}break;case 3:if(Qr(t,e),ga(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fl(t.containerInfo)}catch(y){yn(e,e.return,y)}break;case 4:Qr(t,e),ga(e);break;case 13:Qr(t,e),ga(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(Tv=bn())),r&4&&m_(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(Vn=(u=Vn)||d,Qr(t,e),Vn=u):Qr(t,e),ga(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Je=e,d=e.child;d!==null;){for(f=Je=d;Je!==null;){switch(g=Je,p=g.child,g.tag){case 0:case 11:case 14:case 15:wl(4,g,g.return);break;case 1:io(g,g.return);var m=g.stateNode;if(typeof m.componentWillUnmount=="function"){r=g,n=g.return;try{t=r,m.props=t.memoizedProps,m.state=t.memoizedState,m.componentWillUnmount()}catch(y){yn(r,n,y)}}break;case 5:io(g,g.return);break;case 22:if(g.memoizedState!==null){y_(f);continue}}p!==null?(p.return=g,Je=p):y_(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,s=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Hj("display",s))}catch(y){yn(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){yn(e,e.return,y)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Qr(t,e),ga(e),r&4&&m_(e);break;case 21:break;default:Qr(t,e),ga(e)}}function ga(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(h5(n)){var r=n;break e}n=n.return}throw Error(Pe(160))}switch(r.tag){case 5:var a=r.stateNode;r.flags&32&&(Ll(a,""),r.flags&=-33);var i=h_(e);tb(e,i,a);break;case 3:case 4:var s=r.stateNode.containerInfo,l=h_(e);eb(e,l,s);break;default:throw Error(Pe(161))}}catch(c){yn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function BO(e,t,n){Je=e,y5(e)}function y5(e,t,n){for(var r=(e.mode&1)!==0;Je!==null;){var a=Je,i=a.child;if(a.tag===22&&r){var s=a.memoizedState!==null||ou;if(!s){var l=a.alternate,c=l!==null&&l.memoizedState!==null||Vn;l=ou;var u=Vn;if(ou=s,(Vn=c)&&!u)for(Je=a;Je!==null;)s=Je,c=s.child,s.tag===22&&s.memoizedState!==null?b_(a):c!==null?(c.return=s,Je=c):b_(a);for(;i!==null;)Je=i,y5(i),i=i.sibling;Je=a,ou=l,Vn=u}x_(e)}else a.subtreeFlags&8772&&i!==null?(i.return=a,Je=i):x_(e)}}function x_(e){for(;Je!==null;){var t=Je;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Vn||Qd(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Vn)if(n===null)r.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:ea(t.type,n.memoizedProps);r.componentDidUpdate(a,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&t_(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}t_(t,s,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&Fl(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Pe(163))}Vn||t.flags&512&&Jy(t)}catch(g){yn(t,t.return,g)}}if(t===e){Je=null;break}if(n=t.sibling,n!==null){n.return=t.return,Je=n;break}Je=t.return}}function y_(e){for(;Je!==null;){var t=Je;if(t===e){Je=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Je=n;break}Je=t.return}}function b_(e){for(;Je!==null;){var t=Je;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Qd(4,t)}catch(c){yn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var a=t.return;try{r.componentDidMount()}catch(c){yn(t,a,c)}}var i=t.return;try{Jy(t)}catch(c){yn(t,i,c)}break;case 5:var s=t.return;try{Jy(t)}catch(c){yn(t,s,c)}}}catch(c){yn(t,t.return,c)}if(t===e){Je=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Je=l;break}Je=t.return}}var zO=Math.ceil,bd=Ka.ReactCurrentDispatcher,Cv=Ka.ReactCurrentOwner,Hr=Ka.ReactCurrentBatchConfig,Ft=0,Mn=null,kn=null,Fn=0,Sr=0,so=Oi(0),jn=0,Yl=null,gs=0,Zd=0,jv=0,El=null,gr=null,Tv=0,wo=1/0,La=null,vd=!1,nb=null,Ni=null,lu=!1,yi=null,kd=0,Sl=0,rb=null,qu=-1,Wu=0;function ir(){return Ft&6?bn():qu!==-1?qu:qu=bn()}function Ci(e){return e.mode&1?Ft&2&&Fn!==0?Fn&-Fn:wO.transition!==null?(Wu===0&&(Wu=nT()),Wu):(e=Ht,e!==0||(e=window.event,e=e===void 0?16:cT(e.type)),e):1}function aa(e,t,n,r){if(50<Sl)throw Sl=0,rb=null,Error(Pe(185));dc(e,n,r),(!(Ft&2)||e!==Mn)&&(e===Mn&&(!(Ft&2)&&(Zd|=n),jn===4&&gi(e,Fn)),xr(e,r),n===1&&Ft===0&&!(t.mode&1)&&(wo=bn()+500,Kd&&Di()))}function xr(e,t){var n=e.callbackNode;wL(e,t);var r=ad(e,e===Mn?Fn:0);if(r===0)n!==null&&jk(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&jk(n),t===1)e.tag===0?_O(v_.bind(null,e)):jT(v_.bind(null,e)),yO(function(){!(Ft&6)&&Di()}),n=null;else{switch(rT(r)){case 1:n=tv;break;case 4:n=eT;break;case 16:n=rd;break;case 536870912:n=tT;break;default:n=rd}n=N5(n,b5.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function b5(e,t){if(qu=-1,Wu=0,Ft&6)throw Error(Pe(327));var n=e.callbackNode;if(go()&&e.callbackNode!==n)return null;var r=ad(e,e===Mn?Fn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=_d(e,r);else{t=r;var a=Ft;Ft|=2;var i=k5();(Mn!==e||Fn!==t)&&(La=null,wo=bn()+500,is(e,t));do try{HO();break}catch(l){v5(e,l)}while(!0);pv(),bd.current=i,Ft=a,kn!==null?t=0:(Mn=null,Fn=0,t=jn)}if(t!==0){if(t===2&&(a=Ay(e),a!==0&&(r=a,t=ab(e,a))),t===1)throw n=Yl,is(e,0),gi(e,r),xr(e,bn()),n;if(t===6)gi(e,r);else{if(a=e.current.alternate,!(r&30)&&!UO(a)&&(t=_d(e,r),t===2&&(i=Ay(e),i!==0&&(r=i,t=ab(e,i))),t===1))throw n=Yl,is(e,0),gi(e,r),xr(e,bn()),n;switch(e.finishedWork=a,e.finishedLanes=r,t){case 0:case 1:throw Error(Pe(345));case 2:Xi(e,gr,La);break;case 3:if(gi(e,r),(r&130023424)===r&&(t=Tv+500-bn(),10<t)){if(ad(e,0)!==0)break;if(a=e.suspendedLanes,(a&r)!==r){ir(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Fy(Xi.bind(null,e,gr,La),t);break}Xi(e,gr,La);break;case 4:if(gi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,a=-1;0<r;){var s=31-ra(r);i=1<<s,s=t[s],s>a&&(a=s),r&=~i}if(r=a,r=bn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*zO(r/1960))-r,10<r){e.timeoutHandle=Fy(Xi.bind(null,e,gr,La),r);break}Xi(e,gr,La);break;case 5:Xi(e,gr,La);break;default:throw Error(Pe(329))}}}return xr(e,bn()),e.callbackNode===n?b5.bind(null,e):null}function ab(e,t){var n=El;return e.current.memoizedState.isDehydrated&&(is(e,t).flags|=256),e=_d(e,t),e!==2&&(t=gr,gr=n,t!==null&&ib(t)),e}function ib(e){gr===null?gr=e:gr.push.apply(gr,e)}function UO(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!oa(i(),a))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function gi(e,t){for(t&=~jv,t&=~Zd,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ra(t),r=1<<n;e[n]=-1,t&=~r}}function v_(e){if(Ft&6)throw Error(Pe(327));go();var t=ad(e,0);if(!(t&1))return xr(e,bn()),null;var n=_d(e,t);if(e.tag!==0&&n===2){var r=Ay(e);r!==0&&(t=r,n=ab(e,r))}if(n===1)throw n=Yl,is(e,0),gi(e,t),xr(e,bn()),n;if(n===6)throw Error(Pe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Xi(e,gr,La),xr(e,bn()),null}function Av(e,t){var n=Ft;Ft|=1;try{return e(t)}finally{Ft=n,Ft===0&&(wo=bn()+500,Kd&&Di())}}function ps(e){yi!==null&&yi.tag===0&&!(Ft&6)&&go();var t=Ft;Ft|=1;var n=Hr.transition,r=Ht;try{if(Hr.transition=null,Ht=1,e)return e()}finally{Ht=r,Hr.transition=n,Ft=t,!(Ft&6)&&Di()}}function Rv(){Sr=so.current,tn(so)}function is(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,xO(n)),kn!==null)for(n=kn.return;n!==null;){var r=n;switch(dv(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&cd();break;case 3:ko(),tn(hr),tn(Xn),vv();break;case 5:bv(r);break;case 4:ko();break;case 13:tn(fn);break;case 19:tn(fn);break;case 10:hv(r.type._context);break;case 22:case 23:Rv()}n=n.return}if(Mn=e,kn=e=ji(e.current,null),Fn=Sr=t,jn=0,Yl=null,jv=Zd=gs=0,gr=El=null,es!==null){for(t=0;t<es.length;t++)if(n=es[t],r=n.interleaved,r!==null){n.interleaved=null;var a=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=a,r.next=s}n.pending=r}es=null}return e}function v5(e,t){do{var n=kn;try{if(pv(),Uu.current=yd,xd){for(var r=gn.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}xd=!1}if(fs=0,In=Nn=gn=null,_l=!1,Vl=0,Cv.current=null,n===null||n.return===null){jn=1,Yl=t,kn=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=Fn,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var g=d.alternate;g?(d.updateQueue=g.updateQueue,d.memoizedState=g.memoizedState,d.lanes=g.lanes):(d.updateQueue=null,d.memoizedState=null)}var p=o_(s);if(p!==null){p.flags&=-257,l_(p,s,l,i,t),p.mode&1&&s_(i,u,t),t=p,c=u;var m=t.updateQueue;if(m===null){var y=new Set;y.add(c),t.updateQueue=y}else m.add(c);break e}else{if(!(t&1)){s_(i,u,t),Iv();break e}c=Error(Pe(426))}}else if(on&&l.mode&1){var v=o_(s);if(v!==null){!(v.flags&65536)&&(v.flags|=256),l_(v,s,l,i,t),fv(_o(c,l));break e}}i=c=_o(c,l),jn!==4&&(jn=2),El===null?El=[i]:El.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var x=r5(i,c,t);e_(i,x);break e;case 1:l=c;var b=i.type,k=i.stateNode;if(!(i.flags&128)&&(typeof b.getDerivedStateFromError=="function"||k!==null&&typeof k.componentDidCatch=="function"&&(Ni===null||!Ni.has(k)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=a5(i,l,t);e_(i,S);break e}}i=i.return}while(i!==null)}w5(n)}catch(E){t=E,kn===n&&n!==null&&(kn=n=n.return);continue}break}while(!0)}function k5(){var e=bd.current;return bd.current=yd,e===null?yd:e}function Iv(){(jn===0||jn===3||jn===2)&&(jn=4),Mn===null||!(gs&268435455)&&!(Zd&268435455)||gi(Mn,Fn)}function _d(e,t){var n=Ft;Ft|=2;var r=k5();(Mn!==e||Fn!==t)&&(La=null,is(e,t));do try{$O();break}catch(a){v5(e,a)}while(!0);if(pv(),Ft=n,bd.current=r,kn!==null)throw Error(Pe(261));return Mn=null,Fn=0,jn}function $O(){for(;kn!==null;)_5(kn)}function HO(){for(;kn!==null&&!pL();)_5(kn)}function _5(e){var t=S5(e.alternate,e,Sr);e.memoizedProps=e.pendingProps,t===null?w5(e):kn=t,Cv.current=null}function w5(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=DO(n,t),n!==null){n.flags&=32767,kn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{jn=6,kn=null;return}}else if(n=OO(n,t,Sr),n!==null){kn=n;return}if(t=t.sibling,t!==null){kn=t;return}kn=t=e}while(t!==null);jn===0&&(jn=5)}function Xi(e,t,n){var r=Ht,a=Hr.transition;try{Hr.transition=null,Ht=1,qO(e,t,n,r)}finally{Hr.transition=a,Ht=r}return null}function qO(e,t,n,r){do go();while(yi!==null);if(Ft&6)throw Error(Pe(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(Pe(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(EL(e,i),e===Mn&&(kn=Mn=null,Fn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||lu||(lu=!0,N5(rd,function(){return go(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Hr.transition,Hr.transition=null;var s=Ht;Ht=1;var l=Ft;Ft|=4,Cv.current=null,FO(e,n),x5(n,e),uO(Dy),id=!!Oy,Dy=Oy=null,e.current=n,BO(n),hL(),Ft=l,Ht=s,Hr.transition=i}else e.current=n;if(lu&&(lu=!1,yi=e,kd=a),i=e.pendingLanes,i===0&&(Ni=null),yL(n.stateNode),xr(e,bn()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],r(a.value,{componentStack:a.stack,digest:a.digest});if(vd)throw vd=!1,e=nb,nb=null,e;return kd&1&&e.tag!==0&&go(),i=e.pendingLanes,i&1?e===rb?Sl++:(Sl=0,rb=e):Sl=0,Di(),null}function go(){if(yi!==null){var e=rT(kd),t=Hr.transition,n=Ht;try{if(Hr.transition=null,Ht=16>e?16:e,yi===null)var r=!1;else{if(e=yi,yi=null,kd=0,Ft&6)throw Error(Pe(331));var a=Ft;for(Ft|=4,Je=e.current;Je!==null;){var i=Je,s=i.child;if(Je.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Je=u;Je!==null;){var d=Je;switch(d.tag){case 0:case 11:case 15:wl(8,d,i)}var f=d.child;if(f!==null)f.return=d,Je=f;else for(;Je!==null;){d=Je;var g=d.sibling,p=d.return;if(p5(d),d===u){Je=null;break}if(g!==null){g.return=p,Je=g;break}Je=p}}}var m=i.alternate;if(m!==null){var y=m.child;if(y!==null){m.child=null;do{var v=y.sibling;y.sibling=null,y=v}while(y!==null)}}Je=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,Je=s;else e:for(;Je!==null;){if(i=Je,i.flags&2048)switch(i.tag){case 0:case 11:case 15:wl(9,i,i.return)}var x=i.sibling;if(x!==null){x.return=i.return,Je=x;break e}Je=i.return}}var b=e.current;for(Je=b;Je!==null;){s=Je;var k=s.child;if(s.subtreeFlags&2064&&k!==null)k.return=s,Je=k;else e:for(s=b;Je!==null;){if(l=Je,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Qd(9,l)}}catch(E){yn(l,l.return,E)}if(l===s){Je=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,Je=S;break e}Je=l.return}}if(Ft=a,Di(),ka&&typeof ka.onPostCommitFiberRoot=="function")try{ka.onPostCommitFiberRoot(Hd,e)}catch{}r=!0}return r}finally{Ht=n,Hr.transition=t}}return!1}function k_(e,t,n){t=_o(n,t),t=r5(e,t,1),e=Si(e,t,1),t=ir(),e!==null&&(dc(e,1,t),xr(e,t))}function yn(e,t,n){if(e.tag===3)k_(e,e,n);else for(;t!==null;){if(t.tag===3){k_(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ni===null||!Ni.has(r))){e=_o(n,e),e=a5(t,e,1),t=Si(t,e,1),e=ir(),t!==null&&(dc(t,1,e),xr(t,e));break}}t=t.return}}function WO(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=ir(),e.pingedLanes|=e.suspendedLanes&n,Mn===e&&(Fn&n)===n&&(jn===4||jn===3&&(Fn&130023424)===Fn&&500>bn()-Tv?is(e,0):jv|=n),xr(e,t)}function E5(e,t){t===0&&(e.mode&1?(t=Zc,Zc<<=1,!(Zc&130023424)&&(Zc=4194304)):t=1);var n=ir();e=Wa(e,t),e!==null&&(dc(e,t,n),xr(e,n))}function VO(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),E5(e,n)}function GO(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Pe(314))}r!==null&&r.delete(t),E5(e,n)}var S5;S5=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||hr.current)pr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return pr=!1,LO(e,t,n);pr=!!(e.flags&131072)}else pr=!1,on&&t.flags&1048576&&TT(t,fd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hu(e,t),e=t.pendingProps;var a=yo(t,Xn.current);fo(t,n),a=_v(null,t,r,e,a,n);var i=wv();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,mr(r)?(i=!0,ud(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,xv(t),a.updater=Xd,t.stateNode=a,a._reactInternals=t,Wy(t,r,e,n),t=Ky(null,t,r,!0,i,n)):(t.tag=0,on&&i&&uv(t),rr(null,t,a,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hu(e,t),e=t.pendingProps,a=r._init,r=a(r._payload),t.type=r,a=t.tag=YO(r),e=ea(r,e),a){case 0:t=Gy(null,t,r,e,n);break e;case 1:t=d_(null,t,r,e,n);break e;case 11:t=c_(null,t,r,e,n);break e;case 14:t=u_(null,t,r,ea(r.type,e),n);break e}throw Error(Pe(306,r,""))}return t;case 0:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),Gy(e,t,r,a,n);case 1:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),d_(e,t,r,a,n);case 3:e:{if(l5(t),e===null)throw Error(Pe(387));r=t.pendingProps,i=t.memoizedState,a=i.element,OT(e,t),hd(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=_o(Error(Pe(423)),t),t=f_(e,t,r,n,a);break e}else if(r!==a){a=_o(Error(Pe(424)),t),t=f_(e,t,r,n,a);break e}else for(jr=Ei(t.stateNode.containerInfo.firstChild),Tr=t,on=!0,na=null,n=MT(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(bo(),r===a){t=Va(e,t,n);break e}rr(e,t,r,n)}t=t.child}return t;case 5:return DT(t),e===null&&$y(t),r=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,s=a.children,Py(r,a)?s=null:i!==null&&Py(r,i)&&(t.flags|=32),o5(e,t),rr(e,t,s,n),t.child;case 6:return e===null&&$y(t),null;case 13:return c5(e,t,n);case 4:return yv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=vo(t,null,r,n):rr(e,t,r,n),t.child;case 11:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),c_(e,t,r,a,n);case 7:return rr(e,t,t.pendingProps,n),t.child;case 8:return rr(e,t,t.pendingProps.children,n),t.child;case 12:return rr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,a=t.pendingProps,i=t.memoizedProps,s=a.value,Qt(gd,r._currentValue),r._currentValue=s,i!==null)if(oa(i.value,s)){if(i.children===a.children&&!hr.current){t=Va(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){s=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Ua(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Hy(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(Pe(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Hy(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}rr(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,r=t.pendingProps.children,fo(t,n),a=qr(a),r=r(a),t.flags|=1,rr(e,t,r,n),t.child;case 14:return r=t.type,a=ea(r,t.pendingProps),a=ea(r.type,a),u_(e,t,r,a,n);case 15:return i5(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,a=t.pendingProps,a=t.elementType===r?a:ea(r,a),Hu(e,t),t.tag=1,mr(r)?(e=!0,ud(t)):e=!1,fo(t,n),n5(t,r,a),Wy(t,r,a,n),Ky(null,t,r,!0,e,n);case 19:return u5(e,t,n);case 22:return s5(e,t,n)}throw Error(Pe(156,t.tag))};function N5(e,t){return Jj(e,t)}function KO(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function zr(e,t,n,r){return new KO(e,t,n,r)}function Mv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function YO(e){if(typeof e=="function")return Mv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Zb)return 11;if(e===Jb)return 14}return 2}function ji(e,t){var n=e.alternate;return n===null?(n=zr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Vu(e,t,n,r,a,i){var s=2;if(r=e,typeof e=="function")Mv(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Xs:return ss(n.children,a,i,t);case Qb:s=8,a|=8;break;case hy:return e=zr(12,n,t,a|2),e.elementType=hy,e.lanes=i,e;case my:return e=zr(13,n,t,a),e.elementType=my,e.lanes=i,e;case xy:return e=zr(19,n,t,a),e.elementType=xy,e.lanes=i,e;case Dj:return Jd(n,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Lj:s=10;break e;case Oj:s=9;break e;case Zb:s=11;break e;case Jb:s=14;break e;case ui:s=16,r=null;break e}throw Error(Pe(130,e==null?e:typeof e,""))}return t=zr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=i,t}function ss(e,t,n,r){return e=zr(7,e,r,t),e.lanes=n,e}function Jd(e,t,n,r){return e=zr(22,e,r,t),e.elementType=Dj,e.lanes=n,e.stateNode={isHidden:!1},e}function Tg(e,t,n){return e=zr(6,e,null,t),e.lanes=n,e}function Ag(e,t,n){return t=zr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function XO(e,t,n,r,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ug(0),this.expirationTimes=ug(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ug(0),this.identifierPrefix=r,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Lv(e,t,n,r,a,i,s,l,c){return e=new XO(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=zr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},xv(i),e}function QO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ys,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function C5(e){if(!e)return Ri;e=e._reactInternals;e:{if(ys(e)!==e||e.tag!==1)throw Error(Pe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(mr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Pe(171))}if(e.tag===1){var n=e.type;if(mr(n))return CT(e,n,t)}return t}function j5(e,t,n,r,a,i,s,l,c){return e=Lv(n,r,!0,e,a,i,s,l,c),e.context=C5(null),n=e.current,r=ir(),a=Ci(n),i=Ua(r,a),i.callback=t??null,Si(n,i,a),e.current.lanes=a,dc(e,a,r),xr(e,r),e}function ef(e,t,n,r){var a=t.current,i=ir(),s=Ci(a);return n=C5(n),t.context===null?t.context=n:t.pendingContext=n,t=Ua(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Si(a,t,s),e!==null&&(aa(e,a,s,i),zu(e,a,s)),s}function wd(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 __(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ov(e,t){__(e,t),(e=e.alternate)&&__(e,t)}function ZO(){return null}var T5=typeof reportError=="function"?reportError:function(e){console.error(e)};function Dv(e){this._internalRoot=e}tf.prototype.render=Dv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Pe(409));ef(e,t,null,null)};tf.prototype.unmount=Dv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ps(function(){ef(null,e,null,null)}),t[qa]=null}};function tf(e){this._internalRoot=e}tf.prototype.unstable_scheduleHydration=function(e){if(e){var t=sT();e={blockedOn:null,target:e,priority:t};for(var n=0;n<fi.length&&t!==0&&t<fi[n].priority;n++);fi.splice(n,0,e),n===0&&lT(e)}};function Pv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function nf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function w_(){}function JO(e,t,n,r,a){if(a){if(typeof r=="function"){var i=r;r=function(){var u=wd(s);i.call(u)}}var s=j5(t,r,e,0,null,!1,!1,"",w_);return e._reactRootContainer=s,e[qa]=s.current,Ul(e.nodeType===8?e.parentNode:e),ps(),s}for(;a=e.lastChild;)e.removeChild(a);if(typeof r=="function"){var l=r;r=function(){var u=wd(c);l.call(u)}}var c=Lv(e,0,!1,null,null,!1,!1,"",w_);return e._reactRootContainer=c,e[qa]=c.current,Ul(e.nodeType===8?e.parentNode:e),ps(function(){ef(t,c,n,r)}),c}function rf(e,t,n,r,a){var i=n._reactRootContainer;if(i){var s=i;if(typeof a=="function"){var l=a;a=function(){var c=wd(s);l.call(c)}}ef(t,s,e,a)}else s=JO(n,t,e,a,r);return wd(s)}aT=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ol(t.pendingLanes);n!==0&&(nv(t,n|1),xr(t,bn()),!(Ft&6)&&(wo=bn()+500,Di()))}break;case 13:ps(function(){var r=Wa(e,1);if(r!==null){var a=ir();aa(r,e,1,a)}}),Ov(e,1)}};rv=function(e){if(e.tag===13){var t=Wa(e,134217728);if(t!==null){var n=ir();aa(t,e,134217728,n)}Ov(e,134217728)}};iT=function(e){if(e.tag===13){var t=Ci(e),n=Wa(e,t);if(n!==null){var r=ir();aa(n,e,t,r)}Ov(e,t)}};sT=function(){return Ht};oT=function(e,t){var n=Ht;try{return Ht=e,t()}finally{Ht=n}};Cy=function(e,t,n){switch(t){case"input":if(vy(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=Gd(r);if(!a)throw Error(Pe(90));Fj(r),vy(r,a)}}}break;case"textarea":zj(e,n);break;case"select":t=n.value,t!=null&&oo(e,!!n.multiple,t,!1)}};Gj=Av;Kj=ps;var eD={usingClientEntryPoint:!1,Events:[gc,eo,Gd,Wj,Vj,Av]},Zo={findFiberByHostInstance:Ji,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tD={bundleType:Zo.bundleType,version:Zo.version,rendererPackageName:Zo.rendererPackageName,rendererConfig:Zo.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Ka.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Qj(e),e===null?null:e.stateNode},findFiberByHostInstance:Zo.findFiberByHostInstance||ZO,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 cu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!cu.isDisabled&&cu.supportsFiber)try{Hd=cu.inject(tD),ka=cu}catch{}}Mr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eD;Mr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Pv(t))throw Error(Pe(200));return QO(e,t,null,n)};Mr.createRoot=function(e,t){if(!Pv(e))throw Error(Pe(299));var n=!1,r="",a=T5;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=Lv(e,1,!1,null,null,n,!1,r,a),e[qa]=t.current,Ul(e.nodeType===8?e.parentNode:e),new Dv(t)};Mr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(Pe(188)):(e=Object.keys(e).join(","),Error(Pe(268,e)));return e=Qj(t),e=e===null?null:e.stateNode,e};Mr.flushSync=function(e){return ps(e)};Mr.hydrate=function(e,t,n){if(!nf(t))throw Error(Pe(200));return rf(null,e,t,!0,n)};Mr.hydrateRoot=function(e,t,n){if(!Pv(e))throw Error(Pe(405));var r=n!=null&&n.hydratedSources||null,a=!1,i="",s=T5;if(n!=null&&(n.unstable_strictMode===!0&&(a=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=j5(t,null,e,1,n??null,a,!1,i,s),e[qa]=t.current,Ul(e),r)for(e=0;e<r.length;e++)n=r[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new tf(t)};Mr.render=function(e,t,n){if(!nf(t))throw Error(Pe(200));return rf(null,e,t,!1,n)};Mr.unmountComponentAtNode=function(e){if(!nf(e))throw Error(Pe(40));return e._reactRootContainer?(ps(function(){rf(null,null,e,!1,function(){e._reactRootContainer=null,e[qa]=null})}),!0):!1};Mr.unstable_batchedUpdates=Av;Mr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!nf(n))throw Error(Pe(200));if(e==null||e._reactInternals===void 0)throw Error(Pe(38));return rf(e,t,n,!1,r)};Mr.version="18.3.1-next-f1338f8080-20240426";function A5(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(A5)}catch(e){console.error(e)}}A5(),Aj.exports=Mr;var Fv=Aj.exports;const nD=No(Fv);var E_=Fv;gy.createRoot=E_.createRoot,gy.hydrateRoot=E_.hydrateRoot;const rD="modulepreload",aD=function(e){return"/"+e},S_={},R5=function(t,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),l=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));a=Promise.allSettled(n.map(c=>{if(c=aD(c),c in S_)return;S_[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":rD,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((g,p)=>{f.addEventListener("load",g),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return a.then(s=>{for(const l of s||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},$a={"planCard.heading":"Plan ready — what next?","planCard.showPlan":"Show the plan","planCard.execute":"Switch to build & execute","planCard.keepPlanning":"Keep planning","planCard.executedStatus":"Switched to build mode — executing the plan.","planCard.dismissedStatus":"Staying in plan mode.","planCard.close":"Close","planCard.loading":"Loading…","planCard.loadError":"Couldn't load the plan.","planCard.executePrompt":"Implement the plan in PLAN.md. Follow it step by step.","agent_conversation.back":"Back","agent_conversation.message_count":"{name} - {count} messages","agent_conversation.message_queued":"Message queued for agent","agent_conversation.no_messages":"No messages yet","agent_conversation.no_messages_hint":"Use the Send Message button to contact the agent","agent_conversation.compose_button":"Send Message","agent_conversation.modal_title":"Send Message to {name}","agent_conversation.reply_to_inbox":"Notify me when complete","agent_conversation.urgent_interrupt_button":"Send Urgent Interrupt","agent_conversation.urgent_warning":"This will interrupt the agent’s current work immediately. Click again to confirm.","agent_conversation.confirm_interrupt":"Confirm Interrupt","agent_conversation.priority":"Priority:","agent_conversation.priority_high":"High","agent_conversation.priority_normal":"Normal","agent_conversation.priority_urgent":"Urgent","agent_conversation.priority_urgent_confirm":"This will send an urgent interrupt that aborts the agent's current work. Continue?","agent_conversation.priority_urgent_title":"Send Urgent Interrupt","agent_conversation.priority_urgent_hint":"Urgent: This will interrupt the agent’s current work immediately","agent_conversation.interrupt_button":"Interrupt","agent_conversation.interrupt_sent":"Urgent interrupt sent to agent","agent_conversation.queue_hint":"Messages are queued in the agent's inbox and processed on next wake","agent_conversation.refresh":"Refresh","agent_conversation.send_button":"Send","agent_conversation.send_placeholder":"Send a message to the agent's inbox...","agent_conversation.sending":"Sending","agent_conversation.title":"Conversation","confirm_dialog.cancel":"Cancel","confirm_dialog.confirm":"Confirm","agent_create.cancel":"Cancel","agent_create.configure_subtitle":"Configure your autonomous agent","agent_create.custom_model":"Custom model...","agent_create.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_create.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_create.deselect_all":"Deselect All","agent_create.display_name_hint":"Human-friendly name shown in the UI","agent_create.display_name_label":"Display Name (optional)","agent_create.display_name_placeholder":"e.g., My Development Agent","agent_create.dormant_mode":"Start in dormant mode","agent_create.dormant_mode_desc":"Agent will not process AGENTS.md on startup. It waits until it receives an inbox message.","agent_create.instructions_label":"Agent Instructions (AGENTS.md)","agent_create.instructions_optional":"(optional)","agent_create.instructions_hint":"Instructions and context for the agent. Written to workspace/AGENTS.md if workspace is set.","agent_create.loading_models":"Loading models...","agent_create.loading_skills":"Loading skills...","agent_create.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_create.model_label":"Model *","agent_create.model_placeholder":"github-copilot/claude-opus-4.6","agent_create.name_generate":"Generate random name","agent_create.name_hint":"Lowercase letters, numbers, hyphens, and underscores only","agent_create.name_label":"Agent Name *","agent_create.name_placeholder":"e.g., swift-falcon","agent_create.no_skills":"No skills installed","agent_create.random":"Random","agent_create.reset_default":"Reset to Default","agent_create.select_all":"Select All","agent_create.skills_label":"Skills","agent_create.skills_selected":"Skills selected: {count}","agent_create.soul_label":"Soul / Instructions (AGENTS.md)","agent_create.soul_placeholder":"# AGENTS.md content...","agent_create.spawn":"Spawn Agent","agent_create.spawning":"Spawning...","agent_create.start_mode":"Start Mode","agent_create.title":"Spawn New Agent","agent_create.validate_model":"Please select a model","agent_create.validate_workspace":"Workspace directory is required","agent_create.working_dir_hint":"The agent's working directory for file operations","agent_create.working_dir_label":"Workspace Directory *","agent_create.working_dir_placeholder":"/path/to/project","agent_detail.action_deleted":"Agent deleted","agent_detail.action_updated":"Settings updated successfully","agent_detail.agent_info":"Agent Info","agent_detail.back":"Back to agents list","agent_detail.edit_settings":"Edit Settings","agent_detail.failed_to_load":"Failed to load agent:","agent_detail.iteration":"Iteration","agent_detail.model":"Model","agent_detail.pid":"PID","agent_detail.port":"Port","agent_detail.session_id":"Session ID","agent_detail.soul_file":"Soul File","agent_detail.start_mode":"Start mode","agent_detail.start_mode_dormant":"Dormant","agent_detail.start_mode_normal":"Normal","agent_detail.started":"Started","agent_detail.status":"Status","agent_detail.stopped":"stopped","agent_detail.token_cached":"Cached","agent_detail.token_input":"Input","agent_detail.token_output":"Output","agent_detail.token_usage":"Token Usage","agent_detail.total_cost":"Total Cost","agent_detail.unknown_agent":"Unknown Agent","agent_detail.uptime":"Uptime","agent_detail.view_conversation":"View Conversation","agent_detail.working_dir":"Working Dir","agent_detail.working_dir_label":"Working Dir:","agent_edit.cannot_change":"(cannot be changed)","agent_edit.custom_model":"Custom model...","agent_edit.custom_model_hint":"Enter any model identifier (e.g., github-copilot/claude-opus-4.6, openai/gpt-4o)","agent_edit.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","agent_edit.deselect_all":"Deselect All","agent_edit.display_name_label":"Display Name","agent_edit.display_name_placeholder":"Human-friendly name","agent_edit.dormant_mode":"Start in dormant mode","agent_edit.dormant_mode_desc":"Agent will not process AGENTS.md on startup. Takes effect on next start.","agent_edit.instructions_label":"Agent Instructions (AGENTS.md)","agent_edit.instructions_hint":"Instructions and context for the agent. This file is re-read when the agent starts or when hot-reloaded.","agent_edit.loading_models":"Loading models...","agent_edit.loading_skills":"Loading skills...","agent_edit.model_hint":'Select a model from the list or choose "Custom model..." for other options',"agent_edit.model_label":"Model","agent_edit.model_placeholder":"e.g., github-copilot/claude-opus-4.6","agent_edit.name_label":"Agent Name","agent_edit.no_skills":"No skills installed","agent_edit.no_workspace_warning":"No workspace configured. AGENTS.md cannot be edited without a workspace directory.","agent_edit.not_set":"Not set","agent_edit.running_warning":"Running - restart required for changes","agent_edit.save":"Save Changes","agent_edit.saved":"Settings saved successfully","agent_edit.saving":"Saving...","agent_edit.select_all":"Select All","agent_edit.skills_label":"Skills","agent_edit.skills_selected":"Skills selected: {count}","agent_edit.soul_placeholder":"# AGENTS.md content...","agent_edit.start_mode":"Start Mode","agent_edit.stop_to_change":"Stop the agent to change workspace","agent_edit.tab_general":"General","agent_edit.tab_soul":"AGENTS.md","agent_edit.title":"Edit Agent Settings","agent_edit.will_be_created":"(will be created)","agent_edit.working_dir_hint":"The agent's working directory for file operations","agent_edit.working_dir_label":"Workspace Directory *","agent_edit.working_dir_placeholder":"/path/to/project","agent_edit.workspace_changed_warning":"Workspace has changed. AGENTS.md editing is disabled to prevent overwriting files in the new workspace. Save your changes, then re-open settings to edit AGENTS.md in the new workspace.","agent_edit.workspace_move_warning":"Changing workspace will not move existing AGENTS.md. You may need to re-configure the agent's instructions.","agents.back_to_chat":"Back to Chat","agents.collapse_panel":"Collapse panel","agents.expand_panel":"Expand panel","agents.no_agents_desc":"Spawn your first autonomous agent to get started","agents.no_agents_title":"No agents yet","agents.model_label":"Model: {model}","agents.resize_terminal":"Resize terminal panel","agents.back":"Back","agents.iteration":"Iter","agents.pid":"PID","agents.port":"Port","agents.refresh":"Refresh","agents.restart":"Restart","agents.restarting":"Restarting...","agents.clean_restart":"Clean Restart","agents.clean_restart_tooltip":"Restart with a new session (starts a fresh conversation)","agents.spawn_button":"Spawn Agent","agents.start":"Start","agents.starting":"Starting...","agents.stop":"Stop","agents.stopping":"Stopping...","agents.subtitle":"Manage autonomous agents","agents.title":"Agents","agents.uptime":"Uptime","agents.drop_to_import":"Drop YAML file to import agent","agents.export":"Export","agents.export_error":"Failed to export agent","agents.import":"Import","agents.import_button":"Import Agent","agents.import_error":"Failed to import agent","agents.import_invalid_file":"Invalid file type. Please select a .yaml or .yml file.","agents.import_file_too_large":"File too large (max 10MB)","agents.import_read_error":"Failed to read file","agents.import_success":"Agent imported successfully","agents.view_details":"Agent details","agents.pause":"Pause","agents.pausing":"Pausing...","agents.unpause":"Unpause","agents.resume":"Resume","agents.resuming":"Resuming...","agents.paused":"Paused","agents.select":"Select","agents.selected":"{count} selected","agents.selectAll":"Select All","agents.deselectAll":"Deselect All","agents.pauseAll":"Pause All","agents.unpauseAll":"Unpause All","agents.stopAll":"Stop All","agents.restartAll":"Restart All","agents.startAll":"Start All","app.agents_tab":"Agents","app.chat_tab":"Chat","app.close_search":"Close search","app.activities_panel":"Activities","app.close_activities":"Close activities panel","app.dismiss_error":"Dismiss error","app.hacker_mode_enter":"Enter hacker mode (Ctrl+H or Ctrl+Shift+M)","app.hacker_mode_exit":"Exit hacker mode (Ctrl+H or Ctrl+Shift+M)","app.match_count":"{current} of {total}","app.new_chat":"New Chat","app.next_match":"Next match","app.no_matches":"No matches","app.previous_match":"Previous match","app.reconnecting":"Reconnecting to server...","app.resize_terminal":"Resize terminal panel","app.right_pane_hidden":"Activities panel hidden","app.right_pane_shown":"Activities panel shown","app.search_messages":"Search messages","app.search_placeholder":"Search in conversation...","app.settings_tab":"Settings","app.skills_tab":"Skills","app.toggle_right_pane":"Toggle activities panel ({shortcut})","app.welcome_start":"Start a conversation to get going.","app.welcome_subtitle":"Your AI-powered development assistant","app.welcome_title":"Welcome to PAVE","chat.attach_image":"Attach image","chat.attach_file":"Attach file (image, docx, pdf, text)","chat.attachment":"Attachment","chat.attachment_with_index":"Attachment {index}","chat.copied":"Copied!","chat.copy":"Copy","chat.copy_message":"Copy message","chat.cancel_queued":"Remove from queue","chat.queued":"Queued","chat.edit_queued":"Edit queued message","chat.edit_resend":"Edit and resend","chat.read_only":"Read-only","chat.read_only_desc":"This is a read-only session from the TUI. Messages cannot be sent.","chat.regenerate":"Regenerate response","chat.scroll_to_bottom":"Scroll to bottom","chat.send_button":"Send message","chat.send_hint":"Press Enter to send, Shift+Enter for new line. Type / for commands","chat.send_placeholder":"Send a message...","chat.stop_generating":"Stop generating","chat.tool_bash":"Running command","chat.tool_edit":"Editing file","chat.tool_glob":"Searching files","chat.tool_grep":"Searching code","chat.tool_preparing":"Preparing tool call","chat.tool_preparing_name":"Preparing {name}","chat.tool_read":"Reading file","chat.tool_write":"Writing file","chat.viewing_terminal":"Viewing Terminal session (read-only)","chat.yesterday":"Yesterday","chat.yesterday_time":"Yesterday {time}","chat.viewing_archive":"Viewing archived session (read-only)","chat.compacting_context":"Compacting context","chat.compacted_switch_to_new":"Compacted — switch to new session","chat.unpin_compacted":"Unpin — go back to original","chat.show_thinking":"Show thinking","chat.hide_thinking":"Hide thinking","chat.thinking":"Thinking","chat.whatsapp_enabled":"WhatsApp mode enabled - assistant replies will be sent to WhatsApp","chat.whatsapp_disabled":"Enable WhatsApp two-way mode","chat.whatsapp_no_chatid":"Set PAVE_WHATSAPP_CHAT_ID in Settings before enabling WhatsApp routing","chat.working_directory":"Working Directory","chat.working_directory_current":"Current:","chat.working_directory_recent":"Recent:","chat.working_directory_change":"Change","chat.working_directory_cancel":"Cancel","chat.working_directory_create":"Create Directory","chat.working_directory_not_found":"Directory does not exist","chat.working_directory_invalid":"Invalid path","chat.working_directory_checking":"Checking path...","chat.working_directory_changed":"Working directory changed to {path}","chat.working_directory_created":"Directory created: {path}","chat.working_directory_create_failed":"Failed to create directory: {error}","chat.working_directory_remove_recent":"Remove from recent","chat.working_directory_has_agents_md":"Contains AGENTS.md","chat.working_directory_no_agents_md":"No AGENTS.md in this directory","chat.working_directory_new_path":"New path","chat.working_directory_placeholder":"/path/to/directory or ~/projects/...","chat.working_directory_not_set":"(not set)","chat.idle_injection_title":"Idle Injection","chat.idle_injection_toggle":"Enable idle injection","chat.idle_injection_message":"Injection message","chat.idle_injection_message_placeholder":"Message to inject when idle","chat.idle_injection_interval":"Idle interval (seconds)","chat.idle_injection_interval_desc":"How long to wait after the LLM finishes responding before injecting.","chat.idle_injection_max":"Max injections (0 = unlimited)","chat.idle_injection_max_desc":"Stops injecting after this many times. 0 means no limit.","chat.idle_injection_timeout_toggle":"Enable LLM timeout detection","chat.idle_injection_timeout_toggle_desc":"Detect when the LLM is stuck (no response) and re-inject.","chat.idle_injection_timeout_threshold":"Timeout threshold (seconds)","chat.idle_injection_timeout_threshold_desc":"How long to wait for the first token before considering the LLM hung.","chat.idle_injection_timeout_cooldown":"Timeout cooldown (seconds)","chat.idle_injection_timeout_cooldown_desc":"How long to wait after a timeout before re-injecting.","chat.idle_injection_save":"Save","chat.idle_injection_disable":"Disable","chat.idle_injection_saving":"Saving...","chat.idle_injection_disabling":"Disabling...","chat.idle_injection_saved":"Settings saved","chat.idle_injection_disabled_toast":"Idle injection disabled","chat.idle_injection_enabled_toast":"Idle injection enabled","chat.idle_injection_fired_toast":"Idle injection fired","chat.idle_injection_timeout_toast":"LLM timeout detected — retrying","chat.idle_injection_auto_badge":"auto","scheduled_injection.title":"Scheduled Injections","scheduled_injection.subtitle":"Automatically inject messages at scheduled times","scheduled_injection.add":"Add Schedule","scheduled_injection.empty":"No schedules configured. Add one above.","scheduled_injection.time":"Time","scheduled_injection.repeat":"Repeat","scheduled_injection.repeat_every_day":"Every day","scheduled_injection.repeat_weekdays":"Weekdays","scheduled_injection.repeat_weekends":"Weekends","scheduled_injection.repeat_custom":"Custom","scheduled_injection.timezone":"Timezone","scheduled_injection.message":"Message (optional)","scheduled_injection.message_placeholder":"Leave empty for default check-in message","scheduled_injection.enabled":"Enabled","scheduled_injection.save":"Save Schedule","scheduled_injection.saving":"Saving...","scheduled_injection.delete":"Delete","scheduled_injection.day_sun":"Sun","scheduled_injection.day_mon":"Mon","scheduled_injection.day_tue":"Tue","scheduled_injection.day_wed":"Wed","scheduled_injection.day_thu":"Thu","scheduled_injection.day_fri":"Fri","scheduled_injection.day_sat":"Sat","scheduled_injection.fired_toast":"Scheduled injection fired","scheduled_injection.error_generic":"Failed to save schedule","chat.interrupted_badge":"Interrupted","chat.moe_auto":"Auto","chat.moe_fast":"Fast","chat.moe_fastest":"Fastest","chat.moe_tooltip":"Expert count — lower is faster but less accurate","chat.reasoning_max":"Max","chat.reasoning_high":"High","chat.reasoning_off":"Off","chat.reasoning_tooltip":"Reasoning effort — higher is smarter but slower","chat.idle_injection_mode":"Dispatch mode","chat.idle_injection_mode_desc":"How the injected message is queued.","chat.idle_injection_mode_urgent":"Urgent (between tool calls)","chat.idle_injection_mode_normal":"Normal (after turn)","chat.idle_injection_mode_idle":"Idle (after turn + delay)","chat.idle_injection_wait_ms":"Idle wait delay (seconds)","chat.idle_injection_wait_ms_desc":"Extra delay before dispatching when in Idle mode.","common.back":"Back","common.cancel":"Cancel","common.close":"Close","common.confirm":"Confirm","common.delete":"Delete","common.deleting":"Deleting...","common.edit":"Edit","common.error":"Error","common.loading":"Loading...","common.no":"No","common.optional":"(optional)","common.retry":"Retry","common.save":"Save","common.unknown_error":"Unknown error","common.success":"Success","common.yes":"Yes","login.email_placeholder":"Email","login.or":"or","login.password_placeholder":"Password","login.pave_subtitle":"Personal AI Virtual Environment","login.powered_by":"Powered by PAVE","login.sign_in":"Sign in to continue","login.sign_in_locally":"Sign in locally","login.signing_in":"Signing in...","login.terms":"By signing in, you agree to the terms of service.","permission.allow":"Allow","permission.allowing":"Allowing...","permission.action_clear_all":"Clear All","permission.action_grant":"Grant","permission.action_revoke":"Revoke","permission.clear_all":"Clear ALL permissions (lock down sandbox)","permission.deny":"Deny","permission.denying":"Denying...","permission.expired":"Request expired","permission.no_reason":"No reason provided","permission.reason_prefix":"Reason:","permission.request_desc":"{action} {type} permission for: {target}","permission.title":"Permission Request","permission.type_file_read":"File Read","permission.type_file_write":"File Write","permission.type_module":"Module","permission.type_network":"Network","permission.type_system":"System Command","question.already_answered":"Question already answered","question.custom_placeholder":"Or type a custom answer...","question.dismiss":"Dismiss","question.dismissing":"Dismissing...","question.expired":"Question expired","question.input_placeholder":"Type your answer...","question.select_all":"Select all that apply","question.submit":"Submit","question.submit_n":"Submit {count} answers","question.submitting":"Submitting...","question.reconnecting":"Reconnecting…","question.title":"Question from AI","pricing.add":"Add","pricing.add_model":"Add Model","pricing.add_model_placeholder":"Model name (e.g., gpt-4)","pricing.add_new_model":"Add New Model","pricing.cached_tokens":"Cached tokens (per 1M)","pricing.close":"Close pricing settings","pricing.configured_count":"Configured models: {count}","pricing.fallback_badge":"fallback","pricing.default_exists":'Cannot add "default" - it already exists as fallback',"pricing.discard_confirm":"Discard unsaved changes?","pricing.discard_title":"Discard Changes","pricing.heading":"Token Pricing","pricing.input_tokens":"Input tokens (per 1M)","pricing.label_cache":"Cache:","pricing.label_input":"In:","pricing.label_output":"Out:","pricing.model_column":"Model","pricing.model_exists":"Model already exists","pricing.model_required":"Model name is required","pricing.output_tokens":"Output tokens (per 1M)","pricing.rates_column":"Input / Output / Cached","pricing.rates_subtitle":"Prices in USD per 1M tokens","pricing.remove_model":"Remove model","pricing.remove_model_aria":"Remove {modelName}","pricing.remove_confirm":'Remove pricing for "{model}"?',"pricing.remove_title":"Remove Model Pricing","pricing.reset":"Reset to Defaults","pricing.reset_confirm":"Reset all pricing to default values? This cannot be undone.","pricing.reset_title":"Reset Pricing","pricing.save":"Save","pricing.save_changes":"Save Changes","pricing.subtitle":"Configure cost per 1 million tokens (USD)","pricing.title":"Token Pricing Settings","settings.back":"Back to chat","settings.category.display":"Display","settings.appearance":"Appearance","settings.mobile_frameless":"Frameless assistant messages","settings.mobile_frameless_label":"Mobile UX enhancement (experimental)","settings.mobile_frameless_desc":"Removes avatar and bubble background from assistant messages for a cleaner, full-width reading experience","settings.category.language":"Language","settings.category.marketplace":"Marketplace","settings.category.model":"AI Model & Provider","settings.category.prefillFallback":"Prefill Fallback","settings.category.models":"Models","settings.category.rate":"Rate Limiting","settings.category.systemPrompts":"System Prompts","settings.category.tools":"Tool Execution","settings.category.whatsapp":"WhatsApp","settings.category.lmstudio":"LM Studio","settings.category.compaction":"Compaction","settings.category.sessionBanner":"Session Banner","settings.category.sessionBehavior":"Session Behavior","settings.currently_set_to":"Currently set to: {path}","settings.default_prefix":"Default: {value}","settings.default_empty":"(empty)","settings.description":"Configure PAVE runtime settings. Most changes apply on save; some (e.g. timeouts) may require restarting PAVE.","settings.env_badge":"env","settings.env_override":"This value is currently overridden by the {envVar} environment variable.","settings.failed_to_load":"Failed to load settings: {error}","settings.language":"Language","settings.language_description":"Select your preferred language for the interface","settings.language_auto_applied":"✓ Language applied automatically","settings.no_changes":"No changes to save.","settings.not_set":"Not set","settings.enabled":"Enabled","settings.disabled":"Disabled","settings.notification_sound":"Notification Sound","settings.notification_sound_desc":"Play a sound when new inbox messages arrive","settings.native_notifications":"Native Notifications","settings.native_notifications_desc":"Show browser notifications for new inbox messages","settings.native_notifications_blocked":"Notifications blocked by browser — enable in browser settings","settings.native_notifications_permission":"Click to enable — permission will be requested","settings.native_notifications_unsupported":"Not supported in this browser","settings.auto_saved":"Changes apply immediately","settings.notifications":"Notifications","settings.partial_save":"Some settings could not be saved. See errors below.","settings.requires_restart":"(requires restart)","settings.reset":"Reset","settings.save":"Save","settings.save_failed":"Failed to save: {error}","settings.saved":"Settings saved successfully.","settings.saving":"Saving...","settings.source_default":"Default","settings.source_env":"ENV","settings.source_saved":"Saved","settings.title":"Settings","settings.validating":"Validating...","settings.apply":"Apply","settings.workspace":"Workspace","settings.working_dir":"Working Directory","settings.working_dir_desc":"Set a custom working directory for file operations and tool execution. Leave empty to use the server default.","settings.working_dir_reset":"Working directory reset to server default","settings.working_dir_updated":"Working directory updated to: {path}","settings.working_dir_invalid":"Invalid directory path: {error}","settings.version_title":"Version","settings.current_version":"Current version","settings.latest_version":"Latest version","settings.update_available":"Update available","settings.update_button":"Update","settings.no_updates":"No updates available","settings.check_updates":"Check for Updates","settings.checking_updates":"Checking for updates…","settings.update_in_progress":"Update in progress…","settings.update_success":"Update successful","settings.update_failed":"Update failed","settings.check_updates_failed":"Check for updates failed","settings.model_registry.title":"Model Registry","settings.model_registry.builtin":"Built-in Models","settings.model_registry.user":"User Models","settings.model_registry.add_model":"+ Add Model","settings.model_registry.no_user_models":'No user-defined models. Click "+ Add Model" to add one.',"settings.model_registry.name":"Model Name","settings.model_registry.name_placeholder":"Model name (e.g. my-custom-model)","settings.model_registry.provider":"Provider","settings.model_registry.provider_placeholder":"e.g. openai","settings.model_registry.displayName":"Display Name","settings.model_registry.displayName_placeholder":"My Model","settings.model_registry.url":"Endpoint URL","settings.model_registry.url_placeholder":"http(s)://… or pave(s)://…","settings.model_registry.tier":"Tier","settings.model_registry.tier_placeholder":"e.g. fast, premium","settings.model_registry.limit_context":"Context Limit","settings.model_registry.limit_output":"Output Limit","settings.model_registry.cost_input":"Input Cost ($/1M tokens)","settings.model_registry.cost_output":"Output Cost ($/1M tokens)","settings.model_registry.save":"Save","settings.model_registry.saving":"Saving...","settings.model_registry.cancel":"Cancel","settings.model_registry.add":"Add","settings.model_registry.adding":"Adding...","settings.model_registry.edit":"Edit model","settings.model_registry.delete":"Delete model","settings.model_registry.delete_confirm":'Remove model "{name}" from the registry?',"settings.model_registry.loading":"Loading model registry...","settings.model_registry.load_error":"Failed to load registry: {error}","settings.model_registry.context_k":"{value}K ctx","settings.model_registry.target":"Alias Target (optional)","settings.model_registry.target_placeholder":"e.g. github-copilot/claude-opus-4.7","settings.model_registry.target_hint":"If set, this entry is an alias — selections route to the target model. Leave empty for a self-contained model with its own endpoint URL.","settings.model_registry.spec":"Model Spec","settings.model_registry.spec_placeholder":"e.g. github-copilot/claude-opus-4.7 or pave://host/path?model=…","settings.model_registry.spec_hint":"Enter a provider/model alias (e.g. github-copilot/claude-opus-4.7) or a full pave://, paves://, http://, or https:// URL. URLs are detected automatically.","settings.model_registry.kind_alias":"Alias","settings.model_registry.advanced":"Advanced (limits & cost)","settings.model_registry.error_name_required":"Model name is required","settings.model_registry.error_name_reserved":'Model name "{name}" is reserved',"settings.model_registry.error_name_exists":'A model named "{name}" already exists',"settings.model_registry.error_rename_cleanup":"Renamed, but failed to remove old entry: {error}","settings.custom_model":"Custom model...","settings.custom_model_placeholder":"Enter custom model identifier (e.g., provider/model-name)","sidebar.conversations":"Conversations","sidebar.delete":"Delete","sidebar.delete_all":"Delete All Conversations","sidebar.delete_all_confirm":"Delete the conversations listed here? Sessions belonging to other apps are left alone. This cannot be undone.","sidebar.delete_all_title":"Delete All Sessions","sidebar.delete_confirm":"Delete this conversation?","sidebar.delete_title":"Delete Session","sidebar.hide":"Hide sidebar","sidebar.load_more":"Load more conversations","sidebar.no_conversations":"No conversations yet","sidebar.no_matches":"No matches","sidebar.rename":"Rename","sidebar.regenerate_title":"Regenerate Title","sidebar.send_to_session":"Send to another session","send_to_session.title":"Send to another session","send_to_session.target_label":"Send to","send_to_session.message_label":"Message","send_to_session.delivery_note":"Delivered by the app that has that session open, usually within a couple of seconds. It may be a different app than this one.","send_to_session.queued":"Queued. It will be picked up by whichever app has that session open.","send_to_session.no_targets":"No other sessions to send to.","send_to_session.send":"Send","send_to_session.sending":"Sending...","send_to_session.cancel":"Cancel","send_to_session.close":"Close","sidebar.search_placeholder":"Search conversations...","sidebar.show":"Show conversations","sidebar.terminal":"Terminal","sidebar.studio":"PAVE Studio","sidebar.acp":"Connected editor","sidebar.legacy_sessions":"Older sessions","sidebar.untitled":"Untitled","sidebar.pin":"Pin","sidebar.unpin":"Unpin","sidebar.archive":"Archive","sidebar.unarchive":"Unarchive","sidebar.confirmArchive":"Archive this session? It will be hidden from the sidebar.","sidebar.show_archived":"Show archived","sidebar.hide_archived":"Hide archived","sidebar.pinned":"Pinned","sidebar.today":"Today","sidebar.yesterday":"Yesterday","sidebar.this_week":"This Week","sidebar.this_month":"This Month","sidebar.older":"Older","sidebar.other":"Other","sidebar.archived":"Archived","sidebar.export":"Export as YAML","sidebar.import":"Import session","sidebar.drop_to_import":"Drop session file to import","sidebar.session_processing":"Session is processing","sidebar.more_actions":"More actions","sidebar.age_now":"now","sidebar.age_minutes":"{n}m","sidebar.age_hours":"{n}h","sidebar.age_days":"{n}d","sidebar.age_weeks":"{n}w","import.invalid_file_type":"Only .yaml or .yml session files can be imported","import.file_too_large":"Import file too large (max 10MB)","import.read_error":"Failed to read file. Please try again.","skills.back_to_chat":"Back to chat","skills.cancel":"Cancel","skills.clear_all":"Clear all","skills.clear_confirm":"Clear all credentials for {skill}?","skills.clear_title":"Clear Credentials","skills.close":"Close","skills.close_credential_editor":"Close credential editor","skills.configure":"Configure","skills.configure_skill":"Configure {skill}","skills.configured":"Configured","skills.current_value":"(current: {value})","skills.enter_token":"Enter at least one token value","skills.enter_value":"Enter value...","skills.install":"Install","skills.installed":"Installed","skills.installed_count":"{installed} installed, {available} available","skills.installing":"Installing...","skills.install_failed":"Install failed: {error}","skills.leave_blank":"Leave blank to keep current","skills.load_installed_failed":"Failed to load installed skills: {error}","skills.load_marketplace_failed":"Failed to load marketplace: {error}","skills.needs_setup":"Needs setup","skills.no_credentials_needed":"This skill does not require any credentials.","skills.no_description":"No description","skills.no_match":"No skills match your search.","skills.no_skills":"No skills found.","skills.not_installed":"Not installed","skills.oauth_connect":"Connect with {provider}","skills.oauth_connect_hint":"Use OAuth to authenticate with {provider}. Click the button below to open the authorization page.","skills.oauth_connected":"Connected to {provider}","skills.oauth_disconnect":"Disconnect from {provider}","skills.oauth_connecting":"Connecting...","skills.oauth_needs_credentials":"Enter Client ID and Client Secret above first, then you can connect to {provider}.","skills.save":"Save","skills.saving":"Saving...","skills.search_placeholder":"Search skills...","skills.skill_management":"Skill Management","skills.subtitle":"Manage AI tool capabilities","skills.tab_all":"All","skills.tab_available":"Available","skills.tab_installed":"Installed","skills.tab_marketplace":"Marketplace","skills.title":"Skills","skills.check_updates":"Check for Updates","skills.checking_updates":"Checking...","skills.update":"Update","skills.updating":"Updating...","skills.update_available":"Update available: v{version}","skills.update_success":"Updated to v{version}","skills.update_failed":"Update failed","skills.up_to_date":"Up to date","skills.updates_available":"{count} update(s) available","skills.no_updates":"All skills are up to date","skills.uninstall":"Uninstall","skills.uninstall_title":"Uninstall Skill","skills.uninstall_confirm":"Uninstall {skill}? Your saved credentials will be preserved.","skills.uninstalling":"Uninstalling...","skills.uninstall_failed":"Uninstall failed: {error}","skills.toggle_title":"Manage skills for this session","skills.toggle_header":"Session Skills","skills.toggle_hint":"Toggle skills on/off for this chat only","skills.builtin_tools":"Built-in Tools","skills.agent_comm":"Agent Communication","skills.default":"Default","skills.default_for_new_sessions":"Enable by default for new sessions","skills.reset_to_defaults":"Reset to defaults","auth.device_code_title":"GitHub Copilot Authentication","auth.device_code_instructions":"Open {url} and enter code: {code}","auth.device_code_waiting":"Waiting for authorization...","task.activity":"Activity","task.awaiting":"Awaiting approval","task.completed":"Completed","task.error":"Error","task.no_active":"No active tasks. Send a message to get started.","task.processing":"Processing...","task.tool_bash":"Bash","task.tool_edit":"Edit","task.tool_editing":"Editing {target}","task.tool_glob":"Glob","task.tool_glob_desc":"Searching for files","task.tool_grep":"Grep","task.tool_grep_desc":"Searching code","task.tool_read":"Read","task.tool_reading":"Reading {target}","task.tool_write":"Write","task.tool_writing":"Writing {target}","task.working":"Working on it...","terminal.decrease_font":"Decrease font size","terminal.increase_font":"Increase font size","terminal.matrix_mode":"Matrix","terminal.no_output":"No terminal output yet","terminal.prompt":"$","theme.dark":"Switch to dark mode","theme.light":"Switch to light mode","time.days":"{count}d ","time.hours":"{count}h ","time.just_now":"just now","time.milliseconds":"{count}ms","time.minutes":"{count}m ","time.seconds":"{count}s","token.cache_read":"Cache Read","token.cache_write":"Cache Write","token.generating":"Generating...","token.idle":"Idle","token.input":"Input","token.model":"Model","token.output":"Output","token.session_cost":"Session","token.tokens":"tokens","token.total_cost":"Total Cost","token_usage.generating":"Generating...","token_usage.idle":"Idle","token_usage.messages":"Messages","token_usage.model":"Model","token_usage.originally":"Originally","token_usage.session_info":"Session Info","token_usage.status":"Status","tool.completed":"Done","tool.error":"Error","tool.running":"Running...","tool.tool":"Tool","user_menu.agents":"Agent Management","user_menu.pricing":"Token Pricing","user_menu.settings":"Settings","user_menu.sign_out":"Sign Out","user_menu.skills":"Skill Management","user_menu.title":"User menu","user_inbox.clear_all":"Clear all","user_inbox.delete":"Delete","user_inbox.empty":"No notifications","user_inbox.high_priority":"urgent","user_inbox.mark_all_read":"Mark all read","user_inbox.mark_unread":"Mark as unread","user_inbox.next_message":"Next message","user_inbox.prev_message":"Previous message","user_inbox.title":"Notifications","user_inbox.unread":"Unread","user_inbox.view_agent":"View agent","user_inbox.view_message":"View message","user_inbox.close":"Close","user_inbox.mark_read":"Mark as read","voice.dismiss_error":"Dismiss voice error","voice.downloading_model":"Downloading speech model...","voice.loading_model":"Loading speech model...","voice.processing":"Transcribing audio...","voice.processing_backend":"Transcribing via cloud...","voice.processing_local":"Transcribing locally...","voice.processing_local_server":"Transcribing via local server...","voice.source_backend":"Transcribed via cloud","voice.source_local":"Transcribed locally","voice.source_local_server":"Transcribed via local server","voice.start_recording":"Start voice recording","voice.stop_recording":"Stop recording","voice.pause_recording":"Pause recording","voice.resume_recording":"Resume recording","voice.select_asr_model":"Select speech recognition model","model_selector.title":"Session model","model_selector.list_label":"Available models","model_selector.use_default":"Use default model","model_selector.no_models":"No models available","model_selector.default_label":"Default","model_selector.lmstudio_loading":"Loading LM Studio models...","spotlight.title":"Search Sessions","spotlight.new_chat":"New Chat","spotlight.placeholder":"Search sessions by title...","spotlight.results":"Session results","spotlight.recent_sessions":"Recent Sessions","spotlight.no_results":"No sessions found","spotlight.searching":"Searching...","spotlight.untitled":"Untitled Session","spotlight.current":"current","spotlight.navigate":"navigate","spotlight.select":"select","spotlight.close":"close","slashCommand.title":"Skills","slashCommand.skills":"Skills","slashCommand.commands":"commands","slashCommand.command":"command","slashCommand.noResults":"No matching commands","slashCommand.notConfigured":"not configured","slashCommand.back":"Back to skills","slashCommand.navigate":"navigate","slashCommand.select":"select","slashCommand.close":"close","slashCommand.hint":"Type / to see available commands","archiveViewer.title":"Original Conversation History","archiveViewer.messages":"messages","archiveViewer.loading":"Loading archived messages...","archiveViewer.noArchive":"No archived history available for this session.","archiveViewer.readOnly":"Read-only archive","archiveViewer.archivedAt":"Archived","archiveViewer.close":"Close","archiveViewer.loadError":"Failed to load archive","archiveViewer.you":"You","archiveViewer.assistant":"Assistant","compaction.title":"Conversation compacted","compaction.showSummary":"Show summary","compaction.viewOriginal":"View original history","compaction.viewInHistory":"View in History","compaction.server.title":"Server auto-compact","compaction.server.status":"Context auto-compacted by server","compaction.mode.client":"Client (PAVE summarizes)","compaction.mode.server":"Server (vllm-mlx auto-compact)","compaction.mode.auto":"Auto (detect from provider)","compaction.banner_title":"This session was compacted from a previous conversation.","compaction.view_original":"View original","compaction.dismiss":"Dismiss","compaction.user_message_label":"Summarizing our conversation to keep things efficient.","compaction.boundary":"Context compacted — messages above are no longer in the model’s context","compaction.show_history":"Show {count} messages before compaction","compaction.hide_history":"Hide messages before compaction","credits.limit_reached":"Credit Limit Reached","credits.limit_message":"You've used all your available credits. Add more to continue using the service.","credits.add_credits":"Add Credits","credits.dismiss":"Dismiss","dlp.heading":"Privacy & DLP Settings","dlp.subtitle":"Configure data loss prevention patterns and privacy mode","dlp.title":"DLP Settings","dlp.close":"Close DLP settings","dlp.cancel":"Cancel","dlp.save":"Save","dlp.saving":"Saving...","dlp.discard_title":"Discard Changes","dlp.discard_confirm":"Discard unsaved changes to DLP settings?","dlp.enable_label":"Enable Data Loss Prevention","dlp.enable_desc":"When enabled, outgoing messages are scanned for sensitive data before sending to the AI model.","dlp.default_action_label":"Default action on detection","dlp.default_action_desc":"What happens when a pattern matches. 'Ask' shows a modal, 'Always reroute' sends to the private model, 'Warn only' logs and proceeds.","dlp.reroute_model_label":"Private model (reroute target)","dlp.reroute_model_desc":"The model/provider used for private mode. Format: provider/modelID","dlp.builtin_patterns":"Built-in patterns","dlp.builtin_desc":"Always-available detection patterns. Toggle individual patterns on or off.","dlp.user_patterns":"Custom patterns","dlp.user_patterns_desc":"Patterns you define. These are saved to your policy file and persist across restarts.","dlp.no_user_patterns":"No custom patterns yet. Add one below.","dlp.add_pattern":"Add a pattern","dlp.pattern_name":"Name","dlp.regex_pattern":"Regex","dlp.severity":"Severity","dlp.add":"Add","dlp.remove_pattern":"Remove pattern","dlp.remove_pattern_aria":"Remove pattern {name}","dlp.pattern_exists":"Pattern '{name}' already exists","dlp.name_required":"Pattern name is required","dlp.regex_required":"Regex pattern is required","dlp.invalid_regex":"Invalid regex syntax","user_menu.privacy_dlp":"Privacy & DLP"},bi={en:$a},iD={"zh-TW":()=>R5(()=>import("./zh-TW-CnUPOrCw.js"),[])},po=[{code:"en",name:"English",nativeName:"English"},{code:"zh-TW",name:"Traditional Chinese",nativeName:"繁體中文"}];async function N_(e){if(bi[e])return bi[e];const t=iD[e];if(!t)return console.warn(`No locale importer for "${e}", falling back to English`),$a;try{const n=await t();return bi[e]=n.default||n,bi[e]}catch(n){return console.warn(`Failed to load locale "${e}", falling back to English:`,n),$a}}function I5(e,t,n){let r=e[t];return r===void 0&&e!==$a&&(r=$a[t]),r===void 0?t:n&&typeof n=="object"?r.replace(/\{(\w+)\}/g,(a,i)=>{const s=n[i];return s!==void 0?String(s):a}):r}const M5=h.createContext(null);function sD({initialLocale:e="en",children:t}){const r=po.map(g=>g.code).includes(e)?e:"en",[a,i]=h.useState(r),[s,l]=h.useState(bi[r]||$a),c=h.useRef(0);h.useEffect(()=>{let g=!1;if(r!=="en"&&!bi[r]){const p=++c.current;N_(r).then(m=>{if(g||c.current!==p)return;const y=m===$a&&r!=="en"?"en":r;bi[y]=m,l(m),y!==r&&i(y)})}return()=>{g=!0,c.current+=1}},[]);const u=h.useCallback(async g=>{const p=++c.current,m=await N_(g);if(c.current!==p)return;const y=m===$a&&g!=="en"?"en":g;bi[y]=m,l(m),i(y);try{localStorage.setItem("pave-locale",y)}catch{}},[]),d=h.useCallback((g,p)=>I5(s,g,p),[s]),f=h.useMemo(()=>({t:d,locale:a,setLocale:u,availableLocales:po}),[d,a,u]);return o.jsx(M5.Provider,{value:f,children:t})}function Ct(){const e=h.useContext(M5);return e||{t:(t,n)=>I5($a,t,n),locale:"en",setLocale:()=>{},availableLocales:po}}function oD(){try{let e=localStorage.getItem("pave-locale");if(e==="zh"&&(e="zh-TW",localStorage.setItem("pave-locale",e)),e&&po.some(t=>t.code===e))return e}catch{}if(typeof navigator<"u"&&navigator.language){const e=navigator.language.toLowerCase(),t=po.find(a=>a.code.toLowerCase()===e);if(t)return t.code;const n=e.split("-")[0],r=po.find(a=>a.code.toLowerCase().startsWith(n));if(r)return r.code}return"en"}function lD({darkMode:e,onToggle:t}){const{t:n}=Ct();return o.jsx("button",{onClick:t,className:"p-2 rounded-lg text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:n(e?"theme.light":"theme.dark"),"aria-label":n(e?"theme.light":"theme.dark"),"aria-pressed":e,children:e?o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}function cD({open:e,onClose:t,onConfirm:n,title:r,message:a,confirmLabel:i,cancelLabel:s,destructive:l}){var{t:c}=Ct(),u=h.useRef(null),d=h.useRef(null);if(h.useEffect(function(){e&&d.current&&d.current.focus()},[e]),h.useEffect(function(){if(!e)return;function m(y){y.key==="Escape"&&(typeof y.preventDefault=="function"&&y.preventDefault(),typeof y.stopImmediatePropagation=="function"?y.stopImmediatePropagation():typeof y.stopPropagation=="function"&&y.stopPropagation(),t())}return document.addEventListener("keydown",m,!0),function(){document.removeEventListener("keydown",m,!0)}},[e,t]),h.useEffect(function(){if(!e||!u.current)return;function m(y){if(y.key==="Tab"){var v=u.current.querySelectorAll("button:not([disabled])");if(v.length!==0){var x=v[0],b=v[v.length-1];y.shiftKey?document.activeElement===x&&(y.preventDefault(),b.focus()):document.activeElement===b&&(y.preventDefault(),x.focus())}}}return document.addEventListener("keydown",m),function(){document.removeEventListener("keydown",m)}},[e]),!e)return null;var f=i||c("confirm_dialog.confirm"),g=s||c("confirm_dialog.cancel"),p=l?"bg-red-600 hover:bg-red-700 focus:ring-red-500 text-white":"bg-primary-600 hover:bg-primary-700 focus:ring-primary-500 text-white";return o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm transition-opacity duration-150",onClick:function(m){m.target===m.currentTarget&&t()},children:o.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":r,className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-md mx-4 outline-none transition-all duration-150",children:[o.jsx("div",{className:"px-5 py-4 border-b border-gray-100 dark:border-gray-800",children:o.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-gray-100",children:r})}),o.jsx("div",{className:"px-5 py-4",children:o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:a})}),o.jsxs("div",{className:"px-5 py-3 border-t border-gray-100 dark:border-gray-800 flex justify-end gap-3",children:[o.jsx("button",{ref:d,type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-md bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",children:g}),o.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 "+p,children:f})]})]})})}var L5=h.createContext(null);function uD({children:e}){var{t}=Ct(),n=h.useRef(null),r={open:!1,title:"",message:"",confirmLabel:"",cancelLabel:"",destructive:!1},a=h.useState(r),i=a[0],s=a[1],l=h.useCallback(function(d){n.current&&(n.current(!1),n.current=null);var f=d||{};return new Promise(function(g){n.current=g,s({open:!0,title:f.title||t("confirm_dialog.confirm"),message:f.message||"",confirmLabel:f.confirmLabel||"",cancelLabel:f.cancelLabel||"",destructive:f.destructive||!1})})},[t]),c=h.useCallback(function(){s(r),n.current&&(n.current(!1),n.current=null)},[]),u=h.useCallback(function(){s(r),n.current&&(n.current(!0),n.current=null)},[]);return o.jsxs(L5.Provider,{value:l,children:[e,o.jsx(cD,{open:i.open,onClose:c,onConfirm:u,title:i.title,message:i.message,confirmLabel:i.confirmLabel,cancelLabel:i.cancelLabel,destructive:i.destructive})]})}function hc(){var e=h.useContext(L5);if(!e)throw new Error("useConfirmDialog must be used within a ConfirmDialogProvider");return e}const dD=["web","agent"],Gu="LEGACY",fD=["tui","acp"],gD={tui:"sidebar.terminal",studio:"sidebar.studio",acp:"sidebar.acp"};function O5(e){return e?e.client?dD.indexOf(e.client)!==-1:fD.indexOf(e.source)===-1:!1}function pD(e,t){if(e===Gu)return t("sidebar.legacy_sessions");const n=gD[e];if(n){const r=t(n);if(r&&r!==n)return r}return e.charAt(0).toUpperCase()+e.slice(1)}function hD(e,t){const n=[],r=Object.create(null),a=Array.isArray(e)?e:[];for(let l=0;l<a.length;l++){const c=a[l];if(!c)continue;if(O5(c)){n.push(c);continue}const u=c.client||Gu;r[u]||(r[u]=[]),r[u].push(c)}const i=Object.keys(r).sort((l,c)=>l===Gu?1:c===Gu?-1:l.localeCompare(c)),s=[];for(let l=0;l<i.length;l++)s.push({key:i[l],label:pD(i[l],t),sessions:r[i[l]]});return{own:n,groups:s}}function mD(e){const t=new Date,n=new Date(e),r=new Date(t.getFullYear(),t.getMonth(),t.getDate());if(n>=r)return"today";const a=new Date(r);if(a.setDate(a.getDate()-1),n>=a)return"yesterday";const i=new Date(r);if(i.setDate(i.getDate()-i.getDay()),n>=i)return"thisWeek";const s=new Date(t.getFullYear(),t.getMonth(),1);return n>=s?"thisMonth":"older"}function xD(e,t){const n={today:[],yesterday:[],thisWeek:[],thisMonth:[],older:[]},r={today:t("sidebar.today"),yesterday:t("sidebar.yesterday"),thisWeek:t("sidebar.this_week"),thisMonth:t("sidebar.this_month"),older:t("sidebar.older")};for(let s=0;s<e.length;s++){const l=e[s],c=mD(l.time&&l.time.updated?l.time.updated:0);n[c].push(l)}const a=["today","yesterday","thisWeek","thisMonth","older"],i=[];for(let s=0;s<a.length;s++){const l=a[s];n[l].length>0&&i.push({key:l,label:r[l],sessions:n[l]})}return i}const Jo="\0__other__";function yD(e,t){const n=Object.create(null);for(let i=0;i<e.length;i++){const s=e[i];let l;if(s.directory&&typeof s.directory=="string"&&s.directory.trim()){const u=s.directory.replace(/[\\/]+$/,"").split(/[\\/]/);l=u[u.length-1]||Jo}else l=Jo;n[l]||(n[l]=[]),n[l].push(s)}const r=Object.keys(n).sort(function(i,s){return i===Jo?1:s===Jo?-1:i.localeCompare(s)}),a=[];for(let i=0;i<r.length;i++){const s=r[i];n[s].sort(function(c,u){const d=c.time&&c.time.updated||0;return(u.time&&u.time.updated||0)-d});const l=s===Jo?t("sidebar.other"):s;a.push({key:s,label:l,sessions:n[s]})}return a}function bD(e,t){if(!e)return"";const n=Date.now()-e;if(n<60*1e3)return t("sidebar.age_now");const r=Math.floor(n/(60*1e3));if(r<60)return t("sidebar.age_minutes",{n:r});const a=Math.floor(r/60);if(a<24)return t("sidebar.age_hours",{n:a});const i=Math.floor(a/24);return i<7?t("sidebar.age_days",{n:i}):t("sidebar.age_weeks",{n:Math.floor(i/7)})}function C_(e){return e.source==="legacy"||e.source==="archive"||e._readOnly}const vD={rename:"M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z",regenerate:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15",export:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4",archive:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4",unarchive:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4l3 3m0 0l3-3m-3 3V12",delete:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16",more:"M6 12h.01M12 12h.01M18 12h.01",send:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"};function qi({name:e,className:t}){return o.jsx("svg",{className:t,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:vD[e]})})}function j_({className:e,filled:t}){return o.jsx("svg",{className:e,fill:t?"currentColor":"none",viewBox:"0 0 20 20",stroke:"currentColor",strokeWidth:t?0:1.5,"aria-hidden":"true",children:o.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})})}const Rg=216,uu=8;function kD({anchor:e,items:t,label:n,onClose:r}){const a=h.useRef(null),[i,s]=h.useState(null);h.useEffect(()=>{const c=a.current;if(!c)return;const u=c.offsetHeight;let d=e.align==="right"?e.x-Rg:e.x;d=Math.max(uu,Math.min(d,window.innerWidth-Rg-uu));let f=e.y;f+u>window.innerHeight-uu&&(f=Math.max(uu,e.flipY-u)),s({left:d,top:f})},[e]),h.useEffect(()=>{if(!i||!a.current)return;const c=a.current.querySelector("[data-menuitem]");c&&c.focus()},[i]),h.useEffect(()=>{function c(d){a.current&&!a.current.contains(d.target)&&r()}function u(d){d.key==="Escape"&&(d.stopPropagation(),r())}return document.addEventListener("mousedown",c),document.addEventListener("keydown",u,!0),window.addEventListener("resize",r),window.addEventListener("scroll",r,!0),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u,!0),window.removeEventListener("resize",r),window.removeEventListener("scroll",r,!0)}},[r]);const l=c=>{if(c.key!=="ArrowDown"&&c.key!=="ArrowUp")return;c.preventDefault();const u=Array.from(a.current.querySelectorAll("[data-menuitem]"));if(u.length===0)return;const d=u.indexOf(document.activeElement),f=c.key==="ArrowDown"?(d+1)%u.length:(d-1+u.length)%u.length;u[f].focus()};return Fv.createPortal(o.jsx("div",{ref:a,role:"menu","aria-label":n,onKeyDown:l,className:"fixed z-50 py-1 rounded-lg bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 shadow-lg",style:{width:Rg,left:i?i.left:0,top:i?i.top:0,visibility:i?"visible":"hidden"},children:t.map(c=>c.separator?o.jsx("div",{className:"my-1 h-px bg-gray-100 dark:bg-gray-800"},c.key):o.jsxs("button",{"data-menuitem":"",role:"menuitem",onClick:()=>{r(),c.onSelect()},className:`w-full flex items-center gap-2.5 px-3 py-1.5 text-left text-sm rounded-md ${c.danger?"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20":"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-800"}`,children:[o.jsx("span",{className:"flex-shrink-0 opacity-70",children:c.icon}),o.jsx("span",{className:"flex-1 truncate",children:c.label}),c.hint&&o.jsx("span",{className:"flex-shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:c.hint})]},c.key))}),document.body)}function _D({sessions:e,activeSessionId:t,busySessions:n={},onSelectSession:r,onNewChat:a,onDeleteSession:i,onDeleteAllSessions:s,onRenameSession:l,onRegenerateTitle:c,onPinSession:u,onArchiveSession:d,onExportSession:f,onSendToSession:g,onImportSession:p,onImportError:m,showArchived:y,onToggleShowArchived:v,isOpen:x,onClose:b,onToggle:k,hasMoreSessions:S,onLoadMoreSessions:E}){const{t:_}=Ct(),w=hc(),[N,R]=h.useState(""),[j,P]=h.useState(null),[F,H]=h.useState(""),[L,M]=h.useState({}),[T,O]=h.useState(null),$=h.useRef(null),Y=h.useCallback(()=>{const ee=$.current;$.current=null,O(null),ee&&ee.isConnected&&ee.focus()},[]),A=(ee,Ee,fe)=>{$.current=fe||null,O({id:ee.id,anchor:Ee})},K=ee=>!!L[ee]||!!N,V=ee=>M(Ee=>({...Ee,[ee]:!Ee[ee]})),{own:I,groups:q}=h.useMemo(()=>hD(e,_),[e,_]),ie=N?I.filter(function(ee){return(ee.title||_("sidebar.untitled")).toLowerCase().includes(N.toLowerCase())}):I,J=h.useMemo(()=>{const ee=N.toLowerCase(),Ee=[];for(let fe=0;fe<q.length;fe++){const ve=q[fe],de=N?ve.sessions.filter(function(pe){return(pe.title||_("sidebar.untitled")).toLowerCase().includes(ee)}):ve.sessions;de.length>0&&Ee.push({...ve,sessions:de,projectGroups:yD(de,_)})}return Ee},[q,N,_]),{pinnedSessions:je,regularSessions:X,archivedSessions:he}=h.useMemo(()=>{const ee=[],Ee=[],fe=[];for(let ve=0;ve<ie.length;ve++){const de=ie[ve];de.archived?fe.push(de):de.pinned?ee.push(de):Ee.push(de)}return{pinnedSessions:ee,regularSessions:Ee,archivedSessions:fe}},[ie]),Me=h.useMemo(()=>xD(X,_),[X,_]),we=ee=>{P(ee.id),H(ee.title||"")},ge=ee=>{F.trim()&&l(ee,F.trim()),P(null),H("")},Se=async ee=>{!ee.archived&&!await w({title:_("sidebar.archive"),message:_("sidebar.confirmArchive"),confirmLabel:_("sidebar.archive")})||d(ee.id,!ee.archived)},Re=async ee=>{await w({title:_("sidebar.delete_title"),message:_("sidebar.delete_confirm"),destructive:!0,confirmLabel:_("sidebar.delete")})&&i(ee.id)},me=ee=>{if(C_(ee))return[];const Ee=[{key:"rename",label:_("sidebar.rename"),hint:"F2",icon:o.jsx(qi,{name:"rename",className:"w-4 h-4"}),onSelect:()=>we(ee)}];c&&Ee.push({key:"regenerate",label:_("sidebar.regenerate_title"),icon:o.jsx(qi,{name:"regenerate",className:"w-4 h-4"}),onSelect:()=>c(ee.id)}),f&&Ee.push({key:"export",label:_("sidebar.export"),icon:o.jsx(qi,{name:"export",className:"w-4 h-4"}),onSelect:()=>f(ee.id)}),g&&Ee.push({key:"send-to-session",label:_("sidebar.send_to_session"),icon:o.jsx(qi,{name:"send",className:"w-4 h-4"}),onSelect:()=>g(ee.id)});const fe=[];return u&&(!ee.archived||ee.pinned)&&fe.push({key:"pin",label:ee.pinned?_("sidebar.unpin"):_("sidebar.pin"),icon:o.jsx(j_,{className:"w-4 h-4",filled:ee.pinned}),onSelect:()=>u(ee.id,!ee.pinned)}),d&&fe.push({key:"archive",label:ee.archived?_("sidebar.unarchive"):_("sidebar.archive"),icon:o.jsx(qi,{name:ee.archived?"unarchive":"archive",className:"w-4 h-4"}),onSelect:()=>Se(ee)}),fe.length>0&&(Ee.push({key:"sep-state",separator:!0}),Ee.push(...fe)),Ee.push({key:"sep-danger",separator:!0}),Ee.push({key:"delete",label:_("sidebar.delete"),hint:"Del",danger:!0,icon:o.jsx(qi,{name:"delete",className:"w-4 h-4"}),onSelect:()=>Re(ee)}),Ee},ye=h.useMemo(()=>T&&e.find(ee=>ee.id===T.id)||null,[T,e]);h.useEffect(()=>{T&&!ye&&Y()},[T,ye,Y]);const Oe=(ee,Ee)=>{const fe=Ee&&Ee.dimmed,ve=C_(ee),de=!!(T&&T.id===ee.id),pe=!ve,De=(B,D)=>A(ee,B,D);return o.jsx("div",{role:"button",tabIndex:0,className:`group relative flex items-center gap-1 px-2 py-2 rounded-lg cursor-pointer text-sm mb-0.5 transition-colors ${ee.id===t?"bg-primary-50 dark:bg-primary-900/30 text-primary-600 dark:text-primary-300":fe?"text-gray-400 dark:text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-800":"text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-800"}`,onClick:()=>r(ee.id),onContextMenu:B=>{!pe||j===ee.id||(B.preventDefault(),De({x:B.clientX,y:B.clientY,flipY:B.clientY,align:"left"},B.currentTarget))},onKeyDown:B=>{if(B.currentTarget===B.target){if(B.key==="Enter"||B.key===" "){B.preventDefault(),r(ee.id);return}if(pe){if(B.key==="F2")B.preventDefault(),we(ee);else if(B.key==="Delete")B.preventDefault(),Re(ee);else if(B.key==="ContextMenu"){B.preventDefault();const D=B.currentTarget.getBoundingClientRect();De({x:D.right,y:D.bottom,flipY:D.top,align:"right"},B.currentTarget)}}}},children:j===ee.id?o.jsx("input",{autoFocus:!0,value:F,onChange:B=>H(B.target.value),onBlur:()=>ge(ee.id),onKeyDown:B=>{B.key==="Enter"?(B.preventDefault(),B.stopPropagation(),B.currentTarget.blur()):B.key==="Escape"?(B.stopPropagation(),P(null)):B.key===" "&&B.stopPropagation()},onClick:B=>B.stopPropagation(),className:"flex-1 bg-white dark:bg-gray-700 rounded px-1.5 py-0.5 text-sm outline-none"}):o.jsxs(o.Fragment,{children:[ee.pinned&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M10 2a.75.75 0 01.67.41l1.37 2.78 3.07.45a.75.75 0 01.41 1.28l-2.22 2.16.52 3.05a.75.75 0 01-1.09.79L10 11.35l-2.73 1.43a.75.75 0 01-1.09-.79l.52-3.05-2.22-2.16a.75.75 0 01.42-1.28l3.07-.45 1.37-2.78A.75.75 0 0110 2z"})}),ee.source==="archive"&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-blue-400 dark:text-blue-500 opacity-70",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8"})}),ee.compactedAt&&ee.source!=="archive"&&o.jsx("svg",{className:"w-3 h-3 flex-shrink-0 text-gray-400 dark:text-gray-500 opacity-60",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),n[ee.id]&&o.jsx("div",{className:"w-2 h-2 rounded-full bg-accent-400 animate-pulse flex-shrink-0",role:"status",title:_("sidebar.session_processing"),"aria-label":_("sidebar.session_processing")}),o.jsxs("span",{className:`session-row-title flex-1 flex items-center min-w-0 ${fe?"italic":""}`,"data-menu-open":de?"true":"false",children:[o.jsx("span",{className:"truncate min-w-0",children:ee.title||_("sidebar.untitled")}),ee.archived&&o.jsxs("span",{className:"ml-1 text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:["(",_("sidebar.archived"),")"]})]}),o.jsxs("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-0.5",children:[o.jsx("span",{className:`text-[11px] tabular-nums text-gray-400 dark:text-gray-500 ${de?"hidden":"group-hover:hidden group-focus-within:hidden"}`,children:bD(ee.time&&ee.time.updated,_)}),o.jsxs("div",{className:`items-center gap-0.5 ${de?"flex":"hidden group-hover:flex group-focus-within:flex"}`,children:[u&&(!ee.archived||ee.pinned)&&o.jsx("button",{onClick:B=>{B.stopPropagation(),u(ee.id,!ee.pinned)},className:"p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700",title:ee.pinned?_("sidebar.unpin"):_("sidebar.pin"),"aria-label":ee.pinned?_("sidebar.unpin"):_("sidebar.pin"),children:o.jsx(j_,{className:`w-4 h-4 ${ee.pinned?"text-amber-500":""}`,filled:ee.pinned})}),pe&&o.jsx("button",{onClick:B=>{B.stopPropagation();const D=B.currentTarget.getBoundingClientRect();De({x:D.right,y:D.bottom+4,flipY:D.top-4,align:"right"},B.currentTarget)},className:`p-1.5 rounded hover:bg-gray-300 dark:hover:bg-gray-700 ${de?"bg-gray-300 dark:bg-gray-700":""}`,"aria-label":_("sidebar.more_actions"),"aria-haspopup":"menu","aria-expanded":de,children:o.jsx(qi,{name:"more",className:"w-4 h-4"})})]})]})]})},ee.id)},be=ee=>o.jsx("div",{className:"px-2 pt-3 pb-1",children:o.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 uppercase tracking-wider font-semibold",children:ee})});return o.jsxs(o.Fragment,{children:[x&&o.jsx("div",{className:"fixed inset-0 top-14 bg-black/30 z-20 md:hidden",onClick:b}),!x&&o.jsx("div",{className:"flex-shrink-0 w-10 flex flex-col items-center pt-3 border-r border-gray-200 dark:border-gray-800",children:o.jsx("button",{onClick:k,className:"p-1.5 rounded-lg bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 transition-colors",title:_("sidebar.show"),"aria-label":_("sidebar.show"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})})})}),o.jsxs("aside",{className:`
41
41
  ${x?"translate-x-0":"-translate-x-full"}
42
42
  transition-transform duration-200 ease-in-out
43
43
  fixed md:relative z-30 md:z-auto
@@ -102,7 +102,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),A=T,Y=O),$===void 0&&(
102
102
  `)?" ":"";f(Ie+We+(te||""));return}f(Ie=>{const We=Ie&&!Ie.endsWith(" ")&&!Ie.endsWith(`
103
103
  `)?" ":"";return Ie+We+te})},[]),Xe=h.useRef(null),_t=h.useCallback(()=>{Ve.current="",setTimeout(()=>{Xe.current&&Xe.current()},50)},[]),{state:He,progress:at,downloadingFile:ue,startRecording:qe,stopRecording:Ge,resumeRecording:bt,cancelRecording:cn}=gW({onTranscript:Qe,onError:pe,onAutoSubmit:_t,model:S||void 0,language:L&&L!=="auto"?L:void 0}),Un=h.useCallback(()=>(f(te=>(Ve.current=te||"",te)),qe()),[qe]);h.useEffect(()=>{try{L&&localStorage.setItem(F,L)}catch{}},[L]),h.useEffect(()=>{if(!T)return;const te=ke=>{$.current&&!$.current.contains(ke.target)&&O(!1)};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[T]),h.useEffect(()=>{let te=!1;return lb().then(ke=>{te||(ke&&Array.isArray(ke.models)&&ke.models.length>0&&(k(ke.models),E(Ie=>Ie||ke.models[0].name)),ke&&(ke.preferredEngine==="whisper"||ke.preferredEngine==="paraformer")&&K(ke.preferredEngine))}).catch(()=>{}),()=>{te=!0}},[lb]),h.useEffect(()=>{if(!V)return;const te=ke=>{q.current&&!q.current.contains(ke.target)&&I(!1)};return document.addEventListener("mousedown",te),()=>document.removeEventListener("mousedown",te)},[V]);const Ln=h.useCallback(te=>{I(!1),K(ke=>ke===te?ke:(vP(te).then(()=>{te==="paraformer"&&pe("Paraformer selected — the streaming engine is starting (first use downloads ~1 GB).")}).catch(()=>{K(ke),pe("Could not switch the speech engine — is the server reachable?")}),te))},[pe]);h.useEffect(()=>{if(!_){P(-1);return}R.current.length=b.length;function te(Ie){N.current&&!N.current.contains(Ie.target)&&w(!1)}function ke(Ie){if(Ie.key==="Escape"){w(!1);return}Ie.key!=="ArrowDown"&&Ie.key!=="ArrowUp"&&Ie.key!=="Home"&&Ie.key!=="End"||(Ie.preventDefault(),P(We=>{const ht=R.current.length;if(!ht)return We;const mt=typeof We=="number"?We:-1;let It=mt;return Ie.key==="ArrowDown"?It=mt<ht-1?mt+1:0:Ie.key==="ArrowUp"?It=mt>0?mt-1:ht-1:Ie.key==="Home"?It=0:Ie.key==="End"&&(It=ht-1),R.current[It]&&R.current[It].focus(),It}))}return document.addEventListener("mousedown",te),document.addEventListener("keydown",ke),()=>{document.removeEventListener("mousedown",te),document.removeEventListener("keydown",ke)}},[_,b.length]),h.useEffect(()=>{const te=J.current;te&&(te.style.height="auto",te.style.height=Math.min(te.scrollHeight,200)+"px")},[d]),h.useEffect(()=>{ie.current=g},[g]),h.useEffect(()=>{var te;(te=J.current)==null||te.focus()},[]),h.useImperativeHandle(c,()=>({focus:()=>{var te;(te=J.current)==null||te.focus()},setText:te=>{f(typeof te=="string"?te:""),requestAnimationFrame(()=>{var ke;return(ke=J.current)==null?void 0:ke.focus()})}}),[]);const hn=async()=>{const te=d.trim();var ke=g.filter(function(mt){return ip(mt.type)}),Ie=g.filter(function(mt){return!ip(mt.type)});const We=xW(te);if(We&&typeof l=="function"){const mt=he.current;try{await l(We.name,We.args,{imageAttachments:ke.length>0?ke:void 0,fileAttachments:Ie.length>0?Ie:void 0})}catch{return}if(f(""),Se(!1),me(""),fe(null),ee(0),mt)try{localStorage.removeItem(Vi+mt)}catch{}g.forEach(function(It){It.preview&&URL.revokeObjectURL(It.preview)}),p([]),J.current&&(J.current.style.height="auto");return}if(!te&&ke.length===0&&Ie.length===0)return;const ht=he.current;try{await t(te,ke.length>0?ke:void 0,m?"plan":void 0,Ie.length>0?Ie:void 0)}catch{return}if(f(""),Se(!1),me(""),fe(null),ee(0),ht)try{localStorage.removeItem(Vi+ht)}catch{}g.forEach(function(mt){mt.preview&&URL.revokeObjectURL(mt.preview)}),p([]),J.current&&(J.current.style.height="auto")};Xe.current=hn;const Zn=te=>{if(ge){const ke=G();if(te.key==="ArrowDown"){ke>0&&(te.preventDefault(),ee(Ie=>(Ie+1)%ke));return}if(te.key==="ArrowUp"){ke>0&&(te.preventDefault(),ee(Ie=>(Ie-1+ke)%ke));return}if(te.key==="Enter"||te.key==="Tab"){if(ke>0){te.preventDefault();const Ie=D[be];Ie&&(Ie.type==="command"?Te(Ie.skill,Ie.name):Ie.type==="builtin"?Te("__builtin__",Ie.name):Te(Ie.skill,null));return}if(te.key==="Tab"){Se(!1),me(""),fe(null),ee(0);return}}if(te.key==="Escape"){te.preventDefault(),Se(!1),me(""),fe(null),ee(0);return}if(te.key==="Backspace"&&Ee){const Ie=d.slice(1),We=Ee+" ";if(Ie===We||Ie===Ee){te.preventDefault(),Ue();return}}}te.key==="Enter"&&!te.shiftKey&&(te.preventDefault(),hn())},rn=te=>{if(!a){var ke=te.clipboardData&&te.clipboardData.items;if(ke){for(var Ie=[],We=0;We<ke.length;We++){var ht=(ke[We].type||"").toLowerCase();if(mf.indexOf(ht)!==-1){var mt=ke[We].getAsFile();mt&&Ie.push(mt)}}if(Ie.length!==0){for(var It=!1,_e=0;_e<ke.length;_e++)if(ke[_e].type&&ke[_e].type.startsWith("text/")){It=!0;break}It||te.preventDefault();var it=Ie.map(function(Ot){return{id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:Ot,name:Ot.name||"pasted-image.png",size:Ot.size,type:Ot.type,preview:null}});p(function(Ot){var Dt=Ld-Ot.length;if(Dt<=0)return Ot;for(var $n=it.slice(0,Dt),Sn=0;Sn<$n.length;Sn++)$n[Sn].preview=URL.createObjectURL($n[Sn].file);return Ot.concat($n)})}}}},jt=te=>{const ke=Array.from(te.target.files||[]);if(ke.length===0)return;const Ie=ke.filter(ht=>oI.indexOf(ht.type)!==-1);if(Ie.length===0){te.target.value="";return}const We=Ie.map(ht=>({id:Date.now()+"-"+Math.random().toString(36).slice(2,8),file:ht,name:ht.name,size:ht.size,type:ht.type,preview:null}));p(ht=>{var mt=Ld-ht.length;if(mt<=0)return ht;for(var It=We.slice(0,mt),_e=0;_e<It.length;_e++)It[_e].preview=ip(It[_e].file.type)?URL.createObjectURL(It[_e].file):null;return[...ht,...It]}),te.target.value=""},vr=te=>{p(ke=>{const Ie=ke.find(We=>We.id===te);return Ie!=null&&Ie.preview&&URL.revokeObjectURL(Ie.preview),ke.filter(We=>We.id!==te)})},le=te=>te<1024?te+" B":te<1024*1024?(te/1024).toFixed(1)+" KB":(te/(1024*1024)).toFixed(1)+" MB";return h.useEffect(()=>()=>{ie.current.forEach(te=>{te.preview&&URL.revokeObjectURL(te.preview)})},[]),o.jsx("div",{className:"border-t border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-950 px-2 sm:px-4 py-3",children:o.jsxs("div",{className:"max-w-full sm:max-w-3xl mx-auto",children:[m&&o.jsxs("div",{className:"flex items-center gap-2 mb-2 px-3 py-1.5 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg text-xs text-amber-700 dark:text-amber-300",children:[o.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})}),o.jsx("span",{children:"Plan mode -- read-only. The agent will analyze and plan without making changes."})]}),g.length>0&&o.jsx("div",{className:"flex flex-wrap gap-2 mb-2 overflow-hidden",children:g.map(te=>o.jsxs("div",{className:"relative group flex items-center gap-2 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 text-sm",children:[te.preview?o.jsx("img",{src:te.preview,alt:te.name,className:"w-10 h-10 rounded object-cover"}):o.jsx("svg",{className:"w-5 h-5 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300 truncate max-w-[120px]",children:te.name}),o.jsx("p",{className:"text-xs text-gray-400",children:le(te.size)})]}),o.jsx("button",{onClick:()=>vr(te.id),"aria-label":`Remove attachment ${te.name||""}`,className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-gray-500 hover:bg-red-500 text-white flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},te.id))}),o.jsxs("div",{className:"relative flex flex-col sm:flex-row sm:items-end gap-1 sm:gap-2 bg-gray-100 dark:bg-gray-800 rounded-2xl px-3 py-2",children:[o.jsx(pW,{skills:ye,builtins:B,filter:Re,onSelect:Te,visible:ge,selectedIndex:be,activeSkill:Ee,onBack:Ue}),o.jsxs("div",{className:"order-2 sm:order-none flex items-center gap-1 flex-wrap sm:flex-nowrap relative",children:[o.jsx("button",{onClick:()=>{var te;return(te=je.current)==null?void 0:te.click()},disabled:a||r,className:"flex-shrink-0 w-8 h-8 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 flex items-center justify-center transition-colors text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200",title:u("chat.attach_file"),"aria-label":u("chat.attach_file"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.375 12.739l-7.693 7.693a4.5 4.5 0 01-6.364-6.364l10.94-10.94A3 3 0 1119.5 7.372L8.552 18.32m.009-.01l-.01.01m5.699-9.941l-7.81 7.81a1.5 1.5 0 002.112 2.13"})})}),o.jsx("input",{ref:je,type:"file",multiple:!0,accept:Zq,onChange:jt,className:"hidden"}),o.jsx("button",{onClick:He==="recording"?Ge:He==="paused"?bt:He==="loading"?cn:Un,disabled:He==="draining"||(a||r)&&He!=="recording"&&He!=="loading"&&He!=="paused",className:"flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors "+(He==="recording"?"bg-red-500 hover:bg-red-600 text-white animate-pulse":He==="paused"?"bg-yellow-500 hover:bg-yellow-600 text-white":He==="loading"||He==="draining"?"bg-gray-200 dark:bg-gray-700 text-gray-400 cursor-wait":"hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"),title:He==="recording"?u("voice.stop_recording")||"Stop recording":He==="paused"?u("voice.resume_recording")||"Resume recording":He==="loading"?u("voice.loading_model"):He==="draining"?u("voice.processing")||"Processing remaining audio":u("voice.start_recording"),"aria-label":He==="recording"?u("voice.stop_recording")||"Stop recording":He==="paused"?u("voice.resume_recording")||"Resume recording":He==="loading"?u("voice.loading_model"):He==="draining"?u("voice.processing")||"Processing remaining audio":u("voice.start_recording"),children:He==="draining"?o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):He==="loading"?o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}):He==="recording"?o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}):He==="paused"?o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("circle",{cx:"12",cy:"12",r:"6"})}):o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 18.75a6 6 0 006-6v-1.5m-6 7.5a6 6 0 01-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 01-3-3V4.5a3 3 0 116 0v8.25a3 3 0 01-3 3z"})})}),He==="loading"&&o.jsxs("div",{className:"absolute -top-6 left-1/2 -translate-x-1/2 bg-gray-800 dark:bg-gray-700 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap flex items-center gap-2",children:[o.jsx("div",{className:"w-16 h-1.5 bg-gray-600 rounded-full overflow-hidden",children:o.jsx("div",{className:"h-full bg-primary-400 transition-all duration-300",style:{width:`${at}%`}})}),o.jsx("span",{children:ue?`${ue} ${at}%`:`${at}%`})]}),A==="whisper"&&o.jsxs("div",{className:"relative flex-shrink-0",ref:$,children:[o.jsxs("button",{onClick:()=>O(te=>!te),disabled:He==="recording"||He==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition language","aria-label":"Select speech recognition language","aria-haspopup":"menu","aria-expanded":T,children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 21l5.25-11.25L21 21m-9-3h7.5M3 5.621a48.474 48.474 0 016-.371m0 0c1.12 0 2.233.038 3.334.114M9 5.25V3m3.334 2.364C11.176 10.658 7.69 15.08 3 17.502m9.334-12.138c.896.061 1.785.147 2.666.257m-4.589 8.495a18.023 18.023 0 01-3.827-5.802"})}),o.jsx("span",{className:"max-w-[80px] truncate",children:(H.find(te=>te.code===L)||H[0]).label}),o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),T&&o.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[180px] max-h-64 overflow-y-auto z-50",role:"menu","aria-label":"Speech recognition language",children:H.map(te=>o.jsx("button",{role:"menuitemradio","aria-checked":te.code===L,onClick:()=>{M(te.code),O(!1),te.code==="yue"&&pe("Cantonese requires whisper-small or larger. If transcription is poor, this device may be using the tiny model (Safari, or older cached version).")},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.code===L?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:te.label},te.code))})]}),o.jsxs("div",{className:"relative flex-shrink-0",ref:q,children:[o.jsxs("button",{onClick:()=>I(te=>!te),disabled:He==="recording"||He==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:"Speech recognition engine","aria-label":"Select speech recognition engine","aria-haspopup":"menu","aria-expanded":V,children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.348 14.652a3.75 3.75 0 010-5.304m5.304 0a3.75 3.75 0 010 5.304m-7.425 2.121a6.75 6.75 0 010-9.546m9.546 0a6.75 6.75 0 010 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z"})}),o.jsx("span",{className:"max-w-[90px] truncate",children:(Y.find(te=>te.code===A)||Y[0]).label}),o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),V&&o.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[200px] z-50",role:"menu","aria-label":"Speech recognition engine",children:Y.map(te=>o.jsxs("button",{role:"menuitemradio","aria-checked":te.code===A,onClick:()=>Ln(te.code),className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.code===A?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[o.jsx("div",{children:te.label}),o.jsx("div",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:te.code==="whisper"?"Batch · all languages (default)":"Live streaming · 中文/粵語/English"})]},te.code))})]}),A==="whisper"&&b.length>1&&o.jsxs("div",{className:"relative flex-shrink-0",ref:N,children:[o.jsxs("button",{onClick:()=>w(te=>!te),disabled:He==="recording"||He==="draining",className:"h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 disabled:opacity-40 disabled:cursor-not-allowed",title:u("voice.select_asr_model"),"aria-label":u("voice.select_asr_model"),"aria-haspopup":"menu","aria-expanded":_,children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09z"})}),o.jsx("span",{className:"max-w-[80px] truncate",children:(b.find(te=>te.name===S)||b[0]).label}),o.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 8.25l-7.5 7.5-7.5-7.5"})})]}),_&&o.jsx("div",{className:"absolute bottom-full mb-1 left-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg py-1 min-w-[160px] z-50",role:"menu","aria-label":u("voice.select_asr_model"),children:b.map((te,ke)=>o.jsxs("button",{ref:Ie=>{R.current[ke]=Ie},role:"menuitemradio","aria-checked":te.name===S,tabIndex:j===ke?0:-1,onClick:()=>{E(te.name),w(!1)},className:"w-full text-left px-3 py-1.5 text-xs transition-colors "+(te.name===S?"bg-blue-50 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 font-medium":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"),children:[te.label,te.type!=="openai"&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",te.type,")"]})]},`${te.name}-${ke}`))})]}),o.jsxs("button",{onClick:()=>y(te=>!te),disabled:a||r,className:"flex-shrink-0 h-8 px-2 rounded-full flex items-center justify-center gap-1 transition-colors text-xs font-medium "+(m?"bg-amber-100 dark:bg-amber-900/40 text-amber-700 dark:text-amber-300 ring-1 ring-amber-300 dark:ring-amber-700":"hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-40 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200"),title:m?"Plan mode active (read-only) — click to switch to build":"Switch to plan mode (read-only)","aria-label":m?"Disable plan mode":"Enable plan mode","aria-pressed":m,children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25zM6.75 12h.008v.008H6.75V12zm0 3h.008v.008H6.75V15zm0 3h.008v.008H6.75V18z"})}),m?"Plan":""]})]}),o.jsxs("div",{className:"order-1 sm:order-none flex items-end gap-2 flex-1 min-w-0",children:[o.jsx("textarea",{ref:J,value:d,onChange:te=>ce(te.target.value),onKeyDown:Zn,onPaste:rn,placeholder:u("chat.send_placeholder"),disabled:a,rows:1,role:ge?"combobox":void 0,"aria-controls":ge?"slash-command-listbox":void 0,"aria-activedescendant":ge&&G()>0?"slash-item-"+be:void 0,"aria-expanded":ge||void 0,className:"flex-1 bg-transparent resize-none outline-none text-sm py-1.5 min-h-[32px] text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 max-h-[200px]"}),r&&o.jsx("button",{onClick:n,className:"flex-shrink-0 w-8 h-8 rounded-full bg-red-500 hover:bg-red-600 flex items-center justify-center transition-colors",title:u("chat.stop_generating"),"aria-label":u("chat.stop_generating"),children:o.jsx("svg",{className:"w-3.5 h-3.5 text-white",fill:"currentColor",viewBox:"0 0 24 24",children:o.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}),o.jsxs("button",{onClick:hn,disabled:!d.trim()&&g.length===0||a,className:"relative flex-shrink-0 w-8 h-8 rounded-full bg-accent-400 hover:bg-accent-500 disabled:bg-gray-300 dark:disabled:bg-gray-600 flex items-center justify-center transition-colors",title:r?"Queue message (will send when current finishes)":u("chat.send_button"),"aria-label":r?"Queue message":u("chat.send_button"),"aria-disabled":!d.trim()&&g.length===0||a?"true":void 0,children:[o.jsx("svg",{className:"w-4 h-4 text-gray-900",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14M12 5l7 7-7 7"})}),s>0&&o.jsx("span",{className:"absolute -top-1 -right-1 min-w-[16px] h-4 px-1 rounded-full bg-amber-500 text-white text-[10px] font-bold flex items-center justify-center ring-2 ring-white dark:ring-gray-800","aria-label":`${s} message${s===1?"":"s"} queued`,children:s})]})]})]}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1.5 text-center",children:u("chat.send_hint")}),v&&o.jsxs("div",{role:"alert",className:"mt-2 px-3 py-2 bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 text-sm rounded-lg flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),o.jsx("span",{children:v}),o.jsx("button",{onClick:()=>x(null),className:"ml-auto text-red-500 hover:text-red-700 dark:hover:text-red-200","aria-label":u("voice.dismiss_error"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})]})})});function bW({darkMode:e,onToggleTheme:t}){const{t:n}=Ct(),r=(v,x)=>{const b=n(v);return b===v?x:b},[a,i]=h.useState(""),[s,l]=h.useState(""),[c,u]=h.useState(!1),[d,f]=h.useState(null),[g,p]=h.useState(!1);h.useEffect(()=>{fetch("/auth/membership/available").then(v=>v.json()).then(v=>p(v.available===!0)).catch(()=>{})},[]);const m=async v=>{v.preventDefault(),f(null),u(!0);try{const x=await fetch("/auth/membership/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:a,password:s})}),b=await x.json().catch(()=>({}));if(!x.ok){f(b.error||"Login failed"),u(!1);return}window.location.reload()}catch(x){f("Connection error: "+x.message),u(!1)}},y=async()=>{f(null),u(!0);try{const v=await fetch("/auth/local/login",{method:"POST",credentials:"include"}),x=await v.json().catch(()=>({}));if(!v.ok){f(x.error||"Local login failed"),u(!1);return}window.location.href="/"}catch(v){f("Connection error: "+v.message),u(!1)}};return o.jsxs("div",{className:"min-h-screen flex flex-col bg-gray-50 dark:bg-gray-950",children:[o.jsx("div",{className:"flex justify-end p-4",children:o.jsx("button",{onClick:t,className:"p-2 rounded-lg bg-gray-200 dark:bg-gray-800 text-gray-600 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-700 transition-colors",title:n(e?"theme.light":"theme.dark"),"aria-label":n(e?"theme.light":"theme.dark"),children:e?o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"})}):o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"})})})}),o.jsx("div",{className:"flex-1 flex items-center justify-center px-4",children:o.jsxs("div",{className:"w-full max-w-sm",children:[o.jsxs("div",{className:"text-center mb-8",children:[o.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-primary-500 mb-4",children:o.jsx("span",{className:"text-white font-bold text-2xl",children:"P"})}),o.jsx("h1",{className:"text-2xl font-bold text-gray-900 dark:text-gray-100",children:"PAVE"}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:n("login.pave_subtitle")})]}),o.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl border border-gray-200 dark:border-gray-800 p-6 shadow-sm ring-1 ring-accent-400/20",children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 text-center mb-6",children:n("login.sign_in")}),d&&o.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm border border-red-200 dark:border-red-800",children:d}),g&&o.jsxs("form",{onSubmit:m,className:"space-y-3 mb-4",children:[o.jsx("input",{type:"email",placeholder:r("login.email_placeholder","Email"),value:a,onChange:v=>i(v.target.value),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),o.jsx("input",{type:"password",placeholder:r("login.password_placeholder","Password"),value:s,onChange:v=>l(v.target.value),required:!0,className:"w-full px-3 py-2.5 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent"}),o.jsx("button",{type:"submit",disabled:c,className:"w-full py-2.5 px-4 rounded-lg bg-primary-500 hover:bg-primary-600 text-white font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:c?r("login.signing_in","Signing in..."):n("login.sign_in")})]}),g&&o.jsxs("div",{className:"flex items-center gap-3 my-4",children:[o.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"}),o.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:r("login.or","or")}),o.jsx("div",{className:"flex-1 border-t border-gray-200 dark:border-gray-700"})]}),o.jsxs("button",{type:"button",onClick:y,disabled:c,className:"flex items-center justify-center gap-3 w-full py-2.5 px-4 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-200 font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),r("login.sign_in_locally","Sign in locally")]}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 text-center mt-4",children:n("login.terms")})]})]})})]})}function vW({user:e,onLogout:t,onSkillManagement:n,onAgentManagement:r,onPricingSettings:a,onDlpSettings:i,onSettings:s}){const{t:l}=Ct(),[c,u]=h.useState(!1),d=h.useRef(null);if(h.useEffect(()=>{if(!c)return;function g(p){d.current&&!d.current.contains(p.target)&&u(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c]),!e)return null;const f=(e.name||e.email||"?").split(" ").map(g=>g[0]).join("").slice(0,2).toUpperCase();return o.jsxs("div",{className:"relative",ref:d,children:[o.jsxs("button",{onClick:()=>u(!c),className:"flex items-center gap-2 px-2 py-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",title:e.email,"aria-label":e.name||e.email||l("user_menu.title"),children:[e.picture?o.jsx("img",{src:e.picture,alt:"","aria-hidden":"true",className:"w-7 h-7 rounded-full",referrerPolicy:"no-referrer"}):o.jsx("div",{className:"w-7 h-7 rounded-full bg-primary-500 flex items-center justify-center",children:o.jsx("span",{className:"text-white text-xs font-semibold",children:f})}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300 hidden sm:inline max-w-[120px] truncate",children:e.name||e.email}),o.jsx("svg",{className:"w-3 h-3 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),c&&o.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-lg z-50 py-1",children:[o.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[o.jsx("p",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:e.name}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:e.email})]}),n&&o.jsxs("button",{type:"button",onClick:()=>{u(!1),n()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),l("user_menu.skills")]}),r&&o.jsxs("button",{onClick:()=>{u(!1),r()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),l("user_menu.agents")]}),a&&o.jsxs("button",{onClick:()=>{u(!1),a()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),l("user_menu.pricing")]}),i&&o.jsxs("button",{onClick:()=>{u(!1),i()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})}),l("user_menu.privacy_dlp")]}),s&&o.jsxs("button",{onClick:()=>{u(!1),s()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors flex items-center gap-2",children:[o.jsxs("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),l("user_menu.settings")]}),t&&o.jsx("button",{onClick:()=>{u(!1),t()},className:"w-full text-left px-3 py-2 text-sm text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors",children:l("user_menu.sign_out")})]})]})}function lI({toolParts:e}){const{t}=Ct();return!e||e.length===0?o.jsxs("div",{className:"p-4",children:[o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.activity")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:t("task.no_active")})]}):o.jsxs("div",{className:"p-4",children:[o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium mb-3",children:t("task.working")}),o.jsx("div",{className:"space-y-1 max-h-[calc(100vh-300px)] overflow-y-auto",children:e.map(n=>o.jsx(kW,{part:n},n.id))})]})}function kW({part:e}){var a,i;const t=((a=e.state)==null?void 0:a.status)||"running",n=((i=e.state)==null?void 0:i.input)||{},r=_W(e.tool,n);return o.jsxs("div",{className:"flex items-center gap-2 py-1",children:[o.jsxs("div",{className:"flex-shrink-0",children:[t==="running"&&o.jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-primary-400 border-t-transparent animate-spin"}),t==="completed"&&o.jsx("svg",{className:"w-3.5 h-3.5 text-green-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&o.jsx("svg",{className:"w-3.5 h-3.5 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),t==="pending_confirmation"&&o.jsx("svg",{className:"w-3.5 h-3.5 text-amber-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01"})})]}),o.jsx("span",{className:`text-xs truncate ${t==="running"?"text-gray-800 dark:text-gray-200":t==="error"?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-gray-400"}`,children:r})]})}function _W(e,t){if(!e)return"Processing...";switch(e){case"Read":return"Reading "+Su(t.filePath);case"Write":return"Writing "+Su(t.filePath);case"Edit":return"Editing "+Su(t.filePath);case"Bash":{const n=t.command||"";return C2(n)}case"Glob":return"Searching for files"+(t.pattern?": "+t.pattern:"");case"Grep":return"Searching code"+(t.pattern?' for "'+Rb(t.pattern,30)+'"':"");case"Fetch":case"WebFetch":return"Fetching web page"+(t.url?": "+Rb(t.url,40):"");case"Skill":{const n=t.name||t.skill||"";return wW(n)}case"Todo":case"TodoWrite":return"Updating plan";case"Task":return t._purpose||"Running sub-task";default:return t.filePath?"Processing "+Su(t.filePath):t.command?C2(t.command):"Running "+e.toLowerCase()}}function Su(e){if(!e)return"file";const t=e.split("/"),n=t[t.length-1]||"file";return t.length<=2?n:t[t.length-2]+"/"+n}function C2(e){if(!e)return"Running command";const t=e.trim();if(/^(ls|dir)\b/i.test(t))return"Listing files";if(/^(cat|less|more)\b/i.test(t))return"Reading file contents";if(/^(mkdir)\b/i.test(t))return"Creating directory";if(/^(rm|del)\b/i.test(t))return"Removing files";if(/^(cp|copy)\b/i.test(t))return"Copying files";if(/^(mv|move|rename)\b/i.test(t))return"Moving files";if(/^(git\s+status)\b/i.test(t))return"Checking git status";if(/^(git\s+log)\b/i.test(t))return"Viewing git history";if(/^(git\s+diff)\b/i.test(t))return"Comparing changes";if(/^(git\s+add)\b/i.test(t))return"Staging changes";if(/^(git\s+commit)\b/i.test(t))return"Committing changes";if(/^(git\s+push)\b/i.test(t))return"Pushing to remote";if(/^(git\s+pull)\b/i.test(t))return"Pulling from remote";if(/^(git\s+clone)\b/i.test(t))return"Cloning repository";if(/^(git\s+checkout|git\s+switch)\b/i.test(t))return"Switching branches";if(/^(git\s+branch)\b/i.test(t))return"Managing branches";if(/^git\b/i.test(t))return"Running git command";if(/^(npm\s+install|npm\s+i|yarn\s+install|yarn\s+add|pnpm\s+install)\b/i.test(t))return"Installing dependencies";if(/^(npm\s+run\s+build|yarn\s+build|pnpm\s+build)\b/i.test(t))return"Building project";if(/^(npm\s+run\s+test|npm\s+test|yarn\s+test|jest|pytest|mocha)\b/i.test(t))return"Running tests";if(/^(npm\s+run\s+dev|npm\s+start|yarn\s+dev|yarn\s+start)\b/i.test(t))return"Starting dev server";if(/^(npm|yarn|pnpm)\b/i.test(t))return"Running package manager";if(/^(node|python|ruby|php|java)\b/i.test(t))return"Running script";if(/^(docker)\b/i.test(t))return"Running Docker command";if(/^(curl|wget)\b/i.test(t))return"Fetching URL";if(/^(chmod|chown)\b/i.test(t))return"Changing permissions";if(/^(find|locate)\b/i.test(t))return"Finding files";if(/^(grep|rg|ag)\b/i.test(t))return"Searching file contents";if(/^(sed|awk)\b/i.test(t))return"Processing text";if(/^(echo|printf)\b/i.test(t))return"Running command";if(/^(ssh|scp)\b/i.test(t))return"Connecting remotely";if(/^(ping|traceroute|nslookup|dig)\b/i.test(t))return"Checking network";if(/^(tar|zip|unzip|gzip)\b/i.test(t))return"Compressing/extracting files";const n=t.split(/\s+/)[0];return"Running "+Rb(n,20)}function wW(e,t){const n=(e||"").toLowerCase();return n.includes("gmail")||n.includes("email")?"Checking email":n.includes("gdrive")||n.includes("drive")?"Accessing Google Drive":n.includes("gcal")||n.includes("calendar")?"Checking calendar":n.includes("gtasks")||n.includes("tasks")?"Managing tasks":n.includes("discord")?"Using Discord":n.includes("whatsapp")?"Using WhatsApp":n.includes("wrike")?"Checking Wrike":n.includes("dropbox")?"Accessing Dropbox":n.includes("pandadoc")?"Working with PandaDoc":n.includes("freshbooks")?"Checking FreshBooks":n.includes("mailchimp")?"Using Mailchimp":n.includes("bamboohr")?"Checking BambooHR":e?"Using "+e:"Running skill"}function Rb(e,t){return e?e.length<=t?e:e.slice(0,t)+"...":""}const Ib=10,Mb=24,j2=2,EW=14,cI="pave-terminal-font-size";function SW(){try{const e=localStorage.getItem(cI);if(e!==null){const t=parseInt(e,10);if(!Number.isNaN(t)&&t>=Ib&&t<=Mb)return t}}catch{}return EW}function uI({toolParts:e,matrixMode:t,onToggleMatrix:n,darkMode:r=!0}){var{t:a}=Ct();const i=h.useRef(null),s=h.useRef(null),l=h.useRef(null),[c,u]=h.useState(SW),d=h.useCallback(()=>{u(y=>Math.max(Ib,y-j2))},[]),f=h.useCallback(()=>{u(y=>Math.min(Mb,y+j2))},[]);h.useEffect(()=>{try{localStorage.setItem(cI,String(c))}catch{}},[c]);const g=r?{bg:"bg-gray-950",headerBg:"bg-gray-900",headerBorder:"border-gray-800",titleText:"text-gray-400",promptColor:"text-green-400",commandColor:"text-gray-200",outputColor:"text-green-300/70",waitingText:"text-gray-500",runningColor:"text-yellow-400",doneColor:"text-green-500",errorColor:"text-red-400",pendingColor:"text-blue-400"}:{bg:"bg-gray-100",headerBg:"bg-gray-200",headerBorder:"border-gray-300",titleText:"text-gray-600",promptColor:"text-green-600",commandColor:"text-gray-800",outputColor:"text-green-700/80",waitingText:"text-gray-500",runningColor:"text-yellow-600",doneColor:"text-green-600",errorColor:"text-red-600",pendingColor:"text-blue-600"},p=`px-1.5 py-0.5 text-xs font-mono rounded ${r?"bg-gray-600 text-gray-300 hover:bg-gray-500":"bg-gray-300 text-gray-700 hover:bg-gray-200"} disabled:opacity-40 disabled:cursor-default`;h.useEffect(()=>{i.current&&!t&&(i.current.scrollTop=i.current.scrollHeight)},[e,t]);const m=h.useCallback(()=>{const y=s.current;if(!y)return;const v=y.getContext("2d");if(!v)return;const x=()=>{const N=y.parentElement;if(N&&N.clientWidth>0&&N.clientHeight>0){y.width=N.clientWidth,y.height=N.clientHeight;return}const R=y.getBoundingClientRect();if(R.width>0&&R.height>0){y.width=R.width,y.height=R.height;return}y.width=0,y.height=0};x();const b=c;let k=Math.floor(y.width/b),S=new Array(k).fill(1);const E="アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",_=()=>{v.fillStyle="rgba(0, 0, 0, 0.05)",v.fillRect(0,0,y.width,y.height),v.fillStyle="#0F0",v.font=b+"px monospace";for(let N=0;N<S.length;N++){const R=E.charAt(Math.floor(Math.random()*E.length));v.fillText(R,N*b,S[N]*b),S[N]*b>y.height&&Math.random()>.975&&(S[N]=0),S[N]++}l.current=requestAnimationFrame(_)},w=()=>{x(),k=Math.floor(y.width/b);const N=new Array(k).fill(0);for(let R=0;R<Math.min(S.length,N.length);R++)N[R]=S[R];S=N};return window.addEventListener("resize",w),l.current=requestAnimationFrame(_),()=>{window.removeEventListener("resize",w),l.current&&cancelAnimationFrame(l.current)}},[c]);return h.useEffect(()=>{let y;return t?y=m():l.current&&(cancelAnimationFrame(l.current),l.current=null),()=>{y&&y(),l.current&&(cancelAnimationFrame(l.current),l.current=null)}},[t,m]),e&&e.some(y=>{var v;return(((v=y.state)==null?void 0:v.status)||"running")==="running"}),o.jsxs("div",{className:`flex flex-col h-full ${g.bg} font-mono`,style:{fontSize:c+"px"},children:[o.jsxs("div",{className:`flex items-center justify-between px-3 py-2 ${g.headerBg} border-b ${g.headerBorder} flex-shrink-0`,children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500 cursor-pointer",onDoubleClick:n,title:""}),o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-500"}),o.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"})]}),o.jsx("span",{className:`${g.titleText} text-xs ml-2`,children:"PAVE Terminal"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:d,disabled:c<=Ib,className:p,"aria-label":a("terminal.decrease_font"),title:a("terminal.decrease_font"),children:"A-"}),o.jsx("button",{type:"button",onClick:f,disabled:c>=Mb,className:p,"aria-label":a("terminal.increase_font"),title:a("terminal.increase_font"),children:"A+"})]})]}),o.jsx("div",{className:"flex-1 relative overflow-hidden",children:t?o.jsxs(o.Fragment,{children:[o.jsx("canvas",{ref:s,className:"absolute inset-0 w-full h-full"}),e&&e.length>0&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-black/60 px-3 py-2 max-h-32 overflow-y-auto",children:e.slice(-3).map(y=>o.jsx(CW,{part:y},y.id))})]}):o.jsx("div",{ref:i,className:"h-full overflow-y-auto px-3 py-2 space-y-1",children:!e||e.length===0?o.jsxs("div",{children:[o.jsxs("div",{className:g.promptColor,children:["$ ",o.jsx("span",{className:"terminal-cursor",children:"█"})]}),o.jsx("p",{className:`${g.waitingText} mt-2`,children:"Awaiting commands..."})]}):o.jsxs(o.Fragment,{children:[e.map(y=>o.jsx(NW,{part:y,theme:g},y.id)),o.jsxs("div",{className:g.promptColor,children:["$ ",o.jsx("span",{className:"terminal-cursor",children:"█"})]})]})})})]})}function NW({part:e,theme:t}){var{t:n}=Ct();const{tool:r,state:a}=e;if(!a)return null;const i=a.status||"running",l=hf(r||a.title,a.input)||r||a.title||"unknown",c=a.output?cs(typeof a.output=="string"?a.output:JSON.stringify(a.output,null,2)):null;return o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:`${t.commandColor} break-all`,children:[o.jsx("span",{className:`${t.promptColor} select-none`,children:"$ "}),l]}),i==="running"&&o.jsx("div",{className:`${t.runningColor} mt-0.5`,children:"[running...]"}),i==="completed"&&c&&o.jsx("pre",{className:`${t.outputColor} mt-0.5 whitespace-pre-wrap break-all`,children:c}),i==="completed"&&!c&&o.jsx("div",{className:`${t.doneColor} mt-0.5`,children:"[done]"}),i==="error"&&o.jsxs("pre",{className:`${t.errorColor} mt-0.5 whitespace-pre-wrap break-all`,children:["[error] ",a.error?cs(typeof a.error=="string"?a.error:a.error.message||n("common.error")):n("common.unknown_error")]}),i==="pending_confirmation"&&o.jsx("div",{className:`${t.pendingColor} mt-0.5`,children:"[awaiting confirmation...]"})]})}function CW({part:e}){const{tool:t,state:n}=e;if(!n)return null;const r=n.status||"running",i=hf(t||n.title,n.input)||t||n.title||"unknown",s={running:"text-yellow-400",completed:"text-green-400",error:"text-red-400",pending_confirmation:"text-blue-400"},l={running:"RUN",completed:"OK",error:"ERR",pending_confirmation:"WAIT"};return o.jsxs("div",{className:"text-xs font-mono truncate",children:[o.jsxs("span",{className:s[r]||"text-gray-400",children:["[",l[r]||r,"]"]}),o.jsxs("span",{className:"text-green-300 ml-1",children:["$ ",i]})]})}function E1(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var op,T2;function jW(){if(T2)return op;T2=1;function e(){this.__data__=[],this.size=0}return op=e,op}var lp,A2;function Lo(){if(A2)return lp;A2=1;function e(t,n){return t===n||t!==t&&n!==n}return lp=e,lp}var cp,R2;function xf(){if(R2)return cp;R2=1;var e=Lo();function t(n,r){for(var a=n.length;a--;)if(e(n[a][0],r))return a;return-1}return cp=t,cp}var up,I2;function TW(){if(I2)return up;I2=1;var e=xf(),t=Array.prototype,n=t.splice;function r(a){var i=this.__data__,s=e(i,a);if(s<0)return!1;var l=i.length-1;return s==l?i.pop():n.call(i,s,1),--this.size,!0}return up=r,up}var dp,M2;function AW(){if(M2)return dp;M2=1;var e=xf();function t(n){var r=this.__data__,a=e(r,n);return a<0?void 0:r[a][1]}return dp=t,dp}var fp,L2;function RW(){if(L2)return fp;L2=1;var e=xf();function t(n){return e(this.__data__,n)>-1}return fp=t,fp}var gp,O2;function IW(){if(O2)return gp;O2=1;var e=xf();function t(n,r){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,r])):a[i][1]=r,this}return gp=t,gp}var pp,D2;function yf(){if(D2)return pp;D2=1;var e=jW(),t=TW(),n=AW(),r=RW(),a=IW();function i(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,pp=i,pp}var hp,P2;function MW(){if(P2)return hp;P2=1;var e=yf();function t(){this.__data__=new e,this.size=0}return hp=t,hp}var mp,F2;function LW(){if(F2)return mp;F2=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return mp=e,mp}var xp,B2;function OW(){if(B2)return xp;B2=1;function e(t){return this.__data__.get(t)}return xp=e,xp}var yp,z2;function DW(){if(z2)return yp;z2=1;function e(t){return this.__data__.has(t)}return yp=e,yp}var bp,U2;function dI(){if(U2)return bp;U2=1;var e=typeof mi=="object"&&mi&&mi.Object===Object&&mi;return bp=e,bp}var vp,$2;function ca(){if($2)return vp;$2=1;var e=dI(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return vp=n,vp}var kp,H2;function Oo(){if(H2)return kp;H2=1;var e=ca(),t=e.Symbol;return kp=t,kp}var _p,q2;function PW(){if(q2)return _p;q2=1;var e=Oo(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,a=e?e.toStringTag:void 0;function i(s){var l=n.call(s,a),c=s[a];try{s[a]=void 0;var u=!0}catch{}var d=r.call(s);return u&&(l?s[a]=c:delete s[a]),d}return _p=i,_p}var wp,W2;function FW(){if(W2)return wp;W2=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return wp=n,wp}var Ep,V2;function Es(){if(V2)return Ep;V2=1;var e=Oo(),t=PW(),n=FW(),r="[object Null]",a="[object Undefined]",i=e?e.toStringTag:void 0;function s(l){return l==null?l===void 0?a:r:i&&i in Object(l)?t(l):n(l)}return Ep=s,Ep}var Sp,G2;function Vr(){if(G2)return Sp;G2=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Sp=e,Sp}var Np,K2;function wc(){if(K2)return Np;K2=1;var e=Es(),t=Vr(),n="[object AsyncFunction]",r="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function s(l){if(!t(l))return!1;var c=e(l);return c==r||c==a||c==n||c==i}return Np=s,Np}var Cp,Y2;function BW(){if(Y2)return Cp;Y2=1;var e=ca(),t=e["__core-js_shared__"];return Cp=t,Cp}var jp,X2;function zW(){if(X2)return jp;X2=1;var e=BW(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return jp=n,jp}var Tp,Q2;function fI(){if(Q2)return Tp;Q2=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Tp=n,Tp}var Ap,Z2;function UW(){if(Z2)return Ap;Z2=1;var e=wc(),t=zW(),n=Vr(),r=fI(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,s=Function.prototype,l=Object.prototype,c=s.toString,u=l.hasOwnProperty,d=RegExp("^"+c.call(u).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(g){if(!n(g)||t(g))return!1;var p=e(g)?d:i;return p.test(r(g))}return Ap=f,Ap}var Rp,J2;function $W(){if(J2)return Rp;J2=1;function e(t,n){return t==null?void 0:t[n]}return Rp=e,Rp}var Ip,eE;function Ss(){if(eE)return Ip;eE=1;var e=UW(),t=$W();function n(r,a){var i=t(r,a);return e(i)?i:void 0}return Ip=n,Ip}var Mp,tE;function S1(){if(tE)return Mp;tE=1;var e=Ss(),t=ca(),n=e(t,"Map");return Mp=n,Mp}var Lp,nE;function bf(){if(nE)return Lp;nE=1;var e=Ss(),t=e(Object,"create");return Lp=t,Lp}var Op,rE;function HW(){if(rE)return Op;rE=1;var e=bf();function t(){this.__data__=e?e(null):{},this.size=0}return Op=t,Op}var Dp,aE;function qW(){if(aE)return Dp;aE=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Dp=e,Dp}var Pp,iE;function WW(){if(iE)return Pp;iE=1;var e=bf(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function a(i){var s=this.__data__;if(e){var l=s[i];return l===t?void 0:l}return r.call(s,i)?s[i]:void 0}return Pp=a,Pp}var Fp,sE;function VW(){if(sE)return Fp;sE=1;var e=bf(),t=Object.prototype,n=t.hasOwnProperty;function r(a){var i=this.__data__;return e?i[a]!==void 0:n.call(i,a)}return Fp=r,Fp}var Bp,oE;function GW(){if(oE)return Bp;oE=1;var e=bf(),t="__lodash_hash_undefined__";function n(r,a){var i=this.__data__;return this.size+=this.has(r)?0:1,i[r]=e&&a===void 0?t:a,this}return Bp=n,Bp}var zp,lE;function KW(){if(lE)return zp;lE=1;var e=HW(),t=qW(),n=WW(),r=VW(),a=GW();function i(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,zp=i,zp}var Up,cE;function YW(){if(cE)return Up;cE=1;var e=KW(),t=yf(),n=S1();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Up=r,Up}var $p,uE;function XW(){if(uE)return $p;uE=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return $p=e,$p}var Hp,dE;function vf(){if(dE)return Hp;dE=1;var e=XW();function t(n,r){var a=n.__data__;return e(r)?a[typeof r=="string"?"string":"hash"]:a.map}return Hp=t,Hp}var qp,fE;function QW(){if(fE)return qp;fE=1;var e=vf();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return qp=t,qp}var Wp,gE;function ZW(){if(gE)return Wp;gE=1;var e=vf();function t(n){return e(this,n).get(n)}return Wp=t,Wp}var Vp,pE;function JW(){if(pE)return Vp;pE=1;var e=vf();function t(n){return e(this,n).has(n)}return Vp=t,Vp}var Gp,hE;function eV(){if(hE)return Gp;hE=1;var e=vf();function t(n,r){var a=e(this,n),i=a.size;return a.set(n,r),this.size+=a.size==i?0:1,this}return Gp=t,Gp}var Kp,mE;function N1(){if(mE)return Kp;mE=1;var e=YW(),t=QW(),n=ZW(),r=JW(),a=eV();function i(s){var l=-1,c=s==null?0:s.length;for(this.clear();++l<c;){var u=s[l];this.set(u[0],u[1])}}return i.prototype.clear=e,i.prototype.delete=t,i.prototype.get=n,i.prototype.has=r,i.prototype.set=a,Kp=i,Kp}var Yp,xE;function tV(){if(xE)return Yp;xE=1;var e=yf(),t=S1(),n=N1(),r=200;function a(i,s){var l=this.__data__;if(l instanceof e){var c=l.__data__;if(!t||c.length<r-1)return c.push([i,s]),this.size=++l.size,this;l=this.__data__=new n(c)}return l.set(i,s),this.size=l.size,this}return Yp=a,Yp}var Xp,yE;function kf(){if(yE)return Xp;yE=1;var e=yf(),t=MW(),n=LW(),r=OW(),a=DW(),i=tV();function s(l){var c=this.__data__=new e(l);this.size=c.size}return s.prototype.clear=t,s.prototype.delete=n,s.prototype.get=r,s.prototype.has=a,s.prototype.set=i,Xp=s,Xp}var Qp,bE;function C1(){if(bE)return Qp;bE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a&&n(t[r],r,t)!==!1;);return t}return Qp=e,Qp}var Zp,vE;function gI(){if(vE)return Zp;vE=1;var e=Ss(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}}();return Zp=t,Zp}var Jp,kE;function _f(){if(kE)return Jp;kE=1;var e=gI();function t(n,r,a){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:a,writable:!0}):n[r]=a}return Jp=t,Jp}var eh,_E;function wf(){if(_E)return eh;_E=1;var e=_f(),t=Lo(),n=Object.prototype,r=n.hasOwnProperty;function a(i,s,l){var c=i[s];(!(r.call(i,s)&&t(c,l))||l===void 0&&!(s in i))&&e(i,s,l)}return eh=a,eh}var th,wE;function Ec(){if(wE)return th;wE=1;var e=wf(),t=_f();function n(r,a,i,s){var l=!i;i||(i={});for(var c=-1,u=a.length;++c<u;){var d=a[c],f=s?s(i[d],r[d],d,i,r):void 0;f===void 0&&(f=r[d]),l?t(i,d,f):e(i,d,f)}return i}return th=n,th}var nh,EE;function nV(){if(EE)return nh;EE=1;function e(t,n){for(var r=-1,a=Array(t);++r<t;)a[r]=n(r);return a}return nh=e,nh}var rh,SE;function Na(){if(SE)return rh;SE=1;function e(t){return t!=null&&typeof t=="object"}return rh=e,rh}var ah,NE;function rV(){if(NE)return ah;NE=1;var e=Es(),t=Na(),n="[object Arguments]";function r(a){return t(a)&&e(a)==n}return ah=r,ah}var ih,CE;function Sc(){if(CE)return ih;CE=1;var e=rV(),t=Na(),n=Object.prototype,r=n.hasOwnProperty,a=n.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(s){return t(s)&&r.call(s,"callee")&&!a.call(s,"callee")};return ih=i,ih}var sh,jE;function En(){if(jE)return sh;jE=1;var e=Array.isArray;return sh=e,sh}var ul={exports:{}},oh,TE;function aV(){if(TE)return oh;TE=1;function e(){return!1}return oh=e,oh}ul.exports;var AE;function Do(){return AE||(AE=1,function(e,t){var n=ca(),r=aV(),a=t&&!t.nodeType&&t,i=a&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===a,l=s?n.Buffer:void 0,c=l?l.isBuffer:void 0,u=c||r;e.exports=u}(ul,ul.exports)),ul.exports}var lh,RE;function Ef(){if(RE)return lh;RE=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,a){var i=typeof r;return a=a??e,!!a&&(i=="number"||i!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<a}return lh=n,lh}var ch,IE;function j1(){if(IE)return ch;IE=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return ch=t,ch}var uh,ME;function iV(){if(ME)return uh;ME=1;var e=Es(),t=j1(),n=Na(),r="[object Arguments]",a="[object Array]",i="[object Boolean]",s="[object Date]",l="[object Error]",c="[object Function]",u="[object Map]",d="[object Number]",f="[object Object]",g="[object RegExp]",p="[object Set]",m="[object String]",y="[object WeakMap]",v="[object ArrayBuffer]",x="[object DataView]",b="[object Float32Array]",k="[object Float64Array]",S="[object Int8Array]",E="[object Int16Array]",_="[object Int32Array]",w="[object Uint8Array]",N="[object Uint8ClampedArray]",R="[object Uint16Array]",j="[object Uint32Array]",P={};P[b]=P[k]=P[S]=P[E]=P[_]=P[w]=P[N]=P[R]=P[j]=!0,P[r]=P[a]=P[v]=P[i]=P[x]=P[s]=P[l]=P[c]=P[u]=P[d]=P[f]=P[g]=P[p]=P[m]=P[y]=!1;function F(H){return n(H)&&t(H.length)&&!!P[e(H)]}return uh=F,uh}var dh,LE;function Sf(){if(LE)return dh;LE=1;function e(t){return function(n){return t(n)}}return dh=e,dh}var dl={exports:{}};dl.exports;var OE;function T1(){return OE||(OE=1,function(e,t){var n=dI(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,s=i&&n.process,l=function(){try{var c=a&&a.require&&a.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}}();e.exports=l}(dl,dl.exports)),dl.exports}var fh,DE;function Nc(){if(DE)return fh;DE=1;var e=iV(),t=Sf(),n=T1(),r=n&&n.isTypedArray,a=r?t(r):e;return fh=a,fh}var gh,PE;function pI(){if(PE)return gh;PE=1;var e=nV(),t=Sc(),n=En(),r=Do(),a=Ef(),i=Nc(),s=Object.prototype,l=s.hasOwnProperty;function c(u,d){var f=n(u),g=!f&&t(u),p=!f&&!g&&r(u),m=!f&&!g&&!p&&i(u),y=f||g||p||m,v=y?e(u.length,String):[],x=v.length;for(var b in u)(d||l.call(u,b))&&!(y&&(b=="length"||p&&(b=="offset"||b=="parent")||m&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||a(b,x)))&&v.push(b);return v}return gh=c,gh}var ph,FE;function Nf(){if(FE)return ph;FE=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,a=typeof r=="function"&&r.prototype||e;return n===a}return ph=t,ph}var hh,BE;function hI(){if(BE)return hh;BE=1;function e(t,n){return function(r){return t(n(r))}}return hh=e,hh}var mh,zE;function sV(){if(zE)return mh;zE=1;var e=hI(),t=e(Object.keys,Object);return mh=t,mh}var xh,UE;function A1(){if(UE)return xh;UE=1;var e=Nf(),t=sV(),n=Object.prototype,r=n.hasOwnProperty;function a(i){if(!e(i))return t(i);var s=[];for(var l in Object(i))r.call(i,l)&&l!="constructor"&&s.push(l);return s}return xh=a,xh}var yh,$E;function Xa(){if($E)return yh;$E=1;var e=wc(),t=j1();function n(r){return r!=null&&t(r.length)&&!e(r)}return yh=n,yh}var bh,HE;function Ui(){if(HE)return bh;HE=1;var e=pI(),t=A1(),n=Xa();function r(a){return n(a)?e(a):t(a)}return bh=r,bh}var vh,qE;function oV(){if(qE)return vh;qE=1;var e=Ec(),t=Ui();function n(r,a){return r&&e(a,t(a),r)}return vh=n,vh}var kh,WE;function lV(){if(WE)return kh;WE=1;function e(t){var n=[];if(t!=null)for(var r in Object(t))n.push(r);return n}return kh=e,kh}var _h,VE;function cV(){if(VE)return _h;VE=1;var e=Vr(),t=Nf(),n=lV(),r=Object.prototype,a=r.hasOwnProperty;function i(s){if(!e(s))return n(s);var l=t(s),c=[];for(var u in s)u=="constructor"&&(l||!a.call(s,u))||c.push(u);return c}return _h=i,_h}var wh,GE;function Ns(){if(GE)return wh;GE=1;var e=pI(),t=cV(),n=Xa();function r(a){return n(a)?e(a,!0):t(a)}return wh=r,wh}var Eh,KE;function uV(){if(KE)return Eh;KE=1;var e=Ec(),t=Ns();function n(r,a){return r&&e(a,t(a),r)}return Eh=n,Eh}var fl={exports:{}};fl.exports;var YE;function mI(){return YE||(YE=1,function(e,t){var n=ca(),r=t&&!t.nodeType&&t,a=r&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===r,s=i?n.Buffer:void 0,l=s?s.allocUnsafe:void 0;function c(u,d){if(d)return u.slice();var f=u.length,g=l?l(f):new u.constructor(f);return u.copy(g),g}e.exports=c}(fl,fl.exports)),fl.exports}var Sh,XE;function xI(){if(XE)return Sh;XE=1;function e(t,n){var r=-1,a=t.length;for(n||(n=Array(a));++r<a;)n[r]=t[r];return n}return Sh=e,Sh}var Nh,QE;function yI(){if(QE)return Nh;QE=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=0,s=[];++r<a;){var l=t[r];n(l,r,t)&&(s[i++]=l)}return s}return Nh=e,Nh}var Ch,ZE;function bI(){if(ZE)return Ch;ZE=1;function e(){return[]}return Ch=e,Ch}var jh,JE;function R1(){if(JE)return jh;JE=1;var e=yI(),t=bI(),n=Object.prototype,r=n.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(s){return s==null?[]:(s=Object(s),e(a(s),function(l){return r.call(s,l)}))}:t;return jh=i,jh}var Th,eS;function dV(){if(eS)return Th;eS=1;var e=Ec(),t=R1();function n(r,a){return e(r,t(r),a)}return Th=n,Th}var Ah,tS;function I1(){if(tS)return Ah;tS=1;function e(t,n){for(var r=-1,a=n.length,i=t.length;++r<a;)t[i+r]=n[r];return t}return Ah=e,Ah}var Rh,nS;function Cf(){if(nS)return Rh;nS=1;var e=hI(),t=e(Object.getPrototypeOf,Object);return Rh=t,Rh}var Ih,rS;function vI(){if(rS)return Ih;rS=1;var e=I1(),t=Cf(),n=R1(),r=bI(),a=Object.getOwnPropertySymbols,i=a?function(s){for(var l=[];s;)e(l,n(s)),s=t(s);return l}:r;return Ih=i,Ih}var Mh,aS;function fV(){if(aS)return Mh;aS=1;var e=Ec(),t=vI();function n(r,a){return e(r,t(r),a)}return Mh=n,Mh}var Lh,iS;function kI(){if(iS)return Lh;iS=1;var e=I1(),t=En();function n(r,a,i){var s=a(r);return t(r)?s:e(s,i(r))}return Lh=n,Lh}var Oh,sS;function _I(){if(sS)return Oh;sS=1;var e=kI(),t=R1(),n=Ui();function r(a){return e(a,n,t)}return Oh=r,Oh}var Dh,oS;function gV(){if(oS)return Dh;oS=1;var e=kI(),t=vI(),n=Ns();function r(a){return e(a,n,t)}return Dh=r,Dh}var Ph,lS;function pV(){if(lS)return Ph;lS=1;var e=Ss(),t=ca(),n=e(t,"DataView");return Ph=n,Ph}var Fh,cS;function hV(){if(cS)return Fh;cS=1;var e=Ss(),t=ca(),n=e(t,"Promise");return Fh=n,Fh}var Bh,uS;function wI(){if(uS)return Bh;uS=1;var e=Ss(),t=ca(),n=e(t,"Set");return Bh=n,Bh}var zh,dS;function mV(){if(dS)return zh;dS=1;var e=Ss(),t=ca(),n=e(t,"WeakMap");return zh=n,zh}var Uh,fS;function Po(){if(fS)return Uh;fS=1;var e=pV(),t=S1(),n=hV(),r=wI(),a=mV(),i=Es(),s=fI(),l="[object Map]",c="[object Object]",u="[object Promise]",d="[object Set]",f="[object WeakMap]",g="[object DataView]",p=s(e),m=s(t),y=s(n),v=s(r),x=s(a),b=i;return(e&&b(new e(new ArrayBuffer(1)))!=g||t&&b(new t)!=l||n&&b(n.resolve())!=u||r&&b(new r)!=d||a&&b(new a)!=f)&&(b=function(k){var S=i(k),E=S==c?k.constructor:void 0,_=E?s(E):"";if(_)switch(_){case p:return g;case m:return l;case y:return u;case v:return d;case x:return f}return S}),Uh=b,Uh}var $h,gS;function xV(){if(gS)return $h;gS=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r){var a=r.length,i=new r.constructor(a);return a&&typeof r[0]=="string"&&t.call(r,"index")&&(i.index=r.index,i.input=r.input),i}return $h=n,$h}var Hh,pS;function EI(){if(pS)return Hh;pS=1;var e=ca(),t=e.Uint8Array;return Hh=t,Hh}var qh,hS;function M1(){if(hS)return qh;hS=1;var e=EI();function t(n){var r=new n.constructor(n.byteLength);return new e(r).set(new e(n)),r}return qh=t,qh}var Wh,mS;function yV(){if(mS)return Wh;mS=1;var e=M1();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.byteLength)}return Wh=t,Wh}var Vh,xS;function bV(){if(xS)return Vh;xS=1;var e=/\w*$/;function t(n){var r=new n.constructor(n.source,e.exec(n));return r.lastIndex=n.lastIndex,r}return Vh=t,Vh}var Gh,yS;function vV(){if(yS)return Gh;yS=1;var e=Oo(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(a){return n?Object(n.call(a)):{}}return Gh=r,Gh}var Kh,bS;function SI(){if(bS)return Kh;bS=1;var e=M1();function t(n,r){var a=r?e(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}return Kh=t,Kh}var Yh,vS;function kV(){if(vS)return Yh;vS=1;var e=M1(),t=yV(),n=bV(),r=vV(),a=SI(),i="[object Boolean]",s="[object Date]",l="[object Map]",c="[object Number]",u="[object RegExp]",d="[object Set]",f="[object String]",g="[object Symbol]",p="[object ArrayBuffer]",m="[object DataView]",y="[object Float32Array]",v="[object Float64Array]",x="[object Int8Array]",b="[object Int16Array]",k="[object Int32Array]",S="[object Uint8Array]",E="[object Uint8ClampedArray]",_="[object Uint16Array]",w="[object Uint32Array]";function N(R,j,P){var F=R.constructor;switch(j){case p:return e(R);case i:case s:return new F(+R);case m:return t(R,P);case y:case v:case x:case b:case k:case S:case E:case _:case w:return a(R,P);case l:return new F;case c:case f:return new F(R);case u:return n(R);case d:return new F;case g:return r(R)}}return Yh=N,Yh}var Xh,kS;function NI(){if(kS)return Xh;kS=1;var e=Vr(),t=Object.create,n=function(){function r(){}return function(a){if(!e(a))return{};if(t)return t(a);r.prototype=a;var i=new r;return r.prototype=void 0,i}}();return Xh=n,Xh}var Qh,_S;function CI(){if(_S)return Qh;_S=1;var e=NI(),t=Cf(),n=Nf();function r(a){return typeof a.constructor=="function"&&!n(a)?e(t(a)):{}}return Qh=r,Qh}var Zh,wS;function _V(){if(wS)return Zh;wS=1;var e=Po(),t=Na(),n="[object Map]";function r(a){return t(a)&&e(a)==n}return Zh=r,Zh}var Jh,ES;function wV(){if(ES)return Jh;ES=1;var e=_V(),t=Sf(),n=T1(),r=n&&n.isMap,a=r?t(r):e;return Jh=a,Jh}var em,SS;function EV(){if(SS)return em;SS=1;var e=Po(),t=Na(),n="[object Set]";function r(a){return t(a)&&e(a)==n}return em=r,em}var tm,NS;function SV(){if(NS)return tm;NS=1;var e=EV(),t=Sf(),n=T1(),r=n&&n.isSet,a=r?t(r):e;return tm=a,tm}var nm,CS;function jI(){if(CS)return nm;CS=1;var e=kf(),t=C1(),n=wf(),r=oV(),a=uV(),i=mI(),s=xI(),l=dV(),c=fV(),u=_I(),d=gV(),f=Po(),g=xV(),p=kV(),m=CI(),y=En(),v=Do(),x=wV(),b=Vr(),k=SV(),S=Ui(),E=Ns(),_=1,w=2,N=4,R="[object Arguments]",j="[object Array]",P="[object Boolean]",F="[object Date]",H="[object Error]",L="[object Function]",M="[object GeneratorFunction]",T="[object Map]",O="[object Number]",$="[object Object]",Y="[object RegExp]",A="[object Set]",K="[object String]",V="[object Symbol]",I="[object WeakMap]",q="[object ArrayBuffer]",ie="[object DataView]",J="[object Float32Array]",je="[object Float64Array]",X="[object Int8Array]",he="[object Int16Array]",Me="[object Int32Array]",we="[object Uint8Array]",ge="[object Uint8ClampedArray]",Se="[object Uint16Array]",Re="[object Uint32Array]",me={};me[R]=me[j]=me[q]=me[ie]=me[P]=me[F]=me[J]=me[je]=me[X]=me[he]=me[Me]=me[T]=me[O]=me[$]=me[Y]=me[A]=me[K]=me[V]=me[we]=me[ge]=me[Se]=me[Re]=!0,me[H]=me[L]=me[I]=!1;function ye(Oe,be,ee,Ee,fe,ve){var de,pe=be&_,De=be&w,B=be&N;if(ee&&(de=fe?ee(Oe,Ee,fe,ve):ee(Oe)),de!==void 0)return de;if(!b(Oe))return Oe;var D=y(Oe);if(D){if(de=g(Oe),!pe)return s(Oe,de)}else{var G=f(Oe),ce=G==L||G==M;if(v(Oe))return i(Oe,pe);if(G==$||G==R||ce&&!fe){if(de=De||ce?{}:m(Oe),!pe)return De?c(Oe,a(de,Oe)):l(Oe,r(de,Oe))}else{if(!me[G])return fe?Oe:{};de=p(Oe,G,pe)}}ve||(ve=new e);var Te=ve.get(Oe);if(Te)return Te;ve.set(Oe,de),k(Oe)?Oe.forEach(function(Qe){de.add(ye(Qe,be,ee,Qe,Oe,ve))}):x(Oe)&&Oe.forEach(function(Qe,Xe){de.set(Xe,ye(Qe,be,ee,Xe,Oe,ve))});var Ue=B?De?d:u:De?E:S,Ve=D?void 0:Ue(Oe);return t(Ve||Oe,function(Qe,Xe){Ve&&(Xe=Qe,Qe=Oe[Xe]),n(de,Xe,ye(Qe,be,ee,Xe,Oe,ve))}),de}return nm=ye,nm}var rm,jS;function NV(){if(jS)return rm;jS=1;var e=jI(),t=4;function n(r){return e(r,t)}return rm=n,rm}var am,TS;function L1(){if(TS)return am;TS=1;function e(t){return function(){return t}}return am=e,am}var im,AS;function CV(){if(AS)return im;AS=1;function e(t){return function(n,r,a){for(var i=-1,s=Object(n),l=a(n),c=l.length;c--;){var u=l[t?c:++i];if(r(s[u],u,s)===!1)break}return n}}return im=e,im}var sm,RS;function O1(){if(RS)return sm;RS=1;var e=CV(),t=e();return sm=t,sm}var om,IS;function D1(){if(IS)return om;IS=1;var e=O1(),t=Ui();function n(r,a){return r&&e(r,a,t)}return om=n,om}var lm,MS;function jV(){if(MS)return lm;MS=1;var e=Xa();function t(n,r){return function(a,i){if(a==null)return a;if(!e(a))return n(a,i);for(var s=a.length,l=r?s:-1,c=Object(a);(r?l--:++l<s)&&i(c[l],l,c)!==!1;);return a}}return lm=t,lm}var cm,LS;function jf(){if(LS)return cm;LS=1;var e=D1(),t=jV(),n=t(e);return cm=n,cm}var um,OS;function Cs(){if(OS)return um;OS=1;function e(t){return t}return um=e,um}var dm,DS;function TI(){if(DS)return dm;DS=1;var e=Cs();function t(n){return typeof n=="function"?n:e}return dm=t,dm}var fm,PS;function AI(){if(PS)return fm;PS=1;var e=C1(),t=jf(),n=TI(),r=En();function a(i,s){var l=r(i)?e:t;return l(i,n(s))}return fm=a,fm}var gm,FS;function RI(){return FS||(FS=1,gm=AI()),gm}var pm,BS;function TV(){if(BS)return pm;BS=1;var e=jf();function t(n,r){var a=[];return e(n,function(i,s,l){r(i,s,l)&&a.push(i)}),a}return pm=t,pm}var hm,zS;function AV(){if(zS)return hm;zS=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return hm=t,hm}var mm,US;function RV(){if(US)return mm;US=1;function e(t){return this.__data__.has(t)}return mm=e,mm}var xm,$S;function II(){if($S)return xm;$S=1;var e=N1(),t=AV(),n=RV();function r(a){var i=-1,s=a==null?0:a.length;for(this.__data__=new e;++i<s;)this.add(a[i])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,xm=r,xm}var ym,HS;function IV(){if(HS)return ym;HS=1;function e(t,n){for(var r=-1,a=t==null?0:t.length;++r<a;)if(n(t[r],r,t))return!0;return!1}return ym=e,ym}var bm,qS;function MI(){if(qS)return bm;qS=1;function e(t,n){return t.has(n)}return bm=e,bm}var vm,WS;function LI(){if(WS)return vm;WS=1;var e=II(),t=IV(),n=MI(),r=1,a=2;function i(s,l,c,u,d,f){var g=c&r,p=s.length,m=l.length;if(p!=m&&!(g&&m>p))return!1;var y=f.get(s),v=f.get(l);if(y&&v)return y==l&&v==s;var x=-1,b=!0,k=c&a?new e:void 0;for(f.set(s,l),f.set(l,s);++x<p;){var S=s[x],E=l[x];if(u)var _=g?u(E,S,x,l,s,f):u(S,E,x,s,l,f);if(_!==void 0){if(_)continue;b=!1;break}if(k){if(!t(l,function(w,N){if(!n(k,N)&&(S===w||d(S,w,c,u,f)))return k.push(N)})){b=!1;break}}else if(!(S===E||d(S,E,c,u,f))){b=!1;break}}return f.delete(s),f.delete(l),b}return vm=i,vm}var km,VS;function MV(){if(VS)return km;VS=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a,i){r[++n]=[i,a]}),r}return km=e,km}var _m,GS;function P1(){if(GS)return _m;GS=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(a){r[++n]=a}),r}return _m=e,_m}var wm,KS;function LV(){if(KS)return wm;KS=1;var e=Oo(),t=EI(),n=Lo(),r=LI(),a=MV(),i=P1(),s=1,l=2,c="[object Boolean]",u="[object Date]",d="[object Error]",f="[object Map]",g="[object Number]",p="[object RegExp]",m="[object Set]",y="[object String]",v="[object Symbol]",x="[object ArrayBuffer]",b="[object DataView]",k=e?e.prototype:void 0,S=k?k.valueOf:void 0;function E(_,w,N,R,j,P,F){switch(N){case b:if(_.byteLength!=w.byteLength||_.byteOffset!=w.byteOffset)return!1;_=_.buffer,w=w.buffer;case x:return!(_.byteLength!=w.byteLength||!P(new t(_),new t(w)));case c:case u:case g:return n(+_,+w);case d:return _.name==w.name&&_.message==w.message;case p:case y:return _==w+"";case f:var H=a;case m:var L=R&s;if(H||(H=i),_.size!=w.size&&!L)return!1;var M=F.get(_);if(M)return M==w;R|=l,F.set(_,w);var T=r(H(_),H(w),R,j,P,F);return F.delete(_),T;case v:if(S)return S.call(_)==S.call(w)}return!1}return wm=E,wm}var Em,YS;function OV(){if(YS)return Em;YS=1;var e=_I(),t=1,n=Object.prototype,r=n.hasOwnProperty;function a(i,s,l,c,u,d){var f=l&t,g=e(i),p=g.length,m=e(s),y=m.length;if(p!=y&&!f)return!1;for(var v=p;v--;){var x=g[v];if(!(f?x in s:r.call(s,x)))return!1}var b=d.get(i),k=d.get(s);if(b&&k)return b==s&&k==i;var S=!0;d.set(i,s),d.set(s,i);for(var E=f;++v<p;){x=g[v];var _=i[x],w=s[x];if(c)var N=f?c(w,_,x,s,i,d):c(_,w,x,i,s,d);if(!(N===void 0?_===w||u(_,w,l,c,d):N)){S=!1;break}E||(E=x=="constructor")}if(S&&!E){var R=i.constructor,j=s.constructor;R!=j&&"constructor"in i&&"constructor"in s&&!(typeof R=="function"&&R instanceof R&&typeof j=="function"&&j instanceof j)&&(S=!1)}return d.delete(i),d.delete(s),S}return Em=a,Em}var Sm,XS;function DV(){if(XS)return Sm;XS=1;var e=kf(),t=LI(),n=LV(),r=OV(),a=Po(),i=En(),s=Do(),l=Nc(),c=1,u="[object Arguments]",d="[object Array]",f="[object Object]",g=Object.prototype,p=g.hasOwnProperty;function m(y,v,x,b,k,S){var E=i(y),_=i(v),w=E?d:a(y),N=_?d:a(v);w=w==u?f:w,N=N==u?f:N;var R=w==f,j=N==f,P=w==N;if(P&&s(y)){if(!s(v))return!1;E=!0,R=!1}if(P&&!R)return S||(S=new e),E||l(y)?t(y,v,x,b,k,S):n(y,v,w,x,b,k,S);if(!(x&c)){var F=R&&p.call(y,"__wrapped__"),H=j&&p.call(v,"__wrapped__");if(F||H){var L=F?y.value():y,M=H?v.value():v;return S||(S=new e),k(L,M,x,b,S)}}return P?(S||(S=new e),r(y,v,x,b,k,S)):!1}return Sm=m,Sm}var Nm,QS;function OI(){if(QS)return Nm;QS=1;var e=DV(),t=Na();function n(r,a,i,s,l){return r===a?!0:r==null||a==null||!t(r)&&!t(a)?r!==r&&a!==a:e(r,a,i,s,n,l)}return Nm=n,Nm}var Cm,ZS;function PV(){if(ZS)return Cm;ZS=1;var e=kf(),t=OI(),n=1,r=2;function a(i,s,l,c){var u=l.length,d=u,f=!c;if(i==null)return!d;for(i=Object(i);u--;){var g=l[u];if(f&&g[2]?g[1]!==i[g[0]]:!(g[0]in i))return!1}for(;++u<d;){g=l[u];var p=g[0],m=i[p],y=g[1];if(f&&g[2]){if(m===void 0&&!(p in i))return!1}else{var v=new e;if(c)var x=c(m,y,p,i,s,v);if(!(x===void 0?t(y,m,n|r,c,v):x))return!1}}return!0}return Cm=a,Cm}var jm,JS;function DI(){if(JS)return jm;JS=1;var e=Vr();function t(n){return n===n&&!e(n)}return jm=t,jm}var Tm,eN;function FV(){if(eN)return Tm;eN=1;var e=DI(),t=Ui();function n(r){for(var a=t(r),i=a.length;i--;){var s=a[i],l=r[s];a[i]=[s,l,e(l)]}return a}return Tm=n,Tm}var Am,tN;function PI(){if(tN)return Am;tN=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return Am=e,Am}var Rm,nN;function BV(){if(nN)return Rm;nN=1;var e=PV(),t=FV(),n=PI();function r(a){var i=t(a);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(s){return s===a||e(s,a,i)}}return Rm=r,Rm}var Im,rN;function Fo(){if(rN)return Im;rN=1;var e=Es(),t=Na(),n="[object Symbol]";function r(a){return typeof a=="symbol"||t(a)&&e(a)==n}return Im=r,Im}var Mm,aN;function F1(){if(aN)return Mm;aN=1;var e=En(),t=Fo(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function a(i,s){if(e(i))return!1;var l=typeof i;return l=="number"||l=="symbol"||l=="boolean"||i==null||t(i)?!0:r.test(i)||!n.test(i)||s!=null&&i in Object(s)}return Mm=a,Mm}var Lm,iN;function zV(){if(iN)return Lm;iN=1;var e=N1(),t="Expected a function";function n(r,a){if(typeof r!="function"||a!=null&&typeof a!="function")throw new TypeError(t);var i=function(){var s=arguments,l=a?a.apply(this,s):s[0],c=i.cache;if(c.has(l))return c.get(l);var u=r.apply(this,s);return i.cache=c.set(l,u)||c,u};return i.cache=new(n.Cache||e),i}return n.Cache=e,Lm=n,Lm}var Om,sN;function UV(){if(sN)return Om;sN=1;var e=zV(),t=500;function n(r){var a=e(r,function(s){return i.size===t&&i.clear(),s}),i=a.cache;return a}return Om=n,Om}var Dm,oN;function $V(){if(oN)return Dm;oN=1;var e=UV(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(t,function(s,l,c,u){i.push(c?u.replace(n,"$1"):l||s)}),i});return Dm=r,Dm}var Pm,lN;function Tf(){if(lN)return Pm;lN=1;function e(t,n){for(var r=-1,a=t==null?0:t.length,i=Array(a);++r<a;)i[r]=n(t[r],r,t);return i}return Pm=e,Pm}var Fm,cN;function HV(){if(cN)return Fm;cN=1;var e=Oo(),t=Tf(),n=En(),r=Fo(),a=e?e.prototype:void 0,i=a?a.toString:void 0;function s(l){if(typeof l=="string")return l;if(n(l))return t(l,s)+"";if(r(l))return i?i.call(l):"";var c=l+"";return c=="0"&&1/l==-1/0?"-0":c}return Fm=s,Fm}var Bm,uN;function FI(){if(uN)return Bm;uN=1;var e=HV();function t(n){return n==null?"":e(n)}return Bm=t,Bm}var zm,dN;function Af(){if(dN)return zm;dN=1;var e=En(),t=F1(),n=$V(),r=FI();function a(i,s){return e(i)?i:t(i,s)?[i]:n(r(i))}return zm=a,zm}var Um,fN;function Cc(){if(fN)return Um;fN=1;var e=Fo();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return Um=t,Um}var $m,gN;function Rf(){if(gN)return $m;gN=1;var e=Af(),t=Cc();function n(r,a){a=e(a,r);for(var i=0,s=a.length;r!=null&&i<s;)r=r[t(a[i++])];return i&&i==s?r:void 0}return $m=n,$m}var Hm,pN;function qV(){if(pN)return Hm;pN=1;var e=Rf();function t(n,r,a){var i=n==null?void 0:e(n,r);return i===void 0?a:i}return Hm=t,Hm}var qm,hN;function WV(){if(hN)return qm;hN=1;function e(t,n){return t!=null&&n in Object(t)}return qm=e,qm}var Wm,mN;function BI(){if(mN)return Wm;mN=1;var e=Af(),t=Sc(),n=En(),r=Ef(),a=j1(),i=Cc();function s(l,c,u){c=e(c,l);for(var d=-1,f=c.length,g=!1;++d<f;){var p=i(c[d]);if(!(g=l!=null&&u(l,p)))break;l=l[p]}return g||++d!=f?g:(f=l==null?0:l.length,!!f&&a(f)&&r(p,f)&&(n(l)||t(l)))}return Wm=s,Wm}var Vm,xN;function zI(){if(xN)return Vm;xN=1;var e=WV(),t=BI();function n(r,a){return r!=null&&t(r,a,e)}return Vm=n,Vm}var Gm,yN;function VV(){if(yN)return Gm;yN=1;var e=OI(),t=qV(),n=zI(),r=F1(),a=DI(),i=PI(),s=Cc(),l=1,c=2;function u(d,f){return r(d)&&a(f)?i(s(d),f):function(g){var p=t(g,d);return p===void 0&&p===f?n(g,d):e(f,p,l|c)}}return Gm=u,Gm}var Km,bN;function UI(){if(bN)return Km;bN=1;function e(t){return function(n){return n==null?void 0:n[t]}}return Km=e,Km}var Ym,vN;function GV(){if(vN)return Ym;vN=1;var e=Rf();function t(n){return function(r){return e(r,n)}}return Ym=t,Ym}var Xm,kN;function KV(){if(kN)return Xm;kN=1;var e=UI(),t=GV(),n=F1(),r=Cc();function a(i){return n(i)?e(r(i)):t(i)}return Xm=a,Xm}var Qm,_N;function Qa(){if(_N)return Qm;_N=1;var e=BV(),t=VV(),n=Cs(),r=En(),a=KV();function i(s){return typeof s=="function"?s:s==null?n:typeof s=="object"?r(s)?t(s[0],s[1]):e(s):a(s)}return Qm=i,Qm}var Zm,wN;function $I(){if(wN)return Zm;wN=1;var e=yI(),t=TV(),n=Qa(),r=En();function a(i,s){var l=r(i)?e:t;return l(i,n(s,3))}return Zm=a,Zm}var Jm,EN;function YV(){if(EN)return Jm;EN=1;var e=Object.prototype,t=e.hasOwnProperty;function n(r,a){return r!=null&&t.call(r,a)}return Jm=n,Jm}var e0,SN;function HI(){if(SN)return e0;SN=1;var e=YV(),t=BI();function n(r,a){return r!=null&&t(r,a,e)}return e0=n,e0}var t0,NN;function XV(){if(NN)return t0;NN=1;var e=A1(),t=Po(),n=Sc(),r=En(),a=Xa(),i=Do(),s=Nf(),l=Nc(),c="[object Map]",u="[object Set]",d=Object.prototype,f=d.hasOwnProperty;function g(p){if(p==null)return!0;if(a(p)&&(r(p)||typeof p=="string"||typeof p.splice=="function"||i(p)||l(p)||n(p)))return!p.length;var m=t(p);if(m==c||m==u)return!p.size;if(s(p))return!e(p).length;for(var y in p)if(f.call(p,y))return!1;return!0}return t0=g,t0}var n0,CN;function qI(){if(CN)return n0;CN=1;function e(t){return t===void 0}return n0=e,n0}var r0,jN;function WI(){if(jN)return r0;jN=1;var e=jf(),t=Xa();function n(r,a){var i=-1,s=t(r)?Array(r.length):[];return e(r,function(l,c,u){s[++i]=a(l,c,u)}),s}return r0=n,r0}var a0,TN;function VI(){if(TN)return a0;TN=1;var e=Tf(),t=Qa(),n=WI(),r=En();function a(i,s){var l=r(i)?e:n;return l(i,t(s,3))}return a0=a,a0}var i0,AN;function QV(){if(AN)return i0;AN=1;function e(t,n,r,a){var i=-1,s=t==null?0:t.length;for(a&&s&&(r=t[++i]);++i<s;)r=n(r,t[i],i,t);return r}return i0=e,i0}var s0,RN;function ZV(){if(RN)return s0;RN=1;function e(t,n,r,a,i){return i(t,function(s,l,c){r=a?(a=!1,s):n(r,s,l,c)}),r}return s0=e,s0}var o0,IN;function GI(){if(IN)return o0;IN=1;var e=QV(),t=jf(),n=Qa(),r=ZV(),a=En();function i(s,l,c){var u=a(s)?e:r,d=arguments.length<3;return u(s,n(l,4),c,d,t)}return o0=i,o0}var l0,MN;function JV(){if(MN)return l0;MN=1;var e=Es(),t=En(),n=Na(),r="[object String]";function a(i){return typeof i=="string"||!t(i)&&n(i)&&e(i)==r}return l0=a,l0}var c0,LN;function eG(){if(LN)return c0;LN=1;var e=UI(),t=e("length");return c0=t,c0}var u0,ON;function tG(){if(ON)return u0;ON=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",s="\\u200d",l=RegExp("["+s+e+a+i+"]");function c(u){return l.test(u)}return u0=c,u0}var d0,DN;function nG(){if(DN)return d0;DN=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",a=t+n+r,i="\\ufe0e\\ufe0f",s="["+e+"]",l="["+a+"]",c="\\ud83c[\\udffb-\\udfff]",u="(?:"+l+"|"+c+")",d="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",g="[\\ud800-\\udbff][\\udc00-\\udfff]",p="\\u200d",m=u+"?",y="["+i+"]?",v="(?:"+p+"(?:"+[d,f,g].join("|")+")"+y+m+")*",x=y+m+v,b="(?:"+[d+l+"?",l,f,g,s].join("|")+")",k=RegExp(c+"(?="+c+")|"+b+x,"g");function S(E){for(var _=k.lastIndex=0;k.test(E);)++_;return _}return d0=S,d0}var f0,PN;function rG(){if(PN)return f0;PN=1;var e=eG(),t=tG(),n=nG();function r(a){return t(a)?n(a):e(a)}return f0=r,f0}var g0,FN;function aG(){if(FN)return g0;FN=1;var e=A1(),t=Po(),n=Xa(),r=JV(),a=rG(),i="[object Map]",s="[object Set]";function l(c){if(c==null)return 0;if(n(c))return r(c)?a(c):c.length;var u=t(c);return u==i||u==s?c.size:e(c).length}return g0=l,g0}var p0,BN;function iG(){if(BN)return p0;BN=1;var e=C1(),t=NI(),n=D1(),r=Qa(),a=Cf(),i=En(),s=Do(),l=wc(),c=Vr(),u=Nc();function d(f,g,p){var m=i(f),y=m||s(f)||u(f);if(g=r(g,4),p==null){var v=f&&f.constructor;y?p=m?new v:[]:c(f)?p=l(v)?t(a(f)):{}:p={}}return(y?e:n)(f,function(x,b,k){return g(p,x,b,k)}),p}return p0=d,p0}var h0,zN;function sG(){if(zN)return h0;zN=1;var e=Oo(),t=Sc(),n=En(),r=e?e.isConcatSpreadable:void 0;function a(i){return n(i)||t(i)||!!(r&&i&&i[r])}return h0=a,h0}var m0,UN;function B1(){if(UN)return m0;UN=1;var e=I1(),t=sG();function n(r,a,i,s,l){var c=-1,u=r.length;for(i||(i=t),l||(l=[]);++c<u;){var d=r[c];a>0&&i(d)?a>1?n(d,a-1,i,s,l):e(l,d):s||(l[l.length]=d)}return l}return m0=n,m0}var x0,$N;function oG(){if($N)return x0;$N=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return x0=e,x0}var y0,HN;function KI(){if(HN)return y0;HN=1;var e=oG(),t=Math.max;function n(r,a,i){return a=t(a===void 0?r.length-1:a,0),function(){for(var s=arguments,l=-1,c=t(s.length-a,0),u=Array(c);++l<c;)u[l]=s[a+l];l=-1;for(var d=Array(a+1);++l<a;)d[l]=s[l];return d[a]=i(u),e(r,this,d)}}return y0=n,y0}var b0,qN;function lG(){if(qN)return b0;qN=1;var e=L1(),t=gI(),n=Cs(),r=t?function(a,i){return t(a,"toString",{configurable:!0,enumerable:!1,value:e(i),writable:!0})}:n;return b0=r,b0}var v0,WN;function cG(){if(WN)return v0;WN=1;var e=800,t=16,n=Date.now;function r(a){var i=0,s=0;return function(){var l=n(),c=t-(l-s);if(s=l,c>0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return v0=r,v0}var k0,VN;function YI(){if(VN)return k0;VN=1;var e=lG(),t=cG(),n=t(e);return k0=n,k0}var _0,GN;function If(){if(GN)return _0;GN=1;var e=Cs(),t=KI(),n=YI();function r(a,i){return n(t(a,i,e),a+"")}return _0=r,_0}var w0,KN;function XI(){if(KN)return w0;KN=1;function e(t,n,r,a){for(var i=t.length,s=r+(a?1:-1);a?s--:++s<i;)if(n(t[s],s,t))return s;return-1}return w0=e,w0}var E0,YN;function uG(){if(YN)return E0;YN=1;function e(t){return t!==t}return E0=e,E0}var S0,XN;function dG(){if(XN)return S0;XN=1;function e(t,n,r){for(var a=r-1,i=t.length;++a<i;)if(t[a]===n)return a;return-1}return S0=e,S0}var N0,QN;function fG(){if(QN)return N0;QN=1;var e=XI(),t=uG(),n=dG();function r(a,i,s){return i===i?n(a,i,s):e(a,t,s)}return N0=r,N0}var C0,ZN;function gG(){if(ZN)return C0;ZN=1;var e=fG();function t(n,r){var a=n==null?0:n.length;return!!a&&e(n,r,0)>-1}return C0=t,C0}var j0,JN;function pG(){if(JN)return j0;JN=1;function e(t,n,r){for(var a=-1,i=t==null?0:t.length;++a<i;)if(r(n,t[a]))return!0;return!1}return j0=e,j0}var T0,eC;function hG(){if(eC)return T0;eC=1;function e(){}return T0=e,T0}var A0,tC;function mG(){if(tC)return A0;tC=1;var e=wI(),t=hG(),n=P1(),r=1/0,a=e&&1/n(new e([,-0]))[1]==r?function(i){return new e(i)}:t;return A0=a,A0}var R0,nC;function xG(){if(nC)return R0;nC=1;var e=II(),t=gG(),n=pG(),r=MI(),a=mG(),i=P1(),s=200;function l(c,u,d){var f=-1,g=t,p=c.length,m=!0,y=[],v=y;if(d)m=!1,g=n;else if(p>=s){var x=u?null:a(c);if(x)return i(x);m=!1,g=r,v=new e}else v=u?[]:y;e:for(;++f<p;){var b=c[f],k=u?u(b):b;if(b=d||b!==0?b:0,m&&k===k){for(var S=v.length;S--;)if(v[S]===k)continue e;u&&v.push(k),y.push(b)}else g(v,k,d)||(v!==y&&v.push(k),y.push(b))}return y}return R0=l,R0}var I0,rC;function QI(){if(rC)return I0;rC=1;var e=Xa(),t=Na();function n(r){return t(r)&&e(r)}return I0=n,I0}var M0,aC;function yG(){if(aC)return M0;aC=1;var e=B1(),t=If(),n=xG(),r=QI(),a=t(function(i){return n(e(i,1,r,!0))});return M0=a,M0}var L0,iC;function bG(){if(iC)return L0;iC=1;var e=Tf();function t(n,r){return e(r,function(a){return n[a]})}return L0=t,L0}var O0,sC;function ZI(){if(sC)return O0;sC=1;var e=bG(),t=Ui();function n(r){return r==null?[]:e(r,t(r))}return O0=n,O0}var D0,oC;function Gr(){if(oC)return D0;oC=1;var e;if(typeof E1=="function")try{e={clone:NV(),constant:L1(),each:RI(),filter:$I(),has:HI(),isArray:En(),isEmpty:XV(),isFunction:wc(),isUndefined:qI(),keys:Ui(),map:VI(),reduce:GI(),size:aG(),transform:iG(),union:yG(),values:ZI()}}catch{}return e||(e=window._),D0=e,D0}var P0,lC;function z1(){if(lC)return P0;lC=1;var e=Gr();P0=a;var t="\0",n="\0",r="";function a(d){this._isDirected=e.has(d,"directed")?d.directed:!0,this._isMultigraph=e.has(d,"multigraph")?d.multigraph:!1,this._isCompound=e.has(d,"compound")?d.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(d){return this._label=d,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultNodeLabelFn=d,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return e.keys(this._nodes)},a.prototype.sources=function(){var d=this;return e.filter(this.nodes(),function(f){return e.isEmpty(d._in[f])})},a.prototype.sinks=function(){var d=this;return e.filter(this.nodes(),function(f){return e.isEmpty(d._out[f])})},a.prototype.setNodes=function(d,f){var g=arguments,p=this;return e.each(d,function(m){g.length>1?p.setNode(m,f):p.setNode(m)}),this},a.prototype.setNode=function(d,f){return e.has(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=f),this):(this._nodes[d]=arguments.length>1?f:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=n,this._children[d]={},this._children[n][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)},a.prototype.node=function(d){return this._nodes[d]},a.prototype.hasNode=function(d){return e.has(this._nodes,d)},a.prototype.removeNode=function(d){var f=this;if(e.has(this._nodes,d)){var g=function(p){f.removeEdge(f._edgeObjs[p])};delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],e.each(this.children(d),function(p){f.setParent(p)}),delete this._children[d]),e.each(e.keys(this._in[d]),g),delete this._in[d],delete this._preds[d],e.each(e.keys(this._out[d]),g),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this},a.prototype.setParent=function(d,f){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(f))f=n;else{f+="";for(var g=f;!e.isUndefined(g);g=this.parent(g))if(g===d)throw new Error("Setting "+f+" as parent of "+d+" would create a cycle");this.setNode(f)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=f,this._children[f][d]=!0,this},a.prototype._removeFromParentsChildList=function(d){delete this._children[this._parent[d]][d]},a.prototype.parent=function(d){if(this._isCompound){var f=this._parent[d];if(f!==n)return f}},a.prototype.children=function(d){if(e.isUndefined(d)&&(d=n),this._isCompound){var f=this._children[d];if(f)return e.keys(f)}else{if(d===n)return this.nodes();if(this.hasNode(d))return[]}},a.prototype.predecessors=function(d){var f=this._preds[d];if(f)return e.keys(f)},a.prototype.successors=function(d){var f=this._sucs[d];if(f)return e.keys(f)},a.prototype.neighbors=function(d){var f=this.predecessors(d);if(f)return e.union(f,this.successors(d))},a.prototype.isLeaf=function(d){var f;return this.isDirected()?f=this.successors(d):f=this.neighbors(d),f.length===0},a.prototype.filterNodes=function(d){var f=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});f.setGraph(this.graph());var g=this;e.each(this._nodes,function(y,v){d(v)&&f.setNode(v,y)}),e.each(this._edgeObjs,function(y){f.hasNode(y.v)&&f.hasNode(y.w)&&f.setEdge(y,g.edge(y))});var p={};function m(y){var v=g.parent(y);return v===void 0||f.hasNode(v)?(p[y]=v,v):v in p?p[v]:m(v)}return this._isCompound&&e.each(f.nodes(),function(y){f.setParent(y,m(y))}),f},a.prototype.setDefaultEdgeLabel=function(d){return e.isFunction(d)||(d=e.constant(d)),this._defaultEdgeLabelFn=d,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(d,f){var g=this,p=arguments;return e.reduce(d,function(m,y){return p.length>1?g.setEdge(m,y,f):g.setEdge(m,y),y}),this},a.prototype.setEdge=function(){var d,f,g,p,m=!1,y=arguments[0];typeof y=="object"&&y!==null&&"v"in y?(d=y.v,f=y.w,g=y.name,arguments.length===2&&(p=arguments[1],m=!0)):(d=y,f=arguments[1],g=arguments[3],arguments.length>2&&(p=arguments[2],m=!0)),d=""+d,f=""+f,e.isUndefined(g)||(g=""+g);var v=l(this._isDirected,d,f,g);if(e.has(this._edgeLabels,v))return m&&(this._edgeLabels[v]=p),this;if(!e.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(f),this._edgeLabels[v]=m?p:this._defaultEdgeLabelFn(d,f,g);var x=c(this._isDirected,d,f,g);return d=x.v,f=x.w,Object.freeze(x),this._edgeObjs[v]=x,i(this._preds[f],d),i(this._sucs[d],f),this._in[f][v]=x,this._out[d][v]=x,this._edgeCount++,this},a.prototype.edge=function(d,f,g){var p=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,g);return this._edgeLabels[p]},a.prototype.hasEdge=function(d,f,g){var p=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,g);return e.has(this._edgeLabels,p)},a.prototype.removeEdge=function(d,f,g){var p=arguments.length===1?u(this._isDirected,arguments[0]):l(this._isDirected,d,f,g),m=this._edgeObjs[p];return m&&(d=m.v,f=m.w,delete this._edgeLabels[p],delete this._edgeObjs[p],s(this._preds[f],d),s(this._sucs[d],f),delete this._in[f][p],delete this._out[d][p],this._edgeCount--),this},a.prototype.inEdges=function(d,f){var g=this._in[d];if(g){var p=e.values(g);return f?e.filter(p,function(m){return m.v===f}):p}},a.prototype.outEdges=function(d,f){var g=this._out[d];if(g){var p=e.values(g);return f?e.filter(p,function(m){return m.w===f}):p}},a.prototype.nodeEdges=function(d,f){var g=this.inEdges(d,f);if(g)return g.concat(this.outEdges(d,f))};function i(d,f){d[f]?d[f]++:d[f]=1}function s(d,f){--d[f]||delete d[f]}function l(d,f,g,p){var m=""+f,y=""+g;if(!d&&m>y){var v=m;m=y,y=v}return m+r+y+r+(e.isUndefined(p)?t:p)}function c(d,f,g,p){var m=""+f,y=""+g;if(!d&&m>y){var v=m;m=y,y=v}var x={v:m,w:y};return p&&(x.name=p),x}function u(d,f){return l(d,f.v,f.w,f.name)}return P0}var F0,cC;function vG(){return cC||(cC=1,F0="2.1.8"),F0}var B0,uC;function kG(){return uC||(uC=1,B0={Graph:z1(),version:vG()}),B0}var z0,dC;function _G(){if(dC)return z0;dC=1;var e=Gr(),t=z1();z0={write:n,read:i};function n(s){var l={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:r(s),edges:a(s)};return e.isUndefined(s.graph())||(l.value=e.clone(s.graph())),l}function r(s){return e.map(s.nodes(),function(l){var c=s.node(l),u=s.parent(l),d={v:l};return e.isUndefined(c)||(d.value=c),e.isUndefined(u)||(d.parent=u),d})}function a(s){return e.map(s.edges(),function(l){var c=s.edge(l),u={v:l.v,w:l.w};return e.isUndefined(l.name)||(u.name=l.name),e.isUndefined(c)||(u.value=c),u})}function i(s){var l=new t(s.options).setGraph(s.value);return e.each(s.nodes,function(c){l.setNode(c.v,c.value),c.parent&&l.setParent(c.v,c.parent)}),e.each(s.edges,function(c){l.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),l}return z0}var U0,fC;function wG(){if(fC)return U0;fC=1;var e=Gr();U0=t;function t(n){var r={},a=[],i;function s(l){e.has(r,l)||(r[l]=!0,i.push(l),e.each(n.successors(l),s),e.each(n.predecessors(l),s))}return e.each(n.nodes(),function(l){i=[],s(l),i.length&&a.push(i)}),a}return U0}var $0,gC;function JI(){if(gC)return $0;gC=1;var e=Gr();$0=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(n){return n.key})},t.prototype.has=function(n){return e.has(this._keyIndices,n)},t.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(n,r){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,s=i.length;return a[n]=s,i.push({key:n,priority:r}),this._decrease(s),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},t.prototype.decrease=function(n,r){var a=this._keyIndices[n];if(r>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+r);this._arr[a].priority=r,this._decrease(a)},t.prototype._heapify=function(n){var r=this._arr,a=2*n,i=a+1,s=n;a<r.length&&(s=r[a].priority<r[s].priority?a:s,i<r.length&&(s=r[i].priority<r[s].priority?i:s),s!==n&&(this._swap(n,s),this._heapify(s)))},t.prototype._decrease=function(n){for(var r=this._arr,a=r[n].priority,i;n!==0&&(i=n>>1,!(r[i].priority<a));)this._swap(n,i),n=i},t.prototype._swap=function(n,r){var a=this._arr,i=this._keyIndices,s=a[n],l=a[r];a[n]=l,a[r]=s,i[l.key]=n,i[s.key]=r},$0}var H0,pC;function e3(){if(pC)return H0;pC=1;var e=Gr(),t=JI();H0=r;var n=e.constant(1);function r(i,s,l,c){return a(i,String(s),l||n,c||function(u){return i.outEdges(u)})}function a(i,s,l,c){var u={},d=new t,f,g,p=function(m){var y=m.v!==f?m.v:m.w,v=u[y],x=l(m),b=g.distance+x;if(x<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+m+" Weight: "+x);b<v.distance&&(v.distance=b,v.predecessor=f,d.decrease(y,b))};for(i.nodes().forEach(function(m){var y=m===s?0:Number.POSITIVE_INFINITY;u[m]={distance:y},d.add(m,y)});d.size()>0&&(f=d.removeMin(),g=u[f],g.distance!==Number.POSITIVE_INFINITY);)c(f).forEach(p);return u}return H0}var q0,hC;function EG(){if(hC)return q0;hC=1;var e=e3(),t=Gr();q0=n;function n(r,a,i){return t.transform(r.nodes(),function(s,l){s[l]=e(r,l,a,i)},{})}return q0}var W0,mC;function t3(){if(mC)return W0;mC=1;var e=Gr();W0=t;function t(n){var r=0,a=[],i={},s=[];function l(c){var u=i[c]={onStack:!0,lowlink:r,index:r++};if(a.push(c),n.successors(c).forEach(function(g){e.has(i,g)?i[g].onStack&&(u.lowlink=Math.min(u.lowlink,i[g].index)):(l(g),u.lowlink=Math.min(u.lowlink,i[g].lowlink))}),u.lowlink===u.index){var d=[],f;do f=a.pop(),i[f].onStack=!1,d.push(f);while(c!==f);s.push(d)}}return n.nodes().forEach(function(c){e.has(i,c)||l(c)}),s}return W0}var V0,xC;function SG(){if(xC)return V0;xC=1;var e=Gr(),t=t3();V0=n;function n(r){return e.filter(t(r),function(a){return a.length>1||a.length===1&&r.hasEdge(a[0],a[0])})}return V0}var G0,yC;function NG(){if(yC)return G0;yC=1;var e=Gr();G0=n;var t=e.constant(1);function n(a,i,s){return r(a,i||t,s||function(l){return a.outEdges(l)})}function r(a,i,s){var l={},c=a.nodes();return c.forEach(function(u){l[u]={},l[u][u]={distance:0},c.forEach(function(d){u!==d&&(l[u][d]={distance:Number.POSITIVE_INFINITY})}),s(u).forEach(function(d){var f=d.v===u?d.w:d.v,g=i(d);l[u][f]={distance:g,predecessor:u}})}),c.forEach(function(u){var d=l[u];c.forEach(function(f){var g=l[f];c.forEach(function(p){var m=g[u],y=d[p],v=g[p],x=m.distance+y.distance;x<v.distance&&(v.distance=x,v.predecessor=y.predecessor)})})}),l}return G0}var K0,bC;function n3(){if(bC)return K0;bC=1;var e=Gr();K0=t,t.CycleException=n;function t(r){var a={},i={},s=[];function l(c){if(e.has(i,c))throw new n;e.has(a,c)||(i[c]=!0,a[c]=!0,e.each(r.predecessors(c),l),delete i[c],s.push(c))}if(e.each(r.sinks(),l),e.size(a)!==r.nodeCount())throw new n;return s}function n(){}return n.prototype=new Error,K0}var Y0,vC;function CG(){if(vC)return Y0;vC=1;var e=n3();Y0=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Y0}var X0,kC;function r3(){if(kC)return X0;kC=1;var e=Gr();X0=t;function t(r,a,i){e.isArray(a)||(a=[a]);var s=(r.isDirected()?r.successors:r.neighbors).bind(r),l=[],c={};return e.each(a,function(u){if(!r.hasNode(u))throw new Error("Graph does not have node: "+u);n(r,u,i==="post",c,s,l)}),l}function n(r,a,i,s,l,c){e.has(s,a)||(s[a]=!0,i||c.push(a),e.each(l(a),function(u){n(r,u,i,s,l,c)}),i&&c.push(a))}return X0}var Q0,_C;function jG(){if(_C)return Q0;_C=1;var e=r3();Q0=t;function t(n,r){return e(n,r,"post")}return Q0}var Z0,wC;function TG(){if(wC)return Z0;wC=1;var e=r3();Z0=t;function t(n,r){return e(n,r,"pre")}return Z0}var J0,EC;function AG(){if(EC)return J0;EC=1;var e=Gr(),t=z1(),n=JI();J0=r;function r(a,i){var s=new t,l={},c=new n,u;function d(g){var p=g.v===u?g.w:g.v,m=c.priority(p);if(m!==void 0){var y=i(g);y<m&&(l[p]=u,c.decrease(p,y))}}if(a.nodeCount()===0)return s;e.each(a.nodes(),function(g){c.add(g,Number.POSITIVE_INFINITY),s.setNode(g)}),c.decrease(a.nodes()[0],0);for(var f=!1;c.size()>0;){if(u=c.removeMin(),e.has(l,u))s.setEdge(u,l[u]);else{if(f)throw new Error("Input graph is not connected: "+a);f=!0}a.nodeEdges(u).forEach(d)}return s}return J0}var ex,SC;function RG(){return SC||(SC=1,ex={components:wG(),dijkstra:e3(),dijkstraAll:EG(),findCycles:SG(),floydWarshall:NG(),isAcyclic:CG(),postorder:jG(),preorder:TG(),prim:AG(),tarjan:t3(),topsort:n3()}),ex}var tx,NC;function IG(){if(NC)return tx;NC=1;var e=kG();return tx={Graph:e.Graph,json:_G(),alg:RG(),version:e.version},tx}var Od;if(typeof E1=="function")try{Od=IG()}catch{}Od||(Od=window.graphlib);var ua=Od,nx,CC;function MG(){if(CC)return nx;CC=1;var e=jI(),t=1,n=4;function r(a){return e(a,t|n)}return nx=r,nx}var rx,jC;function Mf(){if(jC)return rx;jC=1;var e=Lo(),t=Xa(),n=Ef(),r=Vr();function a(i,s,l){if(!r(l))return!1;var c=typeof s;return(c=="number"?t(l)&&n(s,l.length):c=="string"&&s in l)?e(l[s],i):!1}return rx=a,rx}var ax,TC;function LG(){if(TC)return ax;TC=1;var e=If(),t=Lo(),n=Mf(),r=Ns(),a=Object.prototype,i=a.hasOwnProperty,s=e(function(l,c){l=Object(l);var u=-1,d=c.length,f=d>2?c[2]:void 0;for(f&&n(c[0],c[1],f)&&(d=1);++u<d;)for(var g=c[u],p=r(g),m=-1,y=p.length;++m<y;){var v=p[m],x=l[v];(x===void 0||t(x,a[v])&&!i.call(l,v))&&(l[v]=g[v])}return l});return ax=s,ax}var ix,AC;function OG(){if(AC)return ix;AC=1;var e=Qa(),t=Xa(),n=Ui();function r(a){return function(i,s,l){var c=Object(i);if(!t(i)){var u=e(s,3);i=n(i),s=function(f){return u(c[f],f,c)}}var d=a(i,s,l);return d>-1?c[u?i[d]:d]:void 0}}return ix=r,ix}var sx,RC;function DG(){if(RC)return sx;RC=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return sx=t,sx}var ox,IC;function PG(){if(IC)return ox;IC=1;var e=DG(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return ox=n,ox}var lx,MC;function FG(){if(MC)return lx;MC=1;var e=PG(),t=Vr(),n=Fo(),r=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,s=/^0o[0-7]+$/i,l=parseInt;function c(u){if(typeof u=="number")return u;if(n(u))return r;if(t(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=t(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=e(u);var f=i.test(u);return f||s.test(u)?l(u.slice(2),f?2:8):a.test(u)?r:+u}return lx=c,lx}var cx,LC;function a3(){if(LC)return cx;LC=1;var e=FG(),t=1/0,n=17976931348623157e292;function r(a){if(!a)return a===0?a:0;if(a=e(a),a===t||a===-t){var i=a<0?-1:1;return i*n}return a===a?a:0}return cx=r,cx}var ux,OC;function BG(){if(OC)return ux;OC=1;var e=a3();function t(n){var r=e(n),a=r%1;return r===r?a?r-a:r:0}return ux=t,ux}var dx,DC;function zG(){if(DC)return dx;DC=1;var e=XI(),t=Qa(),n=BG(),r=Math.max;function a(i,s,l){var c=i==null?0:i.length;if(!c)return-1;var u=l==null?0:n(l);return u<0&&(u=r(c+u,0)),e(i,t(s,3),u)}return dx=a,dx}var fx,PC;function UG(){if(PC)return fx;PC=1;var e=OG(),t=zG(),n=e(t);return fx=n,fx}var gx,FC;function i3(){if(FC)return gx;FC=1;var e=B1();function t(n){var r=n==null?0:n.length;return r?e(n,1):[]}return gx=t,gx}var px,BC;function $G(){if(BC)return px;BC=1;var e=O1(),t=TI(),n=Ns();function r(a,i){return a==null?a:e(a,t(i),n)}return px=r,px}var hx,zC;function HG(){if(zC)return hx;zC=1;function e(t){var n=t==null?0:t.length;return n?t[n-1]:void 0}return hx=e,hx}var mx,UC;function qG(){if(UC)return mx;UC=1;var e=_f(),t=D1(),n=Qa();function r(a,i){var s={};return i=n(i,3),t(a,function(l,c,u){e(s,c,i(l,c,u))}),s}return mx=r,mx}var xx,$C;function U1(){if($C)return xx;$C=1;var e=Fo();function t(n,r,a){for(var i=-1,s=n.length;++i<s;){var l=n[i],c=r(l);if(c!=null&&(u===void 0?c===c&&!e(c):a(c,u)))var u=c,d=l}return d}return xx=t,xx}var yx,HC;function WG(){if(HC)return yx;HC=1;function e(t,n){return t>n}return yx=e,yx}var bx,qC;function VG(){if(qC)return bx;qC=1;var e=U1(),t=WG(),n=Cs();function r(a){return a&&a.length?e(a,n,t):void 0}return bx=r,bx}var vx,WC;function s3(){if(WC)return vx;WC=1;var e=_f(),t=Lo();function n(r,a,i){(i!==void 0&&!t(r[a],i)||i===void 0&&!(a in r))&&e(r,a,i)}return vx=n,vx}var kx,VC;function GG(){if(VC)return kx;VC=1;var e=Es(),t=Cf(),n=Na(),r="[object Object]",a=Function.prototype,i=Object.prototype,s=a.toString,l=i.hasOwnProperty,c=s.call(Object);function u(d){if(!n(d)||e(d)!=r)return!1;var f=t(d);if(f===null)return!0;var g=l.call(f,"constructor")&&f.constructor;return typeof g=="function"&&g instanceof g&&s.call(g)==c}return kx=u,kx}var _x,GC;function o3(){if(GC)return _x;GC=1;function e(t,n){if(!(n==="constructor"&&typeof t[n]=="function")&&n!="__proto__")return t[n]}return _x=e,_x}var wx,KC;function KG(){if(KC)return wx;KC=1;var e=Ec(),t=Ns();function n(r){return e(r,t(r))}return wx=n,wx}var Ex,YC;function YG(){if(YC)return Ex;YC=1;var e=s3(),t=mI(),n=SI(),r=xI(),a=CI(),i=Sc(),s=En(),l=QI(),c=Do(),u=wc(),d=Vr(),f=GG(),g=Nc(),p=o3(),m=KG();function y(v,x,b,k,S,E,_){var w=p(v,b),N=p(x,b),R=_.get(N);if(R){e(v,b,R);return}var j=E?E(w,N,b+"",v,x,_):void 0,P=j===void 0;if(P){var F=s(N),H=!F&&c(N),L=!F&&!H&&g(N);j=N,F||H||L?s(w)?j=w:l(w)?j=r(w):H?(P=!1,j=t(N,!0)):L?(P=!1,j=n(N,!0)):j=[]:f(N)||i(N)?(j=w,i(w)?j=m(w):(!d(w)||u(w))&&(j=a(N))):P=!1}P&&(_.set(N,j),S(j,N,k,E,_),_.delete(N)),e(v,b,j)}return Ex=y,Ex}var Sx,XC;function XG(){if(XC)return Sx;XC=1;var e=kf(),t=s3(),n=O1(),r=YG(),a=Vr(),i=Ns(),s=o3();function l(c,u,d,f,g){c!==u&&n(u,function(p,m){if(g||(g=new e),a(p))r(c,u,m,d,l,f,g);else{var y=f?f(s(c,m),p,m+"",c,u,g):void 0;y===void 0&&(y=p),t(c,m,y)}},i)}return Sx=l,Sx}var Nx,QC;function QG(){if(QC)return Nx;QC=1;var e=If(),t=Mf();function n(r){return e(function(a,i){var s=-1,l=i.length,c=l>1?i[l-1]:void 0,u=l>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(l--,c):void 0,u&&t(i[0],i[1],u)&&(c=l<3?void 0:c,l=1),a=Object(a);++s<l;){var d=i[s];d&&r(a,d,s,c)}return a})}return Nx=n,Nx}var Cx,ZC;function ZG(){if(ZC)return Cx;ZC=1;var e=XG(),t=QG(),n=t(function(r,a,i){e(r,a,i)});return Cx=n,Cx}var jx,JC;function l3(){if(JC)return jx;JC=1;function e(t,n){return t<n}return jx=e,jx}var Tx,e4;function JG(){if(e4)return Tx;e4=1;var e=U1(),t=l3(),n=Cs();function r(a){return a&&a.length?e(a,n,t):void 0}return Tx=r,Tx}var Ax,t4;function eK(){if(t4)return Ax;t4=1;var e=U1(),t=Qa(),n=l3();function r(a,i){return a&&a.length?e(a,t(i,2),n):void 0}return Ax=r,Ax}var Rx,n4;function tK(){if(n4)return Rx;n4=1;var e=ca(),t=function(){return e.Date.now()};return Rx=t,Rx}var Ix,r4;function nK(){if(r4)return Ix;r4=1;var e=wf(),t=Af(),n=Ef(),r=Vr(),a=Cc();function i(s,l,c,u){if(!r(s))return s;l=t(l,s);for(var d=-1,f=l.length,g=f-1,p=s;p!=null&&++d<f;){var m=a(l[d]),y=c;if(m==="__proto__"||m==="constructor"||m==="prototype")return s;if(d!=g){var v=p[m];y=u?u(v,m,p):void 0,y===void 0&&(y=r(v)?v:n(l[d+1])?[]:{})}e(p,m,y),p=p[m]}return s}return Ix=i,Ix}var Mx,a4;function rK(){if(a4)return Mx;a4=1;var e=Rf(),t=nK(),n=Af();function r(a,i,s){for(var l=-1,c=i.length,u={};++l<c;){var d=i[l],f=e(a,d);s(f,d)&&t(u,n(d,a),f)}return u}return Mx=r,Mx}var Lx,i4;function aK(){if(i4)return Lx;i4=1;var e=rK(),t=zI();function n(r,a){return e(r,a,function(i,s){return t(r,s)})}return Lx=n,Lx}var Ox,s4;function iK(){if(s4)return Ox;s4=1;var e=i3(),t=KI(),n=YI();function r(a){return n(t(a,void 0,e),a+"")}return Ox=r,Ox}var Dx,o4;function sK(){if(o4)return Dx;o4=1;var e=aK(),t=iK(),n=t(function(r,a){return r==null?{}:e(r,a)});return Dx=n,Dx}var Px,l4;function oK(){if(l4)return Px;l4=1;var e=Math.ceil,t=Math.max;function n(r,a,i,s){for(var l=-1,c=t(e((a-r)/(i||1)),0),u=Array(c);c--;)u[s?c:++l]=r,r+=i;return u}return Px=n,Px}var Fx,c4;function lK(){if(c4)return Fx;c4=1;var e=oK(),t=Mf(),n=a3();function r(a){return function(i,s,l){return l&&typeof l!="number"&&t(i,s,l)&&(s=l=void 0),i=n(i),s===void 0?(s=i,i=0):s=n(s),l=l===void 0?i<s?1:-1:n(l),e(i,s,l,a)}}return Fx=r,Fx}var Bx,u4;function cK(){if(u4)return Bx;u4=1;var e=lK(),t=e();return Bx=t,Bx}var zx,d4;function uK(){if(d4)return zx;d4=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return zx=e,zx}var Ux,f4;function dK(){if(f4)return Ux;f4=1;var e=Fo();function t(n,r){if(n!==r){var a=n!==void 0,i=n===null,s=n===n,l=e(n),c=r!==void 0,u=r===null,d=r===r,f=e(r);if(!u&&!f&&!l&&n>r||l&&c&&d&&!u&&!f||i&&c&&d||!a&&d||!s)return 1;if(!i&&!l&&!f&&n<r||f&&a&&s&&!i&&!l||u&&a&&s||!c&&s||!d)return-1}return 0}return Ux=t,Ux}var $x,g4;function fK(){if(g4)return $x;g4=1;var e=dK();function t(n,r,a){for(var i=-1,s=n.criteria,l=r.criteria,c=s.length,u=a.length;++i<c;){var d=e(s[i],l[i]);if(d){if(i>=u)return d;var f=a[i];return d*(f=="desc"?-1:1)}}return n.index-r.index}return $x=t,$x}var Hx,p4;function gK(){if(p4)return Hx;p4=1;var e=Tf(),t=Rf(),n=Qa(),r=WI(),a=uK(),i=Sf(),s=fK(),l=Cs(),c=En();function u(d,f,g){f.length?f=e(f,function(y){return c(y)?function(v){return t(v,y.length===1?y[0]:y)}:y}):f=[l];var p=-1;f=e(f,i(n));var m=r(d,function(y,v,x){var b=e(f,function(k){return k(y)});return{criteria:b,index:++p,value:y}});return a(m,function(y,v){return s(y,v,g)})}return Hx=u,Hx}var qx,h4;function pK(){if(h4)return qx;h4=1;var e=B1(),t=gK(),n=If(),r=Mf(),a=n(function(i,s){if(i==null)return[];var l=s.length;return l>1&&r(i,s[0],s[1])?s=[]:l>2&&r(s[0],s[1],s[2])&&(s=[s[0]]),t(i,e(s,1),[])});return qx=a,qx}var Wx,m4;function hK(){if(m4)return Wx;m4=1;var e=FI(),t=0;function n(r){var a=++t;return e(r)+a}return Wx=n,Wx}var Vx,x4;function mK(){if(x4)return Vx;x4=1;function e(t,n,r){for(var a=-1,i=t.length,s=n.length,l={};++a<i;){var c=a<s?n[a]:void 0;r(l,t[a],c)}return l}return Vx=e,Vx}var Gx,y4;function xK(){if(y4)return Gx;y4=1;var e=wf(),t=mK();function n(r,a){return t(r||[],a||[],e)}return Gx=n,Gx}var Dd;if(typeof E1=="function")try{Dd={cloneDeep:MG(),constant:L1(),defaults:LG(),each:RI(),filter:$I(),find:UG(),flatten:i3(),forEach:AI(),forIn:$G(),has:HI(),isUndefined:qI(),last:HG(),map:VI(),mapValues:qG(),max:VG(),merge:ZG(),min:JG(),minBy:eK(),now:tK(),pick:sK(),range:cK(),reduce:GI(),sortBy:pK(),uniqueId:hK(),values:ZI(),zipObject:xK()}}catch{}Dd||(Dd=window._);var ln=Dd,yK=Lf;function Lf(){var e={};e._next=e._prev=e,this._sentinel=e}Lf.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;if(t!==e)return c3(t),t};Lf.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&c3(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t};Lf.prototype.toString=function(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,bK)),n=n._prev;return"["+e.join(", ")+"]"};function c3(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function bK(e,t){if(e!=="_next"&&e!=="_prev")return t}var Ba=ln,vK=ua.Graph,kK=yK,_K=EK,wK=Ba.constant(1);function EK(e,t){if(e.nodeCount()<=1)return[];var n=NK(e,t||wK),r=SK(n.graph,n.buckets,n.zeroIdx);return Ba.flatten(Ba.map(r,function(a){return e.outEdges(a.v,a.w)}),!0)}function SK(e,t,n){for(var r=[],a=t[t.length-1],i=t[0],s;e.nodeCount();){for(;s=i.dequeue();)Kx(e,t,n,s);for(;s=a.dequeue();)Kx(e,t,n,s);if(e.nodeCount()){for(var l=t.length-2;l>0;--l)if(s=t[l].dequeue(),s){r=r.concat(Kx(e,t,n,s,!0));break}}}return r}function Kx(e,t,n,r,a){var i=a?[]:void 0;return Ba.forEach(e.inEdges(r.v),function(s){var l=e.edge(s),c=e.node(s.v);a&&i.push({v:s.v,w:s.w}),c.out-=l,Lb(t,n,c)}),Ba.forEach(e.outEdges(r.v),function(s){var l=e.edge(s),c=s.w,u=e.node(c);u.in-=l,Lb(t,n,u)}),e.removeNode(r.v),i}function NK(e,t){var n=new vK,r=0,a=0;Ba.forEach(e.nodes(),function(l){n.setNode(l,{v:l,in:0,out:0})}),Ba.forEach(e.edges(),function(l){var c=n.edge(l.v,l.w)||0,u=t(l),d=c+u;n.setEdge(l.v,l.w,d),a=Math.max(a,n.node(l.v).out+=u),r=Math.max(r,n.node(l.w).in+=u)});var i=Ba.range(a+r+3).map(function(){return new kK}),s=r+1;return Ba.forEach(n.nodes(),function(l){Lb(i,s,n.node(l))}),{graph:n,buckets:i,zeroIdx:s}}function Lb(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}var as=ln,CK=_K,jK={run:TK,undo:RK};function TK(e){var t=e.graph().acyclicer==="greedy"?CK(e,n(e)):AK(e);as.forEach(t,function(r){var a=e.edge(r);e.removeEdge(r),a.forwardName=r.name,a.reversed=!0,e.setEdge(r.w,r.v,a,as.uniqueId("rev"))});function n(r){return function(a){return r.edge(a).weight}}}function AK(e){var t=[],n={},r={};function a(i){as.has(r,i)||(r[i]=!0,n[i]=!0,as.forEach(e.outEdges(i),function(s){as.has(n,s.w)?t.push(s):a(s.w)}),delete n[i])}return as.forEach(e.nodes(),a),t}function RK(e){as.forEach(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}var zt=ln,u3=ua.Graph,yr={addDummyNode:d3,simplify:IK,asNonCompoundGraph:MK,successorWeights:LK,predecessorWeights:OK,intersectRect:DK,buildLayerMatrix:PK,normalizeRanks:FK,removeEmptyRanks:BK,addBorderNode:zK,maxRank:f3,partition:UK,time:$K,notime:HK};function d3(e,t,n,r){var a;do a=zt.uniqueId(r);while(e.hasNode(a));return n.dummy=t,e.setNode(a,n),a}function IK(e){var t=new u3().setGraph(e.graph());return zt.forEach(e.nodes(),function(n){t.setNode(n,e.node(n))}),zt.forEach(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},a=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+a.weight,minlen:Math.max(r.minlen,a.minlen)})}),t}function MK(e){var t=new u3({multigraph:e.isMultigraph()}).setGraph(e.graph());return zt.forEach(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),zt.forEach(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function LK(e){var t=zt.map(e.nodes(),function(n){var r={};return zt.forEach(e.outEdges(n),function(a){r[a.w]=(r[a.w]||0)+e.edge(a).weight}),r});return zt.zipObject(e.nodes(),t)}function OK(e){var t=zt.map(e.nodes(),function(n){var r={};return zt.forEach(e.inEdges(n),function(a){r[a.v]=(r[a.v]||0)+e.edge(a).weight}),r});return zt.zipObject(e.nodes(),t)}function DK(e,t){var n=e.x,r=e.y,a=t.x-n,i=t.y-r,s=e.width/2,l=e.height/2;if(!a&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var c,u;return Math.abs(i)*s>Math.abs(a)*l?(i<0&&(l=-l),c=l*a/i,u=l):(a<0&&(s=-s),c=s,u=s*i/a),{x:n+c,y:r+u}}function PK(e){var t=zt.map(zt.range(f3(e)+1),function(){return[]});return zt.forEach(e.nodes(),function(n){var r=e.node(n),a=r.rank;zt.isUndefined(a)||(t[a][r.order]=n)}),t}function FK(e){var t=zt.min(zt.map(e.nodes(),function(n){return e.node(n).rank}));zt.forEach(e.nodes(),function(n){var r=e.node(n);zt.has(r,"rank")&&(r.rank-=t)})}function BK(e){var t=zt.min(zt.map(e.nodes(),function(i){return e.node(i).rank})),n=[];zt.forEach(e.nodes(),function(i){var s=e.node(i).rank-t;n[s]||(n[s]=[]),n[s].push(i)});var r=0,a=e.graph().nodeRankFactor;zt.forEach(n,function(i,s){zt.isUndefined(i)&&s%a!==0?--r:r&&zt.forEach(i,function(l){e.node(l).rank+=r})})}function zK(e,t,n,r){var a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=r),d3(e,"border",a,t)}function f3(e){return zt.max(zt.map(e.nodes(),function(t){var n=e.node(t).rank;if(!zt.isUndefined(n))return n}))}function UK(e,t){var n={lhs:[],rhs:[]};return zt.forEach(e,function(r){t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function $K(e,t){var n=zt.now();try{return t()}finally{console.log(e+" time: "+(zt.now()-n)+"ms")}}function HK(e,t){return t()}var g3=ln,qK=yr,WK={run:VK,undo:KK};function VK(e){e.graph().dummyChains=[],g3.forEach(e.edges(),function(t){GK(e,t)})}function GK(e,t){var n=t.v,r=e.node(n).rank,a=t.w,i=e.node(a).rank,s=t.name,l=e.edge(t),c=l.labelRank;if(i!==r+1){e.removeEdge(t);var u,d,f;for(f=0,++r;r<i;++f,++r)l.points=[],d={width:0,height:0,edgeLabel:l,edgeObj:t,rank:r},u=qK.addDummyNode(e,"edge",d,"_d"),r===c&&(d.width=l.width,d.height=l.height,d.dummy="edge-label",d.labelpos=l.labelpos),e.setEdge(n,u,{weight:l.weight},s),f===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,a,{weight:l.weight},s)}}function KK(e){g3.forEach(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,a;for(e.setEdge(n.edgeObj,r);n.dummy;)a=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=a,n=e.node(t)})}var Nu=ln,Of={longestPath:YK,slack:XK};function YK(e){var t={};function n(r){var a=e.node(r);if(Nu.has(t,r))return a.rank;t[r]=!0;var i=Nu.min(Nu.map(e.outEdges(r),function(s){return n(s.w)-e.edge(s).minlen}));return(i===Number.POSITIVE_INFINITY||i===void 0||i===null)&&(i=0),a.rank=i}Nu.forEach(e.sources(),n)}function XK(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Pd=ln,QK=ua.Graph,Fd=Of.slack,p3=ZK;function ZK(e){var t=new QK({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var a,i;JK(t,e)<r;)a=eY(t,e),i=t.hasNode(a.v)?Fd(e,a):-Fd(e,a),tY(t,e,i);return t}function JK(e,t){function n(r){Pd.forEach(t.nodeEdges(r),function(a){var i=a.v,s=r===i?a.w:i;!e.hasNode(s)&&!Fd(t,a)&&(e.setNode(s,{}),e.setEdge(r,s,{}),n(s))})}return Pd.forEach(e.nodes(),n),e.nodeCount()}function eY(e,t){return Pd.minBy(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Fd(t,n)})}function tY(e,t,n){Pd.forEach(e.nodes(),function(r){t.node(r).rank+=n})}var Ga=ln,nY=p3,rY=Of.slack,aY=Of.longestPath,iY=ua.alg.preorder,sY=ua.alg.postorder,oY=yr.simplify,lY=js;js.initLowLimValues=H1;js.initCutValues=$1;js.calcCutValue=h3;js.leaveEdge=x3;js.enterEdge=y3;js.exchangeEdges=b3;function js(e){e=oY(e),aY(e);var t=nY(e);H1(t),$1(t,e);for(var n,r;n=x3(t);)r=y3(t,e,n),b3(t,e,n,r)}function $1(e,t){var n=sY(e,e.nodes());n=n.slice(0,n.length-1),Ga.forEach(n,function(r){cY(e,t,r)})}function cY(e,t,n){var r=e.node(n),a=r.parent;e.edge(n,a).cutvalue=h3(e,t,n)}function h3(e,t,n){var r=e.node(n),a=r.parent,i=!0,s=t.edge(n,a),l=0;return s||(i=!1,s=t.edge(a,n)),l=s.weight,Ga.forEach(t.nodeEdges(n),function(c){var u=c.v===n,d=u?c.w:c.v;if(d!==a){var f=u===i,g=t.edge(c).weight;if(l+=f?g:-g,dY(e,n,d)){var p=e.edge(n,d).cutvalue;l+=f?-p:p}}}),l}function H1(e,t){arguments.length<2&&(t=e.nodes()[0]),m3(e,{},1,t)}function m3(e,t,n,r,a){var i=n,s=e.node(r);return t[r]=!0,Ga.forEach(e.neighbors(r),function(l){Ga.has(t,l)||(n=m3(e,t,n,l,r))}),s.low=i,s.lim=n++,a?s.parent=a:delete s.parent,n}function x3(e){return Ga.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function y3(e,t,n){var r=n.v,a=n.w;t.hasEdge(r,a)||(r=n.w,a=n.v);var i=e.node(r),s=e.node(a),l=i,c=!1;i.lim>s.lim&&(l=s,c=!0);var u=Ga.filter(t.edges(),function(d){return c===b4(e,e.node(d.v),l)&&c!==b4(e,e.node(d.w),l)});return Ga.minBy(u,function(d){return rY(t,d)})}function b3(e,t,n,r){var a=n.v,i=n.w;e.removeEdge(a,i),e.setEdge(r.v,r.w,{}),H1(e),$1(e,t),uY(e,t)}function uY(e,t){var n=Ga.find(e.nodes(),function(a){return!t.node(a).parent}),r=iY(e,n);r=r.slice(1),Ga.forEach(r,function(a){var i=e.node(a).parent,s=t.edge(a,i),l=!1;s||(s=t.edge(i,a),l=!0),t.node(a).rank=t.node(i).rank+(l?s.minlen:-s.minlen)})}function dY(e,t,n){return e.hasEdge(t,n)}function b4(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var fY=Of,v3=fY.longestPath,gY=p3,pY=lY,hY=mY;function mY(e){switch(e.graph().ranker){case"network-simplex":v4(e);break;case"tight-tree":yY(e);break;case"longest-path":xY(e);break;default:v4(e)}}var xY=v3;function yY(e){v3(e),gY(e)}function v4(e){pY(e)}var Ob=ln,bY=vY;function vY(e){var t=_Y(e);Ob.forEach(e.graph().dummyChains,function(n){for(var r=e.node(n),a=r.edgeObj,i=kY(e,t,a.v,a.w),s=i.path,l=i.lca,c=0,u=s[c],d=!0;n!==a.w;){if(r=e.node(n),d){for(;(u=s[c])!==l&&e.node(u).maxRank<r.rank;)c++;u===l&&(d=!1)}if(!d){for(;c<s.length-1&&e.node(u=s[c+1]).minRank<=r.rank;)c++;u=s[c]}e.setParent(n,u),n=e.successors(n)[0]}})}function kY(e,t,n,r){var a=[],i=[],s=Math.min(t[n].low,t[r].low),l=Math.max(t[n].lim,t[r].lim),c,u;c=n;do c=e.parent(c),a.push(c);while(c&&(t[c].low>s||l>t[c].lim));for(u=c,c=r;(c=e.parent(c))!==u;)i.push(c);return{path:a.concat(i.reverse()),lca:u}}function _Y(e){var t={},n=0;function r(a){var i=n;Ob.forEach(e.children(a),r),t[a]={low:i,lim:n++}}return Ob.forEach(e.children(),r),t}var za=ln,Db=yr,wY={run:EY,cleanup:CY};function EY(e){var t=Db.addDummyNode(e,"root",{},"_root"),n=SY(e),r=za.max(za.values(n))-1,a=2*r+1;e.graph().nestingRoot=t,za.forEach(e.edges(),function(s){e.edge(s).minlen*=a});var i=NY(e)+1;za.forEach(e.children(),function(s){k3(e,t,a,i,r,n,s)}),e.graph().nodeRankFactor=a}function k3(e,t,n,r,a,i,s){var l=e.children(s);if(!l.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}var c=Db.addBorderNode(e,"_bt"),u=Db.addBorderNode(e,"_bb"),d=e.node(s);e.setParent(c,s),d.borderTop=c,e.setParent(u,s),d.borderBottom=u,za.forEach(l,function(f){k3(e,t,n,r,a,i,f);var g=e.node(f),p=g.borderTop?g.borderTop:f,m=g.borderBottom?g.borderBottom:f,y=g.borderTop?r:2*r,v=p!==m?1:a-i[s]+1;e.setEdge(c,p,{weight:y,minlen:v,nestingEdge:!0}),e.setEdge(m,u,{weight:y,minlen:v,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,c,{weight:0,minlen:a+i[s]})}function SY(e){var t={};function n(r,a){var i=e.children(r);i&&i.length&&za.forEach(i,function(s){n(s,a+1)}),t[r]=a}return za.forEach(e.children(),function(r){n(r,1)}),t}function NY(e){return za.reduce(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function CY(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,za.forEach(e.edges(),function(n){var r=e.edge(n);r.nestingEdge&&e.removeEdge(n)})}var Yx=ln,jY=yr,TY=AY;function AY(e){function t(n){var r=e.children(n),a=e.node(n);if(r.length&&Yx.forEach(r,t),Yx.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,s=a.maxRank+1;i<s;++i)k4(e,"borderLeft","_bl",n,a,i),k4(e,"borderRight","_br",n,a,i)}}Yx.forEach(e.children(),t)}function k4(e,t,n,r,a,i){var s={width:0,height:0,rank:i,borderType:t},l=a[t][i-1],c=jY.addDummyNode(e,"border",s,n);a[t][i]=c,e.setParent(c,r),l&&e.setEdge(l,c,{weight:1})}var va=ln,RY={adjust:IY,undo:MY};function IY(e){var t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&_3(e)}function MY(e){var t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&LY(e),(t==="lr"||t==="rl")&&(OY(e),_3(e))}function _3(e){va.forEach(e.nodes(),function(t){_4(e.node(t))}),va.forEach(e.edges(),function(t){_4(e.edge(t))})}function _4(e){var t=e.width;e.width=e.height,e.height=t}function LY(e){va.forEach(e.nodes(),function(t){Xx(e.node(t))}),va.forEach(e.edges(),function(t){var n=e.edge(t);va.forEach(n.points,Xx),va.has(n,"y")&&Xx(n)})}function Xx(e){e.y=-e.y}function OY(e){va.forEach(e.nodes(),function(t){Qx(e.node(t))}),va.forEach(e.edges(),function(t){var n=e.edge(t);va.forEach(n.points,Qx),va.has(n,"x")&&Qx(n)})}function Qx(e){var t=e.x;e.x=e.y,e.y=t}var Ma=ln,DY=PY;function PY(e){var t={},n=Ma.filter(e.nodes(),function(l){return!e.children(l).length}),r=Ma.max(Ma.map(n,function(l){return e.node(l).rank})),a=Ma.map(Ma.range(r+1),function(){return[]});function i(l){if(!Ma.has(t,l)){t[l]=!0;var c=e.node(l);a[c.rank].push(l),Ma.forEach(e.successors(l),i)}}var s=Ma.sortBy(n,function(l){return e.node(l).rank});return Ma.forEach(s,i),a}var oi=ln,FY=BY;function BY(e,t){for(var n=0,r=1;r<t.length;++r)n+=zY(e,t[r-1],t[r]);return n}function zY(e,t,n){for(var r=oi.zipObject(n,oi.map(n,function(u,d){return d})),a=oi.flatten(oi.map(t,function(u){return oi.sortBy(oi.map(e.outEdges(u),function(d){return{pos:r[d.w],weight:e.edge(d).weight}}),"pos")}),!0),i=1;i<n.length;)i<<=1;var s=2*i-1;i-=1;var l=oi.map(new Array(s),function(){return 0}),c=0;return oi.forEach(a.forEach(function(u){var d=u.pos+i;l[d]+=u.weight;for(var f=0;d>0;)d%2&&(f+=l[d+1]),d=d-1>>1,l[d]+=u.weight;c+=u.weight*f})),c}var w4=ln,UY=$Y;function $Y(e,t){return w4.map(t,function(n){var r=e.inEdges(n);if(r.length){var a=w4.reduce(r,function(i,s){var l=e.edge(s),c=e.node(s.v);return{sum:i.sum+l.weight*c.order,weight:i.weight+l.weight}},{sum:0,weight:0});return{v:n,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:n}})}var Nr=ln,HY=qY;function qY(e,t){var n={};Nr.forEach(e,function(a,i){var s=n[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};Nr.isUndefined(a.barycenter)||(s.barycenter=a.barycenter,s.weight=a.weight)}),Nr.forEach(t.edges(),function(a){var i=n[a.v],s=n[a.w];!Nr.isUndefined(i)&&!Nr.isUndefined(s)&&(s.indegree++,i.out.push(n[a.w]))});var r=Nr.filter(n,function(a){return!a.indegree});return WY(r)}function WY(e){var t=[];function n(i){return function(s){s.merged||(Nr.isUndefined(s.barycenter)||Nr.isUndefined(i.barycenter)||s.barycenter>=i.barycenter)&&VY(i,s)}}function r(i){return function(s){s.in.push(i),--s.indegree===0&&e.push(s)}}for(;e.length;){var a=e.pop();t.push(a),Nr.forEach(a.in.reverse(),n(a)),Nr.forEach(a.out,r(a))}return Nr.map(Nr.filter(t,function(i){return!i.merged}),function(i){return Nr.pick(i,["vs","i","barycenter","weight"])})}function VY(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}var gl=ln,GY=yr,KY=YY;function YY(e,t){var n=GY.partition(e,function(d){return gl.has(d,"barycenter")}),r=n.lhs,a=gl.sortBy(n.rhs,function(d){return-d.i}),i=[],s=0,l=0,c=0;r.sort(XY(!!t)),c=E4(i,a,c),gl.forEach(r,function(d){c+=d.vs.length,i.push(d.vs),s+=d.barycenter*d.weight,l+=d.weight,c=E4(i,a,c)});var u={vs:gl.flatten(i,!0)};return l&&(u.barycenter=s/l,u.weight=l),u}function E4(e,t,n){for(var r;t.length&&(r=gl.last(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function XY(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}var pi=ln,QY=UY,ZY=HY,JY=KY,eX=w3;function w3(e,t,n,r){var a=e.children(t),i=e.node(t),s=i?i.borderLeft:void 0,l=i?i.borderRight:void 0,c={};s&&(a=pi.filter(a,function(m){return m!==s&&m!==l}));var u=QY(e,a);pi.forEach(u,function(m){if(e.children(m.v).length){var y=w3(e,m.v,n,r);c[m.v]=y,pi.has(y,"barycenter")&&nX(m,y)}});var d=ZY(u,n);tX(d,c);var f=JY(d,r);if(s&&(f.vs=pi.flatten([s,f.vs,l],!0),e.predecessors(s).length)){var g=e.node(e.predecessors(s)[0]),p=e.node(e.predecessors(l)[0]);pi.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+g.order+p.order)/(f.weight+2),f.weight+=2}return f}function tX(e,t){pi.forEach(e,function(n){n.vs=pi.flatten(n.vs.map(function(r){return t[r]?t[r].vs:r}),!0)})}function nX(e,t){pi.isUndefined(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var pl=ln,rX=ua.Graph,aX=iX;function iX(e,t,n){var r=sX(e),a=new rX({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(i){return e.node(i)});return pl.forEach(e.nodes(),function(i){var s=e.node(i),l=e.parent(i);(s.rank===t||s.minRank<=t&&t<=s.maxRank)&&(a.setNode(i),a.setParent(i,l||r),pl.forEach(e[n](i),function(c){var u=c.v===i?c.w:c.v,d=a.edge(u,i),f=pl.isUndefined(d)?0:d.weight;a.setEdge(u,i,{weight:e.edge(c).weight+f})}),pl.has(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[t],borderRight:s.borderRight[t]}))}),a}function sX(e){for(var t;e.hasNode(t=pl.uniqueId("_root")););return t}var oX=ln,lX=cX;function cX(e,t,n){var r={},a;oX.forEach(n,function(i){for(var s=e.parent(i),l,c;s;){if(l=e.parent(s),l?(c=r[l],r[l]=s):(c=a,a=s),c&&c!==s){t.setEdge(c,s);return}s=l}})}var Ti=ln,uX=DY,dX=FY,fX=eX,gX=aX,pX=lX,hX=ua.Graph,S4=yr,mX=xX;function xX(e){var t=S4.maxRank(e),n=N4(e,Ti.range(1,t+1),"inEdges"),r=N4(e,Ti.range(t-1,-1,-1),"outEdges"),a=uX(e);C4(e,a);for(var i=Number.POSITIVE_INFINITY,s,l=0,c=0;c<4;++l,++c){yX(l%2?n:r,l%4>=2),a=S4.buildLayerMatrix(e);var u=dX(e,a);u<i&&(c=0,s=Ti.cloneDeep(a),i=u)}C4(e,s)}function N4(e,t,n){return Ti.map(t,function(r){return gX(e,r,n)})}function yX(e,t){var n=new hX;Ti.forEach(e,function(r){var a=r.graph().root,i=fX(r,a,n,t);Ti.forEach(i.vs,function(s,l){r.node(s).order=l}),pX(r,n,i.vs)})}function C4(e,t){Ti.forEach(t,function(n){Ti.forEach(n,function(r,a){e.node(r).order=a})})}var kt=ln,bX=ua.Graph,vX=yr,kX={positionX:IX};function _X(e,t){var n={};function r(a,i){var s=0,l=0,c=a.length,u=kt.last(i);return kt.forEach(i,function(d,f){var g=EX(e,d),p=g?e.node(g).order:c;(g||d===u)&&(kt.forEach(i.slice(l,f+1),function(m){kt.forEach(e.predecessors(m),function(y){var v=e.node(y),x=v.order;(x<s||p<x)&&!(v.dummy&&e.node(m).dummy)&&E3(n,y,m)})}),l=f+1,s=p)}),i}return kt.reduce(t,r),n}function wX(e,t){var n={};function r(i,s,l,c,u){var d;kt.forEach(kt.range(s,l),function(f){d=i[f],e.node(d).dummy&&kt.forEach(e.predecessors(d),function(g){var p=e.node(g);p.dummy&&(p.order<c||p.order>u)&&E3(n,g,d)})})}function a(i,s){var l=-1,c,u=0;return kt.forEach(s,function(d,f){if(e.node(d).dummy==="border"){var g=e.predecessors(d);g.length&&(c=e.node(g[0]).order,r(s,u,f,l,c),u=f,l=c)}r(s,u,s.length,c,i.length)}),s}return kt.reduce(t,a),n}function EX(e,t){if(e.node(t).dummy)return kt.find(e.predecessors(t),function(n){return e.node(n).dummy})}function E3(e,t,n){if(t>n){var r=t;t=n,n=r}var a=e[t];a||(e[t]=a={}),a[n]=!0}function SX(e,t,n){if(t>n){var r=t;t=n,n=r}return kt.has(e[t],n)}function NX(e,t,n,r){var a={},i={},s={};return kt.forEach(t,function(l){kt.forEach(l,function(c,u){a[c]=c,i[c]=c,s[c]=u})}),kt.forEach(t,function(l){var c=-1;kt.forEach(l,function(u){var d=r(u);if(d.length){d=kt.sortBy(d,function(y){return s[y]});for(var f=(d.length-1)/2,g=Math.floor(f),p=Math.ceil(f);g<=p;++g){var m=d[g];i[u]===u&&c<s[m]&&!SX(n,u,m)&&(i[m]=u,i[u]=a[u]=a[m],c=s[m])}}})}),{root:a,align:i}}function CX(e,t,n,r,a){var i={},s=jX(e,t,n,a),l=a?"borderLeft":"borderRight";function c(f,g){for(var p=s.nodes(),m=p.pop(),y={};m;)y[m]?f(m):(y[m]=!0,p.push(m),p=p.concat(g(m))),m=p.pop()}function u(f){i[f]=s.inEdges(f).reduce(function(g,p){return Math.max(g,i[p.v]+s.edge(p))},0)}function d(f){var g=s.outEdges(f).reduce(function(m,y){return Math.min(m,i[y.w]-s.edge(y))},Number.POSITIVE_INFINITY),p=e.node(f);g!==Number.POSITIVE_INFINITY&&p.borderType!==l&&(i[f]=Math.max(i[f],g))}return c(u,s.predecessors.bind(s)),c(d,s.successors.bind(s)),kt.forEach(r,function(f){i[f]=i[n[f]]}),i}function jX(e,t,n,r){var a=new bX,i=e.graph(),s=MX(i.nodesep,i.edgesep,r);return kt.forEach(t,function(l){var c;kt.forEach(l,function(u){var d=n[u];if(a.setNode(d),c){var f=n[c],g=a.edge(f,d);a.setEdge(f,d,Math.max(s(e,u,c),g||0))}c=u})}),a}function TX(e,t){return kt.minBy(kt.values(t),function(n){var r=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return kt.forIn(n,function(i,s){var l=LX(e,s)/2;r=Math.max(i+l,r),a=Math.min(i-l,a)}),r-a})}function AX(e,t){var n=kt.values(t),r=kt.min(n),a=kt.max(n);kt.forEach(["u","d"],function(i){kt.forEach(["l","r"],function(s){var l=i+s,c=e[l],u;if(c!==t){var d=kt.values(c);u=s==="l"?r-kt.min(d):a-kt.max(d),u&&(e[l]=kt.mapValues(c,function(f){return f+u}))}})})}function RX(e,t){return kt.mapValues(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var a=kt.sortBy(kt.map(e,r));return(a[1]+a[2])/2})}function IX(e){var t=vX.buildLayerMatrix(e),n=kt.merge(_X(e,t),wX(e,t)),r={},a;kt.forEach(["u","d"],function(s){a=s==="u"?t:kt.values(t).reverse(),kt.forEach(["l","r"],function(l){l==="r"&&(a=kt.map(a,function(f){return kt.values(f).reverse()}));var c=(s==="u"?e.predecessors:e.successors).bind(e),u=NX(e,a,n,c),d=CX(e,a,u.root,u.align,l==="r");l==="r"&&(d=kt.mapValues(d,function(f){return-f})),r[s+l]=d})});var i=TX(e,r);return AX(r,i),RX(r,e.graph().align)}function MX(e,t,n){return function(r,a,i){var s=r.node(a),l=r.node(i),c=0,u;if(c+=s.width/2,kt.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(c+=n?u:-u),u=0,c+=(s.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,kt.has(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":u=l.width/2;break;case"r":u=-l.width/2;break}return u&&(c+=n?u:-u),u=0,c}}function LX(e,t){return e.node(t).width}var hl=ln,S3=yr,OX=kX.positionX,DX=PX;function PX(e){e=S3.asNonCompoundGraph(e),FX(e),hl.forEach(OX(e),function(t,n){e.node(n).x=t})}function FX(e){var t=S3.buildLayerMatrix(e),n=e.graph().ranksep,r=0;hl.forEach(t,function(a){var i=hl.max(hl.map(a,function(s){return e.node(s).height}));hl.forEach(a,function(s){e.node(s).y=r+i/2}),r+=i+n})}var Nt=ln,j4=jK,T4=WK,BX=hY,zX=yr.normalizeRanks,UX=bY,$X=yr.removeEmptyRanks,A4=wY,HX=TY,R4=RY,qX=mX,WX=DX,Mi=yr,VX=ua.Graph,GX=KX;function KX(e,t){var n=t&&t.debugTiming?Mi.time:Mi.notime;n("layout",function(){var r=n(" buildLayoutGraph",function(){return iQ(e)});n(" runLayout",function(){YX(r,n)}),n(" updateInputGraph",function(){XX(e,r)})})}function YX(e,t){t(" makeSpaceForEdgeLabels",function(){sQ(e)}),t(" removeSelfEdges",function(){hQ(e)}),t(" acyclic",function(){j4.run(e)}),t(" nestingGraph.run",function(){A4.run(e)}),t(" rank",function(){BX(Mi.asNonCompoundGraph(e))}),t(" injectEdgeLabelProxies",function(){oQ(e)}),t(" removeEmptyRanks",function(){$X(e)}),t(" nestingGraph.cleanup",function(){A4.cleanup(e)}),t(" normalizeRanks",function(){zX(e)}),t(" assignRankMinMax",function(){lQ(e)}),t(" removeEdgeLabelProxies",function(){cQ(e)}),t(" normalize.run",function(){T4.run(e)}),t(" parentDummyChains",function(){UX(e)}),t(" addBorderSegments",function(){HX(e)}),t(" order",function(){qX(e)}),t(" insertSelfEdges",function(){mQ(e)}),t(" adjustCoordinateSystem",function(){R4.adjust(e)}),t(" position",function(){WX(e)}),t(" positionSelfEdges",function(){xQ(e)}),t(" removeBorderNodes",function(){pQ(e)}),t(" normalize.undo",function(){T4.undo(e)}),t(" fixupEdgeLabelCoords",function(){fQ(e)}),t(" undoCoordinateSystem",function(){R4.undo(e)}),t(" translateGraph",function(){uQ(e)}),t(" assignNodeIntersects",function(){dQ(e)}),t(" reversePoints",function(){gQ(e)}),t(" acyclic.undo",function(){j4.undo(e)})}function XX(e,t){Nt.forEach(e.nodes(),function(n){var r=e.node(n),a=t.node(n);r&&(r.x=a.x,r.y=a.y,t.children(n).length&&(r.width=a.width,r.height=a.height))}),Nt.forEach(e.edges(),function(n){var r=e.edge(n),a=t.edge(n);r.points=a.points,Nt.has(a,"x")&&(r.x=a.x,r.y=a.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var QX=["nodesep","edgesep","ranksep","marginx","marginy"],ZX={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},JX=["acyclicer","ranker","rankdir","align"],eQ=["width","height"],tQ={width:0,height:0},nQ=["minlen","weight","width","height","labeloffset"],rQ={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},aQ=["labelpos"];function iQ(e){var t=new VX({multigraph:!0,compound:!0}),n=Jx(e.graph());return t.setGraph(Nt.merge({},ZX,Zx(n,QX),Nt.pick(n,JX))),Nt.forEach(e.nodes(),function(r){var a=Jx(e.node(r));t.setNode(r,Nt.defaults(Zx(a,eQ),tQ)),t.setParent(r,e.parent(r))}),Nt.forEach(e.edges(),function(r){var a=Jx(e.edge(r));t.setEdge(r,Nt.merge({},rQ,Zx(a,nQ),Nt.pick(a,aQ)))}),t}function sQ(e){var t=e.graph();t.ranksep/=2,Nt.forEach(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function oQ(e){Nt.forEach(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v),a=e.node(t.w),i={rank:(a.rank-r.rank)/2+r.rank,e:t};Mi.addDummyNode(e,"edge-proxy",i,"_ep")}})}function lQ(e){var t=0;Nt.forEach(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Nt.max(t,r.maxRank))}),e.graph().maxRank=t}function cQ(e){Nt.forEach(e.nodes(),function(t){var n=e.node(t);n.dummy==="edge-proxy"&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function uQ(e){var t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,a=0,i=e.graph(),s=i.marginx||0,l=i.marginy||0;function c(u){var d=u.x,f=u.y,g=u.width,p=u.height;t=Math.min(t,d-g/2),n=Math.max(n,d+g/2),r=Math.min(r,f-p/2),a=Math.max(a,f+p/2)}Nt.forEach(e.nodes(),function(u){c(e.node(u))}),Nt.forEach(e.edges(),function(u){var d=e.edge(u);Nt.has(d,"x")&&c(d)}),t-=s,r-=l,Nt.forEach(e.nodes(),function(u){var d=e.node(u);d.x-=t,d.y-=r}),Nt.forEach(e.edges(),function(u){var d=e.edge(u);Nt.forEach(d.points,function(f){f.x-=t,f.y-=r}),Nt.has(d,"x")&&(d.x-=t),Nt.has(d,"y")&&(d.y-=r)}),i.width=n-t+s,i.height=a-r+l}function dQ(e){Nt.forEach(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),a=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=a,s=r),n.points.unshift(Mi.intersectRect(r,i)),n.points.push(Mi.intersectRect(a,s))})}function fQ(e){Nt.forEach(e.edges(),function(t){var n=e.edge(t);if(Nt.has(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function gQ(e){Nt.forEach(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function pQ(e){Nt.forEach(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),a=e.node(n.borderBottom),i=e.node(Nt.last(n.borderLeft)),s=e.node(Nt.last(n.borderRight));n.width=Math.abs(s.x-i.x),n.height=Math.abs(a.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),Nt.forEach(e.nodes(),function(t){e.node(t).dummy==="border"&&e.removeNode(t)})}function hQ(e){Nt.forEach(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function mQ(e){var t=Mi.buildLayerMatrix(e);Nt.forEach(t,function(n){var r=0;Nt.forEach(n,function(a,i){var s=e.node(a);s.order=i+r,Nt.forEach(s.selfEdges,function(l){Mi.addDummyNode(e,"selfedge",{width:l.label.width,height:l.label.height,rank:s.rank,order:i+ ++r,e:l.e,label:l.label},"_se")}),delete s.selfEdges})})}function xQ(e){Nt.forEach(e.nodes(),function(t){var n=e.node(t);if(n.dummy==="selfedge"){var r=e.node(n.e.v),a=r.x+r.width/2,i=r.y,s=n.x-a,l=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:a+2*s/3,y:i-l},{x:a+5*s/6,y:i-l},{x:a+s,y:i},{x:a+5*s/6,y:i+l},{x:a+2*s/3,y:i+l}],n.label.x=n.x,n.label.y=n.y}})}function Zx(e,t){return Nt.mapValues(Nt.pick(e,t),Number)}function Jx(e){var t={};return Nt.forEach(e,function(n,r){t[r.toLowerCase()]=n}),t}var Cu=ln,yQ=yr,bQ=ua.Graph,vQ={debugOrdering:kQ};function kQ(e){var t=yQ.buildLayerMatrix(e),n=new bQ({compound:!0,multigraph:!0}).setGraph({});return Cu.forEach(e.nodes(),function(r){n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),Cu.forEach(e.edges(),function(r){n.setEdge(r.v,r.w,{},r.name)}),Cu.forEach(t,function(r,a){var i="layer"+a;n.setNode(i,{rank:"same"}),Cu.reduce(r,function(s,l){return n.setEdge(s,l,{style:"invis"}),l})}),n}var _Q="0.8.5",wQ={graphlib:ua,layout:GX,debug:vQ,util:{time:yr.time,notime:yr.notime},version:_Q};const Bd=No(wQ),EQ={completed:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},in_progress:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},blocked:{fill:"#fef3c7",stroke:"#f59e0b",label:"#b45309"},open:{fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"}},SQ={completed:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},in_progress:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},blocked:{fill:"#78350f",stroke:"#fbbf24",label:"#fde68a"},open:{fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"}};function NQ(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function I4(e){return e.status==="completed"?"completed":e.status==="in_progress"?"in_progress":e.blockedBy&&e.blockedBy.length>0&&e.isBlocked?"blocked":"open"}function CQ({todos:e,darkMode:t}){const n=Array.isArray(e)?e:[],[r,a]=h.useState(null),i=h.useRef(null),s=h.useRef(null),[l,c]=h.useState(400),[u,d]=h.useState(function(){if(typeof window<"u"){const F=parseFloat(localStorage.getItem("pave-map-zoom")||"");if(Number.isFinite(F)&&F>.1)return F}return 1});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-zoom",String(u))},[u]);const[f,g]=h.useState(function(){return typeof window<"u"?localStorage.getItem("pave-map-show-completed")!=="false":!0});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-show-completed",f?"true":"false")},[f]);const[p,m]=h.useState(function(){if(typeof window<"u"){const F=localStorage.getItem("pave-map-rankdir");if(F==="LR"||F==="TB")return F}return"TB"});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-map-rankdir",p)},[p]);const y=h.useMemo(function(){if(f)return n;const F=n.filter(function(L){return L.status!=="completed"}),H={};return F.forEach(function(L){H[L.id]=!0}),F.map(function(L){if(!L.blockedBy||!L.blockedBy.length)return L;const M=L.blockedBy.filter(function(T){return H[T]});return M.length===L.blockedBy.length?L:Object.assign({},L,{blockedBy:M})})},[n,f]);h.useEffect(function(){if(!i.current)return;function F(){i.current&&c(i.current.clientWidth||400)}F();const H=new ResizeObserver(F);return H.observe(i.current),function(){H.disconnect()}},[]);const v=h.useMemo(function(){if(!y.length)return{nodes:[],edges:[],width:0,height:0};const F=new Bd.graphlib.Graph;F.setGraph({rankdir:p,nodesep:24,ranksep:36,marginx:16,marginy:16}),F.setDefaultEdgeLabel(function(){return{}});const H=180,L=56;y.forEach(function(O){F.setNode(String(O.id),{width:H,height:L,todo:O})}),y.forEach(function(O){(O.blockedBy||[]).forEach(function(Y){F.hasNode(String(Y))&&F.setEdge(String(Y),String(O.id))})}),Bd.layout(F);const M=F.nodes().map(function(O){const $=F.node(O);return{id:O,x:$.x-H/2,y:$.y-L/2,w:H,h:L,todo:$.todo}}),T=F.edges().map(function(O){const $=F.edge(O);return{from:O.v,to:O.w,points:$.points}});return{nodes:M,edges:T,width:F.graph().width||H+32,height:F.graph().height||L+32}},[y,p]),x=t?SQ:EQ;if(!y.length){const F=n.length-y.length;return o.jsxs("div",{ref:i,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[o.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:o.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"})})}),F>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"All work complete"}),o.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:[F," completed ",F===1?"todo is":"todos are"," hidden."]}),o.jsx("button",{type:"button",onClick:function(){g(!0)},className:"mt-3 text-xs px-3 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",children:"Show completed"})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Strategy map is empty"}),o.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:["Ask the agent to plan the work — todos created with the ",o.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"todo"})," tool will appear here as a live DAG."]})]})]})}function b(F){if(!F||F.length<2)return"";let H="M "+F[0].x+" "+F[0].y;for(let L=1;L<F.length;L++)H+=" L "+F[L].x+" "+F[L].y;return H}const k=n.reduce(function(F,H){const L=I4(H);return F[L]=(F[L]||0)+1,F},{}),S=k.completed||0,E=Math.max(v.width,100),_=Math.max(v.height,100),N=(E>l-24?1:(l-24)/E)*u,R=E*N,j=_*N;function P(F){(F.ctrlKey||F.metaKey)&&(F.preventDefault(),d(function(H){const L=F.deltaY<0?H*1.1:H/1.1;return Math.max(.25,Math.min(4,L))}))}return o.jsxs("div",{ref:i,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs flex-shrink-0",children:[o.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Strategy Map"}),o.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[o.jsxs("span",{children:[n.length," total"]}),k.in_progress?o.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[k.in_progress," active"]}):null,S?o.jsxs("span",{className:"text-green-600 dark:text-green-400",children:[S," done"]}):null,k.blocked?o.jsxs("span",{className:"text-amber-600 dark:text-amber-400",children:[k.blocked," blocked"]}):null,o.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[o.jsx("button",{type:"button",onClick:function(){m(function(F){return F==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:p==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:p==="TB"?"↓":"→"}),o.jsx("button",{type:"button",onClick:function(){d(function(F){return Math.max(.25,F/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),o.jsxs("button",{type:"button",onClick:function(){d(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(u*100),"%"]}),o.jsx("button",{type:"button",onClick:function(){d(function(F){return Math.min(4,F*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),S>0?o.jsx("button",{type:"button",onClick:function(){g(function(F){return!F})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(f?"border-blue-400 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:f?"Hide completed todos":"Show completed todos",children:f?"hide done":"show done"}):null]})]}),o.jsx("div",{ref:s,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:P,children:o.jsxs("svg",{viewBox:"0 0 "+E+" "+_,width:R,height:j,style:{display:"block"},children:[o.jsx("defs",{children:o.jsx("marker",{id:"sm-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?"#64748b":"#94a3b8"})})}),v.edges.map(function(F,H){return o.jsx("path",{d:b(F.points),fill:"none",stroke:t?"#475569":"#cbd5e1",strokeWidth:1.5,markerEnd:"url(#sm-arrow)"},"e"+H)}),v.nodes.map(function(F){const H=I4(F.todo),L=x[H],M=H==="in_progress",T=r===F.id;return o.jsxs("g",{transform:"translate("+F.x+","+F.y+")",onMouseEnter:function(){a(F.id)},onMouseLeave:function(){a(null)},style:{cursor:"pointer"},children:[o.jsx("rect",{width:F.w,height:F.h,rx:6,ry:6,fill:L.fill,stroke:L.stroke,strokeWidth:M||T?2:1.25,children:M?o.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),M?o.jsx("circle",{cx:10,cy:10,r:3.5,fill:L.stroke,children:o.jsx("animate",{attributeName:"r",values:"3;5;3",dur:"1.4s",repeatCount:"indefinite"})}):null,o.jsx("text",{x:F.w/2,y:F.h/2-6,textAnchor:"middle",fontSize:11,fontWeight:600,fill:L.label,children:"#"+F.todo.id}),o.jsx("text",{x:F.w/2,y:F.h/2+12,textAnchor:"middle",fontSize:11,fill:t?"#e2e8f0":"#0f172a",children:NQ(F.todo.text,26)}),T&&F.todo.text&&F.todo.text.length>26?o.jsx("title",{children:F.todo.text}):null]},F.id)})]})})]})}const jQ={bash:{fill:"#f1f5f9",stroke:"#64748b",label:"#334155"},read:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},Read:{fill:"#dbeafe",stroke:"#3b82f6",label:"#1d4ed8"},edit:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},Edit:{fill:"#dcfce7",stroke:"#16a34a",label:"#15803d"},write:{fill:"#dcfce7",stroke:"#15803d",label:"#14532d"},Write:{fill:"#dcfce7",stroke:"#15803d",label:"#14532d"},glob:{fill:"#ede9fe",stroke:"#8b5cf6",label:"#6d28d9"},grep:{fill:"#ede9fe",stroke:"#8b5cf6",label:"#6d28d9"},fetch:{fill:"#fce7f3",stroke:"#db2777",label:"#9d174d"},canvas:{fill:"#fef3c7",stroke:"#f59e0b",label:"#b45309"},todo:{fill:"#e0f2fe",stroke:"#0ea5e9",label:"#0369a1"}},TQ={fill:"#f1f5f9",stroke:"#94a3b8",label:"#475569"},AQ={fill:"#fee2e2",stroke:"#dc2626",label:"#991b1b"},RQ={bash:{fill:"#1e293b",stroke:"#94a3b8",label:"#e2e8f0"},read:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},Read:{fill:"#1e3a8a",stroke:"#60a5fa",label:"#bfdbfe"},edit:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},Edit:{fill:"#14532d",stroke:"#22c55e",label:"#86efac"},write:{fill:"#14532d",stroke:"#16a34a",label:"#bbf7d0"},Write:{fill:"#14532d",stroke:"#16a34a",label:"#bbf7d0"},glob:{fill:"#4c1d95",stroke:"#a78bfa",label:"#ddd6fe"},grep:{fill:"#4c1d95",stroke:"#a78bfa",label:"#ddd6fe"},fetch:{fill:"#831843",stroke:"#f472b6",label:"#fbcfe8"},canvas:{fill:"#78350f",stroke:"#fbbf24",label:"#fde68a"},todo:{fill:"#0c4a6e",stroke:"#38bdf8",label:"#bae6fd"}},IQ={fill:"#1e293b",stroke:"#64748b",label:"#cbd5e1"},MQ={fill:"#7f1d1d",stroke:"#f87171",label:"#fecaca"},LQ={fill:"#fef9c3",stroke:"#ca8a04",label:"#713f12"},OQ={fill:"#3f2d0a",stroke:"#facc15",label:"#fde68a"},li={data:{light:"#0ea5e9",dark:"#38bdf8"},file:{light:"#94a3b8",dark:"#64748b"},seq:{light:"#cbd5e1",dark:"#475569"}};function DQ(e,t){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function PQ(e,t){return e.kind==="thought"?t?OQ:LQ:e.status==="error"?t?MQ:AQ:(t?RQ:jQ)[e.tool]||(t?IQ:TQ)}function FQ({graph:e,darkMode:t,onNodeClick:n}){const r=e&&Array.isArray(e.nodes)?e.nodes:[],a=e&&Array.isArray(e.edges)?e.edges:[],i=h.useRef(null),s=h.useRef(null),[l,c]=h.useState(null),[u,d]=h.useState(400),[f,g]=h.useState(function(){if(typeof window<"u"){const M=parseFloat(localStorage.getItem("pave-toolmap-zoom")||"");if(Number.isFinite(M)&&M>.1)return M}return 1});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-zoom",String(f))},[f]);const[p,m]=h.useState(function(){if(typeof window<"u"){const M=localStorage.getItem("pave-toolmap-rankdir");if(M==="LR"||M==="TB")return M}return"TB"});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-rankdir",p)},[p]);const[y,v]=h.useState(function(){return typeof window<"u"?localStorage.getItem("pave-toolmap-show-hidden")==="true":!1});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-hidden",y?"true":"false")},[y]);const[x,b]=h.useState(function(){return!(typeof window<"u"&&localStorage.getItem("pave-toolmap-show-thoughts")==="false")});h.useEffect(function(){typeof window<"u"&&localStorage.setItem("pave-toolmap-show-thoughts",x?"true":"false")},[x]);const k=h.useMemo(function(){let M=r;return y||(M=M.filter(function(T){return!T.hidden})),x||(M=M.filter(function(T){return T.kind!=="thought"})),M},[r,y,x]),S=h.useMemo(function(){const M={};return k.forEach(function(T){M[T.id]=!0}),a.filter(function(T){return M[T.from]&&M[T.to]})},[a,k]),E=h.useMemo(function(){if(!k.length)return{nodes:[],edges:[],width:0,height:0};const M=new Bd.graphlib.Graph;M.setGraph({rankdir:p,nodesep:18,ranksep:32,marginx:14,marginy:14}),M.setDefaultEdgeLabel(function(){return{}});const T=168,O=44,$=240,Y=60;k.forEach(function(V){V.kind==="thought"?M.setNode(V.id,{width:$,height:Y,node:V}):M.setNode(V.id,{width:T,height:O,node:V})}),S.forEach(function(V){M.hasNode(V.from)&&M.hasNode(V.to)&&M.setEdge(V.from,V.to,{kind:V.kind})}),Bd.layout(M);const A=M.nodes().map(function(V){const I=M.node(V);return{id:V,x:I.x-I.width/2,y:I.y-I.height/2,w:I.width,h:I.height,node:I.node}}),K=M.edges().map(function(V){const I=M.edge(V);return{from:V.v,to:V.w,points:I.points||[],kind:I.kind||"seq"}});return{nodes:A,edges:K,width:M.graph().width||T+28,height:M.graph().height||O+28}},[k,S,p]);h.useEffect(function(){if(!i.current)return;function M(){i.current&&d(i.current.clientWidth||400)}M();const T=new ResizeObserver(M);return T.observe(i.current),function(){T.disconnect()}},[]);const _=h.useMemo(function(){const M={total:0,ok:0,error:0,running:0,hidden:0,thoughts:0};return r.forEach(function(T){if(T.kind==="thought"){M.thoughts++;return}M.total++,T.hidden&&M.hidden++,T.status==="error"?M.error++:T.status==="running"?M.running++:M.ok++}),M},[r]);if(!k.length)return o.jsxs("div",{ref:i,className:"flex flex-col items-center justify-center h-full text-center px-6",children:[o.jsx("div",{className:"text-gray-400 dark:text-gray-500 mb-2",children:o.jsx("svg",{className:"w-12 h-12 mx-auto opacity-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})})}),o.jsx("div",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"No tool calls yet"}),o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1 max-w-xs",children:"Tool invocations will appear here as a DAG showing data flow and file dependencies."}),_.hidden>0&&!y?o.jsxs("button",{type:"button",onClick:function(){v(!0)},className:"mt-3 text-xs px-3 py-1 rounded border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",children:["Show ",_.hidden," hidden"]}):null]});function w(M){if(!M||M.length<2)return"";let T="M "+M[0].x+" "+M[0].y;for(let O=1;O<M.length;O++)T+=" L "+M[O].x+" "+M[O].y;return T}const N=Math.max(E.width,100),R=Math.max(E.height,100),P=(N>u-24?1:(u-24)/N)*f,F=N*P,H=R*P;function L(M){(M.ctrlKey||M.metaKey)&&(M.preventDefault(),g(function(T){const O=M.deltaY<0?T*1.1:T/1.1;return Math.max(.25,Math.min(4,O))}))}return o.jsxs("div",{ref:i,className:"h-full flex flex-col bg-white dark:bg-gray-900",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 pt-3 pb-2 text-xs flex-shrink-0",children:[o.jsx("div",{className:"font-semibold text-gray-700 dark:text-gray-200",children:"Tool Calls"}),o.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-gray-400",children:[o.jsxs("span",{children:[_.total," tools"]}),_.running?o.jsxs("span",{className:"text-blue-600 dark:text-blue-400",children:[_.running," live"]}):null,_.error?o.jsxs("span",{className:"text-red-600 dark:text-red-400",children:[_.error," err"]}):null,o.jsxs("div",{className:"flex items-center gap-0.5 ml-1 border-l border-gray-200 dark:border-gray-700 pl-2",children:[o.jsx("button",{type:"button",onClick:function(){m(function(M){return M==="TB"?"LR":"TB"})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px]",title:p==="TB"?"Switch to horizontal layout":"Switch to vertical layout","aria-label":"Toggle layout direction",children:p==="TB"?"↓":"→"}),o.jsx("button",{type:"button",onClick:function(){g(function(M){return Math.max(.25,M/1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom out","aria-label":"Zoom out",children:"−"}),o.jsxs("button",{type:"button",onClick:function(){g(1)},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 text-[10px] tabular-nums min-w-[3em]",title:"Reset zoom","aria-label":"Reset zoom",children:[Math.round(f*100),"%"]}),o.jsx("button",{type:"button",onClick:function(){g(function(M){return Math.min(4,M*1.25)})},className:"px-1.5 py-0.5 rounded text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800",title:"Zoom in","aria-label":"Zoom in",children:"+"})]}),_.hidden>0?o.jsx("button",{type:"button",onClick:function(){v(function(M){return!M})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(y?"border-blue-400 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:y?"Hide bookkeeping tools":"Show bookkeeping tools (todo, permission, etc.)",children:y?"hide bk":"show bk"}):null,_.thoughts>0?o.jsx("button",{type:"button",onClick:function(){b(function(M){return!M})},className:"ml-1 px-2 py-0.5 rounded border text-[10px] "+(x?"border-yellow-500 text-yellow-700 dark:text-yellow-300 bg-yellow-50 dark:bg-yellow-900/30":"border-gray-300 dark:border-gray-600 text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800"),title:x?"Hide reasoning bubbles":"Show reasoning bubbles ("+_.thoughts+" thoughts)",children:x?"💭 "+_.thoughts:"💭 off"}):null]})]}),o.jsx("div",{ref:s,className:"flex-1 min-h-0 overflow-auto px-3 pb-3",onWheel:L,children:o.jsxs("svg",{viewBox:"0 0 "+N+" "+R,width:F,height:H,style:{display:"block"},children:[o.jsxs("defs",{children:[o.jsx("marker",{id:"tcm-arrow-data",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?li.data.dark:li.data.light})}),o.jsx("marker",{id:"tcm-arrow-file",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?li.file.dark:li.file.light})}),o.jsx("marker",{id:"tcm-arrow-seq",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"5",markerHeight:"5",orient:"auto",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:t?li.seq.dark:li.seq.light})})]}),E.edges.map(function(M,T){const O=t?li[M.kind].dark:li[M.kind].light;return o.jsx("path",{d:w(M.points),fill:"none",stroke:O,strokeWidth:M.kind==="data"?1.75:M.kind==="file"?1.25:1,strokeDasharray:M.kind==="seq"?"3,3":void 0,markerEnd:"url(#tcm-arrow-"+M.kind+")"},"e"+T)}),E.nodes.map(function(M){const T=M.node,O=PQ(T,t),$=T.status==="running",Y=l===M.id;if(T.kind==="thought"){const K=T.label||"",V=32,I=3,q=K.split(/\s+/),ie=[];let J="";for(const je of q){if(ie.length===I-1&&(J+" "+je).length>V){ie.push(J);const X=q.slice(q.indexOf(je)).join(" ");ie.push(X.length>V?X.slice(0,V-1)+"…":X),J="";break}if(!J){J=je;continue}if((J+" "+je).length<=V?J=J+" "+je:(ie.push(J),J=je),ie.length>=I)break}return J&&ie.length<I&&ie.push(J),o.jsxs("g",{transform:"translate("+M.x+","+M.y+")",onMouseEnter:function(){c(M.id)},onMouseLeave:function(){c(null)},onClick:function(){n&&n(T)},style:{cursor:n?"pointer":"default"},children:[o.jsx("rect",{width:M.w,height:M.h,rx:M.h/2,ry:M.h/2,fill:O.fill,stroke:O.stroke,strokeWidth:Y?1.75:1,strokeDasharray:T.source==="reasoning"?void 0:"4,2"}),o.jsx("text",{x:14,y:2,fontSize:9,fontStyle:"italic",fill:O.label,children:ie.map(function(je,X){return o.jsx("tspan",{x:14,dy:X===0?14:11,children:(X===0?"💭 ":"")+je},"ln"+X)})}),o.jsx("title",{children:(T.source==="reasoning"?"[reasoning] ":"[thought] ")+(T.fullText||T.label)})]},M.id)}return o.jsxs("g",{transform:"translate("+M.x+","+M.y+")",onMouseEnter:function(){c(M.id)},onMouseLeave:function(){c(null)},onClick:function(){n&&n(T)},style:{cursor:n?"pointer":"default"},children:[o.jsx("rect",{width:M.w,height:M.h,rx:5,ry:5,fill:O.fill,stroke:O.stroke,strokeWidth:$||Y?2:1.25,opacity:T.hidden?.55:1,children:$?o.jsx("animate",{attributeName:"stroke-width",values:"1.5;2.5;1.5",dur:"1.6s",repeatCount:"indefinite"}):null}),o.jsx("text",{x:8,y:16,fontSize:10,fontWeight:600,fill:O.label,children:T.tool}),o.jsx("text",{x:8,y:32,fontSize:10,fill:t?"#cbd5e1":"#475569",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace",children:DQ(T.label,22)}),o.jsx("title",{children:T.tool+" · "+T.label+(T.status==="error"?" · ERROR":T.status==="running"?" · RUNNING":"")}),$?o.jsxs("g",{transform:"translate("+(M.w-9)+",9)",children:[o.jsx("circle",{r:4.5,fill:t?"#1e293b":"#ffffff",stroke:O.stroke,strokeWidth:.75}),o.jsxs("circle",{r:3,fill:t?"#38bdf8":"#0ea5e9",children:[o.jsx("animate",{attributeName:"opacity",values:"1;0.25;1",dur:"1.1s",repeatCount:"indefinite"}),o.jsx("animate",{attributeName:"r",values:"2.4;3.4;2.4",dur:"1.1s",repeatCount:"indefinite"})]})]}):null]},M.id)})]})})]})}/*! @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 M4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function BQ(e){if(Array.isArray(e))return e}function zQ(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,i,s,l=[],c=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(d){u=!0,a=d}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw a}}return l}}function UQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
104
104
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $Q(e,t){return BQ(e)||zQ(e,t)||HQ(e,t)||UQ()}function HQ(e,t){if(e){if(typeof e=="string")return M4(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M4(e,t):void 0}}const N3=Object.entries,L4=Object.setPrototypeOf,qQ=Object.isFrozen,WQ=Object.getPrototypeOf,VQ=Object.getOwnPropertyDescriptor;let Pn=Object.freeze,zn=Object.seal,Ks=Object.create,C3=typeof Reflect<"u"&&Reflect,Pb=C3.apply,Fb=C3.construct;Pn||(Pn=function(t){return t});zn||(zn=function(t){return t});Pb||(Pb=function(t,n){for(var r=arguments.length,a=new Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i];return t.apply(n,a)});Fb||(Fb=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return new t(...r)});const Us=wn(Array.prototype.forEach),GQ=wn(Array.prototype.lastIndexOf),O4=wn(Array.prototype.pop),$s=wn(Array.prototype.push),KQ=wn(Array.prototype.splice),hi=Array.isArray,ml=wn(String.prototype.toLowerCase),ey=wn(String.prototype.toString),D4=wn(String.prototype.match),rl=wn(String.prototype.replace),P4=wn(String.prototype.indexOf),YQ=wn(String.prototype.trim),XQ=wn(Number.prototype.toString),QQ=wn(Boolean.prototype.toString),F4=typeof BigInt>"u"?null:wn(BigInt.prototype.toString),B4=typeof Symbol>"u"?null:wn(Symbol.prototype.toString),Rn=wn(Object.prototype.hasOwnProperty),al=wn(Object.prototype.toString),An=wn(RegExp.prototype.test),Gi=ZQ(TypeError);function wn(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return Pb(e,t,r)}}function ZQ(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Fb(e,n)}}function Mt(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:ml;if(L4&&L4(e,null),!hi(t))return e;let r=t.length;for(;r--;){let a=t[r];if(typeof a=="string"){const i=n(a);i!==a&&(qQ(t)||(t[r]=i),a=i)}e[a]=!0}return e}function JQ(e){for(let t=0;t<e.length;t++)Rn(e,t)||(e[t]=null);return e}function Wn(e){const t=Ks(null);for(const r of N3(e)){var n=$Q(r,2);const a=n[0],i=n[1];Rn(e,a)&&(hi(i)?t[a]=JQ(i):i&&typeof i=="object"&&i.constructor===Object?t[a]=Wn(i):t[a]=i)}return t}function eZ(e){switch(typeof e){case"string":return e;case"number":return XQ(e);case"boolean":return QQ(e);case"bigint":return F4?F4(e):"0";case"symbol":return B4?B4(e):"Symbol()";case"undefined":return al(e);case"function":case"object":{if(e===null)return al(e);const t=e,n=Zr(t,"toString");if(typeof n=="function"){const r=n(t);return typeof r=="string"?r:al(r)}return al(e)}default:return al(e)}}function Zr(e,t){for(;e!==null;){const r=VQ(e,t);if(r){if(r.get)return wn(r.get);if(typeof r.value=="function")return wn(r.value)}e=WQ(e)}function n(){return null}return n}function tZ(e){try{return An(e,""),!0}catch{return!1}}const z4=Pn(["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"]),ty=Pn(["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"]),ny=Pn(["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"]),nZ=Pn(["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"]),ry=Pn(["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"]),rZ=Pn(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),U4=Pn(["#text"]),$4=Pn(["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"]),ay=Pn(["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"]),H4=Pn(["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"]),ju=Pn(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),aZ=zn(/{{[\w\W]*|^[\w\W]*}}/g),iZ=zn(/<%[\w\W]*|^[\w\W]*%>/g),sZ=zn(/\${[\w\W]*/g),oZ=zn(/^data-[\-\w.\u00B7-\uFFFF]+$/),lZ=zn(/^aria-[\-\w]+$/),q4=zn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cZ=zn(/^(?:\w+script|data):/i),uZ=zn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),dZ=zn(/^html$/i),fZ=zn(/^[a-z][.\w]*(-[.\w]+)+$/i),W4=zn(/<[/\w!]/g),V4=zn(/<[/\w]/g),gZ=zn(/<\/no(script|embed|frames)/i),pZ=zn(/\/>/i),wr={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},hZ=function(){return typeof window>"u"?null:window},mZ=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const a="data-tt-policy-suffix";n&&n.hasAttribute(a)&&(r=n.getAttribute(a));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},G4=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ci=function(t,n,r,a){return Rn(t,n)&&hi(t[n])?Mt(a.base?Wn(a.base):{},t[n],a.transform):r};function j3(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:hZ();const t=Be=>j3(Be);if(t.version="3.4.13",t.removed=[],!e||!e.document||e.document.nodeType!==wr.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,a=r.currentScript;e.DocumentFragment;const i=e.HTMLTemplateElement,s=e.Node,l=e.Element,c=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const d=e.DOMParser,f=e.trustedTypes,g=l.prototype,p=Zr(g,"cloneNode"),m=Zr(g,"remove"),y=Zr(g,"nextSibling"),v=Zr(g,"childNodes"),x=Zr(g,"parentNode"),b=Zr(g,"shadowRoot"),k=Zr(g,"attributes"),S=s&&s.prototype?Zr(s.prototype,"nodeType"):null,E=s&&s.prototype?Zr(s.prototype,"nodeName"):null,_=s&&s.prototype?Zr(s.prototype,"ownerDocument"):null;if(typeof i=="function"){const Be=n.createElement("template");Be.content&&Be.content.ownerDocument&&(n=Be.content.ownerDocument)}let w,N="",R,j=!1,P=0;const F=function(){if(P>0)throw Gi('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.')},H=function(U){F(),P++;try{return w.createHTML(U)}finally{P--}},L=function(U){F(),P++;try{return w.createScriptURL(U)}finally{P--}},M=function(){return j||(R=mZ(f,a),j=!0),R},T=n,O=T.implementation,$=T.createNodeIterator,Y=T.createDocumentFragment,A=T.getElementsByTagName,K=r.importNode;let V=G4();t.isSupported=typeof N3=="function"&&typeof x=="function"&&O&&O.createHTMLDocument!==void 0;const I=aZ,q=iZ,ie=sZ,J=oZ,je=lZ,X=cZ,he=uZ,Me=fZ;let we=q4,ge=null;const Se=Mt({},[...z4,...ty,...ny,...ry,...U4]);let Re=null;const me=Mt({},[...$4,...ay,...H4,...ju]);let ye=Object.seal(Ks(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}})),Oe=null,be=null;const ee=Object.seal(Ks(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ee=!0,fe=!0,ve=!1,de=!0,pe=!1,De=!0,B=!1,D=!1,G=null,ce=null,Te=!1,Ue=!1,Ve=!1,Qe=!1,Xe=!0,_t=!1;const He="user-content-";let at=!0,ue=!1,qe={},Ge=null;const bt=Mt({},["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 cn=null;const Un=Mt({},["audio","video","img","source","image","track"]);let Ln=null;const hn=Mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Zn="http://www.w3.org/1998/Math/MathML",rn="http://www.w3.org/2000/svg",jt="http://www.w3.org/1999/xhtml";let vr=jt,le=!1,te=null;const ke=Mt({},[Zn,rn,jt],ey),Ie=Pn(["mi","mo","mn","ms","mtext"]);let We=Mt({},Ie);const ht=Pn(["annotation-xml"]);let mt=Mt({},ht);const It=Mt({},["title","style","font","a","script"]);let _e=null;const it=["application/xhtml+xml","text/html"],Ot="text/html";let Dt=null,$n=null;const Sn=n.createElement("form"),Kr=function(U){return U instanceof RegExp||U instanceof Function},Za=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if($n&&$n===U)return;(!U||typeof U!="object")&&(U={}),U=Wn(U),_e=it.indexOf(U.PARSER_MEDIA_TYPE)===-1?Ot:U.PARSER_MEDIA_TYPE,Dt=_e==="application/xhtml+xml"?ey:ml,ge=ci(U,"ALLOWED_TAGS",Se,{transform:Dt}),Re=ci(U,"ALLOWED_ATTR",me,{transform:Dt}),te=ci(U,"ALLOWED_NAMESPACES",ke,{transform:ey}),Ln=ci(U,"ADD_URI_SAFE_ATTR",hn,{transform:Dt,base:hn}),cn=ci(U,"ADD_DATA_URI_TAGS",Un,{transform:Dt,base:Un}),Ge=ci(U,"FORBID_CONTENTS",bt,{transform:Dt}),Oe=ci(U,"FORBID_TAGS",Wn({}),{transform:Dt}),be=ci(U,"FORBID_ATTR",Wn({}),{transform:Dt}),qe=Rn(U,"USE_PROFILES")?U.USE_PROFILES&&typeof U.USE_PROFILES=="object"?Wn(U.USE_PROFILES):U.USE_PROFILES:!1,Ee=U.ALLOW_ARIA_ATTR!==!1,fe=U.ALLOW_DATA_ATTR!==!1,ve=U.ALLOW_UNKNOWN_PROTOCOLS||!1,de=U.ALLOW_SELF_CLOSE_IN_ATTR!==!1,pe=U.SAFE_FOR_TEMPLATES||!1,De=U.SAFE_FOR_XML!==!1,B=U.WHOLE_DOCUMENT||!1,Ue=U.RETURN_DOM||!1,Ve=U.RETURN_DOM_FRAGMENT||!1,Qe=U.RETURN_TRUSTED_TYPE||!1,Te=U.FORCE_BODY||!1,Xe=U.SANITIZE_DOM!==!1,_t=U.SANITIZE_NAMED_PROPS||!1,at=U.KEEP_CONTENT!==!1,ue=U.IN_PLACE||!1,we=tZ(U.ALLOWED_URI_REGEXP)?U.ALLOWED_URI_REGEXP:q4,vr=typeof U.NAMESPACE=="string"?U.NAMESPACE:jt,We=Rn(U,"MATHML_TEXT_INTEGRATION_POINTS")&&U.MATHML_TEXT_INTEGRATION_POINTS&&typeof U.MATHML_TEXT_INTEGRATION_POINTS=="object"?Wn(U.MATHML_TEXT_INTEGRATION_POINTS):Mt({},Ie),mt=Rn(U,"HTML_INTEGRATION_POINTS")&&U.HTML_INTEGRATION_POINTS&&typeof U.HTML_INTEGRATION_POINTS=="object"?Wn(U.HTML_INTEGRATION_POINTS):Mt({},ht);const se=Rn(U,"CUSTOM_ELEMENT_HANDLING")&&U.CUSTOM_ELEMENT_HANDLING&&typeof U.CUSTOM_ELEMENT_HANDLING=="object"?Wn(U.CUSTOM_ELEMENT_HANDLING):Ks(null);if(ye=Ks(null),Rn(se,"tagNameCheck")&&Kr(se.tagNameCheck)&&(ye.tagNameCheck=se.tagNameCheck),Rn(se,"attributeNameCheck")&&Kr(se.attributeNameCheck)&&(ye.attributeNameCheck=se.attributeNameCheck),Rn(se,"allowCustomizedBuiltInElements")&&typeof se.allowCustomizedBuiltInElements=="boolean"&&(ye.allowCustomizedBuiltInElements=se.allowCustomizedBuiltInElements),zn(ye),pe&&(fe=!1),Ve&&(Ue=!0),qe&&(ge=Mt({},U4),Re=Ks(null),qe.html===!0&&(Mt(ge,z4),Mt(Re,$4)),qe.svg===!0&&(Mt(ge,ty),Mt(Re,ay),Mt(Re,ju)),qe.svgFilters===!0&&(Mt(ge,ny),Mt(Re,ay),Mt(Re,ju)),qe.mathMl===!0&&(Mt(ge,ry),Mt(Re,H4),Mt(Re,ju))),ee.tagCheck=null,ee.attributeCheck=null,Rn(U,"ADD_TAGS")&&(typeof U.ADD_TAGS=="function"?ee.tagCheck=U.ADD_TAGS:hi(U.ADD_TAGS)&&(ge===Se&&(ge=Wn(ge)),Mt(ge,U.ADD_TAGS,Dt))),Rn(U,"ADD_ATTR")&&(typeof U.ADD_ATTR=="function"?ee.attributeCheck=U.ADD_ATTR:hi(U.ADD_ATTR)&&(Re===me&&(Re=Wn(Re)),Mt(Re,U.ADD_ATTR,Dt))),Rn(U,"ADD_URI_SAFE_ATTR")&&hi(U.ADD_URI_SAFE_ATTR)&&Mt(Ln,U.ADD_URI_SAFE_ATTR,Dt),Rn(U,"FORBID_CONTENTS")&&hi(U.FORBID_CONTENTS)&&(Ge===bt&&(Ge=Wn(Ge)),Mt(Ge,U.FORBID_CONTENTS,Dt)),Rn(U,"ADD_FORBID_CONTENTS")&&hi(U.ADD_FORBID_CONTENTS)&&(Ge===bt&&(Ge=Wn(Ge)),Mt(Ge,U.ADD_FORBID_CONTENTS,Dt)),at&&(ge["#text"]=!0),B&&Mt(ge,["html","head","body"]),ge.table&&(Mt(ge,["tbody"]),delete Oe.tbody),U.TRUSTED_TYPES_POLICY){if(typeof U.TRUSTED_TYPES_POLICY.createHTML!="function")throw Gi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof U.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Gi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const Ae=w;w=U.TRUSTED_TYPES_POLICY;try{N=H("")}catch(et){throw w=Ae,et}}else U.TRUSTED_TYPES_POLICY===null?(w=void 0,N=""):(w===void 0&&(w=M()),w&&typeof N=="string"&&(N=H("")));Pn&&Pn(U),$n=U},cr=Mt({},[...ty,...ny,...nZ]),Tc=Mt({},[...ry,...rZ]),Ja=function(U,se,Ae){return se.namespaceURI===jt?U==="svg":se.namespaceURI===Zn?U==="svg"&&(Ae==="annotation-xml"||We[Ae]):!!cr[U]},Ts=function(U,se,Ae){return se.namespaceURI===jt?U==="math":se.namespaceURI===rn?U==="math"&&mt[Ae]:!!Tc[U]},Ac=function(U,se,Ae){return se.namespaceURI===rn&&!mt[Ae]||se.namespaceURI===Zn&&!We[Ae]?!1:!Tc[U]&&(It[U]||!cr[U])},Rc=function(U){let se=x(U);(!se||!se.tagName)&&(se={namespaceURI:vr,tagName:"template"});const Ae=ml(U.tagName),et=ml(se.tagName);return te[U.namespaceURI]?U.namespaceURI===rn?Ja(Ae,se,et):U.namespaceURI===Zn?Ts(Ae,se,et):U.namespaceURI===jt?Ac(Ae,se,et):!!(_e==="application/xhtml+xml"&&te[U.namespaceURI]):!1},kr=function(U){$s(t.removed,{element:U});try{x(U).removeChild(U)}catch{if(m(U),!x(U))throw Gi("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},On=function(U){$i(U);const se=v(U);if(se){const et=[];Us(se,st=>{$s(et,st)}),Us(et,st=>{try{m(st)}catch{}})}const Ae=k(U);if(Ae)for(let et=Ae.length-1;et>=0;--et){const st=Ae[et],gt=st&&st.name;if(typeof gt=="string")try{U.removeAttribute(gt)}catch{}}},mn=function(U,se){try{$s(t.removed,{attribute:se.getAttributeNode(U),from:se})}catch{$s(t.removed,{attribute:null,from:se})}if(se.removeAttribute(U),U==="is")if(Ue||Ve)try{kr(se)}catch{}else try{se.setAttribute(U,"")}catch{}},Ic=function(U){const se=k(U);if(se)for(let Ae=se.length-1;Ae>=0;--Ae){const et=se[Ae],st=et&&et.name;if(!(typeof st!="string"||Re[Dt(st)]))try{U.removeAttribute(st)}catch{}}},$i=function(U){const se=[U];for(;se.length>0;){const Ae=se.pop();(S?S(Ae):Ae.nodeType)===wr.element&&Ic(Ae);const st=v(Ae);if(st)for(let gt=st.length-1;gt>=0;--gt)se.push(st[gt])}},da=function(U){if(!De)return;const se=[U];for(;se.length>0;){const Ae=se.pop(),et=S?S(Ae):Ae.nodeType;if(et===wr.processingInstruction||et===wr.comment&&An(V4,Ae.data)){try{m(Ae)}catch{}continue}if(et===wr.element){const gt=Ae,Pt=Dt(E?E(Ae):Ae.nodeName);try{gt.hasAttribute&&gt.hasAttribute("patchsrc")&&gt.removeAttribute("patchsrc"),gt.hasAttribute&&gt.hasAttribute("for")&&Pt!=="label"&&Pt!=="output"&&gt.removeAttribute("for")}catch{}}const st=v(Ae);if(st)for(let gt=st.length-1;gt>=0;--gt)se.push(st[gt])}},Mc=function(U){let se=null,Ae=null;if(Te)U="<remove></remove>"+U;else{const gt=D4(U,/^[\r\n\t ]+/);Ae=gt&&gt[0]}_e==="application/xhtml+xml"&&vr===jt&&(U='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+U+"</body></html>");const et=w?H(U):U;if(vr===jt)try{se=new d().parseFromString(et,_e)}catch{}if(!se||!se.documentElement){se=O.createDocument(vr,"template",null);try{se.documentElement.innerHTML=le?N:et}catch{}}const st=se.body||se.documentElement;return U&&Ae&&st.insertBefore(n.createTextNode(Ae),st.childNodes[0]||null),vr===jt?A.call(se,B?"html":"body")[0]:B?se.documentElement:st},As=function(U){const se=_?_(U):U.ownerDocument;return $.call(se||U,U,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Rs=function(U){return U=rl(U,I," "),U=rl(U,q," "),U=rl(U,ie," "),U},ei=function(U){var se;U.normalize();const Ae=_?_(U):U.ownerDocument,et=$.call(Ae||U,U,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let st=et.nextNode();for(;st;)st.data=Rs(st.data),st=et.nextNode();const gt=(se=U.querySelectorAll)===null||se===void 0?void 0:se.call(U,"template");gt&&Us(gt,Pt=>{Ca(Pt.content)&&ei(Pt.content)})},Is=function(U){const se=E?E(U):null;return typeof se!="string"||Dt(se)!=="form"?!1:typeof U.nodeName!="string"||typeof U.textContent!="string"||typeof U.removeChild!="function"||U.attributes!==k(U)||typeof U.removeAttribute!="function"||typeof U.setAttribute!="function"||typeof U.namespaceURI!="string"||typeof U.insertBefore!="function"||typeof U.hasChildNodes!="function"||U.nodeType!==S(U)||U.childNodes!==v(U)},Ca=function(U){if(!S||typeof U!="object"||U===null)return!1;try{return S(U)===wr.documentFragment}catch{return!1}},Yr=function(U){if(!S||typeof U!="object"||U===null)return!1;try{return typeof S(U)=="number"}catch{return!1}};function ur(Be,U,se){Be.length!==0&&Us(Be,Ae=>{Ae.call(t,U,se,$n)})}const Pf=function(U,se){return!!(De&&U.hasChildNodes()&&!Yr(U.firstElementChild)&&An(W4,U.textContent)&&An(W4,U.innerHTML)||De&&U.namespaceURI===jt&&se==="style"&&Yr(U.firstElementChild)||U.nodeType===wr.processingInstruction||De&&U.nodeType===wr.comment&&An(V4,U.data))},Hi=function(U,se,Ae){if(!Oe[se]&&Dc(se)&&(ye.tagNameCheck instanceof RegExp&&An(ye.tagNameCheck,se)||ye.tagNameCheck instanceof Function&&ye.tagNameCheck(se)))return!1;if(at&&!Ge[se]){const et=x(U),st=v(U);if(st&&et){const gt=st.length;for(let Pt=gt-1;Pt>=0;--Pt){const $t=U===Ae?p(st[Pt],!0):st[Pt];et.insertBefore($t,y(U))}}}return kr(U),!0},Bo=function(U,se,Ae,et){return U.length===0?se:se===Ae||se===et?Wn(se):se},tt=function(U,se){if(ur(V.beforeSanitizeElements,U,null),U!==se&&x(U)===null)return ue&&$i(U),!0;if(Is(U))return kr(U),!0;const Ae=Dt(E?E(U):U.nodeName);if(ge=Bo(V.uponSanitizeElement,ge,Se,G),ur(V.uponSanitizeElement,U,{tagName:Ae,allowedTags:ge}),U!==se&&x(U)===null)return ue&&$i(U),!0;if(Pf(U,Ae))return kr(U),!0;if(Oe[Ae]||!(ee.tagCheck instanceof Function&&ee.tagCheck(Ae))&&!ge[Ae]){const st=Hi(U,Ae,se);return st===!1&&ur(V.afterSanitizeElements,U,null),st}if((S?S(U):U.nodeType)===wr.element&&!Rc(U)||(Ae==="noscript"||Ae==="noembed"||Ae==="noframes")&&An(gZ,U.innerHTML))return kr(U),!0;if(pe&&U.nodeType===wr.text){const st=Rs(U.textContent);U.textContent!==st&&($s(t.removed,{element:U.cloneNode()}),U.textContent=st)}return ur(V.afterSanitizeElements,U,null),!1},Lc=function(U,se,Ae){if(be[se]||De&&se==="patchsrc"||De&&se==="for"&&U!=="label"&&U!=="output"||Xe&&(se==="id"||se==="name")&&(Ae in n||Ae in Sn))return!1;const et=Re[se]||ee.attributeCheck instanceof Function&&ee.attributeCheck(se,U);if(!(fe&&An(J,se))){if(!(Ee&&An(je,se))){if(et){if(!Ln[se]){if(!An(we,rl(Ae,he,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&U!=="script"&&P4(Ae,"data:")===0&&cn[U])){if(!(ve&&!An(X,rl(Ae,he,"")))){if(Ae)return!1}}}}}else if(!(Dc(U)&&(ye.tagNameCheck instanceof RegExp&&An(ye.tagNameCheck,U)||ye.tagNameCheck instanceof Function&&ye.tagNameCheck(U))&&(ye.attributeNameCheck instanceof RegExp&&An(ye.attributeNameCheck,se)||ye.attributeNameCheck instanceof Function&&ye.attributeNameCheck(se,U))||se==="is"&&ye.allowCustomizedBuiltInElements&&(ye.tagNameCheck instanceof RegExp&&An(ye.tagNameCheck,Ae)||ye.tagNameCheck instanceof Function&&ye.tagNameCheck(Ae))))return!1}}return!0},Oc=Mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Dc=function(U){return!Oc[ml(U)]&&An(Me,U)},Ff=function(U,se,Ae,et){if(w&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!Ae)switch(f.getAttributeType(U,se)){case"TrustedHTML":return H(et);case"TrustedScriptURL":return L(et)}return et},Pc=function(U,se,Ae,et){try{Ae?U.setAttributeNS(Ae,se,et):U.setAttribute(se,et),Is(U)?kr(U):O4(t.removed)}catch{mn(se,U)}},Fc=function(U){ur(V.beforeSanitizeAttributes,U,null);const se=U.attributes;if(!se||Is(U))return;Re=Bo(V.uponSanitizeAttribute,Re,me,ce);const Ae={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Re,forceKeepAttr:void 0};let et=se.length;const st=Dt(U.nodeName);for(;et--;){const gt=se[et],Pt=gt.name,$t=gt.namespaceURI,un=gt.value,Xt=Dt(Pt),ni=un;let xn=Pt==="value"?ni:YQ(ni);if(Ae.attrName=Xt,Ae.attrValue=xn,Ae.keepAttr=!0,Ae.forceKeepAttr=void 0,ur(V.uponSanitizeAttribute,U,Ae),xn=Ae.attrValue,_t&&(Xt==="id"||Xt==="name")&&P4(xn,He)!==0&&(mn(Pt,U),xn=He+xn),De&&An(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,xn)){mn(Pt,U);continue}if(Xt==="attributename"&&D4(xn,"href")){mn(Pt,U);continue}if(!Ae.forceKeepAttr){if(!Ae.keepAttr){mn(Pt,U);continue}if(!de&&An(pZ,xn)){mn(Pt,U);continue}if(pe&&(xn=Rs(xn)),!Lc(st,Xt,xn)){mn(Pt,U);continue}xn=Ff(st,Xt,$t,xn),xn!==ni&&Pc(U,Pt,$t,xn)}}ur(V.afterSanitizeAttributes,U,null)},ti=function(U){let se=null;const Ae=As(U);for(ur(V.beforeSanitizeShadowDOM,U,null);se=Ae.nextNode();)if(ur(V.uponSanitizeShadowNode,se,null),tt(se,U),Fc(se),Ca(se.content)&&ti(se.content),(S?S(se):se.nodeType)===wr.element){const st=b(se);Ca(st)&&(zo(st),ti(st))}ur(V.afterSanitizeShadowDOM,U,null)},zo=function(U){const se=[{node:U,shadow:null}];for(;se.length>0;){const Ae=se.pop();if(Ae.shadow){ti(Ae.shadow);continue}const et=Ae.node,gt=(S?S(et):et.nodeType)===wr.element,Pt=v(et);if(Pt)for(let $t=Pt.length-1;$t>=0;--$t)se.push({node:Pt[$t],shadow:null});if(gt){const $t=E?E(et):null;if(typeof $t=="string"&&Dt($t)==="template"){const un=et.content;Ca(un)&&se.push({node:un,shadow:null})}}if(gt){const $t=b(et);Ca($t)&&se.push({node:null,shadow:$t},{node:$t,shadow:null})}}};return t.sanitize=function(Be){let U=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,Ae=null,et=null,st=null;if(le=!Be,le&&(Be="<!-->"),typeof Be!="string"&&!Yr(Be)&&(Be=eZ(Be),typeof Be!="string"))throw Gi("dirty is not a string, aborting");if(!t.isSupported)return Be;D?(ge=G,Re=ce):Za(U),(V.uponSanitizeElement.length>0||V.uponSanitizeAttribute.length>0)&&(ge=Wn(ge)),V.uponSanitizeAttribute.length>0&&(Re=Wn(Re)),t.removed=[];const gt=ue&&typeof Be!="string"&&Yr(Be);if(gt){da(Be);const un=E?E(Be):Be.nodeName;if(typeof un=="string"){const Xt=Dt(un);if(!ge[Xt]||Oe[Xt])throw On(Be),Gi("root node is forbidden and cannot be sanitized in-place")}if(Is(Be))throw On(Be),Gi("root node is clobbered and cannot be sanitized in-place");try{zo(Be)}catch(Xt){throw On(Be),Xt}}else if(Yr(Be))se=Mc("<!---->"),Ae=se.ownerDocument.importNode(Be,!0),Ae.nodeType===wr.element&&Ae.nodeName==="BODY"||Ae.nodeName==="HTML"?se=Ae:se.appendChild(Ae),zo(Ae);else{if(!Ue&&!pe&&!B&&Be.indexOf("<")===-1)return w&&Qe?H(Be):Be;if(se=Mc(Be),!se)return Ue?null:Qe?N:""}se&&Te&&kr(se.firstChild);const Pt=gt?Be:se;try{const un=As(Pt);for(;et=un.nextNode();)tt(et,Pt),Fc(et),Ca(et.content)&&ti(et.content)}catch(un){throw gt&&(On(Be),Us(t.removed,Xt=>{Xt.element&&$i(Xt.element)})),un}if(gt)return Us(t.removed,un=>{un.element&&$i(un.element)}),pe&&ei(Be),Be;if(Ue){if(pe&&ei(se),Ve)for(st=Y.call(se.ownerDocument);se.firstChild;)st.appendChild(se.firstChild);else st=se;return(Re.shadowroot||Re.shadowrootmode)&&(st=K.call(r,st,!0)),st}let $t=B?se.outerHTML:se.innerHTML;return B&&ge["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&An(dZ,se.ownerDocument.doctype.name)&&($t="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
105
- `+$t),pe&&($t=Rs($t)),w&&Qe?H($t):$t},t.setConfig=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Za(Be),D=!0,G=ge,ce=Re},t.clearConfig=function(){$n=null,D=!1,G=null,ce=null,w=R,N=""},t.isValidAttribute=function(Be,U,se){$n||Za({});const Ae=Dt(Be),et=Dt(U);return Lc(Ae,et,se)},t.addHook=function(Be,U){typeof U=="function"&&Rn(V,Be)&&$s(V[Be],U)},t.removeHook=function(Be,U){if(Rn(V,Be)){if(U!==void 0){const se=GQ(V[Be],U);return se===-1?void 0:KQ(V[Be],se,1)[0]}return O4(V[Be])}},t.removeHooks=function(Be){Rn(V,Be)&&(V[Be]=[])},t.removeAllHooks=function(){V=G4()},t}var xZ=j3();let iy=null;function yZ(){return iy||(iy=R5(()=>import("./mermaid.core-Csqy-TMM.js").then(e=>e.bo),[]).then(function(e){const t=e.default||e;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),t})),iy}function K4(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let Y4=0;function bZ(){return Y4+=1,"pave-canvas-"+Y4}function vZ({source:e}){const t=h.useRef(null),n=h.useRef(bZ()),[r,a]=h.useState(null),[i,s]=h.useState(K4());return h.useEffect(function(){if(typeof window>"u")return;const l=new MutationObserver(function(){const c=K4();s(function(u){return u!==c?c:u})});return l.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),function(){l.disconnect()}},[]),h.useEffect(function(){let l=!1;return a(null),yZ().then(function(c){l||(c.initialize({startOnLoad:!1,securityLevel:"strict",theme:i?"dark":"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),c.render(n.current,e).then(function(u){if(!l&&t.current){let d=u.svg;d=d.replace(/<svg([^>]*)\sstyle="[^"]*max-width:[^";]*;?[^"]*"/i,"<svg$1"),d=d.replace(/(<svg[^>]*)\swidth="[^"]*"/i,"$1"),d=d.replace(/(<svg[^>]*)\sheight="[^"]*"/i,"$1"),d=d.replace(/<svg\b/i,'<svg width="100%" height="100%" preserveAspectRatio="xMidYMid meet"'),t.current.innerHTML=d}}).catch(function(u){l||a(u&&u.message||String(u))}))}).catch(function(c){l||a("Failed to load mermaid: "+(c&&c.message||String(c)))}),function(){l=!0}},[e,i]),r?o.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[o.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),o.jsx("pre",{className:"whitespace-pre-wrap",children:r}),o.jsxs("details",{className:"mt-2",children:[o.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),o.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):o.jsx("div",{ref:t,className:"mermaid-canvas w-full h-full flex items-center justify-center [&>svg]:max-w-full [&>svg]:max-h-full [&>svg]:w-full [&>svg]:h-auto"})}function kZ({source:e}){const t=h.useMemo(function(){return xZ.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return o.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function _Z({source:e}){return o.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function wZ({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=o.jsx(vZ,{source:e.source}):e.type==="svg"?t=o.jsx(kZ,{source:e.source}):e.type==="katex"?t=o.jsx(_Z,{source:e.source}):t=o.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function X4({canvases:e,onClear:t}){const n=Array.isArray(e)?e:[],[r,a]=h.useState(Math.max(0,n.length-1)),[i,s]=h.useState(1),[l,c]=h.useState(!1);h.useEffect(function(){a(function(v){return v>=n.length-2?Math.max(0,n.length-1):Math.min(v,Math.max(0,n.length-1))})},[n.length]),h.useEffect(function(){s(1)},[r]),h.useEffect(function(){if(!l)return;const v=x=>{x.key==="Escape"&&c(!1)};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[l]);const u=h.useCallback(()=>s(v=>Math.min(4,+(v+.25).toFixed(2))),[]),d=h.useCallback(()=>s(v=>Math.max(.5,+(v-.25).toFixed(2))),[]),f=h.useCallback(()=>s(1),[]);if(n.length===0)return o.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[o.jsx("svg",{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})}),o.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 max-w-xs",children:["Ask the agent to draw something here. It can use the ",o.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"canvas"})," tool to render Mermaid diagrams, SVG illustrations, or math."]})]});const g=Math.min(Math.max(0,r),n.length-1),p=n[g],m=o.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5 border-b border-gray-200 dark:border-gray-700 text-xs",children:[n.length>1?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:()=>a(Math.max(0,g-1)),disabled:g===0,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Previous canvas",children:"←"}),o.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[g+1,"/",n.length]}),o.jsx("button",{type:"button",onClick:()=>a(Math.min(n.length-1,g+1)),disabled:g===n.length-1,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Next canvas",children:"→"})]}):o.jsx("div",{}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:d,disabled:i<=.5,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom out",children:"−"}),o.jsxs("button",{type:"button",onClick:f,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 tabular-nums min-w-[3rem]",title:"Reset zoom",children:[Math.round(i*100),"%"]}),o.jsx("button",{type:"button",onClick:u,disabled:i>=4,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom in",children:"+"}),o.jsx("button",{type:"button",onClick:()=>c(v=>!v),className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:l?"Exit fullscreen (Esc)":"Fullscreen",children:l?"⤢":"⛶"}),t?o.jsx("button",{type:"button",onClick:t,className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-red-50 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400",title:"Clear all canvases (hides them; messages preserved)",children:"✕"}):null]})]}),y=o.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[p.title?o.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:p.title}):null,o.jsx("div",{style:{transform:`scale(${i})`,transformOrigin:"top left",width:i===1?"100%":`${100/i}%`},children:o.jsx(wZ,{canvas:p})}),p.caption?o.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:p.caption}):null]});return l?o.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[m,y]}):o.jsxs("div",{className:"h-full flex flex-col",children:[m,y]})}function EZ(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function SZ(e,t){const n=EZ(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}const q1={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function W1(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function V1(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}const Q4={"claude-opus-4.5":2e5,"claude-opus-4.6":2e5,"claude-sonnet-4":2e5,"claude-sonnet-4.5":2e5,"claude-sonnet-4.6":2e5,"gpt-4o":128e3,"gpt-4.1":1047576,"gpt-4-turbo":128e3,"gpt-4":8192,o1:2e5,"o1-mini":128e3,o3:2e5,"o3-mini":2e5},NZ=128e3;function sy(e){const[t,n]=h.useState(e),r=h.useRef(e),a=h.useRef(0),i=h.useRef(0);return h.useEffect(()=>{if(e===r.current)return;a.current=0,r.current=t;const s=400,l=t,c=e,u=d=>{a.current||(a.current=d);const f=d-a.current,g=Math.min(f/s,1),p=1-Math.pow(1-g,3);n(Math.round(l+(c-l)*p)),g<1?i.current=requestAnimationFrame(u):n(c)};return i.current=requestAnimationFrame(u),()=>cancelAnimationFrame(i.current)},[e]),t}function CZ({messages:e,isBusy:t,activeModel:n,sessionModel:r,isPrivateMode:a,registryEntries:i}){var K,V;var{t:s}=Ct();const l=e.filter(I=>{var q;return((q=I.info)==null?void 0:q.role)==="user"}).length,c=e.filter(I=>{var q;return((q=I.info)==null?void 0:q.role)==="assistant"}).length;let u=0,d=0,f=0,g=null,p=null;for(let I=e.length-1;I>=0;I--){const q=e[I];if(((K=q.info)==null?void 0:K.role)==="assistant"&&((V=q.info)==null?void 0:V.mode)!=="compaction"){const ie=q.info.tokens;if(ie&&(ie.input||ie.output)){!g&&q.info.modelID&&(g=q.info.modelID),u=ie.lastInput??ie.input??0,d=ie.lastOutput??ie.output??0,f=ie.lastReasoning??ie.reasoning??0,q.info.contextLimit&&(p=q.info.contextLimit);break}}}const m=sy(u),y=sy(d),v=sy(f),x=m+y+v,b=u+d+f>0;let k=n;typeof r=="string"&&r?k=r:r&&r.providerID&&r.modelID&&(k=r.providerID+"/"+r.modelID);let{modelID:S,activeModelID:E}=SZ(k,g),_=null;if(a){S="privacy",E="privacy";let I=null;typeof r=="string"&&r?I=r.includes("/")?r.split("/").pop():r:r&&r.modelID&&(I=r.modelID),_=I||(n?String(n).split("/").pop():null)}else g&&E&&g!==E&&(_=g);const w=h.useMemo(()=>{const I={};if(i&&i.length>0){for(const q of i)if(q.limit&&typeof q.limit.context=="number"&&q.limit.context>0){I[q.key]=q.limit.context;const ie=q.key.includes("/")?q.key.split("/").pop():q.key;ie&&(I[ie]=q.limit.context)}}return I},[i]),N=g||S,j=!!(g&&E&&g!==E)&&(w[k]||w[S]||Q4[S])||p||w[N]||w[k]||Q4[N]||NZ,P=Math.min(100,Math.round(m/j*100));let F="bg-green-500";P>=90?F="bg-red-500":P>=75?F="bg-orange-500":P>=50&&(F="bg-yellow-500");const H="border-gray-200 dark:border-gray-800",L="text-gray-500 dark:text-gray-400",M="text-gray-500 dark:text-gray-400",T="text-gray-700 dark:text-gray-300",O="border-gray-100 dark:border-gray-800";return o.jsxs("div",{className:`p-4 border-t ${H}`,children:[o.jsx("p",{className:`text-xs ${L} uppercase tracking-wide font-medium mb-3`,children:s("token_usage.session_info")}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.messages")}),o.jsx("span",{className:`text-xs font-medium ${T}`,children:l+c})]}),S&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.model")}),o.jsx("span",{className:`text-xs font-medium ${T} truncate ml-2 max-w-[140px]`,children:Z4(S)})]}),_&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.originally")}),o.jsx("span",{className:`text-xs ${M} truncate ml-2 max-w-[140px]`,children:Z4(_)})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.status")}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${t?"bg-accent-400 animate-pulse":"bg-green-500"}`}),o.jsx("span",{className:`text-xs font-medium ${T}`,children:s(t?"token_usage.generating":"token_usage.idle")})]})]}),b?o.jsx(o.Fragment,{children:o.jsxs("div",{className:`border-t ${O} pt-2 mt-2`,children:[o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Context"}),o.jsxs("span",{className:`text-xs ${M}`,children:[P,"% of ",(j/1e3).toFixed(0),"k"]})]}),o.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:o.jsx("div",{className:`h-full ${F} transition-all duration-300`,style:{width:`${P}%`}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Input"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:m.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center justify-between mt-1",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Output"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:y.toLocaleString()})]}),f>0&&o.jsxs("div",{className:"flex items-center justify-between mt-1",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Reasoning"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:v.toLocaleString()})]}),o.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${O}`,children:[o.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Total"}),o.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:x.toLocaleString()})]})]})}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Tokens"}),o.jsx("span",{className:`text-xs ${M}`,children:"--"})]})]})]})}function Z4(e){return e?{"claude-opus-4.5":"Claude Opus 4.5","claude-opus-4.6":"Claude Opus 4.6","claude-sonnet-4":"Claude Sonnet 4","claude-sonnet-4.5":"Claude Sonnet 4.5","claude-sonnet-4.6":"Claude Sonnet 4.6","gpt-4o":"GPT-4o","gpt-4.1":"GPT-4.1","gpt-4-turbo":"GPT-4 Turbo","gpt-4":"GPT-4"}[e]||e:""}function jZ({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:a,lockedReason:i}){const{t:s}=Ct(),[l,c]=h.useState(!1),u=h.useRef(null),[d,f]=h.useState(-1),g=h.useRef([]);h.useEffect(()=>{if(!l)return;function b(k){u.current&&!u.current.contains(k.target)&&c(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),h.useEffect(()=>{if(!l)return;function b(k){if(k.key==="Escape"){c(!1);return}k.key!=="ArrowDown"&&k.key!=="ArrowUp"&&k.key!=="Home"&&k.key!=="End"||(k.preventDefault(),f(S=>{const E=g.current.length;if(!E)return S;const _=typeof S=="number"?S:-1;let w=_;return k.key==="ArrowDown"?w=_<E-1?_+1:0:k.key==="ArrowUp"?w=_>0?_-1:E-1:k.key==="Home"?w=0:k.key==="End"&&(w=E-1),g.current[w]&&g.current[w].focus(),w}))}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[l]);const p=typeof e=="string"&&e.trim()?e.trim():null,m=p!=null,y=Array.isArray(n)?n:[],v=TZ(p,t,y,s),x=h.useCallback(b=>{r(b===t||p&&p===b?null:b),c(!1)},[p,t,r]);return g.current.length=y.length,o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(b=>!b),disabled:a,className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded-md transition-colors "+(m||v?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-900/50":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800")+(a?" opacity-50 cursor-not-allowed":" cursor-pointer"),title:i||s("model_selector.title"),"aria-label":i||s("model_selector.title"),"aria-haspopup":"menu","aria-expanded":l,children:[i?o.jsxs("svg",{className:"w-3.5 h-3.5 flex-shrink-0 text-emerald-600 dark:text-emerald-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 11c.667 0 2 .4 2 2v3a2 2 0 11-4 0v-3c0-1.6 1.333-2 2-2zM6 11V8a6 6 0 1112 0v3"}),o.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):o.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),o.jsx("span",{className:"max-w-[120px] truncate",children:v}),o.jsx("svg",{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),l&&o.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] max-h-72 overflow-y-auto bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",role:"menu","aria-label":s("model_selector.list_label"),children:[y.length===0&&o.jsx("div",{className:"px-3 py-2 text-xs text-gray-400 dark:text-gray-500",children:s("model_selector.no_models")}),y.map((b,k)=>{const S=p===b.key,E=!!t&&(b.key===t||b.target===t||b.url===t),_=b.builtin?b.key:b.displayName||b.key;return o.jsxs("button",{type:"button",ref:w=>{g.current[k]=w},tabIndex:d===k?0:-1,role:"menuitemradio","aria-checked":S||!m&&E,onClick:()=>x(b.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(S||!m&&E?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"),children:[o.jsx("span",{className:"font-medium",children:_}),E&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",s("model_selector.default_label"),")"]})]},b.key)})]})]})}function TZ(e,t,n,r){return e?J4(e,n):t?J4(t,n):r("model_selector.default_label")}function AZ(e,t){if(!e||!Array.isArray(t))return null;for(let n=0;n<t.length;n++){const r=t[n];if(r&&(r.key===e||r.target===e||r.url===e))return r}return null}function J4(e,t){if(!e)return"";const n=AZ(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function RZ(e){e.sessionId;var t=e.disabledSkills,n=e.onToggle,r=e.onResetToDefaults,a=e.t,i=e.disabled,s=h.useState(!1),l=s[0],c=s[1],u=h.useState([]),d=u[0],f=u[1],g=h.useState(!1),p=g[0],m=g[1],y=h.useRef(null),v=t instanceof Array?new Set(t):new Set,x=h.useCallback(async function(){m(!0);try{var _=await Bv();f(_||[])}catch{}finally{m(!1)}},[]);h.useEffect(function(){x()},[x]),h.useEffect(function(){if(!l)return;function _(w){y.current&&!y.current.contains(w.target)&&c(!1)}return document.addEventListener("mousedown",_),function(){document.removeEventListener("mousedown",_)}},[l]);var b=v.size,k=v.has("agent"),S=k?b-1:b,E=Math.max(0,d.length-S+(k?0:1));return o.jsxs("div",{className:"relative",ref:y,children:[o.jsxs("button",{onClick:function(){c(!l)},disabled:i,className:"p-1.5 rounded-lg transition-colors "+(b>0?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800")+(i?" opacity-50 cursor-not-allowed":""),title:a("skills.toggle_title"),"aria-label":a("skills.toggle_title"),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),E>0&&o.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 text-[9px] font-bold flex items-center justify-center bg-primary-500 text-white rounded-full",children:E})]}),l&&o.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50 max-h-80 overflow-y-auto",children:[o.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[o.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:a("skills.toggle_header")}),o.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:a("skills.toggle_hint")})]}),p?o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):d.length===0?o.jsx("div",{className:"px-3 py-4 text-center",children:o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:a("skills.no_skills")})}):o.jsx("div",{className:"py-1",children:d.map(function(_){var w=v.has(_.name);return o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[o.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:_.name}),o.jsx("button",{onClick:function(){n(_.name,w)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(w?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!w,children:o.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(w?"translate-x-1":"translate-x-5")})})]},_.name)})}),o.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:o.jsx("p",{className:"text-[10px] font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wide",children:a("skills.builtin_tools")})}),o.jsx("div",{className:"py-1",children:o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[o.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:a("skills.agent_comm")}),o.jsx("button",{onClick:function(){n("agent",k)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(k?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!k,children:o.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(k?"translate-x-1":"translate-x-5")})})]})}),r&&o.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:o.jsx("button",{onClick:r,className:"w-full text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 hover:underline transition-colors text-center",children:a("skills.reset_to_defaults")})})]})]})}function IZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875S10.5 3.089 10.5 4.125c0 .369.128.713.349 1.003.215.283.401.604.401.959V6a.75.75 0 01-.75.75H7.5a.75.75 0 00-.75.75v2.25c0 .414-.336.75-.75.75S5.25 10.164 5.25 9.75V9A2.25 2.25 0 003 11.25v.75a.75.75 0 00.75.75h2.25c.414 0 .75.336.75.75s-.336.75-.75.75H3.75a.75.75 0 00-.75.75v.75A2.25 2.25 0 005.25 18h1.5a.75.75 0 01.75.75v.75c0 .414.336.75.75.75h6a.75.75 0 00.75-.75v-.75a.75.75 0 01.75-.75h1.5A2.25 2.25 0 0019.5 15.75v-.75a.75.75 0 00-.75-.75h-2.25a.75.75 0 01-.75-.75c0-.414.336-.75.75-.75h2.25a.75.75 0 00.75-.75v-.75A2.25 2.25 0 0017.25 9h-3a.75.75 0 01-.75-.75V6.087z"})})}function MZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M20 18h-2V9.25L12 13 6 9.25V18H4V6h1.2l6.8 4.25L18.8 6H20m0-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"})})}function LZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M7.71 3.5l-5.71 9.94 3.48 6.06h5.44L4.07 8.56 7.71 3.5zm1.42 0L15.84 15h-6.71L2.42 3.5h6.71zm.71 12h11.46l-3.48 6.06H6.36l3.48-6.06zm.71-1L16.84 3.5l5.71 9.94-3.48.06H10.55z"})})}function OZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function DZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})})}function PZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M3 6l3.5 12h2l2.5-8 2.5 8h2L19 6h-2.5l-2.25 8L12 6h-2l-2.25 8L5.5 6H3z"})})}function FZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M5 3a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V5a2 2 0 00-2-2H5zm11.293 6.707l-5.5 5.5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 111.414-1.414L10.086 13.1l4.793-4.793a1 1 0 111.414 1.4z"})})}function BZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function zZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 15.5v-5l-3 3v-4l3-3v-3l4 4-4 4v4z"})})}function UZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function $Z({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})})}function HZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M6 2l6 3.75L6 9.5.002 5.75 6 2zm12 0l6 3.75-6 3.75-5.998-3.75L18 2zM.002 13.25L6 9.5l6 3.75L6 17 .002 13.25zm17.998-3.75l6 3.75L18 17l-5.998-3.75L18 9.5zM6 18.25l6-3.75 6 3.75-6 3.75-6-3.75z"})})}function qZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function WZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})})}function VZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}const ej={gmail:MZ,gdrive:LZ,discord:OZ,whatsapp:DZ,wrike:PZ,gtasks:FZ,mailchimp:BZ,bamboohr:zZ,pandadoc:UZ,exa:$Z,dropbox:HZ,freshbooks:qZ,gcal:WZ,docx2md:VZ};function GZ(e){return Object.prototype.hasOwnProperty.call(ej,e)?ej[e]:IZ}const tj={gmail:"#EA4335",gdrive:"#4285F4",discord:"#5865F2",whatsapp:"#25D366",wrike:"#08CF65",gtasks:"#4285F4",mailchimp:"#FFE01B",bamboohr:"#73C41D",pandadoc:"#4ABB5A",exa:"#6366F1",dropbox:"#0061FF",freshbooks:"#00B7E3",gcal:"#4285F4",docx2md:"#6B7280"};function KZ({installed:e,configured:t,t:n}){return e?t?o.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),n("skills.configured")]}):o.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),n("skills.needs_setup")]}):o.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:n("skills.not_installed")})}function YZ({skill:e,onClose:t,onSaved:n}){var{t:r}=Ct(),a=hc(),[i,s]=h.useState({}),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,g]=h.useState(null),[p,m]=h.useState(!1),[y,v]=h.useState(null);h.useEffect(function(){var R=!1;async function j(){try{var P=await QD(e.name);if(R)return;v(P);for(var F=Object.create(null),H=Object.keys(P.tokens||{}),L=0;L<H.length;L++){var M=H[L],T=P.tokens[M]||{},O=T.env||M;F[O]=""}s(F),c(!1)}catch($){R||(g($.message),c(!1))}}return j(),function(){R=!0}},[e.name]);var x=h.useMemo(function(){if(!y||!y.tokens)return null;if(y.oauth&&y.oauth.broker){var R=!!y.oauth.connected,j=y.oauth.provider||"";return{provider:j?j.charAt(0).toUpperCase()+j.slice(1):"OAuth",brokered:!0,canConnect:!R,refreshConfigured:R,clientIdConfigured:!0,clientSecretConfigured:!0}}for(var P=Object.keys(y.tokens),F=0;F<P.length;F++){var H=y.tokens[P[F]]||{};if(H.description&&H.description.includes("OAuth")){for(var L=null,M=null,T=null,O=Object.entries(y.tokens),$=0;$<O.length;$++){var Y=O[$][0];Y.includes("REFRESH_TOKEN")&&(L=Y),(Y.includes("CLIENT_ID")||Y.includes("APP_KEY"))&&(M=Y),(Y.includes("CLIENT_SECRET")||Y.includes("APP_SECRET"))&&(T=Y)}if(L&&M){var A=y.tokens[L]&&y.tokens[L].configured,K=y.tokens[M]&&y.tokens[M].configured,V=T&&y.tokens[T]&&y.tokens[T].configured,I="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?I="Google":e.name==="dropbox"?I="Dropbox":e.name==="freshbooks"&&(I="FreshBooks"),{provider:I,canConnect:K&&V&&!A,refreshConfigured:A,clientIdConfigured:K,clientSecretConfigured:V}}}}return null},[y,e.name]),b=h.useCallback(async function(){g(null),m(!0);try{if(x&&x.brokered){let ie=function(){N.current&&(clearInterval(N.current),N.current=null)};var R=await sP(e.name),j=600,P=700,F=(window.screen.width-j)/2,H=(window.screen.height-P)/2,L=window.open(R.authorizeUrl,"oauth_popup","width="+j+",height="+P+",left="+F+",top="+H+",scrollbars=yes");if(!L){g("Popup blocked. Please allow popups or visit: "+R.authorizeUrl),m(!1);return}var M=R.flowId,T=0,O=0;N.current=setInterval(async function(){T+=1500;try{var J=await oP(e.name,M);if(J&&J.connected){ie();try{L.close()}catch{}m(!1),n();return}}catch(je){ie(),g(je.message),m(!1);return}if(L.closed&&(O||(O=T),T-O>9e3)){ie(),m(!1),n();return}T>3e5&&(ie(),m(!1),g("Connection timed out. Please try again."))},1500);return}var $=await iP(e.name),Y=600,A=700,K=(window.screen.width-Y)/2,V=(window.screen.height-A)/2,I=window.open($.authorizeUrl,"oauth_popup","width="+Y+",height="+A+",left="+K+",top="+V+",scrollbars=yes");if(I)var q=setInterval(function(){I.closed&&(clearInterval(q),m(!1),n())},500);else g("Popup blocked. Please allow popups or visit: "+$.authorizeUrl),m(!1)}catch(ie){g(ie.message),m(!1)}},[e.name,n,x]),k=h.useCallback(async function(){g(null),d(!0);try{for(var R=Object.create(null),j=Object.keys(i),P=0;P<j.length;P++){var F=j[P];i[F]&&i[F].trim()&&(R[F]=i[F].trim())}if(Object.keys(R).length===0){g(r("skills.enter_token")),d(!1);return}await tP(e.name,R),n()}catch(H){g(H.message)}finally{d(!1)}},[i,e.name,n,r]),S=h.useCallback(async function(){if(await a({title:r("skills.clear_title"),message:r("skills.clear_confirm",{skill:e.name}),destructive:!0})){g(null),d(!0);try{await nP(e.name),n()}catch(R){g(R.message)}finally{d(!1)}}},[e.name,n,a,r]),E=h.useCallback(function(R,j){s(function(P){var F=Object.assign(Object.create(null),P);return F[R]=j,F})},[]),_=y&&!(y.oauth&&y.oauth.broker)?Object.entries(y.tokens||{}).map(function(R){var j=R[0],P=R[1],F=P&&P.env||j;return{name:j,env:F,description:P.description,configured:P.configured,maskedValue:P.maskedValue}}):[],w=h.useRef(null);h.useEffect(function(){function R(j){j.key==="Escape"&&t()}return document.addEventListener("keydown",R),w.current&&w.current.focus(),function(){document.removeEventListener("keydown",R)}},[t]);var N=h.useRef(null);return h.useEffect(function(){return function(){N.current&&(clearInterval(N.current),N.current=null)}},[]),o.jsx("div",{ref:w,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,role:"dialog","aria-modal":"true","aria-label":r("skills.configure_skill",{skill:e.name}),children:o.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 p-6",onClick:function(R){R.stopPropagation()},children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:r("skills.configure_skill",{skill:e.name})}),o.jsx("button",{onClick:t,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":r("skills.close_credential_editor"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),l&&o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!l&&_.length>0&&o.jsx("div",{className:"space-y-3 mb-4",children:_.map(function(R){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[R.env,R.configured&&o.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:R.maskedValue}),")"]})]}),R.description&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:R.description}),o.jsx("input",{type:"password",placeholder:R.configured?r("skills.leave_blank"):r("skills.enter_value"),value:i[R.env]||"",onChange:function(j){E(R.env,j.target.value)},className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})]},R.env)})}),!l&&x&&o.jsx("div",{className:"mb-4 p-4 bg-gray-50 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-700",children:x.canConnect?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:r("skills.oauth_connect_hint",{provider:x.provider})}),o.jsx("button",{onClick:b,disabled:p||u,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white font-medium rounded-lg disabled:opacity-50 transition-colors",children:p?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r("skills.oauth_connecting")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),r("skills.oauth_connect",{provider:x.provider})]})})]}):x.refreshConfigured?o.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),r("skills.oauth_connected",{provider:x.provider})]}):o.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:r("skills.oauth_needs_credentials",{provider:x.provider})})}),!l&&!f&&_.length===0&&!x&&o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:r("skills.no_credentials_needed")}),f&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:f}),!l&&_.length>0&&o.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("button",{onClick:S,disabled:u,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:r("skills.clear_all")}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:t,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg",children:r("skills.cancel")}),o.jsx("button",{onClick:k,disabled:u,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 transition-colors",children:r(u?"skills.saving":"skills.save")})]})]})]})})}function XZ({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:a,onInstall:i,onUpdate:s,onUninstall:l,skillDefaultEnabled:c,onToggleDefault:u,t:d}){var f=GZ(e.name),g=Object.prototype.hasOwnProperty.call(tj,e.name)?tj[e.name]:"#6B7280",[p,m]=h.useState(!1),y=r===e.name,v=n&&n.hasUpdate,x=h.useCallback(async function(){m(!0);try{await i(e)}finally{m(!1)}},[e,i]),b=h.useCallback(function(){s&&s(e.name)},[e.name,s]);return o.jsxs("div",{className:"group relative bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-md dark:hover:shadow-gray-800/50 transition-all flex flex-col",children:[o.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:g}}),o.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[o.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",style:{backgroundColor:g+"15"},children:o.jsx(f,{className:"w-5 h-5",style:{color:g}})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),o.jsx(KZ,{installed:t,configured:t&&e.allTokensConfigured,t:d}),t&&v&&o.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400",children:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"v",n.latestVersion]}),t&&n&&!v&&o.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:d("skills.up_to_date")})]}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||d("skills.no_description")}),e.version&&o.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),o.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:function(){a(e)},className:"flex-1 px-3 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:d("skills.configure")}),u&&o.jsxs("button",{onClick:function(){u(e.name,!c)},title:d("skills.default_for_new_sessions"),className:"px-2 py-1.5 text-xs font-medium rounded-lg transition-colors flex items-center gap-1 "+(c?"text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/20 hover:bg-primary-100 dark:hover:bg-primary-900/40":"text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800"),children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c?o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),d("skills.default")]}),v&&o.jsx("button",{onClick:b,disabled:y,className:"px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:y?o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),d("skills.updating")]}):d("skills.update")}),l&&o.jsx("button",{onClick:function(){l(e)},title:d("skills.uninstall"),className:"px-2 py-1.5 text-xs font-medium text-gray-400 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors","aria-label":d("skills.uninstall"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}):o.jsx("button",{onClick:x,disabled:p,className:"flex-1 px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:p?o.jsxs("span",{className:"flex items-center justify-center gap-1",children:[o.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),d("skills.installing")]}):d("skills.install")})})]})}function QZ({onBack:e}){var{t}=Ct(),[n,r]=h.useState([]),[a,i]=h.useState([]),[s,l]=h.useState(!0),[c,u]=h.useState(null),[d,f]=h.useState(null),[g,p]=h.useState("all"),[m,y]=h.useState(""),[v,x]=h.useState(!1),[b,k]=h.useState(Object.create(null)),[S,E]=h.useState(null),[_,w]=h.useState(!1),[N,R]=h.useState(Object.create(null)),j=hc(),P=h.useCallback(async function(){l(!0),u(null),w(!1);try{var q=await Promise.allSettled([Bv(),XD(),P5()]),ie=q[0].status==="fulfilled"?q[0].value:[],J=q[1].status==="fulfilled"?q[1].value:[],je=q[2].status==="fulfilled"?q[2].value.skillDefaults||{}:{};r(ie),i(J),R(je);var X=[];q[0].status==="rejected"&&X.push(t("skills.load_installed_failed",{error:q[0].reason.message})),q[1].status==="rejected"&&X.push(t("skills.load_marketplace_failed",{error:q[1].reason.message})),X.length>0&&u(X.join("; "))}catch(he){u(he.message)}finally{l(!1)}},[t]);h.useEffect(function(){P()},[P]);var F=[],H=new Set(n.map(function(q){return q.name}));n.forEach(function(q){F.push(Object.assign({},q,{_installed:!0}))}),a.forEach(function(q){H.has(q.name)||F.push(Object.assign({},q,{_installed:!1,allTokensConfigured:!1}))});var L=F;if(g==="installed"?L=F.filter(function(q){return q._installed}):g==="available"&&(L=F.filter(function(q){return!q._installed})),m){var M=m.toLowerCase();L=L.filter(function(q){return q.name&&q.name.toLowerCase().indexOf(M)!==-1||q.description&&q.description.toLowerCase().indexOf(M)!==-1||q.category&&q.category.toLowerCase().indexOf(M)!==-1})}var T=h.useCallback(async function(q){try{await ZD(q.name),P()}catch(ie){u(t("skills.install_failed",{error:ie.message}))}},[P,t]),O=h.useCallback(function(q){f(q)},[]),$=h.useCallback(async function(q){if(await j({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:q.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await rP(q.name),P()}catch(ie){u(t("skills.uninstall_failed",{error:ie.message}))}},[P,j,t]),Y=h.useCallback(function(){f(null),P()},[P]),A=h.useCallback(async function(q,ie){R(function(je){var X=Object.assign({},je);return ie?X[q]=!0:delete X[q],X});try{var J={};J[q]=ie,await aP(J)}catch(je){R(function(X){var he=Object.assign({},X);return ie?delete he[q]:he[q]=!0,he}),u(je.message)}},[]),K=h.useCallback(async function(){x(!0),u(null);try{var q=await eP(),ie=Object.create(null);(q.skills||[]).forEach(function(J){ie[J.name]={hasUpdate:J.hasUpdate,latestVersion:J.latestVersion,currentVersion:J.currentVersion}}),k(ie),w(!0)}catch(J){u(J.message)}finally{x(!1)}},[]),V=h.useCallback(async function(q){E(q),u(null);try{var ie=await JD(q);ie.updated&&(k(function(J){var je=Object.assign(Object.create(null),J);return je[q]={hasUpdate:!1,latestVersion:J[q]?J[q].latestVersion:null,currentVersion:J[q]?J[q].currentVersion:null},je}),P())}catch(J){u(t("skills.update_failed")+": "+J.message)}finally{E(null)}},[P,t]),I=Object.values(b).filter(function(q){return q&&q.hasUpdate}).length;return o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:e,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":t("skills.back_to_chat"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:n.length,available:a.filter(function(q){return!H.has(q.name)}).length})})]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:K,disabled:v||s,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:v?o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.checking_updates")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.check_updates")]})}),I>0&&o.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 rounded-full",children:t("skills.updates_available",{count:I})}),_&&I===0&&!v&&o.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded-full",children:t("skills.no_updates")}),o.jsx("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:["all","installed","available"].map(function(q){return o.jsx("button",{onClick:function(){p(q)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(g===q?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:t("skills.tab_"+q)},q)})})]})]}),o.jsx("div",{className:"flex-shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:o.jsxs("div",{className:"relative",children:[o.jsx("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),o.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:m,onChange:function(q){y(q.target.value)},className:"w-full pl-10 pr-4 py-2 text-sm bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-900 dark:text-gray-100 placeholder-gray-400 outline-none focus:ring-2 focus:ring-primary-500/30 focus:border-primary-500"})]})}),o.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[s&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),c&&o.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:c})}),!s&&L.length===0&&o.jsx("div",{className:"text-center py-12",children:o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(m?"skills.no_match":"skills.no_skills")})}),!s&&L.length>0&&o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:L.map(function(q){return o.jsx(XZ,{skill:q,installed:q._installed,updateInfo:b[q.name],updatingSkill:S,onConfigure:O,onInstall:T,onUpdate:V,onUninstall:q._installed?$:null,skillDefaultEnabled:!!N[q.name],onToggleDefault:q._installed?A:null,t},q.name)})})]}),d&&o.jsx(YZ,{skill:d,onClose:function(){f(null)},onSaved:Y})]})}const Kt="";function Yt(e,t={}){return fetch(e,{credentials:"include",...t})}async function ZZ(){const e=await Yt(Kt+"/api/agents");if(!e.ok)throw new Error("Failed to fetch agents: "+e.statusText);return e.json()}async function JZ(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e));if(!t.ok)throw new Error("Failed to fetch agent: "+t.statusText);return t.json()}async function Bb(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/start",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to start agent")}return t.json()}async function zb(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/stop",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to stop agent")}return t.json()}async function zd(e,t){const n={};t&&t.clean&&(n.clean=!0);const r=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to restart agent")}return r.json()}async function Ub(e,t){const n={};t&&t.level&&(n.level=t.level),t&&t.span&&(n.span=t.span);const r=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/pause",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to pause agent")}return r.json()}async function $b(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/unpause",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to unpause agent")}return t.json()}async function eJ(e,t,n,r){const a={message:t,priority:n};r!=null&&(a.replyToInbox=r);const i=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.error||"Failed to send message to agent")}return i.json()}async function tJ(e,t,n){const r={message:t};n!=null&&(r.replyToInbox=n);const a=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/interrupt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to send urgent interrupt to agent")}return a.json()}async function nJ(e,t){let n=Kt+"/api/agents/"+encodeURIComponent(e)+"/messages";t&&t.refresh&&(n+="?refresh=true");const r=await Yt(n);if(!r.ok)throw new Error("Failed to fetch agent messages: "+r.statusText);return r.json()}async function rJ(){const e=await Yt(Kt+"/api/pricing");if(!e.ok)throw new Error("Failed to fetch pricing: "+e.statusText);return e.json()}async function aJ(e){const t=await Yt(Kt+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to update pricing")}return t.json()}async function iJ(){const e=await Yt(Kt+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error||"Failed to reset pricing")}return e.json()}async function sJ(e,t=!1){const n=Kt+"/api/agents/"+encodeURIComponent(e)+(t?"?force=true":""),r=await Yt(n,{method:"DELETE"});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to delete agent")}return r.json()}async function oJ(e){const t=await Yt(Kt+"/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to create agent")}return t.json()}async function T3(){const e=await Yt(Kt+"/api/skills");if(!e.ok)throw new Error("Failed to fetch skills: "+e.statusText);return e.json()}async function G1(){const e=await Yt(Kt+"/api/models");if(!e.ok)throw new Error("Failed to fetch models: "+e.statusText);return e.json()}async function lJ(e,t){const n=await Yt(Kt+"/api/agents/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to update agent")}return n.json()}async function cJ(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/agents-md");if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to fetch AGENTS.md")}return t.json()}async function uJ(e,t){const n=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/agents-md",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to update AGENTS.md")}return n.json()}async function A3(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/export");if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to export agent")}const n=await t.text(),r=new Blob([n],{type:"text/yaml"}),a=URL.createObjectURL(r),i=t.headers.get("X-Filename")||e+".agent.yaml",s=document.createElement("a");s.href=a,s.download=i,document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(a),5e3)}async function dJ(e,t){const n=new URLSearchParams,r=n.toString()?"?"+n.toString():"",a=await Yt(Kt+"/api/agents/import"+r,{method:"POST",headers:{"Content-Type":"text/yaml"},body:e});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to import agent")}return a.json()}async function oy(){const e=await Yt(Kt+"/api/system/updates");if(!e.ok){const t="Failed to check for updates",n=await e.json().catch(()=>({})),r=n.error||n.message||n.output||e.statusText;throw r?r.indexOf(t)===0||r===t?new Error(r):new Error(t+": "+r):new Error(t)}return e.json()}async function fJ(){const e=await Yt(Kt+"/api/system/update",{method:"POST"});if(!e.ok){const n="Failed to perform update",r=await e.json().catch(()=>({})),a=r.error||r.message||r.output||e.statusText;throw a?a.indexOf(n)===0||a===n?new Error(a):new Error(n+": "+a):new Error(n)}const t=await e.json();if(t.status!=="success"){let n=t.error||t.message||"";throw t.output&&!t.error&&!t.message?n="Update returned status: "+(t.status||"failed")+(t.output?": "+t.output:""):t.output&&(n+=t.output?" ("+t.output+")":""),n||(n="Update returned unexpected status: "+(t.status||"unknown")),new Error(n)}return t}async function nj(){const e=await Yt(Kt+"/api/models/registry");if(!e.ok)throw new Error("Failed to fetch model registry: "+e.statusText);return e.json()}async function rj(e,t){const n=await Yt(Kt+"/api/models/registry",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to save model: "+n.statusText)}return n.json()}async function aj(e){const t=await Yt(Kt+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to delete model: "+t.statusText)}return t.json()}function R3(e){const t=typeof e=="string"?e.split("-"):null;if(t&&t.length===3){const n=Number(t[0]),r=Number(t[1]),a=Number(t[2]);if(!Number.isNaN(n)&&!Number.isNaN(r)&&!Number.isNaN(a))return new Date(n,r-1,a)}return new Date(e)}function gJ(e){const t=R3(e),n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return n[t.getDay()]+", "+r[t.getMonth()]+" "+t.getDate()}function Tu(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString()}function pJ({data:e}){if(!e||e.length===0)return o.jsx("div",{className:"h-32 flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"No usage data available"});const t=280,n=120,r={top:10,right:10,bottom:25,left:40},a=t-r.left-r.right,i=n-r.top-r.bottom,s=Math.max(...e.map(g=>(g.input||0)+(g.output||0)+(g.cached||0)),1),l=a/e.length,c=Math.max(8,l*.6),u=(l-c)/2,d=g=>i-g/s*i,f=[0,.25,.5,.75,1].map(g=>Math.round(s*g));return o.jsxs("div",{className:"relative",children:[o.jsxs("svg",{width:"100%",height:n,viewBox:`0 0 ${t} ${n}`,className:"overflow-visible",children:[f.map((g,p)=>{const m=r.top+d(g);return o.jsxs("g",{children:[o.jsx("line",{x1:r.left,y1:m,x2:t-r.right,y2:m,stroke:"currentColor",strokeOpacity:.1,className:"text-gray-400 dark:text-gray-600"}),o.jsx("text",{x:r.left-5,y:m,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Tu(g)})]},p)}),e.map((g,p)=>{const m=r.left+p*l+u,y=g.input||0,v=g.output||0,x=g.cached||0,b=y/s*i,k=v/s*i,S=x/s*i,E=r.top+i-b,_=E-k,w=_-S,N=R3(g.date),R=["S","M","T","W","T","F","S"][N.getDay()];return o.jsxs("g",{className:"group",children:[o.jsx("rect",{x:m-u,y:r.top,width:l,height:i,fill:"transparent",className:"cursor-pointer"}),y>0&&o.jsx("rect",{x:m,y:E,width:c,height:b,rx:2,className:"fill-blue-500 dark:fill-blue-400 transition-opacity group-hover:opacity-80"}),v>0&&o.jsx("rect",{x:m,y:_,width:c,height:k,rx:2,className:"fill-green-500 dark:fill-green-400 transition-opacity group-hover:opacity-80"}),x>0&&o.jsx("rect",{x:m,y:w,width:c,height:S,rx:2,className:"fill-purple-500 dark:fill-purple-400 transition-opacity group-hover:opacity-80"}),o.jsx("text",{x:m+c/2,y:n-5,textAnchor:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:R}),o.jsxs("g",{className:"opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:[o.jsx("rect",{x:m+c/2-45,y:Math.min(w,_,E)-50,width:90,height:45,rx:4,className:"fill-gray-900 dark:fill-gray-100"}),o.jsx("text",{x:m+c/2,y:Math.min(w,_,E)-38,textAnchor:"middle",className:"text-[9px] fill-white dark:fill-gray-900 font-medium",children:gJ(g.date)}),o.jsxs("text",{x:m+c/2,y:Math.min(w,_,E)-26,textAnchor:"middle",className:"text-[8px] fill-blue-300 dark:fill-blue-600",children:["In: ",Tu(y)]}),o.jsxs("text",{x:m+c/2,y:Math.min(w,_,E)-16,textAnchor:"middle",className:"text-[8px] fill-green-300 dark:fill-green-600",children:["Out: ",Tu(v)]}),o.jsxs("text",{x:m+c/2,y:Math.min(w,_,E)-6,textAnchor:"middle",className:"text-[8px] fill-purple-300 dark:fill-purple-600",children:["Cache: ",Tu(x)]})]})]},p)})]}),o.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-blue-500 dark:bg-blue-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Input"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-green-500 dark:bg-green-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Output"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-purple-500 dark:bg-purple-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Cached"})]})]})]})}function hJ({agentName:e,onClose:t,onToolPartsChange:n,hackerMode:r}){var{t:a}=Ct(),[i,s]=h.useState([]),[l,c]=h.useState(!0),[u,d]=h.useState(null),[f,g]=h.useState(!1),[p,m]=h.useState(""),[y,v]=h.useState(!0),[x,b]=h.useState(!1),[k,S]=h.useState(!1),[E,_]=h.useState(!1),[w,N]=h.useState(!1),R=h.useRef(null),j=h.useRef(null),P=h.useRef(!0),F=h.useRef([]),H=h.useRef(null),L=h.useRef(null),M=h.useRef(null),T=h.useRef(null);h.useEffect(function(){F.current=i},[i]);var O=h.useCallback(async function(J,je){if(e){je!==!1&&c(!0);try{var X=await nJ(e,{refresh:!!J}),he=X.messages||[],Me=F.current,we=he.length!==Me.length;if(!we&&he.length>0&&Me.length>0){var ge=he[he.length-1],Se=Me[Me.length-1];if(ge.info.id!==Se.info.id&&(we=!0),!we){var Re=ge.parts||[],me=Se.parts||[];if(Re.length!==me.length)we=!0;else for(var ye=0;ye<Re.length&&!we;ye++){var Oe=Re[ye]||{},be=me[ye]||{},ee=Oe.state?Oe.state.status:Oe.status,Ee=be.state?be.state.status:be.status;(Oe.id!==be.id||ee!==Ee)&&(we=!0)}}}we&&s(he.slice()),d(null)}catch(fe){console.error("Failed to load messages:",fe),d(fe.message)}finally{je!==!1&&c(!1)}}},[e]);h.useEffect(function(){O(!0);var J=setInterval(function(){O(!0,!1)},5e3);return function(){clearInterval(J),L.current&&clearTimeout(L.current),T.current&&clearTimeout(T.current)}},[O]),h.useEffect(function(){P.current&&R.current&&R.current.scrollIntoView({behavior:"smooth"})},[i]);var $=h.useCallback(function(){var J=j.current;J&&(P.current=J.scrollHeight-J.scrollTop-J.clientHeight<50)},[]),Y=h.useMemo(function(){for(var J=null,je=i.length-1;je>=0;je--)if(i[je].info&&i[je].info.role==="assistant"){J=i[je];break}return J?(J.parts||[]).filter(function(X){return X.type==="tool"}):[]},[i]);h.useEffect(function(){n&&n(Y)},[Y,n]);var A=h.useCallback(async function(){if(!(!p.trim()||x)){b(!0),S(!1),_(!1),N(!1),d(null);try{await eJ(e,p.trim(),"normal",y),m(""),S(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(function(){S(!1),g(!1),L.current=null},1500),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){O(!0,!1),T.current=null},500)}catch(J){d(J.message)}finally{b(!1)}}},[e,p,y,x,O]),K=h.useCallback(async function(){if(!(!p.trim()||x)){if(!w){N(!0);return}b(!0),S(!1),_(!0),N(!1),d(null);try{await tJ(e,p.trim(),y),m(""),S(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(function(){S(!1),g(!1),L.current=null},1500),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){O(!0,!1),T.current=null},500)}catch(J){d(J.message)}finally{b(!1)}}},[e,p,x,w,y,O]),V=h.useCallback(function(){g(!1),N(!1),d(null),L.current&&(clearTimeout(L.current),L.current=null),T.current&&(clearTimeout(T.current),T.current=null),S(!1)},[]);h.useEffect(function(){if(!f)return;function J(je){je.key==="Escape"&&!x&&V()}return document.addEventListener("keydown",J),function(){document.removeEventListener("keydown",J)}},[f,V,x]),h.useEffect(function(){if(!(!f||!M.current)){var J=M.current;J.contains(document.activeElement)||J.focus()}},[f]);var I=h.useCallback(function(J){J.target===J.currentTarget&&!x&&V()},[V,x]),q=h.useCallback(function(J){J.key==="Enter"&&!J.shiftKey&&!w&&(J.preventDefault(),A())},[A,w]),ie=h.useCallback(function(){},[]);return o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 relative",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:a("agents.back"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Conversation"}),o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e," - ",i.length," messages"]})]})]}),o.jsx("button",{onClick:function(){P.current=!0,O(!0),R.current&&R.current.scrollIntoView({behavior:"smooth"})},disabled:l,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",title:a("agents.refresh"),children:o.jsx("svg",{className:`w-4 h-4 ${l?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),u&&o.jsxs("div",{className:"mx-4 mt-3 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:u}),o.jsx("button",{onClick:function(){d(null)},className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),k&&o.jsxs("div",{className:`mx-4 mt-3 px-4 py-2 text-sm rounded-lg flex items-center gap-2 ${E?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400"}`,children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:E?o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"}):o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),a(E?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")]}),o.jsx("div",{ref:j,onScroll:$,className:"flex-1 overflow-y-auto px-4 py-4",children:l&&i.length===0?o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):i.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-center",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-3",children:o.jsx("svg",{className:"w-6 h-6 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("agent_conversation.no_messages")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:a("agent_conversation.no_messages_hint")})]}):o.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[i.map(function(J){return o.jsx(iI,{message:J.info,parts:J.parts,streamingParts:null,searchQuery:null,matchOffset:-1,matchCount:0,activeMatchIndex:-1,registerMatchRef:ie,hackerMode:r,hideThinking:!1},J.info.id)}),o.jsx("div",{ref:R})]})}),o.jsx("div",{className:"absolute bottom-6 right-6",children:o.jsxs("button",{onClick:function(){g(!0),N(!1),d(null)},className:"px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white rounded-full shadow-lg font-medium text-sm transition-colors flex items-center gap-2","aria-label":a("agent_conversation.compose_button"),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),a("agent_conversation.compose_button")]})}),f&&o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:I,children:o.jsxs("div",{ref:M,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":"compose-modal-title",className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[o.jsx("h3",{id:"compose-modal-title",className:"text-base font-semibold text-gray-900 dark:text-white",children:a("agent_conversation.modal_title",{name:e})}),o.jsx("button",{onClick:V,disabled:x,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"+(x?" opacity-50 cursor-not-allowed":""),"aria-label":a("common.close"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:y,onChange:function(J){v(J.target.checked)},className:"w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:a("agent_conversation.reply_to_inbox")})]}),o.jsx("textarea",{ref:H,value:p,onChange:function(J){m(J.target.value)},onKeyDown:q,placeholder:a("agent_conversation.send_placeholder"),className:"w-full px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 outline-none resize-none text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400 focus:border-transparent",rows:4,disabled:x,autoFocus:!0}),k&&o.jsx("p",{className:"text-sm text-green-600 dark:text-green-400 font-medium",children:a(E?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")}),u&&o.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:u})]}),o.jsx("div",{className:"px-5 py-4 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:w?o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 font-medium",children:a("agent_conversation.urgent_warning")}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("button",{onClick:function(){N(!1)},className:"px-3 py-1.5 text-xs text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors",children:a("common.cancel")}),o.jsxs("button",{onClick:K,disabled:!p.trim()||x,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed text-xs font-medium transition-colors flex items-center gap-1.5",children:[x&&E?o.jsx("div",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}):o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),a("agent_conversation.confirm_interrupt")]})]})]}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("button",{onClick:K,disabled:!p.trim()||x,className:"px-3 py-1.5 text-xs text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-1.5",children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),a("agent_conversation.urgent_interrupt_button")]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:V,disabled:x,className:"px-4 py-2 text-sm transition-colors"+(x?" text-gray-400 dark:text-gray-600 cursor-not-allowed":" text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"),children:a("common.cancel")}),o.jsxs("button",{onClick:A,disabled:!p.trim()||x,className:"px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed font-medium text-sm transition-colors flex items-center gap-2",children:[x&&!E?o.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})}),a("agent_conversation.send_button")]})]})]})})]})})]})}function mJ({isOpen:e,agent:t,onClose:n,onUpdated:r,onDeleted:a}){const{t:i}=Ct(),[s,l]=h.useState(""),[c,u]=h.useState(""),[d,f]=h.useState(""),[g,p]=h.useState(""),[m,y]=h.useState(!1),[v,x]=h.useState([]),[b,k]=h.useState(!1),[S,E]=h.useState(""),[_,w]=h.useState(null),[N,R]=h.useState(!1),[j,P]=h.useState([]),[F,H]=h.useState([]),[L,M]=h.useState(!1),[T,O]=h.useState(!0),[$,Y]=h.useState(!1),[A,K]=h.useState(!1),[V,I]=h.useState(null),[q,ie]=h.useState(!1),[J,je]=h.useState(!1),[X,he]=h.useState("general"),[Me,we]=h.useState(!1);h.useEffect(()=>{const fe={cancelled:!1};if(e&&t&&!Me){ge();const ve=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";Se(fe,ve),we(!0)}return e||(we(!1),y(!1),p(""),O(!0),H([])),()=>{fe.cancelled=!0}},[e,t==null?void 0:t.name]);const ge=()=>{if(!t)return;l(t.displayName||t.name||""),u(t.cwd||"");const fe=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";f(fe),y(!1),p(""),x(Array.isArray(t.skills)?t.skills:[]),k(!!t.skipInitialPrompt)},Se=async(fe,ve)=>{M(!0),O(!0),t!=null&&t.name&&Y(!0);const de=[T3(),G1()];t!=null&&t.name&&de.push(cJ(t.name));const pe=await Promise.allSettled(de);if(fe.cancelled)return;const[De,B,D]=pe;if(De.status==="fulfilled"?P(De.value):(console.error("Failed to load skills:",De.reason),P([])),M(!1),B.status==="fulfilled"){const G=B.value;H(G);const ce=ve;G.find(Te=>Te.id===ce)||(y(!0),p(ce),f(ce))}else console.error("Failed to load models:",B.reason),H([]);if(O(!1),t!=null&&t.name&&D){if(D.status==="fulfilled"){const G=D.value;E(G.content||""),w(G.path||null),R(G.exists||!1)}else console.error("Failed to load AGENTS.md:",D.reason),E(""),w(null),R(!1);Y(!1)}},Re=fe=>{x(ve=>ve.includes(fe)?ve.filter(de=>de!==fe):[...ve,fe])},me=()=>{v.length===j.length?x([]):x(j.map(fe=>fe.name))},ye=async fe=>{if(fe&&fe.preventDefault(),!!(t!=null&&t.name)){I(null),K(!0);try{await lJ(t.name,{displayName:s.trim()||t.name,workspace:c.trim(),model:d,skipInitialPrompt:b,skills:v}),_&&S!==null&&!Ee&&await uJ(t.name,S),r&&r(t.name),n()}catch(ve){I(ve.message)}finally{K(!1)}}},Oe=async()=>{if(t!=null&&t.name){je(!0),I(null);try{await sJ(t.name,!0),a&&a(t.name),n()}catch(fe){I(fe.message),ie(!1)}finally{je(!1)}}},be=()=>{!A&&!J&&(I(null),ie(!1),he("general"),n())};if(!e||!t)return null;const ee=t.state==="working"||t.state==="idle"||t.state==="starting",Ee=c.trim()!==(t.cwd||"");return o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:be}),q&&o.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:()=>ie(!1)}),o.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-xl shadow-2xl max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2",children:"Delete Agent?"}),o.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:["Are you sure you want to delete ",o.jsx("strong",{children:t.displayName||t.name}),"?",ee&&o.jsx("span",{className:"block mt-2 text-yellow-600 dark:text-yellow-400",children:"Warning: This agent is currently running and will be stopped."})]}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mb-4",children:"This will remove the agent registration. The workspace directory will not be deleted."}),o.jsxs("div",{className:"flex justify-end gap-3",children:[o.jsx("button",{onClick:()=>ie(!1),disabled:J,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:i("common.cancel")}),o.jsx("button",{onClick:Oe,disabled:J,className:"px-4 py-2 rounded-lg bg-red-600 hover:bg-red-700 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-2",children:J?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i("common.deleting")]}):i("common.delete")})]})]})]}),o.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:i("agent_edit.title")}),o.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t.name,ee&&o.jsxs("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:["(",i("agent_edit.running_warning"),")"]})]})]}),o.jsx("button",{onClick:be,disabled:A||J,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-800 px-6",children:[o.jsx("button",{onClick:()=>he("general"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${X==="general"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:i("agent_edit.tab_general")}),o.jsx("button",{onClick:()=>he("soul"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${X==="soul"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:i("agent_edit.tab_soul")})]}),o.jsxs("form",{onSubmit:fe=>fe.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[V&&o.jsxs("div",{className:"px-4 py-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:V}),o.jsx("button",{type:"button",onClick:()=>I(null),className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),X==="general"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[i("agent_edit.name_label"),o.jsx("span",{className:"text-gray-400 font-normal ml-1",children:i("agent_edit.cannot_change")})]}),o.jsx("input",{type:"text",value:t.name,disabled:!0,className:"w-full px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed font-mono"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.display_name_label")}),o.jsx("input",{type:"text",value:s,onChange:fe=>l(fe.target.value),placeholder:i("agent_edit.display_name_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.working_dir_label")}),ee?o.jsx("div",{className:"px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 font-mono text-sm break-all",children:c||i("agent_edit.not_set")}):o.jsx("input",{type:"text",value:c,onChange:fe=>u(fe.target.value),placeholder:i("agent_edit.working_dir_placeholder"),disabled:A||J,className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm disabled:opacity-50"}),ee?o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.stop_to_change")}):c.trim()!==(t.cwd||"")?o.jsx("p",{className:"mt-1 text-xs text-amber-500 dark:text-amber-400",children:i("agent_edit.workspace_move_warning")}):o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.working_dir_hint")})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.model_label")}),T?o.jsx("div",{className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-400 text-sm",children:i("agent_edit.loading_models")}):F.length===0?o.jsx("input",{type:"text",value:d,onChange:fe=>f(fe.target.value),placeholder:i("agent_edit.model_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"}):o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:m?"__custom__":d,onChange:fe=>{fe.target.value==="__custom__"?(y(!0),d&&d!=="__custom__"&&p(d)):(y(!1),f(fe.target.value))},className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500",children:[(()=>{const fe=V1(F);return Object.entries(fe).map(([ve,de])=>o.jsx("optgroup",{label:q1[ve]||ve,children:de.map(pe=>o.jsxs("option",{value:pe.id,children:[pe.name,W1(pe.tier)]},pe.id))},ve))})(),o.jsx("option",{value:"__custom__",children:i("agent_edit.custom_model")})]}),m&&o.jsx("input",{type:"text",value:g,onChange:fe=>{p(fe.target.value),f(fe.target.value)},placeholder:i("agent_edit.custom_model_placeholder"),className:"w-full mt-2 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"})]}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i(m?"agent_edit.custom_model_hint":"agent_edit.model_hint")})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_edit.start_mode")}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:b,onChange:fe=>k(fe.target.checked),className:"mt-0.5 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),o.jsxs("div",{children:[o.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100",children:i("agent_edit.dormant_mode")}),o.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:i("agent_edit.dormant_mode_desc")})]})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_edit.skills_label")}),o.jsx("button",{type:"button",onClick:me,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:v.length===j.length?i("agent_edit.deselect_all"):i("agent_edit.select_all")})]}),o.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-800",children:L?o.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_edit.loading_skills")}):j.length===0?o.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_edit.no_skills")}):o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:j.map(fe=>o.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${v.includes(fe.name)?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[o.jsx("input",{type:"checkbox",checked:v.includes(fe.name),onChange:()=>Re(fe.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),o.jsxs("span",{className:"text-sm truncate",title:fe.description,children:[fe.icon&&o.jsx("span",{className:"mr-1",children:fe.icon}),fe.name]})]},fe.name))})}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.skills_selected",{count:v.length})})]})]}),X==="soul"&&o.jsxs("div",{className:"space-y-4",children:[_&&o.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono bg-gray-50 dark:bg-gray-800 rounded px-3 py-2",children:[_,!N&&o.jsx("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:i("agent_edit.will_be_created")})]}),!_&&!c.trim()&&o.jsx("div",{className:"px-4 py-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 text-sm rounded-lg",children:i("agent_edit.no_workspace_warning")}),Ee&&o.jsx("div",{className:"px-4 py-3 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm rounded-lg",children:i("agent_edit.workspace_changed_warning")}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.instructions_label")}),o.jsx("textarea",{value:S,onChange:fe=>E(fe.target.value),disabled:!_||Ee,rows:16,placeholder:i($?"common.loading":"agent_edit.soul_placeholder"),className:"w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm resize-none disabled:cursor-not-allowed disabled:opacity-50"}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.instructions_hint")})]})]})]}),o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900",children:[o.jsxs("button",{type:"button",onClick:()=>ie(!0),disabled:A||J,className:"px-4 py-2 rounded-lg text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-50 flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),i("common.delete")]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{type:"button",onClick:be,disabled:A||J,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:i("common.cancel")}),o.jsx("button",{type:"button",onClick:ye,disabled:A||J,className:"px-6 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:A?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i("agent_edit.saving")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i("agent_edit.save")]})})]})]})]})]})}const ij={working:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",idle:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",paused:"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400",stopped:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",crashed:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",error:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",starting:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"},sj={working:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),idle:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})}),paused:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),stopped:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z",clipRule:"evenodd"})}),crashed:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),error:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),starting:o.jsx("svg",{className:"w-4 h-4 mr-1.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})};function xJ({state:e}){const t=ij[e]||ij.stopped,n=sj[e]||sj.stopped;return o.jsxs("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${t}`,children:[n,e]})}function yJ(e){if(!e)return"-";const t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return n+"s";const r=Math.floor(n/60);if(r<60)return r+"m";const a=Math.floor(r/60),i=r%60;if(a<24)return a+"h "+i+"m";const s=Math.floor(a/24),l=a%24;return s+"d "+l+"h"}function ly({label:e,value:t,max:n,color:r}){const a=n>0?Math.min(100,Math.round(t/n*100)):0;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:e}),o.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:t.toLocaleString()})]}),o.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:o.jsx("div",{className:`h-full ${r} transition-all duration-300`,style:{width:a+"%"}})})]})}function Ki({label:e,value:t,mono:n}){return o.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-gray-100 dark:border-gray-800 last:border-0",children:[o.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e}),o.jsx("span",{className:`text-sm text-gray-900 dark:text-gray-100 ${n?"font-mono":""}`,children:t||"-"})]})}function bJ({agent:e,onClose:t,onAction:n,onToolPartsChange:r,hackerMode:a}){const{t:i}=Ct(),[s,l]=h.useState(e),[c,u]=h.useState(null),[d,f]=h.useState(null),[g,p]=h.useState(!1),[m,y]=h.useState(!1),v=h.useCallback(async()=>{if(e!=null&&e.name)try{const N=await JZ(e.name);l(N),u(null)}catch(N){console.error("Failed to load agent:",N),u(N.message)}},[e==null?void 0:e.name]);h.useEffect(()=>{v();const N=setInterval(v,5e3);return()=>clearInterval(N)},[v]);const x=h.useCallback(async N=>{f(N),u(null);try{N==="start"?await Bb(s.name):N==="stop"?await zb(s.name):N==="restart"?await zd(s.name):N==="cleanRestart"?await zd(s.name,{clean:!0}):N==="pause"?await Ub(s.name,{level:"tools"}):N==="unpause"&&await $b(s.name),await v(),n&&n(s.name,N)}catch(R){u(R.message)}finally{f(null)}},[s==null?void 0:s.name,v,n]),b=(s==null?void 0:s.state)==="working"||(s==null?void 0:s.state)==="idle"||(s==null?void 0:s.state)==="starting"||(s==null?void 0:s.state)==="paused",k=(s==null?void 0:s.state)==="paused"||(s==null?void 0:s.paused),S=(s==null?void 0:s.displayName)||(s==null?void 0:s.name)||"Unknown Agent",E=(s==null?void 0:s.tokens)||{input:0,output:0,cached:0,total:0},_=Math.max(E.input,E.output,E.cached,1),w=(s==null?void 0:s.cost)||{input:0,output:0,cached:0,total:0};return g?o.jsx(hJ,{agentName:s==null?void 0:s.name,onClose:()=>{p(!1),r&&r(null)},onToolPartsChange:r,hackerMode:a}):o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors flex-shrink-0",title:i("agent_detail.back"),"aria-label":i("agent_detail.back"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",title:S,children:S}),(s==null?void 0:s.displayName)&&s.displayName!==s.name&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",title:s.name,children:s.name})]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:()=>y(!0),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:i("agent_detail.edit_settings"),"aria-label":i("agent_detail.edit_settings"),children:o.jsxs("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.jsx(xJ,{state:(s==null?void 0:s.state)||"stopped"})]})]}),o.jsx(mJ,{isOpen:m,agent:s,onClose:()=>y(!1),onUpdated:N=>{v(),n&&n(N,"updated")},onDeleted:N=>{n&&n(N,"deleted"),t()}}),c&&o.jsxs("div",{className:"mx-6 mt-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:c}),o.jsx("button",{onClick:()=>u(null),className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[o.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:b?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>x("stop"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:i(d==="stop"?"agents.stopping":"agents.stop")}),k?o.jsx("button",{onClick:()=>x("unpause"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:i(d==="unpause"?"agents.resuming":"agents.resume")}):o.jsx("button",{onClick:()=>x("pause"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:i(d==="pause"?"agents.pausing":"agents.pause")}),o.jsx("button",{onClick:()=>x("restart"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800/40 disabled:opacity-50 transition-colors",children:i(d==="restart"?"agents.restarting":"agents.restart")}),o.jsx("button",{onClick:()=>x("cleanRestart"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",title:i("agents.clean_restart_tooltip"),children:i(d==="cleanRestart"?"agents.restarting":"agents.clean_restart")})]}):o.jsx("button",{onClick:()=>x("start"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:i(d==="start"?"agents.starting":"agents.start")})}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:i("agent_detail.agent_info")}),o.jsxs("div",{className:"space-y-0",children:[o.jsx(Ki,{label:i("agent_detail.model"),value:s==null?void 0:s.model,mono:!0}),o.jsx(Ki,{label:i("agent_detail.port"),value:s==null?void 0:s.port,mono:!0}),o.jsx(Ki,{label:i("agent_detail.pid"),value:s==null?void 0:s.pid,mono:!0}),o.jsx(Ki,{label:i("agent_detail.session_id"),value:s!=null&&s.sessionId?s.sessionId.slice(0,12)+"...":null,mono:!0}),o.jsx(Ki,{label:i("agent_detail.uptime"),value:yJ(s==null?void 0:s.startedAt)}),o.jsx(Ki,{label:i("agent_detail.iteration"),value:s==null?void 0:s.iteration}),o.jsx(Ki,{label:i("agent_detail.start_mode"),value:s!=null&&s.skipInitialPrompt?i("agent_detail.start_mode_dormant"):i("agent_detail.start_mode_normal")})]})]}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:i("agent_detail.token_usage")}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(ly,{label:i("agent_detail.token_input"),value:E.input,max:_,color:"bg-blue-500"}),o.jsx(ly,{label:i("agent_detail.token_output"),value:E.output,max:_,color:"bg-green-500"}),o.jsx(ly,{label:i("agent_detail.token_cached"),value:E.cached,max:_,color:"bg-purple-500"}),o.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Total"}),o.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-gray-100",children:E.total.toLocaleString()})]})]})]}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Estimated Cost"}),o.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-3",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Input"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",w.input.toFixed(4)]})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Output"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",w.output.toFixed(4)]})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Cached"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",w.cached.toFixed(4)]})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:i("agent_detail.total_cost")}),o.jsxs("span",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:["$",w.total.toFixed(4)]})]})]}),(s==null?void 0:s.dailyUsage)&&s.dailyUsage.length>0&&o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Daily Usage (Last 7 Days)"}),o.jsx(pJ,{data:s.dailyUsage})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>p(!0),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),i("agent_detail.view_conversation")]}),o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>y(!0),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),i("agent_detail.edit_settings")]}),o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:async()=>{try{await A3(s.name)}catch(N){u(i("agents.export_error")+": "+N.message)}},children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),i("agents.export")]})]}),(s==null?void 0:s.cwd)&&o.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500 break-all",children:[o.jsx("span",{className:"font-medium",children:i("agent_detail.working_dir_label")}),o.jsx("br",{}),o.jsx("span",{className:"font-mono",children:s.cwd})]})]})]})}const Au=["swift","quick","rapid","agile","nimble","clever","smart","wise","bright","keen","bold","brave","calm","steady","noble","silent","shadow","storm","iron","steel","amber","azure","cobalt","crimson","golden","cosmic","cyber","digital","quantum","prime"],Ru=["falcon","hawk","eagle","raven","phoenix","wolf","fox","hound","coyote","tiger","panther","lynx","leopard","bear","orca","shark","viper","cobra","dragon","griffin","sentinel","guardian","titan","node","nexus","core","spark","pulse"];function oj(e=[],t=100){const n=new Set(e.map(s=>s.toLowerCase()));for(let s=0;s<t;s++){const l=Au[Math.floor(Math.random()*Au.length)],c=Ru[Math.floor(Math.random()*Ru.length)],u=`${l}-${c}`;if(!n.has(u))return u}const r=Au[Math.floor(Math.random()*Au.length)],a=Ru[Math.floor(Math.random()*Ru.length)],i=Math.floor(Math.random()*1e3);return`${r}-${a}-${i}`}function lj(e,t=[]){if(!e||typeof e!="string")return{valid:!1,error:"Name is required"};const n=e.trim().toLowerCase();return n.length===0?{valid:!1,error:"Name cannot be empty"}:n.length<2?{valid:!1,error:"Name must be at least 2 characters"}:n.length>50?{valid:!1,error:"Name must be 50 characters or less"}:/^[a-z0-9_-]+$/.test(n)?new Set(t.map(a=>a.toLowerCase())).has(n)?{valid:!1,error:"An agent with this name already exists"}:{valid:!0,error:null}:{valid:!1,error:"Name can only contain lowercase letters, numbers, hyphens, and underscores"}}function vJ(e){return e?e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const Iu=`# AGENTS.md - AI Agent Instructions
105
+ `+$t),pe&&($t=Rs($t)),w&&Qe?H($t):$t},t.setConfig=function(){let Be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Za(Be),D=!0,G=ge,ce=Re},t.clearConfig=function(){$n=null,D=!1,G=null,ce=null,w=R,N=""},t.isValidAttribute=function(Be,U,se){$n||Za({});const Ae=Dt(Be),et=Dt(U);return Lc(Ae,et,se)},t.addHook=function(Be,U){typeof U=="function"&&Rn(V,Be)&&$s(V[Be],U)},t.removeHook=function(Be,U){if(Rn(V,Be)){if(U!==void 0){const se=GQ(V[Be],U);return se===-1?void 0:KQ(V[Be],se,1)[0]}return O4(V[Be])}},t.removeHooks=function(Be){Rn(V,Be)&&(V[Be]=[])},t.removeAllHooks=function(){V=G4()},t}var xZ=j3();let iy=null;function yZ(){return iy||(iy=R5(()=>import("./mermaid.core-DO9mNo1y.js").then(e=>e.bo),[]).then(function(e){const t=e.default||e;return t.initialize({startOnLoad:!1,securityLevel:"strict",theme:"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),t})),iy}function K4(){return typeof document>"u"?!1:document.documentElement.classList.contains("dark")}let Y4=0;function bZ(){return Y4+=1,"pave-canvas-"+Y4}function vZ({source:e}){const t=h.useRef(null),n=h.useRef(bZ()),[r,a]=h.useState(null),[i,s]=h.useState(K4());return h.useEffect(function(){if(typeof window>"u")return;const l=new MutationObserver(function(){const c=K4();s(function(u){return u!==c?c:u})});return l.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),function(){l.disconnect()}},[]),h.useEffect(function(){let l=!1;return a(null),yZ().then(function(c){l||(c.initialize({startOnLoad:!1,securityLevel:"strict",theme:i?"dark":"default",flowchart:{curve:"basis"},suppressErrorRendering:!0}),c.render(n.current,e).then(function(u){if(!l&&t.current){let d=u.svg;d=d.replace(/<svg([^>]*)\sstyle="[^"]*max-width:[^";]*;?[^"]*"/i,"<svg$1"),d=d.replace(/(<svg[^>]*)\swidth="[^"]*"/i,"$1"),d=d.replace(/(<svg[^>]*)\sheight="[^"]*"/i,"$1"),d=d.replace(/<svg\b/i,'<svg width="100%" height="100%" preserveAspectRatio="xMidYMid meet"'),t.current.innerHTML=d}}).catch(function(u){l||a(u&&u.message||String(u))}))}).catch(function(c){l||a("Failed to load mermaid: "+(c&&c.message||String(c)))}),function(){l=!0}},[e,i]),r?o.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400 p-2",children:[o.jsx("div",{className:"font-semibold mb-1",children:"Mermaid render error:"}),o.jsx("pre",{className:"whitespace-pre-wrap",children:r}),o.jsxs("details",{className:"mt-2",children:[o.jsx("summary",{className:"cursor-pointer text-gray-600 dark:text-gray-400",children:"Source"}),o.jsx("pre",{className:"mt-1 p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})]})]}):o.jsx("div",{ref:t,className:"mermaid-canvas w-full h-full flex items-center justify-center [&>svg]:max-w-full [&>svg]:max-h-full [&>svg]:w-full [&>svg]:h-auto"})}function kZ({source:e}){const t=h.useMemo(function(){return xZ.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})},[e]);return o.jsx("div",{className:"svg-canvas overflow-x-auto",dangerouslySetInnerHTML:{__html:t}})}function _Z({source:e}){return o.jsx("pre",{className:"text-sm p-2 bg-gray-100 dark:bg-gray-800 rounded overflow-x-auto",children:e})}function wZ({canvas:e}){if(!e||!e.type||!e.source)return null;let t=null;return e.type==="mermaid"?t=o.jsx(vZ,{source:e.source}):e.type==="svg"?t=o.jsx(kZ,{source:e.source}):e.type==="katex"?t=o.jsx(_Z,{source:e.source}):t=o.jsxs("pre",{className:"text-xs text-red-600 dark:text-red-400",children:["Unknown canvas type: ",e.type]}),o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:t})}function X4({canvases:e,onClear:t}){const n=Array.isArray(e)?e:[],[r,a]=h.useState(Math.max(0,n.length-1)),[i,s]=h.useState(1),[l,c]=h.useState(!1);h.useEffect(function(){a(function(v){return v>=n.length-2?Math.max(0,n.length-1):Math.min(v,Math.max(0,n.length-1))})},[n.length]),h.useEffect(function(){s(1)},[r]),h.useEffect(function(){if(!l)return;const v=x=>{x.key==="Escape"&&c(!1)};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[l]);const u=h.useCallback(()=>s(v=>Math.min(4,+(v+.25).toFixed(2))),[]),d=h.useCallback(()=>s(v=>Math.max(.5,+(v-.25).toFixed(2))),[]),f=h.useCallback(()=>s(1),[]);if(n.length===0)return o.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-6 text-center",children:[o.jsx("svg",{className:"w-12 h-12 text-gray-300 dark:text-gray-600 mb-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 10V7m0 10a2 2 0 002 2h2a2 2 0 002-2V7a2 2 0 00-2-2h-2a2 2 0 00-2 2"})}),o.jsxs("div",{className:"text-sm text-gray-500 dark:text-gray-400 max-w-xs",children:["Ask the agent to draw something here. It can use the ",o.jsx("code",{className:"px-1 bg-gray-200 dark:bg-gray-700 rounded",children:"canvas"})," tool to render Mermaid diagrams, SVG illustrations, or math."]})]});const g=Math.min(Math.max(0,r),n.length-1),p=n[g],m=o.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-1.5 border-b border-gray-200 dark:border-gray-700 text-xs",children:[n.length>1?o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:()=>a(Math.max(0,g-1)),disabled:g===0,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Previous canvas",children:"←"}),o.jsxs("span",{className:"text-gray-500 dark:text-gray-400 tabular-nums",children:[g+1,"/",n.length]}),o.jsx("button",{type:"button",onClick:()=>a(Math.min(n.length-1,g+1)),disabled:g===n.length-1,className:"px-2 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40 disabled:cursor-not-allowed",title:"Next canvas",children:"→"})]}):o.jsx("div",{}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:d,disabled:i<=.5,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom out",children:"−"}),o.jsxs("button",{type:"button",onClick:f,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 tabular-nums min-w-[3rem]",title:"Reset zoom",children:[Math.round(i*100),"%"]}),o.jsx("button",{type:"button",onClick:u,disabled:i>=4,className:"px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 disabled:opacity-40",title:"Zoom in",children:"+"}),o.jsx("button",{type:"button",onClick:()=>c(v=>!v),className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",title:l?"Exit fullscreen (Esc)":"Fullscreen",children:l?"⤢":"⛶"}),t?o.jsx("button",{type:"button",onClick:t,className:"ml-1 px-1.5 py-0.5 rounded text-gray-600 dark:text-gray-300 hover:bg-red-50 dark:hover:bg-red-900/30 hover:text-red-600 dark:hover:text-red-400",title:"Clear all canvases (hides them; messages preserved)",children:"✕"}):null]})]}),y=o.jsxs("div",{className:"flex-1 overflow-auto p-3",children:[p.title?o.jsx("div",{className:"text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2",children:p.title}):null,o.jsx("div",{style:{transform:`scale(${i})`,transformOrigin:"top left",width:i===1?"100%":`${100/i}%`},children:o.jsx(wZ,{canvas:p})}),p.caption?o.jsx("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400 italic",children:p.caption}):null]});return l?o.jsxs("div",{className:"fixed inset-0 z-50 bg-white dark:bg-gray-900 flex flex-col",children:[m,y]}):o.jsxs("div",{className:"h-full flex flex-col",children:[m,y]})}function EZ(e){return e?e.includes("/")?e.split("/").slice(1).join("/")||null:e:null}function SZ(e,t){const n=EZ(e);return{modelID:n||t||null,activeModelID:n,conversationModelID:t}}const q1={"github-copilot":"GitHub Copilot",anthropic:"Anthropic",openai:"OpenAI",google:"Google",other:"Other"};function W1(e){return e==="recommended"?" — Recommended":e==="fast"?" — Fast":e==="premium"?" — Premium":""}function V1(e){const t={};return e.forEach(n=>{const r=n.provider||"other";t[r]||(t[r]=[]),t[r].push(n)}),t}const Q4={"claude-opus-4.5":2e5,"claude-opus-4.6":2e5,"claude-sonnet-4":2e5,"claude-sonnet-4.5":2e5,"claude-sonnet-4.6":2e5,"gpt-4o":128e3,"gpt-4.1":1047576,"gpt-4-turbo":128e3,"gpt-4":8192,o1:2e5,"o1-mini":128e3,o3:2e5,"o3-mini":2e5},NZ=128e3;function sy(e){const[t,n]=h.useState(e),r=h.useRef(e),a=h.useRef(0),i=h.useRef(0);return h.useEffect(()=>{if(e===r.current)return;a.current=0,r.current=t;const s=400,l=t,c=e,u=d=>{a.current||(a.current=d);const f=d-a.current,g=Math.min(f/s,1),p=1-Math.pow(1-g,3);n(Math.round(l+(c-l)*p)),g<1?i.current=requestAnimationFrame(u):n(c)};return i.current=requestAnimationFrame(u),()=>cancelAnimationFrame(i.current)},[e]),t}function CZ({messages:e,isBusy:t,activeModel:n,sessionModel:r,isPrivateMode:a,registryEntries:i}){var K,V;var{t:s}=Ct();const l=e.filter(I=>{var q;return((q=I.info)==null?void 0:q.role)==="user"}).length,c=e.filter(I=>{var q;return((q=I.info)==null?void 0:q.role)==="assistant"}).length;let u=0,d=0,f=0,g=null,p=null;for(let I=e.length-1;I>=0;I--){const q=e[I];if(((K=q.info)==null?void 0:K.role)==="assistant"&&((V=q.info)==null?void 0:V.mode)!=="compaction"){const ie=q.info.tokens;if(ie&&(ie.input||ie.output)){!g&&q.info.modelID&&(g=q.info.modelID),u=ie.lastInput??ie.input??0,d=ie.lastOutput??ie.output??0,f=ie.lastReasoning??ie.reasoning??0,q.info.contextLimit&&(p=q.info.contextLimit);break}}}const m=sy(u),y=sy(d),v=sy(f),x=m+y+v,b=u+d+f>0;let k=n;typeof r=="string"&&r?k=r:r&&r.providerID&&r.modelID&&(k=r.providerID+"/"+r.modelID);let{modelID:S,activeModelID:E}=SZ(k,g),_=null;if(a){S="privacy",E="privacy";let I=null;typeof r=="string"&&r?I=r.includes("/")?r.split("/").pop():r:r&&r.modelID&&(I=r.modelID),_=I||(n?String(n).split("/").pop():null)}else g&&E&&g!==E&&(_=g);const w=h.useMemo(()=>{const I={};if(i&&i.length>0){for(const q of i)if(q.limit&&typeof q.limit.context=="number"&&q.limit.context>0){I[q.key]=q.limit.context;const ie=q.key.includes("/")?q.key.split("/").pop():q.key;ie&&(I[ie]=q.limit.context)}}return I},[i]),N=g||S,j=!!(g&&E&&g!==E)&&(w[k]||w[S]||Q4[S])||p||w[N]||w[k]||Q4[N]||NZ,P=Math.min(100,Math.round(m/j*100));let F="bg-green-500";P>=90?F="bg-red-500":P>=75?F="bg-orange-500":P>=50&&(F="bg-yellow-500");const H="border-gray-200 dark:border-gray-800",L="text-gray-500 dark:text-gray-400",M="text-gray-500 dark:text-gray-400",T="text-gray-700 dark:text-gray-300",O="border-gray-100 dark:border-gray-800";return o.jsxs("div",{className:`p-4 border-t ${H}`,children:[o.jsx("p",{className:`text-xs ${L} uppercase tracking-wide font-medium mb-3`,children:s("token_usage.session_info")}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.messages")}),o.jsx("span",{className:`text-xs font-medium ${T}`,children:l+c})]}),S&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.model")}),o.jsx("span",{className:`text-xs font-medium ${T} truncate ml-2 max-w-[140px]`,children:Z4(S)})]}),_&&o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.originally")}),o.jsx("span",{className:`text-xs ${M} truncate ml-2 max-w-[140px]`,children:Z4(_)})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:s("token_usage.status")}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:`w-1.5 h-1.5 rounded-full ${t?"bg-accent-400 animate-pulse":"bg-green-500"}`}),o.jsx("span",{className:`text-xs font-medium ${T}`,children:s(t?"token_usage.generating":"token_usage.idle")})]})]}),b?o.jsx(o.Fragment,{children:o.jsxs("div",{className:`border-t ${O} pt-2 mt-2`,children:[o.jsxs("div",{className:"mb-2",children:[o.jsxs("div",{className:"flex items-center justify-between mb-1",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Context"}),o.jsxs("span",{className:`text-xs ${M}`,children:[P,"% of ",(j/1e3).toFixed(0),"k"]})]}),o.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:o.jsx("div",{className:`h-full ${F} transition-all duration-300`,style:{width:`${P}%`}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Input"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:m.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center justify-between mt-1",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Output"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:y.toLocaleString()})]}),f>0&&o.jsxs("div",{className:"flex items-center justify-between mt-1",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Reasoning"}),o.jsx("span",{className:`text-xs font-medium ${T} tabular-nums`,children:v.toLocaleString()})]}),o.jsxs("div",{className:`flex items-center justify-between mt-1 pt-1 border-t ${O}`,children:[o.jsx("span",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Total"}),o.jsx("span",{className:"text-xs font-semibold text-gray-900 dark:text-gray-100 tabular-nums",children:x.toLocaleString()})]})]})}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:`text-xs ${M}`,children:"Tokens"}),o.jsx("span",{className:`text-xs ${M}`,children:"--"})]})]})]})}function Z4(e){return e?{"claude-opus-4.5":"Claude Opus 4.5","claude-opus-4.6":"Claude Opus 4.6","claude-sonnet-4":"Claude Sonnet 4","claude-sonnet-4.5":"Claude Sonnet 4.5","claude-sonnet-4.6":"Claude Sonnet 4.6","gpt-4o":"GPT-4o","gpt-4.1":"GPT-4.1","gpt-4-turbo":"GPT-4 Turbo","gpt-4":"GPT-4"}[e]||e:""}function jZ({sessionModel:e,activeModel:t,registryEntries:n,onModelChange:r,disabled:a,lockedReason:i}){const{t:s}=Ct(),[l,c]=h.useState(!1),u=h.useRef(null),[d,f]=h.useState(-1),g=h.useRef([]);h.useEffect(()=>{if(!l)return;function b(k){u.current&&!u.current.contains(k.target)&&c(!1)}return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[l]),h.useEffect(()=>{if(!l)return;function b(k){if(k.key==="Escape"){c(!1);return}k.key!=="ArrowDown"&&k.key!=="ArrowUp"&&k.key!=="Home"&&k.key!=="End"||(k.preventDefault(),f(S=>{const E=g.current.length;if(!E)return S;const _=typeof S=="number"?S:-1;let w=_;return k.key==="ArrowDown"?w=_<E-1?_+1:0:k.key==="ArrowUp"?w=_>0?_-1:E-1:k.key==="Home"?w=0:k.key==="End"&&(w=E-1),g.current[w]&&g.current[w].focus(),w}))}return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[l]);const p=typeof e=="string"&&e.trim()?e.trim():null,m=p!=null,y=Array.isArray(n)?n:[],v=TZ(p,t,y,s),x=h.useCallback(b=>{r(b===t||p&&p===b?null:b),c(!1)},[p,t,r]);return g.current.length=y.length,o.jsxs("div",{className:"relative",ref:u,children:[o.jsxs("button",{type:"button",onClick:()=>c(b=>!b),disabled:a,className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium rounded-md transition-colors "+(m||v?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-900/50":"text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800")+(a?" opacity-50 cursor-not-allowed":" cursor-pointer"),title:i||s("model_selector.title"),"aria-label":i||s("model_selector.title"),"aria-haspopup":"menu","aria-expanded":l,children:[i?o.jsxs("svg",{className:"w-3.5 h-3.5 flex-shrink-0 text-emerald-600 dark:text-emerald-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 11c.667 0 2 .4 2 2v3a2 2 0 11-4 0v-3c0-1.6 1.333-2 2-2zM6 11V8a6 6 0 1112 0v3"}),o.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}):o.jsx("svg",{className:"w-3.5 h-3.5 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),o.jsx("span",{className:"max-w-[120px] truncate",children:v}),o.jsx("svg",{className:`w-3 h-3 transition-transform ${l?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),l&&o.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] max-h-72 overflow-y-auto bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50",role:"menu","aria-label":s("model_selector.list_label"),children:[y.length===0&&o.jsx("div",{className:"px-3 py-2 text-xs text-gray-400 dark:text-gray-500",children:s("model_selector.no_models")}),y.map((b,k)=>{const S=p===b.key,E=!!t&&(b.key===t||b.target===t||b.url===t),_=b.builtin?b.key:b.displayName||b.key;return o.jsxs("button",{type:"button",ref:w=>{g.current[k]=w},tabIndex:d===k?0:-1,role:"menuitemradio","aria-checked":S||!m&&E,onClick:()=>x(b.key),className:"w-full text-left px-3 py-2 text-xs transition-colors "+(S||!m&&E?"bg-primary-50 dark:bg-primary-900/20 text-primary-700 dark:text-primary-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800"),children:[o.jsx("span",{className:"font-medium",children:_}),E&&o.jsxs("span",{className:"ml-1 text-gray-400 dark:text-gray-500",children:["(",s("model_selector.default_label"),")"]})]},b.key)})]})]})}function TZ(e,t,n,r){return e?J4(e,n):t?J4(t,n):r("model_selector.default_label")}function AZ(e,t){if(!e||!Array.isArray(t))return null;for(let n=0;n<t.length;n++){const r=t[n];if(r&&(r.key===e||r.target===e||r.url===e))return r}return null}function J4(e,t){if(!e)return"";const n=AZ(e,t);return n?n.builtin?n.key:n.displayName||n.key:typeof e=="string"&&e.includes("/")?e.split("/").slice(1).join("/"):e}function RZ(e){e.sessionId;var t=e.disabledSkills,n=e.onToggle,r=e.onResetToDefaults,a=e.t,i=e.disabled,s=h.useState(!1),l=s[0],c=s[1],u=h.useState([]),d=u[0],f=u[1],g=h.useState(!1),p=g[0],m=g[1],y=h.useRef(null),v=t instanceof Array?new Set(t):new Set,x=h.useCallback(async function(){m(!0);try{var _=await Bv();f(_||[])}catch{}finally{m(!1)}},[]);h.useEffect(function(){x()},[x]),h.useEffect(function(){if(!l)return;function _(w){y.current&&!y.current.contains(w.target)&&c(!1)}return document.addEventListener("mousedown",_),function(){document.removeEventListener("mousedown",_)}},[l]);var b=v.size,k=v.has("agent"),S=k?b-1:b,E=Math.max(0,d.length-S+(k?0:1));return o.jsxs("div",{className:"relative",ref:y,children:[o.jsxs("button",{onClick:function(){c(!l)},disabled:i,className:"p-1.5 rounded-lg transition-colors "+(b>0?"bg-amber-500/10 text-amber-600 dark:text-amber-400":"text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800")+(i?" opacity-50 cursor-not-allowed":""),title:a("skills.toggle_title"),"aria-label":a("skills.toggle_title"),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 4a2 2 0 114 0v1a1 1 0 001 1h3a1 1 0 011 1v3a1 1 0 01-1 1h-1a2 2 0 100 4h1a1 1 0 011 1v3a1 1 0 01-1 1h-3a1 1 0 01-1-1v-1a2 2 0 10-4 0v1a1 1 0 01-1 1H7a1 1 0 01-1-1v-3a1 1 0 00-1-1H4a2 2 0 110-4h1a1 1 0 001-1V7a1 1 0 011-1h3a1 1 0 001-1V4z"})}),E>0&&o.jsx("span",{className:"absolute -top-1 -right-1 w-4 h-4 text-[9px] font-bold flex items-center justify-center bg-primary-500 text-white rounded-full",children:E})]}),l&&o.jsxs("div",{className:"absolute left-0 sm:left-auto sm:right-0 top-full mt-1 w-64 max-w-[calc(100vw-1.5rem)] bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg z-50 max-h-80 overflow-y-auto",children:[o.jsxs("div",{className:"px-3 py-2 border-b border-gray-100 dark:border-gray-800",children:[o.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:a("skills.toggle_header")}),o.jsx("p",{className:"text-[10px] text-gray-400 dark:text-gray-500 mt-0.5",children:a("skills.toggle_hint")})]}),p?o.jsx("div",{className:"flex items-center justify-center py-4",children:o.jsx("div",{className:"w-5 h-5 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):d.length===0?o.jsx("div",{className:"px-3 py-4 text-center",children:o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:a("skills.no_skills")})}):o.jsx("div",{className:"py-1",children:d.map(function(_){var w=v.has(_.name);return o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[o.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:_.name}),o.jsx("button",{onClick:function(){n(_.name,w)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(w?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!w,children:o.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(w?"translate-x-1":"translate-x-5")})})]},_.name)})}),o.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:o.jsx("p",{className:"text-[10px] font-semibold text-gray-400 dark:text-gray-500 uppercase tracking-wide",children:a("skills.builtin_tools")})}),o.jsx("div",{className:"py-1",children:o.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[o.jsx("span",{className:"text-xs text-gray-700 dark:text-gray-300 truncate flex-1 mr-2",children:a("skills.agent_comm")}),o.jsx("button",{onClick:function(){n("agent",k)},className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors flex-shrink-0 "+(k?"bg-gray-300 dark:bg-gray-600":"bg-primary-500"),role:"switch","aria-checked":!k,children:o.jsx("span",{className:"inline-block h-3.5 w-3.5 transform rounded-full bg-white transition-transform "+(k?"translate-x-1":"translate-x-5")})})]})}),r&&o.jsx("div",{className:"px-3 py-1.5 border-t border-gray-100 dark:border-gray-800",children:o.jsx("button",{onClick:r,className:"w-full text-xs font-medium text-gray-500 dark:text-gray-400 hover:text-primary-600 dark:hover:text-primary-400 hover:underline transition-colors text-center",children:a("skills.reset_to_defaults")})})]})]})}function IZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875S10.5 3.089 10.5 4.125c0 .369.128.713.349 1.003.215.283.401.604.401.959V6a.75.75 0 01-.75.75H7.5a.75.75 0 00-.75.75v2.25c0 .414-.336.75-.75.75S5.25 10.164 5.25 9.75V9A2.25 2.25 0 003 11.25v.75a.75.75 0 00.75.75h2.25c.414 0 .75.336.75.75s-.336.75-.75.75H3.75a.75.75 0 00-.75.75v.75A2.25 2.25 0 005.25 18h1.5a.75.75 0 01.75.75v.75c0 .414.336.75.75.75h6a.75.75 0 00.75-.75v-.75a.75.75 0 01.75-.75h1.5A2.25 2.25 0 0019.5 15.75v-.75a.75.75 0 00-.75-.75h-2.25a.75.75 0 01-.75-.75c0-.414.336-.75.75-.75h2.25a.75.75 0 00.75-.75v-.75A2.25 2.25 0 0017.25 9h-3a.75.75 0 01-.75-.75V6.087z"})})}function MZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M20 18h-2V9.25L12 13 6 9.25V18H4V6h1.2l6.8 4.25L18.8 6H20m0-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2z"})})}function LZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M7.71 3.5l-5.71 9.94 3.48 6.06h5.44L4.07 8.56 7.71 3.5zm1.42 0L15.84 15h-6.71L2.42 3.5h6.71zm.71 12h11.46l-3.48 6.06H6.36l3.48-6.06zm.71-1L16.84 3.5l5.71 9.94-3.48.06H10.55z"})})}function OZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"})})}function DZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z"})})}function PZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M3 6l3.5 12h2l2.5-8 2.5 8h2L19 6h-2.5l-2.25 8L12 6h-2l-2.25 8L5.5 6H3z"})})}function FZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M5 3a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2V5a2 2 0 00-2-2H5zm11.293 6.707l-5.5 5.5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 111.414-1.414L10.086 13.1l4.793-4.793a1 1 0 111.414 1.4z"})})}function BZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M4 18V6h3.2l2.8 7 2.8-7H16v12h-2.4V9.6L10.6 18H9.4L6.4 9.6V18H4z"})})}function zZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 15.5v-5l-3 3v-4l3-3v-3l4 4-4 4v4z"})})}function UZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}function $Z({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"})})}function HZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"currentColor",children:o.jsx("path",{d:"M6 2l6 3.75L6 9.5.002 5.75 6 2zm12 0l6 3.75-6 3.75-5.998-3.75L18 2zM.002 13.25L6 9.5l6 3.75L6 17 .002 13.25zm17.998-3.75l6 3.75L18 17l-5.998-3.75L18 9.5zM6 18.25l6-3.75 6 3.75-6 3.75-6-3.75z"})})}function qZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v12m-3-2.818l.879.659c1.171.879 3.07.879 4.242 0 1.172-.879 1.172-2.303 0-3.182C13.536 12.219 12.768 12 12 12c-.725 0-1.45-.22-2.003-.659-1.106-.879-1.106-2.303 0-3.182s2.9-.879 4.006 0l.415.33M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}function WZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"})})}function VZ({className:e,...t}){return o.jsx("svg",{className:e,...t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})})}const ej={gmail:MZ,gdrive:LZ,discord:OZ,whatsapp:DZ,wrike:PZ,gtasks:FZ,mailchimp:BZ,bamboohr:zZ,pandadoc:UZ,exa:$Z,dropbox:HZ,freshbooks:qZ,gcal:WZ,docx2md:VZ};function GZ(e){return Object.prototype.hasOwnProperty.call(ej,e)?ej[e]:IZ}const tj={gmail:"#EA4335",gdrive:"#4285F4",discord:"#5865F2",whatsapp:"#25D366",wrike:"#08CF65",gtasks:"#4285F4",mailchimp:"#FFE01B",bamboohr:"#73C41D",pandadoc:"#4ABB5A",exa:"#6366F1",dropbox:"#0061FF",freshbooks:"#00B7E3",gcal:"#4285F4",docx2md:"#6B7280"};function KZ({installed:e,configured:t,t:n}){return e?t?o.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),n("skills.configured")]}):o.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400",children:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),n("skills.needs_setup")]}):o.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400",children:n("skills.not_installed")})}function YZ({skill:e,onClose:t,onSaved:n}){var{t:r}=Ct(),a=hc(),[i,s]=h.useState({}),[l,c]=h.useState(!0),[u,d]=h.useState(!1),[f,g]=h.useState(null),[p,m]=h.useState(!1),[y,v]=h.useState(null);h.useEffect(function(){var R=!1;async function j(){try{var P=await QD(e.name);if(R)return;v(P);for(var F=Object.create(null),H=Object.keys(P.tokens||{}),L=0;L<H.length;L++){var M=H[L],T=P.tokens[M]||{},O=T.env||M;F[O]=""}s(F),c(!1)}catch($){R||(g($.message),c(!1))}}return j(),function(){R=!0}},[e.name]);var x=h.useMemo(function(){if(!y||!y.tokens)return null;if(y.oauth&&y.oauth.broker){var R=!!y.oauth.connected,j=y.oauth.provider||"";return{provider:j?j.charAt(0).toUpperCase()+j.slice(1):"OAuth",brokered:!0,canConnect:!R,refreshConfigured:R,clientIdConfigured:!0,clientSecretConfigured:!0}}for(var P=Object.keys(y.tokens),F=0;F<P.length;F++){var H=y.tokens[P[F]]||{};if(H.description&&H.description.includes("OAuth")){for(var L=null,M=null,T=null,O=Object.entries(y.tokens),$=0;$<O.length;$++){var Y=O[$][0];Y.includes("REFRESH_TOKEN")&&(L=Y),(Y.includes("CLIENT_ID")||Y.includes("APP_KEY"))&&(M=Y),(Y.includes("CLIENT_SECRET")||Y.includes("APP_SECRET"))&&(T=Y)}if(L&&M){var A=y.tokens[L]&&y.tokens[L].configured,K=y.tokens[M]&&y.tokens[M].configured,V=T&&y.tokens[T]&&y.tokens[T].configured,I="OAuth";return e.name==="gmail"||e.name==="gdrive"||e.name==="gcal"||e.name==="gtasks"?I="Google":e.name==="dropbox"?I="Dropbox":e.name==="freshbooks"&&(I="FreshBooks"),{provider:I,canConnect:K&&V&&!A,refreshConfigured:A,clientIdConfigured:K,clientSecretConfigured:V}}}}return null},[y,e.name]),b=h.useCallback(async function(){g(null),m(!0);try{if(x&&x.brokered){let ie=function(){N.current&&(clearInterval(N.current),N.current=null)};var R=await sP(e.name),j=600,P=700,F=(window.screen.width-j)/2,H=(window.screen.height-P)/2,L=window.open(R.authorizeUrl,"oauth_popup","width="+j+",height="+P+",left="+F+",top="+H+",scrollbars=yes");if(!L){g("Popup blocked. Please allow popups or visit: "+R.authorizeUrl),m(!1);return}var M=R.flowId,T=0,O=0;N.current=setInterval(async function(){T+=1500;try{var J=await oP(e.name,M);if(J&&J.connected){ie();try{L.close()}catch{}m(!1),n();return}}catch(je){ie(),g(je.message),m(!1);return}if(L.closed&&(O||(O=T),T-O>9e3)){ie(),m(!1),n();return}T>3e5&&(ie(),m(!1),g("Connection timed out. Please try again."))},1500);return}var $=await iP(e.name),Y=600,A=700,K=(window.screen.width-Y)/2,V=(window.screen.height-A)/2,I=window.open($.authorizeUrl,"oauth_popup","width="+Y+",height="+A+",left="+K+",top="+V+",scrollbars=yes");if(I)var q=setInterval(function(){I.closed&&(clearInterval(q),m(!1),n())},500);else g("Popup blocked. Please allow popups or visit: "+$.authorizeUrl),m(!1)}catch(ie){g(ie.message),m(!1)}},[e.name,n,x]),k=h.useCallback(async function(){g(null),d(!0);try{for(var R=Object.create(null),j=Object.keys(i),P=0;P<j.length;P++){var F=j[P];i[F]&&i[F].trim()&&(R[F]=i[F].trim())}if(Object.keys(R).length===0){g(r("skills.enter_token")),d(!1);return}await tP(e.name,R),n()}catch(H){g(H.message)}finally{d(!1)}},[i,e.name,n,r]),S=h.useCallback(async function(){if(await a({title:r("skills.clear_title"),message:r("skills.clear_confirm",{skill:e.name}),destructive:!0})){g(null),d(!0);try{await nP(e.name),n()}catch(R){g(R.message)}finally{d(!1)}}},[e.name,n,a,r]),E=h.useCallback(function(R,j){s(function(P){var F=Object.assign(Object.create(null),P);return F[R]=j,F})},[]),_=y&&!(y.oauth&&y.oauth.broker)?Object.entries(y.tokens||{}).map(function(R){var j=R[0],P=R[1],F=P&&P.env||j;return{name:j,env:F,description:P.description,configured:P.configured,maskedValue:P.maskedValue}}):[],w=h.useRef(null);h.useEffect(function(){function R(j){j.key==="Escape"&&t()}return document.addEventListener("keydown",R),w.current&&w.current.focus(),function(){document.removeEventListener("keydown",R)}},[t]);var N=h.useRef(null);return h.useEffect(function(){return function(){N.current&&(clearInterval(N.current),N.current=null)}},[]),o.jsx("div",{ref:w,tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:t,role:"dialog","aria-modal":"true","aria-label":r("skills.configure_skill",{skill:e.name}),children:o.jsxs("div",{className:"bg-white dark:bg-gray-900 rounded-xl shadow-2xl w-full max-w-lg mx-4 p-6",onClick:function(R){R.stopPropagation()},children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:r("skills.configure_skill",{skill:e.name})}),o.jsx("button",{onClick:t,className:"p-1 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400","aria-label":r("skills.close_credential_editor"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),l&&o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),!l&&_.length>0&&o.jsx("div",{className:"space-y-3 mb-4",children:_.map(function(R){return o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:[R.env,R.configured&&o.jsxs("span",{className:"ml-2 text-xs text-green-600 dark:text-green-400",children:["(",r("skills.current_value",{value:R.maskedValue}),")"]})]}),R.description&&o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:R.description}),o.jsx("input",{type:"password",placeholder:R.configured?r("skills.leave_blank"):r("skills.enter_value"),value:i[R.env]||"",onChange:function(j){E(R.env,j.target.value)},className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-lg bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-400"})]},R.env)})}),!l&&x&&o.jsx("div",{className:"mb-4 p-4 bg-gray-50 dark:bg-gray-800/50 rounded-lg border border-gray-200 dark:border-gray-700",children:x.canConnect?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-3",children:r("skills.oauth_connect_hint",{provider:x.provider})}),o.jsx("button",{onClick:b,disabled:p||u,className:"w-full flex items-center justify-center gap-2 px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white font-medium rounded-lg disabled:opacity-50 transition-colors",children:p?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),r("skills.oauth_connecting")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1"})}),r("skills.oauth_connect",{provider:x.provider})]})})]}):x.refreshConfigured?o.jsxs("div",{className:"space-y-3",children:[o.jsxs("p",{className:"text-sm text-green-600 dark:text-green-400 flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),r("skills.oauth_connected",{provider:x.provider})]}),o.jsx("button",{onClick:S,disabled:u,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:r("skills.oauth_disconnect",{provider:x.provider})})]}):o.jsx("p",{className:"text-sm text-amber-600 dark:text-amber-400",children:r("skills.oauth_needs_credentials",{provider:x.provider})})}),!l&&!f&&_.length===0&&!x&&o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400 py-4",children:r("skills.no_credentials_needed")}),f&&o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400 mb-3",children:f}),!l&&_.length>0&&o.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("button",{onClick:S,disabled:u,className:"text-sm text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 disabled:opacity-50",children:r("skills.clear_all")}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:t,className:"px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg",children:r("skills.cancel")}),o.jsx("button",{onClick:k,disabled:u,className:"px-4 py-1.5 text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 transition-colors",children:r(u?"skills.saving":"skills.save")})]})]})]})})}function XZ({skill:e,installed:t,updateInfo:n,updatingSkill:r,onConfigure:a,onInstall:i,onUpdate:s,onUninstall:l,skillDefaultEnabled:c,onToggleDefault:u,t:d}){var f=GZ(e.name),g=Object.prototype.hasOwnProperty.call(tj,e.name)?tj[e.name]:"#6B7280",[p,m]=h.useState(!1),y=r===e.name,v=n&&n.hasUpdate,x=h.useCallback(async function(){m(!0);try{await i(e)}finally{m(!1)}},[e,i]),b=h.useCallback(function(){s&&s(e.name)},[e.name,s]);return o.jsxs("div",{className:"group relative bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-xl p-4 hover:shadow-md dark:hover:shadow-gray-800/50 transition-all flex flex-col",children:[o.jsx("div",{className:"absolute top-0 left-4 right-4 h-0.5 rounded-full",style:{backgroundColor:g}}),o.jsxs("div",{className:"flex items-start gap-3 mt-1 flex-1",children:[o.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center flex-shrink-0",style:{backgroundColor:g+"15"},children:o.jsx(f,{className:"w-5 h-5",style:{color:g}})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.name}),o.jsx(KZ,{installed:t,configured:t&&e.allTokensConfigured,t:d}),t&&v&&o.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400",children:[o.jsx("svg",{className:"w-3 h-3 mr-1",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"v",n.latestVersion]}),t&&n&&!v&&o.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",children:d("skills.up_to_date")})]}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 line-clamp-2",children:e.description||d("skills.no_description")}),e.version&&o.jsxs("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:["v",e.version]})]})]}),o.jsx("div",{className:"mt-auto pt-3 flex items-center gap-2",children:t?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:function(){a(e)},className:"flex-1 px-3 py-1.5 text-xs font-medium text-gray-700 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors",children:d("skills.configure")}),u&&o.jsxs("button",{onClick:function(){u(e.name,!c)},title:d("skills.default_for_new_sessions"),className:"px-2 py-1.5 text-xs font-medium rounded-lg transition-colors flex items-center gap-1 "+(c?"text-primary-600 dark:text-primary-400 bg-primary-50 dark:bg-primary-900/20 hover:bg-primary-100 dark:hover:bg-primary-900/40":"text-gray-400 dark:text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800"),children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:c?o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}):o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),d("skills.default")]}),v&&o.jsx("button",{onClick:b,disabled:y,className:"px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:y?o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),d("skills.updating")]}):d("skills.update")}),l&&o.jsx("button",{onClick:function(){l(e)},title:d("skills.uninstall"),className:"px-2 py-1.5 text-xs font-medium text-gray-400 hover:text-red-500 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors","aria-label":d("skills.uninstall"),children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]}):o.jsx("button",{onClick:x,disabled:p,className:"flex-1 px-3 py-1.5 text-xs font-medium text-white bg-primary-500 hover:bg-primary-600 rounded-lg transition-colors disabled:opacity-50",children:p?o.jsxs("span",{className:"flex items-center justify-center gap-1",children:[o.jsx("svg",{className:"w-3 h-3 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),d("skills.installing")]}):d("skills.install")})})]})}function QZ({onBack:e}){var{t}=Ct(),[n,r]=h.useState([]),[a,i]=h.useState([]),[s,l]=h.useState(!0),[c,u]=h.useState(null),[d,f]=h.useState(null),[g,p]=h.useState("all"),[m,y]=h.useState(""),[v,x]=h.useState(!1),[b,k]=h.useState(Object.create(null)),[S,E]=h.useState(null),[_,w]=h.useState(!1),[N,R]=h.useState(Object.create(null)),j=hc(),P=h.useCallback(async function(){l(!0),u(null),w(!1);try{var q=await Promise.allSettled([Bv(),XD(),P5()]),ie=q[0].status==="fulfilled"?q[0].value:[],J=q[1].status==="fulfilled"?q[1].value:[],je=q[2].status==="fulfilled"?q[2].value.skillDefaults||{}:{};r(ie),i(J),R(je);var X=[];q[0].status==="rejected"&&X.push(t("skills.load_installed_failed",{error:q[0].reason.message})),q[1].status==="rejected"&&X.push(t("skills.load_marketplace_failed",{error:q[1].reason.message})),X.length>0&&u(X.join("; "))}catch(he){u(he.message)}finally{l(!1)}},[t]);h.useEffect(function(){P()},[P]);var F=[],H=new Set(n.map(function(q){return q.name}));n.forEach(function(q){F.push(Object.assign({},q,{_installed:!0}))}),a.forEach(function(q){H.has(q.name)||F.push(Object.assign({},q,{_installed:!1,allTokensConfigured:!1}))});var L=F;if(g==="installed"?L=F.filter(function(q){return q._installed}):g==="available"&&(L=F.filter(function(q){return!q._installed})),m){var M=m.toLowerCase();L=L.filter(function(q){return q.name&&q.name.toLowerCase().indexOf(M)!==-1||q.description&&q.description.toLowerCase().indexOf(M)!==-1||q.category&&q.category.toLowerCase().indexOf(M)!==-1})}var T=h.useCallback(async function(q){try{await ZD(q.name),P()}catch(ie){u(t("skills.install_failed",{error:ie.message}))}},[P,t]),O=h.useCallback(function(q){f(q)},[]),$=h.useCallback(async function(q){if(await j({title:t("skills.uninstall_title"),message:t("skills.uninstall_confirm",{skill:q.name}),destructive:!0,confirmLabel:t("skills.uninstall")}))try{await rP(q.name),P()}catch(ie){u(t("skills.uninstall_failed",{error:ie.message}))}},[P,j,t]),Y=h.useCallback(function(){f(null),P()},[P]),A=h.useCallback(async function(q,ie){R(function(je){var X=Object.assign({},je);return ie?X[q]=!0:delete X[q],X});try{var J={};J[q]=ie,await aP(J)}catch(je){R(function(X){var he=Object.assign({},X);return ie?delete he[q]:he[q]=!0,he}),u(je.message)}},[]),K=h.useCallback(async function(){x(!0),u(null);try{var q=await eP(),ie=Object.create(null);(q.skills||[]).forEach(function(J){ie[J.name]={hasUpdate:J.hasUpdate,latestVersion:J.latestVersion,currentVersion:J.currentVersion}}),k(ie),w(!0)}catch(J){u(J.message)}finally{x(!1)}},[]),V=h.useCallback(async function(q){E(q),u(null);try{var ie=await JD(q);ie.updated&&(k(function(J){var je=Object.assign(Object.create(null),J);return je[q]={hasUpdate:!1,latestVersion:J[q]?J[q].latestVersion:null,currentVersion:J[q]?J[q].currentVersion:null},je}),P())}catch(J){u(t("skills.update_failed")+": "+J.message)}finally{E(null)}},[P,t]),I=Object.values(b).filter(function(q){return q&&q.hasUpdate}).length;return o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-950 min-h-0",children:[o.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:e,className:"p-1.5 rounded-lg text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors","aria-label":t("skills.back_to_chat"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18"})})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:t("skills.skill_management")}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:t("skills.installed_count",{installed:n.length,available:a.filter(function(q){return!H.has(q.name)}).length})})]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:K,disabled:v||s,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-gray-600 dark:text-gray-300 bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-lg transition-colors disabled:opacity-50",children:v?o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-3.5 h-3.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.checking_updates")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),t("skills.check_updates")]})}),I>0&&o.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 rounded-full",children:t("skills.updates_available",{count:I})}),_&&I===0&&!v&&o.jsx("span",{className:"px-2 py-0.5 text-xs font-medium bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 rounded-full",children:t("skills.no_updates")}),o.jsx("div",{className:"flex items-center gap-1 bg-gray-100 dark:bg-gray-800 rounded-lg p-0.5",children:["all","installed","available"].map(function(q){return o.jsx("button",{onClick:function(){p(q)},className:"px-3 py-1 text-xs font-medium rounded-md transition-colors "+(g===q?"bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 shadow-sm":"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"),children:t("skills.tab_"+q)},q)})})]})]}),o.jsx("div",{className:"flex-shrink-0 px-6 py-3 border-b border-gray-100 dark:border-gray-800/50",children:o.jsxs("div",{className:"relative",children:[o.jsx("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),o.jsx("input",{type:"text",placeholder:t("skills.search_placeholder"),value:m,onChange:function(q){y(q.target.value)},className:"w-full pl-10 pr-4 py-2 text-sm bg-gray-50 dark:bg-gray-900 border border-gray-200 dark:border-gray-700 rounded-lg text-gray-900 dark:text-gray-100 placeholder-gray-400 outline-none focus:ring-2 focus:ring-primary-500/30 focus:border-primary-500"})]})}),o.jsxs("div",{className:"flex-1 overflow-y-auto overflow-x-hidden p-6 min-h-0",children:[s&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx("div",{className:"w-8 h-8 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}),c&&o.jsx("div",{className:"mb-4 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg border border-red-200 dark:border-red-800",children:o.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:c})}),!s&&L.length===0&&o.jsx("div",{className:"text-center py-12",children:o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:t(m?"skills.no_match":"skills.no_skills")})}),!s&&L.length>0&&o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:L.map(function(q){return o.jsx(XZ,{skill:q,installed:q._installed,updateInfo:b[q.name],updatingSkill:S,onConfigure:O,onInstall:T,onUpdate:V,onUninstall:q._installed?$:null,skillDefaultEnabled:!!N[q.name],onToggleDefault:q._installed?A:null,t},q.name)})})]}),d&&o.jsx(YZ,{skill:d,onClose:function(){f(null)},onSaved:Y})]})}const Kt="";function Yt(e,t={}){return fetch(e,{credentials:"include",...t})}async function ZZ(){const e=await Yt(Kt+"/api/agents");if(!e.ok)throw new Error("Failed to fetch agents: "+e.statusText);return e.json()}async function JZ(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e));if(!t.ok)throw new Error("Failed to fetch agent: "+t.statusText);return t.json()}async function Bb(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/start",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to start agent")}return t.json()}async function zb(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/stop",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to stop agent")}return t.json()}async function zd(e,t){const n={};t&&t.clean&&(n.clean=!0);const r=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to restart agent")}return r.json()}async function Ub(e,t){const n={};t&&t.level&&(n.level=t.level),t&&t.span&&(n.span=t.span);const r=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/pause",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to pause agent")}return r.json()}async function $b(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/unpause",{method:"POST"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to unpause agent")}return t.json()}async function eJ(e,t,n,r){const a={message:t,priority:n};r!=null&&(a.replyToInbox=r);const i=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/inbox",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.error||"Failed to send message to agent")}return i.json()}async function tJ(e,t,n){const r={message:t};n!=null&&(r.replyToInbox=n);const a=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/interrupt",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to send urgent interrupt to agent")}return a.json()}async function nJ(e,t){let n=Kt+"/api/agents/"+encodeURIComponent(e)+"/messages";t&&t.refresh&&(n+="?refresh=true");const r=await Yt(n);if(!r.ok)throw new Error("Failed to fetch agent messages: "+r.statusText);return r.json()}async function rJ(){const e=await Yt(Kt+"/api/pricing");if(!e.ok)throw new Error("Failed to fetch pricing: "+e.statusText);return e.json()}async function aJ(e){const t=await Yt(Kt+"/api/pricing",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to update pricing")}return t.json()}async function iJ(){const e=await Yt(Kt+"/api/pricing/reset",{method:"POST"});if(!e.ok){const t=await e.json().catch(()=>({}));throw new Error(t.error||"Failed to reset pricing")}return e.json()}async function sJ(e,t=!1){const n=Kt+"/api/agents/"+encodeURIComponent(e)+(t?"?force=true":""),r=await Yt(n,{method:"DELETE"});if(!r.ok){const a=await r.json().catch(()=>({}));throw new Error(a.error||"Failed to delete agent")}return r.json()}async function oJ(e){const t=await Yt(Kt+"/api/agents",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to create agent")}return t.json()}async function T3(){const e=await Yt(Kt+"/api/skills");if(!e.ok)throw new Error("Failed to fetch skills: "+e.statusText);return e.json()}async function G1(){const e=await Yt(Kt+"/api/models");if(!e.ok)throw new Error("Failed to fetch models: "+e.statusText);return e.json()}async function lJ(e,t){const n=await Yt(Kt+"/api/agents/"+encodeURIComponent(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to update agent")}return n.json()}async function cJ(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/agents-md");if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to fetch AGENTS.md")}return t.json()}async function uJ(e,t){const n=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/agents-md",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to update AGENTS.md")}return n.json()}async function A3(e){const t=await Yt(Kt+"/api/agents/"+encodeURIComponent(e)+"/export");if(!t.ok){const l=await t.json().catch(()=>({}));throw new Error(l.error||"Failed to export agent")}const n=await t.text(),r=new Blob([n],{type:"text/yaml"}),a=URL.createObjectURL(r),i=t.headers.get("X-Filename")||e+".agent.yaml",s=document.createElement("a");s.href=a,s.download=i,document.body.appendChild(s),s.click(),document.body.removeChild(s),setTimeout(()=>URL.revokeObjectURL(a),5e3)}async function dJ(e,t){const n=new URLSearchParams,r=n.toString()?"?"+n.toString():"",a=await Yt(Kt+"/api/agents/import"+r,{method:"POST",headers:{"Content-Type":"text/yaml"},body:e});if(!a.ok){const i=await a.json().catch(()=>({}));throw new Error(i.error||"Failed to import agent")}return a.json()}async function oy(){const e=await Yt(Kt+"/api/system/updates");if(!e.ok){const t="Failed to check for updates",n=await e.json().catch(()=>({})),r=n.error||n.message||n.output||e.statusText;throw r?r.indexOf(t)===0||r===t?new Error(r):new Error(t+": "+r):new Error(t)}return e.json()}async function fJ(){const e=await Yt(Kt+"/api/system/update",{method:"POST"});if(!e.ok){const n="Failed to perform update",r=await e.json().catch(()=>({})),a=r.error||r.message||r.output||e.statusText;throw a?a.indexOf(n)===0||a===n?new Error(a):new Error(n+": "+a):new Error(n)}const t=await e.json();if(t.status!=="success"){let n=t.error||t.message||"";throw t.output&&!t.error&&!t.message?n="Update returned status: "+(t.status||"failed")+(t.output?": "+t.output:""):t.output&&(n+=t.output?" ("+t.output+")":""),n||(n="Update returned unexpected status: "+(t.status||"unknown")),new Error(n)}return t}async function nj(){const e=await Yt(Kt+"/api/models/registry");if(!e.ok)throw new Error("Failed to fetch model registry: "+e.statusText);return e.json()}async function rj(e,t){const n=await Yt(Kt+"/api/models/registry",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e,...t})});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error||"Failed to save model: "+n.statusText)}return n.json()}async function aj(e){const t=await Yt(Kt+"/api/models/registry/"+encodeURIComponent(e),{method:"DELETE"});if(!t.ok){const n=await t.json().catch(()=>({}));throw new Error(n.error||"Failed to delete model: "+t.statusText)}return t.json()}function R3(e){const t=typeof e=="string"?e.split("-"):null;if(t&&t.length===3){const n=Number(t[0]),r=Number(t[1]),a=Number(t[2]);if(!Number.isNaN(n)&&!Number.isNaN(r)&&!Number.isNaN(a))return new Date(n,r-1,a)}return new Date(e)}function gJ(e){const t=R3(e),n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],r=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return n[t.getDay()]+", "+r[t.getMonth()]+" "+t.getDate()}function Tu(e){return e>=1e6?(e/1e6).toFixed(1)+"M":e>=1e3?(e/1e3).toFixed(1)+"K":e.toString()}function pJ({data:e}){if(!e||e.length===0)return o.jsx("div",{className:"h-32 flex items-center justify-center text-sm text-gray-400 dark:text-gray-500",children:"No usage data available"});const t=280,n=120,r={top:10,right:10,bottom:25,left:40},a=t-r.left-r.right,i=n-r.top-r.bottom,s=Math.max(...e.map(g=>(g.input||0)+(g.output||0)+(g.cached||0)),1),l=a/e.length,c=Math.max(8,l*.6),u=(l-c)/2,d=g=>i-g/s*i,f=[0,.25,.5,.75,1].map(g=>Math.round(s*g));return o.jsxs("div",{className:"relative",children:[o.jsxs("svg",{width:"100%",height:n,viewBox:`0 0 ${t} ${n}`,className:"overflow-visible",children:[f.map((g,p)=>{const m=r.top+d(g);return o.jsxs("g",{children:[o.jsx("line",{x1:r.left,y1:m,x2:t-r.right,y2:m,stroke:"currentColor",strokeOpacity:.1,className:"text-gray-400 dark:text-gray-600"}),o.jsx("text",{x:r.left-5,y:m,textAnchor:"end",dominantBaseline:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:Tu(g)})]},p)}),e.map((g,p)=>{const m=r.left+p*l+u,y=g.input||0,v=g.output||0,x=g.cached||0,b=y/s*i,k=v/s*i,S=x/s*i,E=r.top+i-b,_=E-k,w=_-S,N=R3(g.date),R=["S","M","T","W","T","F","S"][N.getDay()];return o.jsxs("g",{className:"group",children:[o.jsx("rect",{x:m-u,y:r.top,width:l,height:i,fill:"transparent",className:"cursor-pointer"}),y>0&&o.jsx("rect",{x:m,y:E,width:c,height:b,rx:2,className:"fill-blue-500 dark:fill-blue-400 transition-opacity group-hover:opacity-80"}),v>0&&o.jsx("rect",{x:m,y:_,width:c,height:k,rx:2,className:"fill-green-500 dark:fill-green-400 transition-opacity group-hover:opacity-80"}),x>0&&o.jsx("rect",{x:m,y:w,width:c,height:S,rx:2,className:"fill-purple-500 dark:fill-purple-400 transition-opacity group-hover:opacity-80"}),o.jsx("text",{x:m+c/2,y:n-5,textAnchor:"middle",className:"text-[9px] fill-gray-400 dark:fill-gray-500",children:R}),o.jsxs("g",{className:"opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:[o.jsx("rect",{x:m+c/2-45,y:Math.min(w,_,E)-50,width:90,height:45,rx:4,className:"fill-gray-900 dark:fill-gray-100"}),o.jsx("text",{x:m+c/2,y:Math.min(w,_,E)-38,textAnchor:"middle",className:"text-[9px] fill-white dark:fill-gray-900 font-medium",children:gJ(g.date)}),o.jsxs("text",{x:m+c/2,y:Math.min(w,_,E)-26,textAnchor:"middle",className:"text-[8px] fill-blue-300 dark:fill-blue-600",children:["In: ",Tu(y)]}),o.jsxs("text",{x:m+c/2,y:Math.min(w,_,E)-16,textAnchor:"middle",className:"text-[8px] fill-green-300 dark:fill-green-600",children:["Out: ",Tu(v)]}),o.jsxs("text",{x:m+c/2,y:Math.min(w,_,E)-6,textAnchor:"middle",className:"text-[8px] fill-purple-300 dark:fill-purple-600",children:["Cache: ",Tu(x)]})]})]},p)})]}),o.jsxs("div",{className:"flex items-center justify-center gap-4 mt-2 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-blue-500 dark:bg-blue-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Input"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-green-500 dark:bg-green-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Output"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("div",{className:"w-2 h-2 rounded-sm bg-purple-500 dark:bg-purple-400"}),o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Cached"})]})]})]})}function hJ({agentName:e,onClose:t,onToolPartsChange:n,hackerMode:r}){var{t:a}=Ct(),[i,s]=h.useState([]),[l,c]=h.useState(!0),[u,d]=h.useState(null),[f,g]=h.useState(!1),[p,m]=h.useState(""),[y,v]=h.useState(!0),[x,b]=h.useState(!1),[k,S]=h.useState(!1),[E,_]=h.useState(!1),[w,N]=h.useState(!1),R=h.useRef(null),j=h.useRef(null),P=h.useRef(!0),F=h.useRef([]),H=h.useRef(null),L=h.useRef(null),M=h.useRef(null),T=h.useRef(null);h.useEffect(function(){F.current=i},[i]);var O=h.useCallback(async function(J,je){if(e){je!==!1&&c(!0);try{var X=await nJ(e,{refresh:!!J}),he=X.messages||[],Me=F.current,we=he.length!==Me.length;if(!we&&he.length>0&&Me.length>0){var ge=he[he.length-1],Se=Me[Me.length-1];if(ge.info.id!==Se.info.id&&(we=!0),!we){var Re=ge.parts||[],me=Se.parts||[];if(Re.length!==me.length)we=!0;else for(var ye=0;ye<Re.length&&!we;ye++){var Oe=Re[ye]||{},be=me[ye]||{},ee=Oe.state?Oe.state.status:Oe.status,Ee=be.state?be.state.status:be.status;(Oe.id!==be.id||ee!==Ee)&&(we=!0)}}}we&&s(he.slice()),d(null)}catch(fe){console.error("Failed to load messages:",fe),d(fe.message)}finally{je!==!1&&c(!1)}}},[e]);h.useEffect(function(){O(!0);var J=setInterval(function(){O(!0,!1)},5e3);return function(){clearInterval(J),L.current&&clearTimeout(L.current),T.current&&clearTimeout(T.current)}},[O]),h.useEffect(function(){P.current&&R.current&&R.current.scrollIntoView({behavior:"smooth"})},[i]);var $=h.useCallback(function(){var J=j.current;J&&(P.current=J.scrollHeight-J.scrollTop-J.clientHeight<50)},[]),Y=h.useMemo(function(){for(var J=null,je=i.length-1;je>=0;je--)if(i[je].info&&i[je].info.role==="assistant"){J=i[je];break}return J?(J.parts||[]).filter(function(X){return X.type==="tool"}):[]},[i]);h.useEffect(function(){n&&n(Y)},[Y,n]);var A=h.useCallback(async function(){if(!(!p.trim()||x)){b(!0),S(!1),_(!1),N(!1),d(null);try{await eJ(e,p.trim(),"normal",y),m(""),S(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(function(){S(!1),g(!1),L.current=null},1500),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){O(!0,!1),T.current=null},500)}catch(J){d(J.message)}finally{b(!1)}}},[e,p,y,x,O]),K=h.useCallback(async function(){if(!(!p.trim()||x)){if(!w){N(!0);return}b(!0),S(!1),_(!0),N(!1),d(null);try{await tJ(e,p.trim(),y),m(""),S(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(function(){S(!1),g(!1),L.current=null},1500),T.current&&clearTimeout(T.current),T.current=setTimeout(function(){O(!0,!1),T.current=null},500)}catch(J){d(J.message)}finally{b(!1)}}},[e,p,x,w,y,O]),V=h.useCallback(function(){g(!1),N(!1),d(null),L.current&&(clearTimeout(L.current),L.current=null),T.current&&(clearTimeout(T.current),T.current=null),S(!1)},[]);h.useEffect(function(){if(!f)return;function J(je){je.key==="Escape"&&!x&&V()}return document.addEventListener("keydown",J),function(){document.removeEventListener("keydown",J)}},[f,V,x]),h.useEffect(function(){if(!(!f||!M.current)){var J=M.current;J.contains(document.activeElement)||J.focus()}},[f]);var I=h.useCallback(function(J){J.target===J.currentTarget&&!x&&V()},[V,x]),q=h.useCallback(function(J){J.key==="Enter"&&!J.shiftKey&&!w&&(J.preventDefault(),A())},[A,w]),ie=h.useCallback(function(){},[]);return o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 relative",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:a("agents.back"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsxs("div",{children:[o.jsx("h2",{className:"text-sm font-semibold text-gray-900 dark:text-gray-100",children:"Conversation"}),o.jsxs("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:[e," - ",i.length," messages"]})]})]}),o.jsx("button",{onClick:function(){P.current=!0,O(!0),R.current&&R.current.scrollIntoView({behavior:"smooth"})},disabled:l,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",title:a("agents.refresh"),children:o.jsx("svg",{className:`w-4 h-4 ${l?"animate-spin":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})})]}),u&&o.jsxs("div",{className:"mx-4 mt-3 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:u}),o.jsx("button",{onClick:function(){d(null)},className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),k&&o.jsxs("div",{className:`mx-4 mt-3 px-4 py-2 text-sm rounded-lg flex items-center gap-2 ${E?"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400":"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400"}`,children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:E?o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"}):o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),a(E?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")]}),o.jsx("div",{ref:j,onScroll:$,className:"flex-1 overflow-y-auto px-4 py-4",children:l&&i.length===0?o.jsx("div",{className:"flex items-center justify-center h-32",children:o.jsx("div",{className:"w-6 h-6 border-2 border-primary-500 border-t-transparent rounded-full animate-spin"})}):i.length===0?o.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-center",children:[o.jsx("div",{className:"w-12 h-12 rounded-xl bg-gray-100 dark:bg-gray-800 flex items-center justify-center mb-3",children:o.jsx("svg",{className:"w-6 h-6 text-gray-400 dark:text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})})}),o.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:a("agent_conversation.no_messages")}),o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mt-1",children:a("agent_conversation.no_messages_hint")})]}):o.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[i.map(function(J){return o.jsx(iI,{message:J.info,parts:J.parts,streamingParts:null,searchQuery:null,matchOffset:-1,matchCount:0,activeMatchIndex:-1,registerMatchRef:ie,hackerMode:r,hideThinking:!1},J.info.id)}),o.jsx("div",{ref:R})]})}),o.jsx("div",{className:"absolute bottom-6 right-6",children:o.jsxs("button",{onClick:function(){g(!0),N(!1),d(null)},className:"px-4 py-2.5 bg-primary-500 hover:bg-primary-600 text-white rounded-full shadow-lg font-medium text-sm transition-colors flex items-center gap-2","aria-label":a("agent_conversation.compose_button"),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})}),a("agent_conversation.compose_button")]})}),f&&o.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40 backdrop-blur-sm",onClick:I,children:o.jsxs("div",{ref:M,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":"compose-modal-title",className:"bg-white dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700 shadow-xl w-full max-w-lg mx-4 max-h-[80vh] flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:[o.jsx("h3",{id:"compose-modal-title",className:"text-base font-semibold text-gray-900 dark:text-white",children:a("agent_conversation.modal_title",{name:e})}),o.jsx("button",{onClick:V,disabled:x,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors"+(x?" opacity-50 cursor-not-allowed":""),"aria-label":a("common.close"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"px-5 py-4 space-y-4 overflow-y-auto flex-1 min-h-0",children:[o.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:y,onChange:function(J){v(J.target.checked)},className:"w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),o.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:a("agent_conversation.reply_to_inbox")})]}),o.jsx("textarea",{ref:H,value:p,onChange:function(J){m(J.target.value)},onKeyDown:q,placeholder:a("agent_conversation.send_placeholder"),className:"w-full px-4 py-3 bg-gray-50 dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 outline-none resize-none text-sm text-gray-900 dark:text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 focus:ring-2 focus:ring-primary-500 dark:focus:ring-primary-400 focus:border-transparent",rows:4,disabled:x,autoFocus:!0}),k&&o.jsx("p",{className:"text-sm text-green-600 dark:text-green-400 font-medium",children:a(E?"agent_conversation.interrupt_sent":"agent_conversation.message_queued")}),u&&o.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:u})]}),o.jsx("div",{className:"px-5 py-4 border-t border-gray-200 dark:border-gray-700 flex-shrink-0",children:w?o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs text-red-500 dark:text-red-400 font-medium",children:a("agent_conversation.urgent_warning")}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("button",{onClick:function(){N(!1)},className:"px-3 py-1.5 text-xs text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200 transition-colors",children:a("common.cancel")}),o.jsxs("button",{onClick:K,disabled:!p.trim()||x,className:"px-3 py-1.5 bg-red-500 hover:bg-red-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed text-xs font-medium transition-colors flex items-center gap-1.5",children:[x&&E?o.jsx("div",{className:"w-3 h-3 border-2 border-white border-t-transparent rounded-full animate-spin"}):o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),a("agent_conversation.confirm_interrupt")]})]})]}):o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("button",{onClick:K,disabled:!p.trim()||x,className:"px-3 py-1.5 text-xs text-red-500 dark:text-red-400 hover:text-red-600 dark:hover:text-red-300 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-1.5",children:[o.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13 10V3L4 14h7v7l9-11h-7z"})}),a("agent_conversation.urgent_interrupt_button")]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:V,disabled:x,className:"px-4 py-2 text-sm transition-colors"+(x?" text-gray-400 dark:text-gray-600 cursor-not-allowed":" text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200"),children:a("common.cancel")}),o.jsxs("button",{onClick:A,disabled:!p.trim()||x,className:"px-4 py-2 bg-primary-500 hover:bg-primary-600 text-white rounded-lg disabled:opacity-50 disabled:cursor-not-allowed font-medium text-sm transition-colors flex items-center gap-2",children:[x&&!E?o.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}):o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"})}),a("agent_conversation.send_button")]})]})]})})]})})]})}function mJ({isOpen:e,agent:t,onClose:n,onUpdated:r,onDeleted:a}){const{t:i}=Ct(),[s,l]=h.useState(""),[c,u]=h.useState(""),[d,f]=h.useState(""),[g,p]=h.useState(""),[m,y]=h.useState(!1),[v,x]=h.useState([]),[b,k]=h.useState(!1),[S,E]=h.useState(""),[_,w]=h.useState(null),[N,R]=h.useState(!1),[j,P]=h.useState([]),[F,H]=h.useState([]),[L,M]=h.useState(!1),[T,O]=h.useState(!0),[$,Y]=h.useState(!1),[A,K]=h.useState(!1),[V,I]=h.useState(null),[q,ie]=h.useState(!1),[J,je]=h.useState(!1),[X,he]=h.useState("general"),[Me,we]=h.useState(!1);h.useEffect(()=>{const fe={cancelled:!1};if(e&&t&&!Me){ge();const ve=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";Se(fe,ve),we(!0)}return e||(we(!1),y(!1),p(""),O(!0),H([])),()=>{fe.cancelled=!0}},[e,t==null?void 0:t.name]);const ge=()=>{if(!t)return;l(t.displayName||t.name||""),u(t.cwd||"");const fe=(typeof t.model=="string"?t.model.trim():t.model)||"github-copilot/claude-opus-4.6";f(fe),y(!1),p(""),x(Array.isArray(t.skills)?t.skills:[]),k(!!t.skipInitialPrompt)},Se=async(fe,ve)=>{M(!0),O(!0),t!=null&&t.name&&Y(!0);const de=[T3(),G1()];t!=null&&t.name&&de.push(cJ(t.name));const pe=await Promise.allSettled(de);if(fe.cancelled)return;const[De,B,D]=pe;if(De.status==="fulfilled"?P(De.value):(console.error("Failed to load skills:",De.reason),P([])),M(!1),B.status==="fulfilled"){const G=B.value;H(G);const ce=ve;G.find(Te=>Te.id===ce)||(y(!0),p(ce),f(ce))}else console.error("Failed to load models:",B.reason),H([]);if(O(!1),t!=null&&t.name&&D){if(D.status==="fulfilled"){const G=D.value;E(G.content||""),w(G.path||null),R(G.exists||!1)}else console.error("Failed to load AGENTS.md:",D.reason),E(""),w(null),R(!1);Y(!1)}},Re=fe=>{x(ve=>ve.includes(fe)?ve.filter(de=>de!==fe):[...ve,fe])},me=()=>{v.length===j.length?x([]):x(j.map(fe=>fe.name))},ye=async fe=>{if(fe&&fe.preventDefault(),!!(t!=null&&t.name)){I(null),K(!0);try{await lJ(t.name,{displayName:s.trim()||t.name,workspace:c.trim(),model:d,skipInitialPrompt:b,skills:v}),_&&S!==null&&!Ee&&await uJ(t.name,S),r&&r(t.name),n()}catch(ve){I(ve.message)}finally{K(!1)}}},Oe=async()=>{if(t!=null&&t.name){je(!0),I(null);try{await sJ(t.name,!0),a&&a(t.name),n()}catch(fe){I(fe.message),ie(!1)}finally{je(!1)}}},be=()=>{!A&&!J&&(I(null),ie(!1),he("general"),n())};if(!e||!t)return null;const ee=t.state==="working"||t.state==="idle"||t.state==="starting",Ee=c.trim()!==(t.cwd||"");return o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:be}),q&&o.jsxs("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/30",onClick:()=>ie(!1)}),o.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-xl shadow-2xl max-w-md w-full p-6",children:[o.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 mb-2",children:"Delete Agent?"}),o.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:["Are you sure you want to delete ",o.jsx("strong",{children:t.displayName||t.name}),"?",ee&&o.jsx("span",{className:"block mt-2 text-yellow-600 dark:text-yellow-400",children:"Warning: This agent is currently running and will be stopped."})]}),o.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500 mb-4",children:"This will remove the agent registration. The workspace directory will not be deleted."}),o.jsxs("div",{className:"flex justify-end gap-3",children:[o.jsx("button",{onClick:()=>ie(!1),disabled:J,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:i("common.cancel")}),o.jsx("button",{onClick:Oe,disabled:J,className:"px-4 py-2 rounded-lg bg-red-600 hover:bg-red-700 text-white font-medium transition-colors disabled:opacity-50 flex items-center gap-2",children:J?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i("common.deleting")]}):i("common.delete")})]})]})]}),o.jsxs("div",{className:"relative bg-white dark:bg-gray-900 rounded-2xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100",children:i("agent_edit.title")}),o.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:[t.name,ee&&o.jsxs("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:["(",i("agent_edit.running_warning"),")"]})]})]}),o.jsx("button",{onClick:be,disabled:A||J,className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-400 transition-colors disabled:opacity-50",children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex border-b border-gray-200 dark:border-gray-800 px-6",children:[o.jsx("button",{onClick:()=>he("general"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${X==="general"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:i("agent_edit.tab_general")}),o.jsx("button",{onClick:()=>he("soul"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${X==="soul"?"border-primary-500 text-primary-600 dark:text-primary-400":"border-transparent text-gray-500 hover:text-gray-700 dark:hover:text-gray-300"}`,children:i("agent_edit.tab_soul")})]}),o.jsxs("form",{onSubmit:fe=>fe.preventDefault(),className:"flex-1 overflow-y-auto p-6 space-y-6",children:[V&&o.jsxs("div",{className:"px-4 py-3 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:V}),o.jsx("button",{type:"button",onClick:()=>I(null),className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),X==="general"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{children:[o.jsxs("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:[i("agent_edit.name_label"),o.jsx("span",{className:"text-gray-400 font-normal ml-1",children:i("agent_edit.cannot_change")})]}),o.jsx("input",{type:"text",value:t.name,disabled:!0,className:"w-full px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 cursor-not-allowed font-mono"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.display_name_label")}),o.jsx("input",{type:"text",value:s,onChange:fe=>l(fe.target.value),placeholder:i("agent_edit.display_name_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500"})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.working_dir_label")}),ee?o.jsx("div",{className:"px-4 py-2 rounded-lg bg-gray-100 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 font-mono text-sm break-all",children:c||i("agent_edit.not_set")}):o.jsx("input",{type:"text",value:c,onChange:fe=>u(fe.target.value),placeholder:i("agent_edit.working_dir_placeholder"),disabled:A||J,className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm disabled:opacity-50"}),ee?o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.stop_to_change")}):c.trim()!==(t.cwd||"")?o.jsx("p",{className:"mt-1 text-xs text-amber-500 dark:text-amber-400",children:i("agent_edit.workspace_move_warning")}):o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.working_dir_hint")})]}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.model_label")}),T?o.jsx("div",{className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-400 text-sm",children:i("agent_edit.loading_models")}):F.length===0?o.jsx("input",{type:"text",value:d,onChange:fe=>f(fe.target.value),placeholder:i("agent_edit.model_placeholder"),className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"}):o.jsxs(o.Fragment,{children:[o.jsxs("select",{value:m?"__custom__":d,onChange:fe=>{fe.target.value==="__custom__"?(y(!0),d&&d!=="__custom__"&&p(d)):(y(!1),f(fe.target.value))},className:"w-full px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-primary-500",children:[(()=>{const fe=V1(F);return Object.entries(fe).map(([ve,de])=>o.jsx("optgroup",{label:q1[ve]||ve,children:de.map(pe=>o.jsxs("option",{value:pe.id,children:[pe.name,W1(pe.tier)]},pe.id))},ve))})(),o.jsx("option",{value:"__custom__",children:i("agent_edit.custom_model")})]}),m&&o.jsx("input",{type:"text",value:g,onChange:fe=>{p(fe.target.value),f(fe.target.value)},placeholder:i("agent_edit.custom_model_placeholder"),className:"w-full mt-2 px-4 py-2 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm"})]}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i(m?"agent_edit.custom_model_hint":"agent_edit.model_hint")})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_edit.start_mode")}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[o.jsx("input",{type:"checkbox",checked:b,onChange:fe=>k(fe.target.checked),className:"mt-0.5 rounded border-gray-300 dark:border-gray-600 text-primary-600 focus:ring-primary-500"}),o.jsxs("div",{children:[o.jsx("span",{className:"text-sm text-gray-900 dark:text-gray-100",children:i("agent_edit.dormant_mode")}),o.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:i("agent_edit.dormant_mode_desc")})]})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:i("agent_edit.skills_label")}),o.jsx("button",{type:"button",onClick:me,className:"text-xs text-primary-600 dark:text-primary-400 hover:underline",children:v.length===j.length?i("agent_edit.deselect_all"):i("agent_edit.select_all")})]}),o.jsx("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg p-3 max-h-48 overflow-y-auto bg-gray-50 dark:bg-gray-800",children:L?o.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_edit.loading_skills")}):j.length===0?o.jsx("div",{className:"text-center py-4 text-gray-500",children:i("agent_edit.no_skills")}):o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-2",children:j.map(fe=>o.jsxs("label",{className:`flex items-center gap-2 px-3 py-2 rounded-lg cursor-pointer transition-colors ${v.includes(fe.name)?"bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300":"hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300"}`,children:[o.jsx("input",{type:"checkbox",checked:v.includes(fe.name),onChange:()=>Re(fe.name),className:"rounded border-gray-300 text-primary-600 focus:ring-primary-500"}),o.jsxs("span",{className:"text-sm truncate",title:fe.description,children:[fe.icon&&o.jsx("span",{className:"mr-1",children:fe.icon}),fe.name]})]},fe.name))})}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.skills_selected",{count:v.length})})]})]}),X==="soul"&&o.jsxs("div",{className:"space-y-4",children:[_&&o.jsxs("div",{className:"text-xs text-gray-500 dark:text-gray-400 font-mono bg-gray-50 dark:bg-gray-800 rounded px-3 py-2",children:[_,!N&&o.jsx("span",{className:"ml-2 text-yellow-600 dark:text-yellow-400",children:i("agent_edit.will_be_created")})]}),!_&&!c.trim()&&o.jsx("div",{className:"px-4 py-3 bg-yellow-50 dark:bg-yellow-900/20 text-yellow-700 dark:text-yellow-400 text-sm rounded-lg",children:i("agent_edit.no_workspace_warning")}),Ee&&o.jsx("div",{className:"px-4 py-3 bg-amber-50 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400 text-sm rounded-lg",children:i("agent_edit.workspace_changed_warning")}),o.jsxs("div",{children:[o.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2",children:i("agent_edit.instructions_label")}),o.jsx("textarea",{value:S,onChange:fe=>E(fe.target.value),disabled:!_||Ee,rows:16,placeholder:i($?"common.loading":"agent_edit.soul_placeholder"),className:"w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 text-gray-900 dark:text-gray-100 placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-primary-500 font-mono text-sm resize-none disabled:cursor-not-allowed disabled:opacity-50"}),o.jsx("p",{className:"mt-1 text-xs text-gray-400",children:i("agent_edit.instructions_hint")})]})]})]}),o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-t border-gray-200 dark:border-gray-800 bg-gray-50 dark:bg-gray-900",children:[o.jsxs("button",{type:"button",onClick:()=>ie(!0),disabled:A||J,className:"px-4 py-2 rounded-lg text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-50 flex items-center gap-2",children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),i("common.delete")]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{type:"button",onClick:be,disabled:A||J,className:"px-4 py-2 rounded-lg text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors disabled:opacity-50",children:i("common.cancel")}),o.jsx("button",{type:"button",onClick:ye,disabled:A||J,className:"px-6 py-2 rounded-lg bg-primary-600 hover:bg-primary-700 text-white font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:A?o.jsxs(o.Fragment,{children:[o.jsxs("svg",{className:"w-4 h-4 animate-spin",fill:"none",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),i("agent_edit.saving")]}):o.jsxs(o.Fragment,{children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),i("agent_edit.save")]})})]})]})]})]})}const ij={working:"bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400",idle:"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-400",paused:"bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400",stopped:"bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400",crashed:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",error:"bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400",starting:"bg-yellow-100 dark:bg-yellow-900/30 text-yellow-700 dark:text-yellow-400"},sj={working:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})}),idle:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{d:"M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"})}),paused:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zM7 8a1 1 0 012 0v4a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v4a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"})}),stopped:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8 7a1 1 0 00-1 1v4a1 1 0 001 1h4a1 1 0 001-1V8a1 1 0 00-1-1H8z",clipRule:"evenodd"})}),crashed:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),error:o.jsx("svg",{className:"w-4 h-4 mr-1.5",fill:"currentColor",viewBox:"0 0 20 20",children:o.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),starting:o.jsx("svg",{className:"w-4 h-4 mr-1.5 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})})};function xJ({state:e}){const t=ij[e]||ij.stopped,n=sj[e]||sj.stopped;return o.jsxs("span",{className:`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${t}`,children:[n,e]})}function yJ(e){if(!e)return"-";const t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return n+"s";const r=Math.floor(n/60);if(r<60)return r+"m";const a=Math.floor(r/60),i=r%60;if(a<24)return a+"h "+i+"m";const s=Math.floor(a/24),l=a%24;return s+"d "+l+"h"}function ly({label:e,value:t,max:n,color:r}){const a=n>0?Math.min(100,Math.round(t/n*100)):0;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between text-xs",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:e}),o.jsx("span",{className:"text-gray-700 dark:text-gray-300 font-medium",children:t.toLocaleString()})]}),o.jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:o.jsx("div",{className:`h-full ${r} transition-all duration-300`,style:{width:a+"%"}})})]})}function Ki({label:e,value:t,mono:n}){return o.jsxs("div",{className:"flex items-center justify-between py-2 border-b border-gray-100 dark:border-gray-800 last:border-0",children:[o.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:e}),o.jsx("span",{className:`text-sm text-gray-900 dark:text-gray-100 ${n?"font-mono":""}`,children:t||"-"})]})}function bJ({agent:e,onClose:t,onAction:n,onToolPartsChange:r,hackerMode:a}){const{t:i}=Ct(),[s,l]=h.useState(e),[c,u]=h.useState(null),[d,f]=h.useState(null),[g,p]=h.useState(!1),[m,y]=h.useState(!1),v=h.useCallback(async()=>{if(e!=null&&e.name)try{const N=await JZ(e.name);l(N),u(null)}catch(N){console.error("Failed to load agent:",N),u(N.message)}},[e==null?void 0:e.name]);h.useEffect(()=>{v();const N=setInterval(v,5e3);return()=>clearInterval(N)},[v]);const x=h.useCallback(async N=>{f(N),u(null);try{N==="start"?await Bb(s.name):N==="stop"?await zb(s.name):N==="restart"?await zd(s.name):N==="cleanRestart"?await zd(s.name,{clean:!0}):N==="pause"?await Ub(s.name,{level:"tools"}):N==="unpause"&&await $b(s.name),await v(),n&&n(s.name,N)}catch(R){u(R.message)}finally{f(null)}},[s==null?void 0:s.name,v,n]),b=(s==null?void 0:s.state)==="working"||(s==null?void 0:s.state)==="idle"||(s==null?void 0:s.state)==="starting"||(s==null?void 0:s.state)==="paused",k=(s==null?void 0:s.state)==="paused"||(s==null?void 0:s.paused),S=(s==null?void 0:s.displayName)||(s==null?void 0:s.name)||"Unknown Agent",E=(s==null?void 0:s.tokens)||{input:0,output:0,cached:0,total:0},_=Math.max(E.input,E.output,E.cached,1),w=(s==null?void 0:s.cost)||{input:0,output:0,cached:0,total:0};return g?o.jsx(hJ,{agentName:s==null?void 0:s.name,onClose:()=>{p(!1),r&&r(null)},onToolPartsChange:r,hackerMode:a}):o.jsxs("div",{className:"h-full flex flex-col bg-white dark:bg-gray-900 border-l border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-800",children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsx("button",{onClick:t,className:"p-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors flex-shrink-0",title:i("agent_detail.back"),"aria-label":i("agent_detail.back"),children:o.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-gray-100 truncate",title:S,children:S}),(s==null?void 0:s.displayName)&&s.displayName!==s.name&&o.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 truncate",title:s.name,children:s.name})]})]}),o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("button",{onClick:()=>y(!0),className:"p-2 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-800 text-gray-500 dark:text-gray-400 transition-colors",title:i("agent_detail.edit_settings"),"aria-label":i("agent_detail.edit_settings"),children:o.jsxs("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"}),o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]})}),o.jsx(xJ,{state:(s==null?void 0:s.state)||"stopped"})]})]}),o.jsx(mJ,{isOpen:m,agent:s,onClose:()=>y(!1),onUpdated:N=>{v(),n&&n(N,"updated")},onDeleted:N=>{n&&n(N,"deleted"),t()}}),c&&o.jsxs("div",{className:"mx-6 mt-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 text-sm rounded-lg flex items-center justify-between",children:[o.jsx("span",{children:c}),o.jsx("button",{onClick:()=>u(null),className:"ml-2 text-red-400 hover:text-red-600",children:o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[o.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:b?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>x("stop"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:bg-gray-200 dark:hover:bg-gray-700 disabled:opacity-50 transition-colors",children:i(d==="stop"?"agents.stopping":"agents.stop")}),k?o.jsx("button",{onClick:()=>x("unpause"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:i(d==="unpause"?"agents.resuming":"agents.resume")}):o.jsx("button",{onClick:()=>x("pause"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",children:i(d==="pause"?"agents.pausing":"agents.pause")}),o.jsx("button",{onClick:()=>x("restart"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800/40 disabled:opacity-50 transition-colors",children:i(d==="restart"?"agents.restarting":"agents.restart")}),o.jsx("button",{onClick:()=>x("cleanRestart"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-orange-100 dark:bg-orange-900/30 text-orange-700 dark:text-orange-400 hover:bg-orange-200 dark:hover:bg-orange-800/40 disabled:opacity-50 transition-colors",title:i("agents.clean_restart_tooltip"),children:i(d==="cleanRestart"?"agents.restarting":"agents.clean_restart")})]}):o.jsx("button",{onClick:()=>x("start"),disabled:d,className:"flex-1 px-4 py-2 text-sm font-medium rounded-lg bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 hover:bg-green-200 dark:hover:bg-green-800/40 disabled:opacity-50 transition-colors",children:i(d==="start"?"agents.starting":"agents.start")})}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:i("agent_detail.agent_info")}),o.jsxs("div",{className:"space-y-0",children:[o.jsx(Ki,{label:i("agent_detail.model"),value:s==null?void 0:s.model,mono:!0}),o.jsx(Ki,{label:i("agent_detail.port"),value:s==null?void 0:s.port,mono:!0}),o.jsx(Ki,{label:i("agent_detail.pid"),value:s==null?void 0:s.pid,mono:!0}),o.jsx(Ki,{label:i("agent_detail.session_id"),value:s!=null&&s.sessionId?s.sessionId.slice(0,12)+"...":null,mono:!0}),o.jsx(Ki,{label:i("agent_detail.uptime"),value:yJ(s==null?void 0:s.startedAt)}),o.jsx(Ki,{label:i("agent_detail.iteration"),value:s==null?void 0:s.iteration}),o.jsx(Ki,{label:i("agent_detail.start_mode"),value:s!=null&&s.skipInitialPrompt?i("agent_detail.start_mode_dormant"):i("agent_detail.start_mode_normal")})]})]}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:i("agent_detail.token_usage")}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(ly,{label:i("agent_detail.token_input"),value:E.input,max:_,color:"bg-blue-500"}),o.jsx(ly,{label:i("agent_detail.token_output"),value:E.output,max:_,color:"bg-green-500"}),o.jsx(ly,{label:i("agent_detail.token_cached"),value:E.cached,max:_,color:"bg-purple-500"}),o.jsxs("div",{className:"flex items-center justify-between pt-2 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:"Total"}),o.jsx("span",{className:"text-sm font-bold text-gray-900 dark:text-gray-100",children:E.total.toLocaleString()})]})]})]}),o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Estimated Cost"}),o.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-3",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Input"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",w.input.toFixed(4)]})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Output"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",w.output.toFixed(4)]})]}),o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Cached"}),o.jsxs("div",{className:"text-sm font-medium text-gray-900 dark:text-gray-100",children:["$",w.cached.toFixed(4)]})]})]}),o.jsxs("div",{className:"flex items-center justify-between pt-3 border-t border-gray-200 dark:border-gray-700",children:[o.jsx("span",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:i("agent_detail.total_cost")}),o.jsxs("span",{className:"text-lg font-bold text-gray-900 dark:text-gray-100",children:["$",w.total.toFixed(4)]})]})]}),(s==null?void 0:s.dailyUsage)&&s.dailyUsage.length>0&&o.jsxs("div",{className:"bg-gray-50 dark:bg-gray-800/50 rounded-xl p-4",children:[o.jsx("h3",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider mb-3",children:"Daily Usage (Last 7 Days)"}),o.jsx(pJ,{data:s.dailyUsage})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>p(!0),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),i("agent_detail.view_conversation")]}),o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:()=>y(!0),children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})}),i("agent_detail.edit_settings")]}),o.jsxs("button",{className:"w-full px-4 py-2.5 text-sm font-medium rounded-lg border border-gray-200 dark:border-gray-700 text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors flex items-center justify-center gap-2",onClick:async()=>{try{await A3(s.name)}catch(N){u(i("agents.export_error")+": "+N.message)}},children:[o.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),i("agents.export")]})]}),(s==null?void 0:s.cwd)&&o.jsxs("div",{className:"text-xs text-gray-400 dark:text-gray-500 break-all",children:[o.jsx("span",{className:"font-medium",children:i("agent_detail.working_dir_label")}),o.jsx("br",{}),o.jsx("span",{className:"font-mono",children:s.cwd})]})]})]})}const Au=["swift","quick","rapid","agile","nimble","clever","smart","wise","bright","keen","bold","brave","calm","steady","noble","silent","shadow","storm","iron","steel","amber","azure","cobalt","crimson","golden","cosmic","cyber","digital","quantum","prime"],Ru=["falcon","hawk","eagle","raven","phoenix","wolf","fox","hound","coyote","tiger","panther","lynx","leopard","bear","orca","shark","viper","cobra","dragon","griffin","sentinel","guardian","titan","node","nexus","core","spark","pulse"];function oj(e=[],t=100){const n=new Set(e.map(s=>s.toLowerCase()));for(let s=0;s<t;s++){const l=Au[Math.floor(Math.random()*Au.length)],c=Ru[Math.floor(Math.random()*Ru.length)],u=`${l}-${c}`;if(!n.has(u))return u}const r=Au[Math.floor(Math.random()*Au.length)],a=Ru[Math.floor(Math.random()*Ru.length)],i=Math.floor(Math.random()*1e3);return`${r}-${a}-${i}`}function lj(e,t=[]){if(!e||typeof e!="string")return{valid:!1,error:"Name is required"};const n=e.trim().toLowerCase();return n.length===0?{valid:!1,error:"Name cannot be empty"}:n.length<2?{valid:!1,error:"Name must be at least 2 characters"}:n.length>50?{valid:!1,error:"Name must be 50 characters or less"}:/^[a-z0-9_-]+$/.test(n)?new Set(t.map(a=>a.toLowerCase())).has(n)?{valid:!1,error:"An agent with this name already exists"}:{valid:!0,error:null}:{valid:!1,error:"Name can only contain lowercase letters, numbers, hyphens, and underscores"}}function vJ(e){return e?e.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,""):""}const Iu=`# AGENTS.md - AI Agent Instructions
106
106
 
107
107
  ## Overview
108
108
  You are an autonomous AI agent. Your goal is to help users accomplish tasks efficiently.