@piagent/platform 1.42.0 → 1.43.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -0
- package/docs/adaptive-delivery.md +56 -0
- package/docs/command-reference-vietnamese.md +2 -2
- package/docs/distribution-standard.md +6 -6
- package/docs/operator-manual-vietnamese.md +7 -7
- package/docs/publishing-for-teams.md +6 -0
- package/docs/release-install-policy.md +2 -2
- package/docs/team-onboarding.md +2 -2
- package/docs-site/architecture.html +1 -1
- package/docs-site/assets/search-en.json +1 -1
- package/docs-site/assets/search-vi.json +1 -1
- package/docs-site/benchmark.html +1 -1
- package/docs-site/commands.html +1 -1
- package/docs-site/context-engine.html +1 -1
- package/docs-site/ecosystem.html +1 -1
- package/docs-site/en/architecture.html +1 -1
- package/docs-site/en/benchmark.html +1 -1
- package/docs-site/en/commands.html +1 -1
- package/docs-site/en/context-engine.html +1 -1
- package/docs-site/en/ecosystem.html +1 -1
- package/docs-site/en/index.html +15 -15
- package/docs-site/en/mcp-approval.html +1 -1
- package/docs-site/en/mcp-auth.html +1 -1
- package/docs-site/en/mcp-servers.html +1 -1
- package/docs-site/en/mcp.html +1 -1
- package/docs-site/en/permissions.html +1 -1
- package/docs-site/en/profiles.html +1 -1
- package/docs-site/en/quickstart.html +1 -1
- package/docs-site/en/runtime.html +1 -1
- package/docs-site/en/scope.html +1 -1
- package/docs-site/en/security.html +1 -1
- package/docs-site/en/team.html +1 -1
- package/docs-site/en/update.html +3 -3
- package/docs-site/en/whats-new.html +150 -85
- package/docs-site/en/windows.html +1 -1
- package/docs-site/en/workflows.html +1 -1
- package/docs-site/index.html +15 -15
- package/docs-site/mcp-approval.html +1 -1
- package/docs-site/mcp-auth.html +1 -1
- package/docs-site/mcp-servers.html +1 -1
- package/docs-site/mcp.html +1 -1
- package/docs-site/permissions.html +1 -1
- package/docs-site/profiles.html +1 -1
- package/docs-site/quickstart.html +1 -1
- package/docs-site/releases.json +201 -0
- package/docs-site/runtime.html +1 -1
- package/docs-site/scope.html +1 -1
- package/docs-site/security.html +1 -1
- package/docs-site/team.html +1 -1
- package/docs-site/update.html +3 -3
- package/docs-site/whats-new.html +150 -85
- package/docs-site/windows.html +1 -1
- package/docs-site/workflows.html +1 -1
- package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
- package/package.json +1 -1
- package/packages/piagent-core/managed/delivery-context.mjs +126 -0
- package/packages/piagent-core/managed/dist/workspace/manifest.json +1 -1
- package/packages/piagent-core/managed/dist/workspace/worker.mjs +1 -1
- package/packages/piagent-core/managed/helper-run.mjs +2 -1
- package/packages/piagent-core/managed/patch-snapshot.mjs +7 -3
- package/packages/piagent-core/managed/review-snapshot-worker.mjs +53 -7
- package/packages/piagent-core/managed/session.mjs +7 -7
- package/packages/piagent-core/managed/workflow-context.mjs +117 -0
- package/packages/piagent-core/managed/workflow.mjs +22 -4
- package/packages/piagent-core/package.json +1 -1
- package/packages/piagent-core/security/workspace-file-reader.ts +3 -1
- package/packages/piagent-webui/dist/client/assets/ActivityPanel-DRAiHliI.js +1 -0
- package/packages/piagent-webui/dist/client/assets/App-CarM9drO.js +5 -0
- package/packages/piagent-webui/dist/client/assets/GatewayApp-uqpLU6gs.js +93 -0
- package/packages/piagent-webui/dist/client/assets/InspectionApp-C00GhY47.js +1 -0
- package/packages/piagent-webui/dist/client/assets/{LineReview-DzonwD-g.js → LineReview-DZ9ez8kO.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/{MarkdownMessage-DchODuO7.js → MarkdownMessage-D7bbIWJe.js} +2 -2
- package/packages/piagent-webui/dist/client/assets/SessionAgentWorkspace-CBbWJmh7.js +1 -0
- package/packages/piagent-webui/dist/client/assets/SessionInspectorDrawer-CMgkZoNX.js +2 -0
- package/packages/piagent-webui/dist/client/assets/SettingsNavigation-CM0s3QUC.js +3 -0
- package/packages/piagent-webui/dist/client/assets/SettingsPage-Cr6M2FVg.js +1 -0
- package/packages/piagent-webui/dist/client/assets/TerminalPanel-DNKKZsMX.js +2 -0
- package/packages/piagent-webui/dist/client/assets/{TerminalView-BML7uS6R.js → TerminalView-CR4TO5f1.js} +3 -3
- package/packages/piagent-webui/dist/client/assets/{WorkspaceCodeEditor-B7ieqDnt.js → WorkspaceCodeEditor-DUffKV2S.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/WorkspaceExplorer-D5iHXMqE.js +5 -0
- package/packages/piagent-webui/dist/client/assets/{WorkspaceQuickOpen-CGoGfUPk.js → WorkspaceQuickOpen-vQ5DqfJl.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/composer-drafts-BtMaVw8W.js +1 -0
- package/packages/piagent-webui/dist/client/assets/index-D6GtlEqC.js +37 -0
- package/packages/piagent-webui/dist/client/assets/latest-request-DXcYQW86.js +1 -0
- package/packages/piagent-webui/dist/client/assets/{tab-close-Crj8vsUq.js → tab-close-DHDqCxTL.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/terminal-transport-Dk5pYNX5.js +1 -0
- package/packages/piagent-webui/dist/client/assets/transcript-view-model-BNGQCkzY.js +3 -0
- package/packages/piagent-webui/dist/client/assets/{ui-preferences-B3UfDp-5.js → ui-preferences-Dy4qeODT.js} +1 -1
- package/packages/piagent-webui/dist/client/assets/vendor-CA5pzJiI.js +136 -0
- package/packages/piagent-webui/dist/client/assets/view-model-CWNiS4JN.js +1 -0
- package/packages/piagent-webui/dist/client/assets/workspace-navigation-C8GtShbg.js +1 -0
- package/packages/piagent-webui/dist/client/index.html +3 -5
- package/packages/piagent-webui/gateway/signed-session-journal.ts +16 -6
- package/packages/piagent-webui/server/loopback-server.ts +19 -5
- package/packages/piagent-webui/server/static-bundle.ts +10 -2
- package/scripts/verify-local.sh +17 -1
- package/packages/piagent-webui/dist/client/assets/App-DBx4BU3F.js +0 -5
- package/packages/piagent-webui/dist/client/assets/SessionInspectorDrawer-BHHNlct3.js +0 -1
- package/packages/piagent-webui/dist/client/assets/SettingsPage-DX28MsZA.js +0 -1
- package/packages/piagent-webui/dist/client/assets/TerminalPanel-C--BiN0p.js +0 -2
- package/packages/piagent-webui/dist/client/assets/WorkspaceExplorer-BOafuPU-.js +0 -5
- package/packages/piagent-webui/dist/client/assets/index-C7Azrwpq.js +0 -132
- package/packages/piagent-webui/dist/client/assets/vendor-Ch5hIe0W.js +0 -136
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/WorkspaceQuickOpen-CGoGfUPk.js","assets/rolldown-runtime-hePW80VL.js","assets/vendor-Ch5hIe0W.js","assets/ui-preferences-B3UfDp-5.js","assets/workspace-api-O7auv_td.js","assets/bootstrap-CedkNtRG.js","assets/TerminalPanel-C--BiN0p.js","assets/tab-close-Crj8vsUq.js","assets/WorkspaceExplorer-BOafuPU-.js","assets/api-BUjrtT1B.js","assets/LineReview-DzonwD-g.js","assets/MarkdownMessage-DchODuO7.js","assets/SettingsPage-DX28MsZA.js","assets/SessionInspectorDrawer-BHHNlct3.js","assets/App-DBx4BU3F.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{$ as n,$t as r,A as i,An as a,At as o,B as s,Bt as c,C as l,Cn as u,Ct as d,D as f,Dn as p,Dt as m,E as h,En as g,Et as _,F as v,Fn as y,Ft as b,G as x,Gt as S,H as C,Ht as w,I as T,In as E,It as D,J as O,Jt as k,K as A,Kt as j,L as M,Lt as N,M as P,Mn as F,Mt as I,N as L,Nn as ee,Nt as te,O as ne,On as R,Ot as z,P as B,Pn as re,Pt as ie,Q as ae,Qt as oe,R as V,Rt as H,S as se,Sn as ce,St as U,T as le,Tn as ue,Tt as de,U as fe,Ut as W,V as pe,Vt as me,W as he,Wt as ge,X as _e,Xt as ve,Y as ye,Yt as be,Z as xe,_ as Se,_n as Ce,_t as we,an as Te,at as Ee,b as De,bn as Oe,bt as ke,cn as Ae,ct as je,dn as Me,dt as Ne,en as Pe,et as Fe,f as Ie,fn as Le,ft as Re,g as ze,gn as Be,gt as Ve,h as He,hn as Ue,ht as We,in as Ge,it as Ke,j as qe,jn as Je,jt as Ye,k as Xe,kt as Ze,ln as Qe,lt as $e,m as G,mn as et,mt as tt,nn as nt,nt as rt,on as it,ot as at,p as ot,pn as st,pt as ct,q as lt,qt as ut,rn as dt,rt as ft,sn as pt,st as mt,tn as ht,tt as gt,un as _t,ut as vt,v as yt,vn as bt,vt as xt,w as St,wn as Ct,wt,x as Tt,xn as Et,xt as Dt,y as Ot,yn as kt,yt as At,z as jt,zt as Mt}from"./vendor-Ch5hIe0W.js";import{a as Nt,i as Pt,n as K,o as Ft,s as It,t as Lt}from"./ui-preferences-B3UfDp-5.js";import{a as Rt,i as zt,n as Bt,o as Vt,r as Ht,s as Ut,t as Wt}from"./bootstrap-CedkNtRG.js";import{B as Gt,C as Kt,F as qt,G as Jt,H as Yt,K as Xt,L as Zt,M as Qt,P as $t,R as en,T as tn,d as nn,ft as rn,i as an,j as on,l as sn,n as cn,o as ln,p as un,r as dn,s as fn,t as pn,u as mn,ut as hn,w as gn,x as _n}from"./api-BUjrtT1B.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var vn=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),yn=t(((e,t)=>{t.exports=vn()})),bn=t((e=>{var t=yn(),n=E(),r=y();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 s(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 c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var M=Symbol.for(`react.client.reference`);function N(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===M?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?N(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return N(e(t))}catch{}}return null}var P=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},ee=[],te=-1;function ne(e){return{current:e}}function R(e){0>te||(e.current=ee[te],ee[te]=null,te--)}function z(e,t){te++,ee[te]=e.current,e.current=t}var B=ne(null),re=ne(null),ie=ne(null),ae=ne(null);function oe(e,t){switch(z(ie,t),z(re,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function V(){R(B),R(re),R(ie)}function H(e){e.memoizedState!==null&&z(ae,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(re,e),z(B,n))}function se(e){re.current===e&&(R(B),R(re)),ae.current===e&&(R(ae),Qf._currentValue=L)}var ce,U;function le(e){if(ce===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ce=t&&t[1]||``,U=-1<e.stack.indexOf(`
|
|
3
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
-
`+ce+e+U}var ue=!1;function de(e,t){if(!e||ue)return``;ue=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
-
`),l=s.split(`
|
|
6
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{ue=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?le(n):``}function fe(e,t){switch(e.tag){case 26:case 27:case 5:return le(e.type);case 16:return le(`Lazy`);case 13:return e.child!==t&&t!==null?le(`Suspense Fallback`):le(`Suspense`);case 19:return le(`SuspenseList`);case 0:case 15:return de(e.type,!1);case 11:return de(e.type.render,!1);case 1:return de(e.type,!0);case 31:return le(`Activity`);default:return``}}function W(e){try{var t=``,n=null;do t+=fe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
-
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}}var pe=Object.prototype.hasOwnProperty,me=t.unstable_scheduleCallback,he=t.unstable_cancelCallback,ge=t.unstable_shouldYield,_e=t.unstable_requestPaint,ve=t.unstable_now,ye=t.unstable_getCurrentPriorityLevel,be=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,Se=t.unstable_NormalPriority,Ce=t.unstable_LowPriority,we=t.unstable_IdlePriority,Te=t.log,Ee=t.unstable_setDisableYieldValue,De=null,Oe=null;function ke(e){if(typeof Te==`function`&&Ee(e),Oe&&typeof Oe.setStrictMode==`function`)try{Oe.setStrictMode(De,e)}catch{}}var Ae=Math.clz32?Math.clz32:Ne,je=Math.log,Me=Math.LN2;function Ne(e){return e>>>=0,e===0?32:31-(je(e)/Me|0)|0}var Pe=256,Fe=262144,Ie=4194304;function Le(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Re(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Le(n))):i=Le(o):i=Le(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Le(n))):i=Le(o)):i=Le(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function ze(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Be(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ve(){var e=Ie;return Ie<<=1,!(Ie&62914560)&&(Ie=4194304),e}function He(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ue(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function We(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-Ae(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ge(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ge(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Ae(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function Ke(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ae(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function qe(e,t){var n=t&-t;return n=n&42?1:Je(n),(n&(e.suspendedLanes|t))===0?n:0}function Je(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Ye(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Xe(){var e=I.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function Ze(e,t){var n=I.p;try{return I.p=e,t()}finally{I.p=n}}var Qe=Math.random().toString(36).slice(2),$e=`__reactFiber$`+Qe,G=`__reactProps$`+Qe,et=`__reactContainer$`+Qe,tt=`__reactEvents$`+Qe,nt=`__reactListeners$`+Qe,rt=`__reactHandles$`+Qe,it=`__reactResources$`+Qe,at=`__reactMarker$`+Qe;function ot(e){delete e[$e],delete e[G],delete e[tt],delete e[nt],delete e[rt]}function st(e){var t=e[$e];if(t)return t;for(var n=e.parentNode;n;){if(t=n[et]||n[$e]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[$e])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function ct(e){if(e=e[$e]||e[et]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function lt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ut(e){var t=e[it];return t||=e[it]={hoistableStyles:new Map,hoistableScripts:new Map},t}function dt(e){e[at]=!0}var ft=new Set,pt={};function mt(e,t){ht(e,t),ht(e+`Capture`,t)}function ht(e,t){for(pt[e]=t,e=0;e<t.length;e++)ft.add(t[e])}var gt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),_t={},vt={};function yt(e){return pe.call(vt,e)?!0:pe.call(_t,e)?!1:gt.test(e)?vt[e]=!0:(_t[e]=!0,!1)}function bt(e,t,n){if(yt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function xt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function St(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Ct(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function wt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Tt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Et(e){if(!e._valueTracker){var t=wt(e)?`checked`:`value`;e._valueTracker=Tt(e,t,``+e[t])}}function Dt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=wt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Ot(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var kt=/[\n"\\]/g;function At(e){return e.replace(kt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function jt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Ct(t)):e.value!==``+Ct(t)&&(e.value=``+Ct(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Nt(e,o,Ct(n)):Nt(e,o,Ct(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Ct(s):e.removeAttribute(`name`)}function Mt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Et(e);return}n=n==null?``:``+Ct(n),t=t==null?n:``+Ct(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Et(e)}function Nt(e,t,n){t===`number`&&Ot(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Pt(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Ct(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function K(e,t,n){if(t!=null&&(t=``+Ct(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Ct(n)}function Ft(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(P(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Ct(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Et(e)}function It(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Lt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Rt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Lt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function zt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Rt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Rt(e,o,t[o])}function Bt(e){if(e.indexOf(`-`)===-1)return!1;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 Vt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Ht=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ut(e){return Ht.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Wt(){}var Gt=null;function Kt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var qt=null,Jt=null;function Yt(e){var t=ct(e);if(t&&(e=t.stateNode)){var n=e[G]||null;a:switch(e=t.stateNode,t.type){case`input`:if(jt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+At(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[G]||null;if(!a)throw Error(i(90));jt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Dt(r)}break a;case`textarea`:K(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Pt(e,!!n.multiple,t,!1)}}}var Xt=!1;function Zt(e,t,n){if(Xt)return e(t,n);Xt=!0;try{return e(t)}finally{if(Xt=!1,(qt!==null||Jt!==null)&&(vu(),qt&&(t=qt,e=Jt,Jt=qt=null,Yt(t),e)))for(t=0;t<e.length;t++)Yt(e[t])}}function Qt(e,t){var n=e.stateNode;if(n===null)return null;var r=n[G]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var $t=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),en=!1;if($t)try{var tn={};Object.defineProperty(tn,"passive",{get:function(){en=!0}}),window.addEventListener(`test`,tn,tn),window.removeEventListener(`test`,tn,tn)}catch{en=!1}var nn=null,rn=null,an=null;function on(){if(an)return an;var e,t=rn,n=t.length,r,i=`value`in nn?nn.value:nn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return an=i.slice(e,1<r?1-r:void 0)}function sn(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 cn(){return!0}function ln(){return!1}function un(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?cn:ln,this.isPropagationStopped=ln,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=cn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=cn)},persist:function(){},isPersistent:cn}),t}var dn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},fn=un(dn),pn=f({},dn,{view:0,detail:0}),mn=un(pn),hn,gn,_n,vn=f({},pn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:On,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!==_n&&(_n&&e.type===`mousemove`?(hn=e.screenX-_n.screenX,gn=e.screenY-_n.screenY):gn=hn=0,_n=e),hn)},movementY:function(e){return`movementY`in e?e.movementY:gn}}),bn=un(vn),xn=un(f({},vn,{dataTransfer:0})),q=un(f({},pn,{relatedTarget:0})),Sn=un(f({},dn,{animationName:0,elapsedTime:0,pseudoElement:0})),Cn=un(f({},dn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),wn=un(f({},dn,{data:0})),J={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Tn={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`},En={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Dn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=En[e])?!!t[e]:!1}function On(){return Dn}var kn=un(f({},pn,{key:function(e){if(e.key){var t=J[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=sn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Tn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:On,charCode:function(e){return e.type===`keypress`?sn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?sn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),An=un(f({},vn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),jn=un(f({},pn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:On})),Mn=un(f({},dn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Nn=un(f({},vn,{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})),Pn=un(f({},dn,{newState:0,oldState:0})),Fn=[9,13,27,32],In=$t&&`CompositionEvent`in window,Ln=null;$t&&`documentMode`in document&&(Ln=document.documentMode);var Rn=$t&&`TextEvent`in window&&!Ln,zn=$t&&(!In||Ln&&8<Ln&&11>=Ln),Bn=` `,Vn=!1;function Hn(e,t){switch(e){case`keyup`:return Fn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Un(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Wn=!1;function Gn(e,t){switch(e){case`compositionend`:return Un(t);case`keypress`:return t.which===32?(Vn=!0,Bn):null;case`textInput`:return e=t.data,e===Bn&&Vn?null:e;default:return null}}function Kn(e,t){if(Wn)return e===`compositionend`||!In&&Hn(e,t)?(e=on(),an=rn=nn=null,Wn=!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 zn&&t.locale!==`ko`?null:t.data;default:return null}}var qn={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 Jn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!qn[e.type]:t===`textarea`}function Yn(e,t,n,r){qt?Jt?Jt.push(r):Jt=[r]:qt=r,t=Td(t,`onChange`),0<t.length&&(n=new fn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Xn=null,Zn=null;function Qn(e){_d(e,0)}function $n(e){if(Dt(lt(e)))return e}function er(e,t){if(e===`change`)return t}var tr=!1;if($t){var nr;if($t){var rr=`oninput`in document;if(!rr){var ir=document.createElement(`div`);ir.setAttribute(`oninput`,`return;`),rr=typeof ir.oninput==`function`}nr=rr}else nr=!1;tr=nr&&(!document.documentMode||9<document.documentMode)}function ar(){Xn&&(Xn.detachEvent(`onpropertychange`,or),Zn=Xn=null)}function or(e){if(e.propertyName===`value`&&$n(Zn)){var t=[];Yn(t,Zn,e,Kt(e)),Zt(Qn,t)}}function sr(e,t,n){e===`focusin`?(ar(),Xn=t,Zn=n,Xn.attachEvent(`onpropertychange`,or)):e===`focusout`&&ar()}function cr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return $n(Zn)}function lr(e,t){if(e===`click`)return $n(t)}function ur(e,t){if(e===`input`||e===`change`)return $n(t)}function dr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var fr=typeof Object.is==`function`?Object.is:dr;function pr(e,t){if(fr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!pe.call(t,i)||!fr(e[i],t[i]))return!1}return!0}function mr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function hr(e,t){var n=mr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=mr(n)}}function gr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _r(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ot(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ot(e.document)}return t}function vr(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`)}var yr=$t&&`documentMode`in document&&11>=document.documentMode,br=null,xr=null,Sr=null,Cr=!1;function wr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Cr||br==null||br!==Ot(r)||(r=br,`selectionStart`in r&&vr(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}),Sr&&pr(Sr,r)||(Sr=r,r=Td(xr,`onSelect`),0<r.length&&(t=new fn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=br)))}function Tr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Er={animationend:Tr(`Animation`,`AnimationEnd`),animationiteration:Tr(`Animation`,`AnimationIteration`),animationstart:Tr(`Animation`,`AnimationStart`),transitionrun:Tr(`Transition`,`TransitionRun`),transitionstart:Tr(`Transition`,`TransitionStart`),transitioncancel:Tr(`Transition`,`TransitionCancel`),transitionend:Tr(`Transition`,`TransitionEnd`)},Dr={},Or={};$t&&(Or=document.createElement(`div`).style,`AnimationEvent`in window||(delete Er.animationend.animation,delete Er.animationiteration.animation,delete Er.animationstart.animation),`TransitionEvent`in window||delete Er.transitionend.transition);function kr(e){if(Dr[e])return Dr[e];if(!Er[e])return e;var t=Er[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Or)return Dr[e]=t[n];return e}var Ar=kr(`animationend`),jr=kr(`animationiteration`),Mr=kr(`animationstart`),Nr=kr(`transitionrun`),Pr=kr(`transitionstart`),Fr=kr(`transitioncancel`),Ir=kr(`transitionend`),Lr=new Map,Rr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Rr.push(`scrollEnd`);function zr(e,t){Lr.set(e,t),mt(t,[e])}var Br=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Vr=[],Hr=0,Ur=0;function Wr(){for(var e=Hr,t=Ur=Hr=0;t<e;){var n=Vr[t];Vr[t++]=null;var r=Vr[t];Vr[t++]=null;var i=Vr[t];Vr[t++]=null;var a=Vr[t];if(Vr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Jr(n,i,a)}}function Gr(e,t,n,r){Vr[Hr++]=e,Vr[Hr++]=t,Vr[Hr++]=n,Vr[Hr++]=r,Ur|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Kr(e,t,n,r){return Gr(e,t,n,r),Yr(e)}function qr(e,t){return Gr(e,null,null,t),Yr(e)}function Jr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-Ae(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Yr(e){if(50<lu)throw lu=0,uu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Xr={};function Zr(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.refCleanup=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 Qr(e,t,n,r){return new Zr(e,t,n,r)}function $r(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ei(e,t){var n=e.alternate;return n===null?(n=Qr(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&65011712,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.refCleanup=e.refCleanup,n}function ti(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ni(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)$r(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,B.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case O:return e=Qr(31,n,t,a),e.elementType=O,e.lanes=o,e;case g:return ri(n.children,a,o,t);case _:s=8,a|=24;break;case v:return e=Qr(12,n,t,a|2),e.elementType=v,e.lanes=o,e;case C:return e=Qr(13,n,t,a),e.elementType=C,e.lanes=o,e;case w:return e=Qr(19,n,t,a),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case S:s=11;break a;case T:s=14;break a;case D:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Qr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function ri(e,t,n,r){return e=Qr(7,e,r,t),e.lanes=n,e}function ii(e,t,n){return e=Qr(6,e,null,t),e.lanes=n,e}function ai(e){var t=Qr(18,null,null,0);return t.stateNode=e,t}function oi(e,t,n){return t=Qr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var si=new WeakMap;function ci(e,t){if(typeof e==`object`&&e){var n=si.get(e);return n===void 0?(t={value:e,source:t,stack:W(t)},si.set(e,t),t):n}return{value:e,source:t,stack:W(t)}}var li=[],ui=0,di=null,fi=0,pi=[],mi=0,hi=null,gi=1,_i=``;function vi(e,t){li[ui++]=fi,li[ui++]=di,di=e,fi=t}function yi(e,t,n){pi[mi++]=gi,pi[mi++]=_i,pi[mi++]=hi,hi=e;var r=gi;e=_i;var i=32-Ae(r)-1;r&=~(1<<i),n+=1;var a=32-Ae(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,gi=1<<32-Ae(t)+i|n<<i|r,_i=a+e}else gi=1<<a|n<<i|r,_i=e}function bi(e){e.return!==null&&(vi(e,1),yi(e,1,0))}function xi(e){for(;e===di;)di=li[--ui],li[ui]=null,fi=li[--ui],li[ui]=null;for(;e===hi;)hi=pi[--mi],pi[mi]=null,_i=pi[--mi],pi[mi]=null,gi=pi[--mi],pi[mi]=null}function Si(e,t){pi[mi++]=gi,pi[mi++]=_i,pi[mi++]=hi,gi=t.id,_i=t.overflow,hi=e}var Ci=null,wi=null,Y=!1,Ti=null,Ei=!1,Di=Error(i(519));function Oi(e){throw Pi(ci(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Di}function ki(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[$e]=e,t[G]=r,n){case`dialog`:vd(`cancel`,t),vd(`close`,t);break;case`iframe`:case`object`:case`embed`:vd(`load`,t);break;case`video`:case`audio`:for(n=0;n<hd.length;n++)vd(hd[n],t);break;case`source`:vd(`error`,t);break;case`img`:case`image`:case`link`:vd(`error`,t),vd(`load`,t);break;case`details`:vd(`toggle`,t);break;case`input`:vd(`invalid`,t),Mt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:vd(`invalid`,t);break;case`textarea`:vd(`invalid`,t),Ft(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&(vd(`beforetoggle`,t),vd(`toggle`,t)),r.onScroll!=null&&vd(`scroll`,t),r.onScrollEnd!=null&&vd(`scrollend`,t),r.onClick!=null&&(t.onclick=Wt),t=!0):t=!1,t||Oi(e,!0)}function Ai(e){for(Ci=e.return;Ci;)switch(Ci.tag){case 5:case 31:case 13:Ei=!1;return;case 27:case 3:Ei=!0;return;default:Ci=Ci.return}}function ji(e){if(e!==Ci)return!1;if(!Y)return Ai(e),Y=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&wi&&Oi(e),Ai(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));wi=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));wi=uf(e)}else t===27?(t=wi,Zd(e.type)?(e=lf,lf=null,wi=e):wi=t):wi=Ci?cf(e.stateNode.nextSibling):null;return!0}function Mi(){wi=Ci=null,Y=!1}function Ni(){var e=Ti;return e!==null&&(Yl===null?Yl=e:Yl.push.apply(Yl,e),Ti=null),e}function Pi(e){Ti===null?Ti=[e]:Ti.push(e)}var Fi=ne(null),Ii=null,Li=null;function Ri(e,t,n){z(Fi,t._currentValue),t._currentValue=n}function zi(e){e._currentValue=Fi.current,R(Fi)}function Bi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Vi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Bi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Bi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Hi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;fr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ae.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&Vi(t,e,n,r),t.flags|=262144}function Ui(e){for(e=e.firstContext;e!==null;){if(!fr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wi(e){Ii=e,Li=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Gi(e){return qi(Ii,e)}function Ki(e,t){return Ii===null&&Wi(e),qi(e,t)}function qi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Li===null){if(e===null)throw Error(i(308));Li=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Li=Li.next=t;return n}var Ji=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Yi=t.unstable_scheduleCallback,Xi=t.unstable_NormalPriority,Zi={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qi(){return{controller:new Ji,data:new Map,refCount:0}}function $i(e){e.refCount--,e.refCount===0&&Yi(Xi,function(){e.controller.abort()})}var ea=null,ta=0,na=0,ra=null;function ia(e,t){if(ea===null){var n=ea=[];ta=0,na=ld(),ra={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ta++,t.then(aa,aa),t}function aa(){if(--ta===0&&ea!==null){ra!==null&&(ra.status=`fulfilled`);var e=ea;ea=null,na=0,ra=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function oa(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var sa=F.S;F.S=function(e,t){Ql=ve(),typeof t==`object`&&t&&typeof t.then==`function`&&ia(e,t),sa!==null&&sa(e,t)};var ca=ne(null);function la(){var e=ca.current;return e===null?Fl.pooledCache:e}function ua(e,t){t===null?z(ca,ca.current):z(ca,t.pool)}function da(){var e=la();return e===null?null:{parent:Zi._currentValue,pool:e}}var fa=Error(i(460)),pa=Error(i(474)),ma=Error(i(542)),ha={then:function(){}};function ga(e){return e=e.status,e===`fulfilled`||e===`rejected`}function _a(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Wt,Wt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,xa(e),e;default:if(typeof t.status==`string`)t.then(Wt,Wt);else{if(e=Fl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,xa(e),e}throw ya=t,fa}}function va(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ya=e,fa):e}}var ya=null;function ba(){if(ya===null)throw Error(i(459));var e=ya;return ya=null,e}function xa(e){if(e===fa||e===ma)throw Error(i(483))}var Sa=null,Ca=0;function wa(e){var t=Ca;return Ca+=1,Sa===null&&(Sa=[]),_a(Sa,e,t)}function Ta(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ea(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Da(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=ei(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ii(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===g?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===D&&va(i)===t.type)?(t=a(t,n.props),Ta(t,n),t.return=e,t):(t=ni(n.type,n.key,n.props,null,e.mode,r),Ta(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=oi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=ri(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ii(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case m:return n=ni(t.type,t.key,t.props,null,e.mode,n),Ta(n,t),n.return=e,n;case h:return t=oi(t,e.mode,n),t.return=e,t;case D:return t=va(t),f(e,t,n)}if(P(t)||j(t))return t=ri(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,wa(t),n);if(t.$$typeof===x)return f(e,Ki(e,t),n);Ea(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case m:return n.key===i?l(e,t,n,r):null;case h:return n.key===i?u(e,t,n,r):null;case D:return n=va(n),p(e,t,n,r)}if(P(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,wa(n),r);if(n.$$typeof===x)return p(e,t,Ki(e,n),r);Ea(e,n)}return null}function _(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case m:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case h:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case D:return r=va(r),_(e,t,n,r,i)}if(P(r)||j(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return _(e,t,n,wa(r),i);if(r.$$typeof===x)return _(e,t,n,Ki(t,r),i);Ea(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,m=a=0,h=null;d!==null&&m<s.length;m++){d.index>m?(h=d,d=null):h=d.sibling;var g=p(i,d,s[m],c);if(g===null){d===null&&(d=h);break}e&&d&&g.alternate===null&&t(i,d),a=o(g,a,m),u===null?l=g:u.sibling=g,u=g,d=h}if(m===s.length)return n(i,d),Y&&vi(i,m),l;if(d===null){for(;m<s.length;m++)d=f(i,s[m],c),d!==null&&(a=o(d,a,m),u===null?l=d:u.sibling=d,u=d);return Y&&vi(i,m),l}for(d=r(d);m<s.length;m++)h=_(d,i,m,s[m],c),h!==null&&(e&&h.alternate!==null&&d.delete(h.key===null?m:h.key),a=o(h,a,m),u===null?l=h:u.sibling=h,u=h);return e&&d.forEach(function(e){return t(i,e)}),Y&&vi(i,m),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,m=s,h=s=0,g=null,v=c.next();m!==null&&!v.done;h++,v=c.next()){m.index>h?(g=m,m=null):g=m.sibling;var y=p(a,m,v.value,l);if(y===null){m===null&&(m=g);break}e&&m&&y.alternate===null&&t(a,m),s=o(y,s,h),d===null?u=y:d.sibling=y,d=y,m=g}if(v.done)return n(a,m),Y&&vi(a,h),u;if(m===null){for(;!v.done;h++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return Y&&vi(a,h),u}for(m=r(m);!v.done;h++,v=c.next())v=_(m,a,h,v.value,l),v!==null&&(e&&v.alternate!==null&&m.delete(v.key===null?h:v.key),s=o(v,s,h),d===null?u=v:d.sibling=v,d=v);return e&&m.forEach(function(e){return t(a,e)}),Y&&vi(a,h),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===g&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case m:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===g){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&va(l)===r.type){n(e,r.sibling),c=a(r,o.props),Ta(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===g?(c=ri(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=ni(o.type,o.key,o.props,null,e.mode,c),Ta(c,o),c.return=e,e=c)}return s(e);case h:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=oi(o,e.mode,c),c.return=e,e=c}return s(e);case D:return o=va(o),b(e,r,o,c)}if(P(o))return v(e,r,o,c);if(j(o)){if(l=j(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,wa(o),c);if(o.$$typeof===x)return b(e,r,Ki(e,o),c);Ea(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ii(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ca=0;var i=b(e,t,n,r);return Sa=null,i}catch(t){if(t===fa||t===ma)throw t;var a=Qr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Oa=Da(!0),ka=Da(!1),Aa=!1;function ja(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ma(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Na(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Pa(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Pl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Yr(e),Jr(e,null,n),t}return Gr(e,r,t,n),Yr(e)}function Fa(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}function Ia(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var La=!1;function Ra(){if(La){var e=ra;if(e!==null)throw e}}function za(e,t,n,r){La=!1;var i=e.updateQueue;Aa=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Q&p)===p:(r&p)===p){p!==0&&p===na&&(La=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Aa=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function Ba(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Va(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ba(n[e],t)}var Ha=ne(null),Ua=ne(0);function Wa(e,t){e=Vl,z(Ua,e),z(Ha,t),Vl=e|t.baseLanes}function Ga(){z(Ua,Vl),z(Ha,Ha.current)}function Ka(){Vl=Ua.current,R(Ha),R(Ua)}var qa=ne(null),Ja=null;function Ya(e){var t=e.alternate;z(eo,eo.current&1),z(qa,e),Ja===null&&(t===null||Ha.current!==null||t.memoizedState!==null)&&(Ja=e)}function Xa(e){z(eo,eo.current),z(qa,e),Ja===null&&(Ja=e)}function Za(e){e.tag===22?(z(eo,eo.current),z(qa,e),Ja===null&&(Ja=e)):Qa(e)}function Qa(){z(eo,eo.current),z(qa,qa.current)}function $a(e){R(qa),Ja===e&&(Ja=null),R(eo)}var eo=ne(0);function to(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){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 no=0,X=null,ro=null,io=null,ao=!1,oo=!1,so=!1,co=0,lo=0,uo=null,fo=0;function po(){throw Error(i(321))}function mo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!fr(e[n],t[n]))return!1;return!0}function ho(e,t,n,r,i,a){return no=a,X=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?Ms:Ns,so=!1,a=n(r,i),so=!1,oo&&(a=_o(t,n,r,i)),go(e),a}function go(e){F.H=js;var t=ro!==null&&ro.next!==null;if(no=0,io=ro=X=null,ao=!1,lo=0,uo=null,t)throw Error(i(300));e===null||Xs||(e=e.dependencies,e!==null&&Ui(e)&&(Xs=!0))}function _o(e,t,n,r){X=e;var a=0;do{if(oo&&(uo=null),lo=0,oo=!1,25<=a)throw Error(i(301));if(a+=1,io=ro=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}F.H=Ps,o=t(n,r)}while(oo);return o}function vo(){var e=F.H,t=e.useState()[0];return t=typeof t.then==`function`?To(t):t,e=e.useState()[0],(ro===null?null:ro.memoizedState)!==e&&(X.flags|=1024),t}function yo(){var e=co!==0;return co=0,e}function bo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function xo(e){if(ao){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ao=!1}no=0,io=ro=X=null,oo=!1,lo=co=0,uo=null}function So(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return io===null?X.memoizedState=io=e:io=io.next=e,io}function Co(){if(ro===null){var e=X.alternate;e=e===null?null:e.memoizedState}else e=ro.next;var t=io===null?X.memoizedState:io.next;if(t!==null)io=t,ro=e;else{if(e===null)throw X.alternate===null?Error(i(467)):Error(i(310));ro=e,e={memoizedState:ro.memoizedState,baseState:ro.baseState,baseQueue:ro.baseQueue,queue:ro.queue,next:null},io===null?X.memoizedState=io=e:io=io.next=e}return io}function wo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function To(e){var t=lo;return lo+=1,uo===null&&(uo=[]),e=_a(uo,e,t),t=X,(io===null?t.memoizedState:io.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?Ms:Ns),e}function Eo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return To(e);if(e.$$typeof===x)return Gi(e)}throw Error(i(438,String(e)))}function Do(e){var t=null,n=X.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=X.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=wo(),X.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function Oo(e,t){return typeof t==`function`?t(e):t}function ko(e){return Ao(Co(),ro,e)}function Ao(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(no&f)===f:(Q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===na&&(d=!0);else if((no&p)===p){u=u.next,p===na&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,X.lanes|=p,Ul|=p;f=u.action,so&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,X.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!fr(o,e.memoizedState)&&(Xs=!0,d&&(n=ra,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function jo(e){var t=Co(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);fr(o,t.memoizedState)||(Xs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Mo(e,t,n){var r=X,a=Co(),o=Y;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!fr((ro||a).memoizedState,n);if(s&&(a.memoizedState=n,Xs=!0),a=a.queue,rs(Fo.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||io!==null&&io.memoizedState.tag&1){if(r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,a,n,t),null),Fl===null)throw Error(i(349));o||no&127||No(r,t,n)}return n}function No(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=X.updateQueue,t===null?(t=wo(),X.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Po(e,t,n,r){t.value=n,t.getSnapshot=r,Io(t)&&Lo(e)}function Fo(e,t,n){return n(function(){Io(t)&&Lo(e)})}function Io(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!fr(e,n)}catch{return!0}}function Lo(e){var t=qr(e,2);t!==null&&pu(t,e,2)}function Ro(e){var t=So();if(typeof e==`function`){var n=e;if(e=n(),so){ke(!0);try{n()}finally{ke(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:e},t}function zo(e,t,n,r){return e.baseState=n,Ao(e,ro,typeof r==`function`?r:Oo)}function Bo(e,t,n,r,a){if(Os(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};F.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Vo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Vo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=F.T,o={};F.T=o;try{var s=n(i,r),c=F.S;c!==null&&c(o,s),Ho(e,t,s)}catch(n){Wo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),F.T=a}}else try{a=n(i,r),Ho(e,t,a)}catch(n){Wo(e,t,n)}}function Ho(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Uo(e,t,n)},function(n){return Wo(e,t,n)}):Uo(e,t,n)}function Uo(e,t,n){t.status=`fulfilled`,t.value=n,Go(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Vo(e,n)))}function Wo(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Go(t),t=t.next;while(t!==r)}e.action=null}function Go(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ko(e,t){return t}function qo(e,t){if(Y){var n=Fl.formState;if(n!==null){a:{var r=X;if(Y){if(wi){b:{for(var i=wi,a=Ei;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){wi=cf(i.nextSibling),r=i.data===`F!`;break a}}Oi(r)}r=!1}r&&(t=n[0])}}return n=So(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ko,lastRenderedState:t},n.queue=r,n=Ts.bind(null,X,r),r.dispatch=n,r=Ro(!1),a=Ds.bind(null,X,!1,r.queue),r=So(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Bo.bind(null,X,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Jo(e){return Yo(Co(),ro,e)}function Yo(e,t,n){if(t=Ao(e,t,Ko)[0],e=ko(Oo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=To(t)}catch(e){throw e===fa?ma:e}else r=t;t=Co();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(X.flags|=2048,Qo(9,{destroy:void 0},Xo.bind(null,i,n),null)),[r,a,e]}function Xo(e,t){e.action=t}function Zo(e){var t=Co(),n=ro;if(n!==null)return Yo(t,n,e);Co(),t=t.memoizedState,n=Co();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Qo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=X.updateQueue,t===null&&(t=wo(),X.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function $o(){return Co().memoizedState}function es(e,t,n,r){var i=So();X.flags|=e,i.memoizedState=Qo(1|t,{destroy:void 0},n,r===void 0?null:r)}function ts(e,t,n,r){var i=Co();r=r===void 0?null:r;var a=i.memoizedState.inst;ro!==null&&r!==null&&mo(r,ro.memoizedState.deps)?i.memoizedState=Qo(t,a,n,r):(X.flags|=e,i.memoizedState=Qo(1|t,a,n,r))}function ns(e,t){es(8390656,8,e,t)}function rs(e,t){ts(2048,8,e,t)}function is(e){X.flags|=4;var t=X.updateQueue;if(t===null)t=wo(),X.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function as(e){var t=Co().memoizedState;return is({ref:t,nextImpl:e}),function(){if(Pl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function os(e,t){return ts(4,2,e,t)}function ss(e,t){return ts(4,4,e,t)}function cs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ls(e,t,n){n=n==null?null:n.concat([e]),ts(4,4,cs.bind(null,t,e),n)}function us(){}function ds(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&mo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function fs(e,t){var n=Co();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&mo(t,r[1]))return r[0];if(r=e(),so){ke(!0);try{e()}finally{ke(!1)}}return n.memoizedState=[r,t],r}function ps(e,t,n){return n===void 0||no&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=fu(),X.lanes|=e,Ul|=e,n)}function ms(e,t,n,r){return fr(n,t)?n:Ha.current===null?!(no&42)||no&1073741824&&!(Q&261930)?(Xs=!0,e.memoizedState=n):(e=fu(),X.lanes|=e,Ul|=e,t):(e=ps(e,n,r),fr(e,t)||(Xs=!0),e)}function hs(e,t,n,r,i){var a=I.p;I.p=a!==0&&8>a?a:8;var o=F.T,s={};F.T=s,Ds(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Es(e,t,oa(c,r),du(e)):Es(e,t,r,du(e))}catch(n){Es(e,t,{then:function(){},status:`rejected`,reason:n},du())}finally{I.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function gs(){}function _s(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=vs(e).queue;hs(e,a,t,L,n===null?gs:function(){return ys(e),n(r)})}function vs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:L},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ys(e){var t=vs(e);t.next===null&&(t=e.alternate.memoizedState),Es(e,t.next.queue,{},du())}function bs(){return Gi(Qf)}function xs(){return Co().memoizedState}function Ss(){return Co().memoizedState}function Cs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=du();e=Na(n);var r=Pa(t,e,n);r!==null&&(pu(r,t,n),Fa(r,t,n)),t={cache:Qi()},e.payload=t;return}t=t.return}}function ws(e,t,n){var r=du();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Os(e)?ks(t,n):(n=Kr(e,t,n,r),n!==null&&(pu(n,e,r),As(n,t,r)))}function Ts(e,t,n){Es(e,t,n,du())}function Es(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Os(e))ks(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,fr(s,o))return Gr(e,t,i,0),Fl===null&&Wr(),!1}catch{}if(n=Kr(e,t,i,r),n!==null)return pu(n,e,r),As(n,t,r),!0}return!1}function Ds(e,t,n,r){if(r={lane:2,revertLane:ld(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Os(e)){if(t)throw Error(i(479))}else t=Kr(e,n,r,2),t!==null&&pu(t,e,2)}function Os(e){var t=e.alternate;return e===X||t!==null&&t===X}function ks(e,t){oo=ao=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function As(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ke(e,n)}}var js={readContext:Gi,use:Eo,useCallback:po,useContext:po,useEffect:po,useImperativeHandle:po,useLayoutEffect:po,useInsertionEffect:po,useMemo:po,useReducer:po,useRef:po,useState:po,useDebugValue:po,useDeferredValue:po,useTransition:po,useSyncExternalStore:po,useId:po,useHostTransitionStatus:po,useFormState:po,useActionState:po,useOptimistic:po,useMemoCache:po,useCacheRefresh:po};js.useEffectEvent=po;var Ms={readContext:Gi,use:Eo,useCallback:function(e,t){return So().memoizedState=[e,t===void 0?null:t],e},useContext:Gi,useEffect:ns,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),es(4194308,4,cs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){es(4,2,e,t)},useMemo:function(e,t){var n=So();t=t===void 0?null:t;var r=e();if(so){ke(!0);try{e()}finally{ke(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=So();if(n!==void 0){var i=n(t);if(so){ke(!0);try{n(t)}finally{ke(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=ws.bind(null,X,e),[r.memoizedState,e]},useRef:function(e){var t=So();return e={current:e},t.memoizedState=e},useState:function(e){e=Ro(e);var t=e.queue,n=Ts.bind(null,X,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:us,useDeferredValue:function(e,t){return ps(So(),e,t)},useTransition:function(){var e=Ro(!1);return e=hs.bind(null,X,e.queue,!0,!1),So().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=X,a=So();if(Y){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Fl===null)throw Error(i(349));Q&127||No(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Fo.bind(null,r,o,e),[e]),r.flags|=2048,Qo(9,{destroy:void 0},Po.bind(null,r,o,n,t),null),n},useId:function(){var e=So(),t=Fl.identifierPrefix;if(Y){var n=_i,r=gi;n=(r&~(1<<32-Ae(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=co++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=fo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:bs,useFormState:qo,useActionState:qo,useOptimistic:function(e){var t=So();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ds.bind(null,X,!0,n),n.dispatch=t,[e,t]},useMemoCache:Do,useCacheRefresh:function(){return So().memoizedState=Cs.bind(null,X)},useEffectEvent:function(e){var t=So(),n={impl:e};return t.memoizedState=n,function(){if(Pl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Ns={readContext:Gi,use:Eo,useCallback:ds,useContext:Gi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:ko,useRef:$o,useState:function(){return ko(Oo)},useDebugValue:us,useDeferredValue:function(e,t){return ms(Co(),ro.memoizedState,e,t)},useTransition:function(){var e=ko(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Jo,useActionState:Jo,useOptimistic:function(e,t){return zo(Co(),ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ns.useEffectEvent=as;var Ps={readContext:Gi,use:Eo,useCallback:ds,useContext:Gi,useEffect:rs,useImperativeHandle:ls,useInsertionEffect:os,useLayoutEffect:ss,useMemo:fs,useReducer:jo,useRef:$o,useState:function(){return jo(Oo)},useDebugValue:us,useDeferredValue:function(e,t){var n=Co();return ro===null?ps(n,e,t):ms(n,ro.memoizedState,e,t)},useTransition:function(){var e=jo(Oo)[0],t=Co().memoizedState;return[typeof e==`boolean`?e:To(e),t]},useSyncExternalStore:Mo,useId:xs,useHostTransitionStatus:bs,useFormState:Zo,useActionState:Zo,useOptimistic:function(e,t){var n=Co();return ro===null?(n.baseState=e,[e,n.queue.dispatch]):zo(n,ro,e,t)},useMemoCache:Do,useCacheRefresh:Ss};Ps.useEffectEvent=as;function Fs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Is={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=du(),i=Na(r);i.payload=t,n!=null&&(i.callback=n),t=Pa(e,i,r),t!==null&&(pu(t,e,r),Fa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=du(),i=Na(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Pa(e,i,r),t!==null&&(pu(t,e,r),Fa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=du(),r=Na(n);r.tag=2,t!=null&&(r.callback=t),t=Pa(e,r,n),t!==null&&(pu(t,e,n),Fa(t,e,n))}};function Ls(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!pr(n,r)||!pr(i,a):!0}function Rs(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&&Is.enqueueReplaceState(t,t.state,null)}function zs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Bs(e){Br(e)}function Vs(e){console.error(e)}function Hs(e){Br(e)}function Us(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ws(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Gs(e,t,n){return n=Na(n),n.tag=3,n.payload={element:null},n.callback=function(){Us(e,t)},n}function Ks(e){return e=Na(e),e.tag=3,e}function qs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ws(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ws(t,n,r),typeof i!=`function`&&(tu===null?tu=new Set([this]):tu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Js(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Hi(t,n,a,!0),n=qa.current,n!==null){switch(n.tag){case 31:case 13:return Ja===null?Tu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===ha?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Uu(e,r,a)),!1;case 22:return n.flags|=65536,r===ha?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Uu(e,r,a)),!1}throw Error(i(435,n.tag))}return Uu(e,r,a),Tu(),!1}if(Y)return t=qa.current,t===null?(r!==Di&&(t=Error(i(423),{cause:r}),Pi(ci(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ci(r,n),a=Gs(e.stateNode,r,a),Ia(e,a),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Di&&(e=Error(i(422),{cause:r}),Pi(ci(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ci(o,n),Jl===null?Jl=[o]:Jl.push(o),Hl!==4&&(Hl=2),t===null)return!0;r=ci(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Gs(n.stateNode,r,e),Ia(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(tu===null||!tu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ks(a),qs(a,e,n,r),Ia(n,a),!1}n=n.return}while(n!==null);return!1}var Ys=Error(i(461)),Xs=!1;function Zs(e,t,n,r){t.child=e===null?ka(t,null,n,r):Oa(t,e.child,n,r)}function Qs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Wi(t),r=ho(e,t,n,o,a,i),s=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(Y&&s&&bi(t),t.flags|=1,Zs(e,t,r,i),t.child)}function $s(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!$r(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,ec(e,t,a,r,i)):(e=ni(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Cc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?pr:n,n(o,r)&&e.ref===t.ref)return Sc(e,t,i)}return t.flags|=1,e=ei(a,r),e.ref=t.ref,e.return=t,t.child=e}function ec(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(pr(a,r)&&e.ref===t.ref){if(Xs=!1,t.pendingProps=r=a,Cc(e,i))e.flags&131072&&(Xs=!0);else return t.lanes=e.lanes,Sc(e,t,i)}}return cc(e,t,n,r,i)}function tc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return rc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ua(t,a===null?null:a.cachePool),a===null?Ga():Wa(t,a),Za(t);else return r=t.lanes=536870912,rc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ua(t,null),Ga(),Qa(t)):(ua(t,a.cachePool),Wa(t,a),Qa(t),t.memoizedState=null);return Zs(e,t,i,n),t.child}function nc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function rc(e,t,n,r,i){var a=la();return a=a===null?null:{parent:Zi._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ua(t,null),Ga(),Za(t),e!==null&&Hi(e,t,r,!0),t.childLanes=i,null}function ic(e,t){return t=_c({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function ac(e,t,n){return Oa(t,e.child,null,n),e=ic(t,t.pendingProps),e.flags|=2,$a(t),t.memoizedState=null,e}function oc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(Y){if(r.mode===`hidden`)return e=ic(t,r),t.lanes=536870912,nc(null,e);if(Xa(t),(e=wi)?(e=rf(e,Ei),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:hi===null?null:{id:gi,overflow:_i},retryLane:536870912,hydrationErrors:null},n=ai(e),n.return=t,t.child=n,Ci=t,wi=null)):e=null,e===null)throw Oi(t);return t.lanes=536870912,null}return ic(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Xa(t),a){if(t.flags&256)t.flags&=-257,t=ac(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Xs||Hi(e,t,n,!1),a=(n&e.childLanes)!==0,Xs||a){if(r=Fl,r!==null&&(s=qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,qr(e,s),pu(r,e,s),Ys;Tu(),t=ac(e,t,n)}else e=o.treeContext,wi=cf(s.nextSibling),Ci=t,Y=!0,Ti=null,Ei=!1,e!==null&&Si(t,e),t=ic(t,r),t.flags|=4096;return t}return e=ei(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function sc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function cc(e,t,n,r,i){return Wi(t),n=ho(e,t,n,r,void 0,i),r=yo(),e!==null&&!Xs?(bo(e,t,i),Sc(e,t,i)):(Y&&r&&bi(t),t.flags|=1,Zs(e,t,n,i),t.child)}function lc(e,t,n,r,i,a){return Wi(t),t.updateQueue=null,n=_o(t,r,n,i),go(e),r=yo(),e!==null&&!Xs?(bo(e,t,a),Sc(e,t,a)):(Y&&r&&bi(t),t.flags|=1,Zs(e,t,n,a),t.child)}function uc(e,t,n,r,i){if(Wi(t),t.stateNode===null){var a=Xr,o=n.contextType;typeof o==`object`&&o&&(a=Gi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Is,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ja(t),o=n.contextType,a.context=typeof o==`object`&&o?Gi(o):Xr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Fs(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Is.enqueueReplaceState(a,a.state,null),za(t,r,a,i),Ra(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=zs(n,s);a.props=c;var l=a.context,u=n.contextType;o=Xr,typeof u==`object`&&u&&(o=Gi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Rs(t,a,r,o),Aa=!1;var f=t.memoizedState;a.state=f,za(t,r,a,i),Ra(),l=t.memoizedState,s||f!==l||Aa?(typeof d==`function`&&(Fs(t,n,d,r),l=t.memoizedState),(c=Aa||Ls(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Ma(e,t),o=t.memoizedProps,u=zs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Xr,typeof l==`object`&&l&&(c=Gi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Rs(t,a,r,c),Aa=!1,f=t.memoizedState,a.state=f,za(t,r,a,i),Ra();var p=t.memoizedState;o!==d||f!==p||Aa||e!==null&&e.dependencies!==null&&Ui(e.dependencies)?(typeof s==`function`&&(Fs(t,n,s,r),p=t.memoizedState),(u=Aa||Ls(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ui(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,sc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Oa(t,e.child,null,i),t.child=Oa(t,null,n,i)):Zs(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Sc(e,t,i),e}function dc(e,t,n,r){return Mi(),t.flags|=256,Zs(e,t,n,r),t.child}var fc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function pc(e){return{baseLanes:e,cachePool:da()}}function mc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Kl),e}function hc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(eo.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(Y){if(a?Ya(t):Qa(t),(e=wi)?(e=rf(e,Ei),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:hi===null?null:{id:gi,overflow:_i},retryLane:536870912,hydrationErrors:null},n=ai(e),n.return=t,t.child=n,Ci=t,wi=null)):e=null,e===null)throw Oi(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Qa(t),a=t.mode,c=_c({mode:`hidden`,children:c},a),r=ri(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(null,r)):(Ya(t),gc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Ya(t),t.flags&=-257,t=vc(e,t,n)):t.memoizedState===null?(Qa(t),c=r.fallback,a=t.mode,r=_c({mode:`visible`,children:r.children},a),c=ri(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Oa(t,e.child,null,n),r=t.child,r.memoizedState=pc(n),r.childLanes=mc(e,s,n),t.memoizedState=fc,t=nc(null,r)):(Qa(t),t.child=e.child,t.flags|=128,t=null);else if(Ya(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Pi({value:r,source:null,stack:null}),t=vc(e,t,n)}else if(Xs||Hi(e,t,n,!1),s=(n&e.childLanes)!==0,Xs||s){if(s=Fl,s!==null&&(r=qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,qr(e,r),pu(s,e,r),Ys;af(c)||Tu(),t=vc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,wi=cf(c.nextSibling),Ci=t,Y=!0,Ti=null,Ei=!1,e!==null&&Si(t,e),t=gc(t,r.children),t.flags|=4096);return t}return a?(Qa(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ei(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=ri(c,a,n,null),c.flags|=2):c=ei(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,nc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=pc(n):(a=c.cachePool,a===null?a=da():(l=Zi._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=mc(e,s,n),t.memoizedState=fc,nc(e.child,r)):(Ya(t),n=e.child,e=n.sibling,n=ei(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function gc(e,t){return t=_c({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function _c(e,t){return e=Qr(22,e,null,t),e.lanes=0,e}function vc(e,t,n){return Oa(t,e.child,null,n),e=gc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function yc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bi(e.return,t,n)}function bc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function xc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=eo.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,z(eo,o),Zs(e,t,r,n),r=Y?fi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&yc(e,n,t);else if(e.tag===19)yc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&to(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),bc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&to(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}bc(t,!0,n,null,a,r);break;case`together`:bc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Sc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Hi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ei(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ei(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Cc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ui(e)))}function wc(e,t,n){switch(t.tag){case 3:oe(t,t.stateNode.containerInfo),Ri(t,Zi,e.memoizedState.cache),Mi();break;case 27:case 5:H(t);break;case 4:oe(t,t.stateNode.containerInfo);break;case 10:Ri(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Xa(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ya(t),e=Sc(e,t,n),e===null?null:e.sibling):hc(e,t,n):(Ya(t),t.flags|=128,null);Ya(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(Hi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return xc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),z(eo,eo.current),r)break;return null;case 22:return t.lanes=0,tc(e,t,n,t.pendingProps);case 24:Ri(t,Zi,e.memoizedState.cache)}return Sc(e,t,n)}function Tc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Xs=!0;else{if(!Cc(e,n)&&!(t.flags&128))return Xs=!1,wc(e,t,n);Xs=!!(e.flags&131072)}}else Xs=!1,Y&&t.flags&1048576&&yi(t,fi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=va(t.elementType),t.type=e,typeof e==`function`)$r(e)?(r=zs(e,r),t.tag=1,t=uc(null,t,e,r,n)):(t.tag=0,t=cc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===S){t.tag=11,t=Qs(null,t,e,r,n);break a}if(a===T){t.tag=14,t=$s(null,t,e,r,n);break a}}throw t=N(e)||e,Error(i(306,t,``))}}return t;case 0:return cc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=zs(r,t.pendingProps),uc(e,t,r,a,n);case 3:a:{if(oe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Ma(e,t),za(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ri(t,Zi,r),r!==o.cache&&Vi(t,[Zi],n,!0),Ra(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=dc(e,t,r,n);break a}if(r!==a){a=ci(Error(i(424)),t),Pi(a),t=dc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(wi=cf(e.firstChild),Ci=t,Y=!0,Ti=null,Ei=!0,n=ka(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Mi(),r===a){t=Sc(e,t,n);break a}Zs(e,t,r,n)}t=t.child}return t;case 26:return sc(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Y||(n=t.type,e=t.pendingProps,r=Bd(ie.current).createElement(n),r[$e]=t,r[G]=e,Pd(r,n,e),dt(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return H(t),e===null&&Y&&(r=t.stateNode=ff(t.type,t.pendingProps,ie.current),Ci=t,Ei=!0,a=wi,Zd(t.type)?(lf=a,wi=cf(r.firstChild)):wi=a),Zs(e,t,t.pendingProps.children,n),sc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Y&&((a=r=wi)&&(r=tf(r,t.type,t.pendingProps,Ei),r===null?a=!1:(t.stateNode=r,Ci=t,wi=cf(r.firstChild),Ei=!1,a=!0)),a||Oi(t)),H(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ho(e,t,vo,null,null,n),Qf._currentValue=a),sc(e,t),Zs(e,t,r,n),t.child;case 6:return e===null&&Y&&((e=n=wi)&&(n=nf(n,t.pendingProps,Ei),n===null?e=!1:(t.stateNode=n,Ci=t,wi=null,e=!0)),e||Oi(t)),null;case 13:return hc(e,t,n);case 4:return oe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Oa(t,null,r,n):Zs(e,t,r,n),t.child;case 11:return Qs(e,t,t.type,t.pendingProps,n);case 7:return Zs(e,t,t.pendingProps,n),t.child;case 8:return Zs(e,t,t.pendingProps.children,n),t.child;case 12:return Zs(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ri(t,t.type,r.value),Zs(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Wi(t),a=Gi(a),r=r(a),t.flags|=1,Zs(e,t,r,n),t.child;case 14:return $s(e,t,t.type,t.pendingProps,n);case 15:return ec(e,t,t.type,t.pendingProps,n);case 19:return xc(e,t,n);case 31:return oc(e,t,n);case 22:return tc(e,t,n,t.pendingProps);case 24:return Wi(t),r=Gi(Zi),e===null?(a=la(),a===null&&(a=Fl,o=Qi(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ja(t),Ri(t,Zi,a)):((e.lanes&n)!==0&&(Ma(e,t),za(t,null,null,n),Ra()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ri(t,Zi,r),r!==a.cache&&Vi(t,[Zi],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ri(t,Zi,r))),Zs(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Ec(e){e.flags|=4}function Dc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Su())e.flags|=8192;else throw ya=ha,pa}}else e.flags&=-16777217}function Oc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t)){if(Su())e.flags|=8192;else throw ya=ha,pa}}function kc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ve(),e.lanes|=t,ql|=t)}function Ac(e,t){if(!Y)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 jc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Mc(e,t,n){var r=t.pendingProps;switch(xi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return jc(t),null;case 1:return jc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),zi(Zi),V(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ji(t)?Ec(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ni())),jc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Ec(t),o===null?(jc(t),Dc(t,a,null,r,n)):(jc(t),Oc(t,o))):o?o===e.memoizedState?(jc(t),t.flags&=-16777217):(Ec(t),jc(t),Oc(t,o)):(e=e.memoizedProps,e!==r&&Ec(t),jc(t),Dc(t,a,e,r,n)),null;case 27:if(se(t),n=ie.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}e=B.current,ji(t)?ki(t,e):(e=ff(a,r,n),t.stateNode=e,Ec(t))}return jc(t),null;case 5:if(se(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return jc(t),null}if(o=B.current,ji(t))ki(t,o);else{var s=Bd(ie.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[$e]=t,o[G]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Ec(t)}}return jc(t),Dc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Ec(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ie.current,ji(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Ci,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[$e]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Oi(t,!0)}else e=Bd(e).createTextNode(r),e[$e]=t,t.stateNode=e}return jc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ji(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[$e]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),e=!1}else n=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?($a(t),t):($a(t),null);if(t.flags&128)throw Error(i(558))}return jc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ji(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[$e]=t}else Mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;jc(t),a=!1}else a=Ni(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?($a(t),t):($a(t),null)}return $a(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),kc(t,t.updateQueue),jc(t),null);case 4:return V(),e===null&&xd(t.stateNode.containerInfo),jc(t),null;case 10:return zi(t.type),jc(t),null;case 19:if(R(eo),r=t.memoizedState,r===null)return jc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Ac(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=to(e),o!==null){for(t.flags|=128,Ac(r,!1),e=o.updateQueue,t.updateQueue=e,kc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ti(n,e),n=n.sibling;return z(eo,eo.current&1|2),Y&&vi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&ve()>$l&&(t.flags|=128,a=!0,Ac(r,!1),t.lanes=4194304)}}else{if(!a){if(e=to(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,kc(t,e),Ac(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Y)return jc(t),null}else 2*ve()-r.renderingStartTime>$l&&n!==536870912&&(t.flags|=128,a=!0,Ac(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(jc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=ve(),e.sibling=null,n=eo.current,z(eo,a?n&1|2:n&1),Y&&vi(t,r.treeForkCount),e);case 22:case 23:return $a(t),Ka(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(jc(t),t.subtreeFlags&6&&(t.flags|=8192)):jc(t),n=t.updateQueue,n!==null&&kc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&R(ca),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),zi(Zi),jc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Nc(e,t){switch(xi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return zi(Zi),V(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return se(t),null;case 31:if(t.memoizedState!==null){if($a(t),t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($a(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(eo),null;case 4:return V(),null;case 10:return zi(t.type),null;case 22:case 23:return $a(t),Ka(),e!==null&&R(ca),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return zi(Zi),null;case 25:return null;default:return null}}function Pc(e,t){switch(xi(t),t.tag){case 3:zi(Zi),V();break;case 26:case 27:case 5:se(t);break;case 4:V();break;case 31:t.memoizedState!==null&&$a(t);break;case 13:$a(t);break;case 19:R(eo);break;case 10:zi(t.type);break;case 22:case 23:$a(t),Ka(),e!==null&&R(ca);break;case 24:zi(Zi)}}function Fc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){$(t,t.return,e)}}function Ic(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){$(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){$(t,t.return,e)}}function Lc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Va(t,n)}catch(t){$(e,e.return,t)}}}function Rc(e,t,n){n.props=zs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){$(e,t,n)}}function zc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){$(e,t,n)}}function Bc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){$(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function Vc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){$(e,e.return,t)}}function Hc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[G]=t}catch(t){$(e,e.return,t)}}function Uc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Wc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Uc(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.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Gc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Gc(e,t,n),e=e.sibling;e!==null;)Gc(e,t,n),e=e.sibling}function Kc(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&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Kc(e,t,n),e=e.sibling;e!==null;)Kc(e,t,n),e=e.sibling}function qc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[$e]=e,t[G]=n}catch(t){$(e,e.return,t)}}var Jc=!1,Yc=!1,Xc=!1,Zc=typeof WeakSet==`function`?WeakSet:Set,Qc=null;function $c(e,t){if(e=e.containerInfo,Rd=sp,e=_r(e),vr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{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,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Qc=t;Qc!==null;)if(t=Qc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Qc=e;else for(;Qc!==null;){switch(t=Qc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=zs(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){$(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Qc=e;break}Qc=t.return}}function el(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:hl(e,n),r&4&&Fc(5,n);break;case 1:if(hl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){$(n,n.return,e)}else{var i=zs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){$(n,n.return,e)}}}r&64&&Lc(n),r&512&&zc(n,n.return);break;case 3:if(hl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Va(e,t)}catch(e){$(n,n.return,e)}}break;case 27:t===null&&r&4&&qc(n);case 26:case 5:hl(e,n),t===null&&r&4&&Vc(n),r&512&&zc(n,n.return);break;case 12:hl(e,n);break;case 31:hl(e,n),r&4&&ol(e,n);break;case 13:hl(e,n),r&4&&sl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ku.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Jc,!r){t=t!==null&&t.memoizedState!==null||Yc,i=Jc;var a=Yc;Jc=r,(Yc=t)&&!a?_l(e,n,!!(n.subtreeFlags&8772)):hl(e,n),Jc=i,Yc=a}break;case 30:break;default:hl(e,n)}}function tl(e){var t=e.alternate;t!==null&&(e.alternate=null,tl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ot(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var nl=null,rl=!1;function il(e,t,n){for(n=n.child;n!==null;)al(e,t,n),n=n.sibling}function al(e,t,n){if(Oe&&typeof Oe.onCommitFiberUnmount==`function`)try{Oe.onCommitFiberUnmount(De,n)}catch{}switch(n.tag){case 26:Yc||Bc(n,t),il(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Yc||Bc(n,t);var r=nl,i=rl;Zd(n.type)&&(nl=n.stateNode,rl=!1),il(e,t,n),pf(n.stateNode),nl=r,rl=i;break;case 5:Yc||Bc(n,t);case 6:if(r=nl,i=rl,nl=null,il(e,t,n),nl=r,rl=i,nl!==null){if(rl)try{(nl.nodeType===9?nl.body:nl.nodeName===`HTML`?nl.ownerDocument.body:nl).removeChild(n.stateNode)}catch(e){$(n,t,e)}else try{nl.removeChild(n.stateNode)}catch(e){$(n,t,e)}}break;case 18:nl!==null&&(rl?(e=nl,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(nl,n.stateNode));break;case 4:r=nl,i=rl,nl=n.stateNode.containerInfo,rl=!0,il(e,t,n),nl=r,rl=i;break;case 0:case 11:case 14:case 15:Ic(2,n,t),Yc||Ic(4,n,t),il(e,t,n);break;case 1:Yc||(Bc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Rc(n,t,r)),il(e,t,n);break;case 21:il(e,t,n);break;case 22:Yc=(r=Yc)||n.memoizedState!==null,il(e,t,n),Yc=r;break;default:il(e,t,n)}}function ol(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){$(t,t.return,e)}}}function sl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){$(t,t.return,e)}}function cl(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Zc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Zc),t;default:throw Error(i(435,e.tag))}}function ll(e,t){var n=cl(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=qu.bind(null,e,t);t.then(r,r)}})}function ul(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){nl=c.stateNode,rl=!1;break a}break;case 5:nl=c.stateNode,rl=!1;break a;case 3:case 4:nl=c.stateNode.containerInfo,rl=!0;break a}c=c.return}if(nl===null)throw Error(i(160));al(o,s,a),nl=null,rl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)fl(t,e),t=t.sibling}var dl=null;function fl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:ul(t,e),pl(e),r&4&&(Ic(3,e,e.return),Fc(3,e),Ic(5,e,e.return));break;case 1:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&64&&Jc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=dl;if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[at]||o[$e]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[$e]=e,dt(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[$e]=e,dt(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode)}else e.stateNode=If(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Hc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),n!==null&&r&4&&Hc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(ul(t,e),pl(e),r&512&&(Yc||n===null||Bc(n,n.return)),e.flags&32){a=e.stateNode;try{It(a,``)}catch(t){$(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Hc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Xc=!0);break;case 6:if(ul(t,e),pl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){$(e,e.return,t)}}break;case 3:if(Bf=null,a=dl,dl=gf(t.containerInfo),ul(t,e),dl=a,pl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){$(e,e.return,t)}Xc&&(Xc=!1,ml(e));break;case 4:r=dl,dl=gf(e.stateNode.containerInfo),ul(t,e),pl(e),dl=r;break;case 12:ul(t,e),pl(e);break;case 31:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 13:ul(t,e),pl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Zl=ve()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Jc,d=Yc;if(Jc=u||a,Yc=d||l,ul(t,e),Yc=d,Jc=u,pl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Jc||Yc||gl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){$(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){$(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){$(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,ll(e,n))));break;case 19:ul(t,e),pl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,ll(e,r)));break;case 30:break;case 21:break;default:ul(t,e),pl(e)}}function pl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Uc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Kc(e,Wc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(It(o,``),n.flags&=-33),Kc(e,Wc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Gc(e,Wc(e),s);break;default:throw Error(i(161))}}catch(t){$(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function ml(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;ml(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function hl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)el(e,t.alternate,t),t=t.sibling}function gl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Ic(4,t,t.return),gl(t);break;case 1:Bc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Rc(t,t.return,n),gl(t);break;case 27:pf(t.stateNode);case 26:case 5:Bc(t,t.return),gl(t);break;case 22:t.memoizedState===null&&gl(t);break;case 30:gl(t);break;default:gl(t)}e=e.sibling}}function _l(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:_l(i,a,n),Fc(4,a);break;case 1:if(_l(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){$(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ba(c[i],s)}catch(e){$(r,r.return,e)}}n&&o&64&&Lc(a),zc(a,a.return);break;case 27:qc(a);case 26:case 5:_l(i,a,n),n&&r===null&&o&4&&Vc(a),zc(a,a.return);break;case 12:_l(i,a,n);break;case 31:_l(i,a,n),n&&o&4&&ol(i,a);break;case 13:_l(i,a,n),n&&o&4&&sl(i,a);break;case 22:a.memoizedState===null&&_l(i,a,n),zc(a,a.return);break;case 30:break;default:_l(i,a,n)}t=t.sibling}}function vl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&$i(n))}function yl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$i(e))}function bl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xl(e,t,n,r),t=t.sibling}function xl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:bl(e,t,n,r),i&2048&&Fc(9,t);break;case 1:bl(e,t,n,r);break;case 3:bl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&$i(e)));break;case 12:if(i&2048){bl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){$(t,t.return,e)}}else bl(e,t,n,r);break;case 31:bl(e,t,n,r);break;case 13:bl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?bl(e,t,n,r):(a._visibility|=2,Sl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?bl(e,t,n,r):Cl(e,t),i&2048&&vl(o,t);break;case 24:bl(e,t,n,r),i&2048&&yl(t.alternate,t);break;default:bl(e,t,n,r)}}function Sl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Sl(a,o,s,c,i),Fc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Sl(a,o,s,c,i)):u._visibility&2?Sl(a,o,s,c,i):Cl(a,o),i&&l&2048&&vl(o.alternate,o);break;case 24:Sl(a,o,s,c,i),i&&l&2048&&yl(o.alternate,o);break;default:Sl(a,o,s,c,i)}t=t.sibling}}function Cl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Cl(n,r),i&2048&&vl(r.alternate,r);break;case 24:Cl(n,r),i&2048&&yl(r.alternate,r);break;default:Cl(n,r)}t=t.sibling}}var wl=8192;function Tl(e,t,n){if(e.subtreeFlags&wl)for(e=e.child;e!==null;)El(e,t,n),e=e.sibling}function El(e,t,n){switch(e.tag){case 26:Tl(e,t,n),e.flags&wl&&e.memoizedState!==null&&Gf(n,dl,e.memoizedState,e.memoizedProps);break;case 5:Tl(e,t,n);break;case 3:case 4:var r=dl;dl=gf(e.stateNode.containerInfo),Tl(e,t,n),dl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=wl,wl=16777216,Tl(e,t,n),wl=r):Tl(e,t,n));break;default:Tl(e,t,n)}}function Dl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)kl(e),e=e.sibling}function kl(e){switch(e.tag){case 0:case 11:case 15:Ol(e),e.flags&2048&&Ic(9,e,e.return);break;case 3:Ol(e);break;case 12:Ol(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Al(e)):Ol(e);break;default:Ol(e)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Qc=r,jl(r,e)}Dl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Ic(8,t,t.return),Al(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Al(t));break;default:Al(t)}e=e.sibling}}function jl(e,t){for(;Qc!==null;){var n=Qc;switch(n.tag){case 0:case 11:case 15:Ic(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:$i(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Qc=r;else a:for(n=e;Qc!==null;){r=Qc;var i=r.sibling,a=r.return;if(tl(r),r===n){Qc=null;break a}if(i!==null){i.return=a,Qc=i;break a}Qc=a}}}var Ml={getCacheForType:function(e){var t=Gi(Zi),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Gi(Zi).controller.signal}},Nl=typeof WeakMap==`function`?WeakMap:Map,Pl=0,Fl=null,Z=null,Q=0,Il=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,Kl=0,ql=0,Jl=null,Yl=null,Xl=!1,Zl=0,Ql=0,$l=1/0,eu=null,tu=null,nu=0,ru=null,iu=null,au=0,ou=0,su=null,cu=null,lu=0,uu=null;function du(){return Pl&2&&Q!==0?Q&-Q:F.T===null?Xe():ld()}function fu(){if(Kl===0){if(!(Q&536870912)||Y){var e=Fe;Fe<<=1,!(Fe&3932160)&&(Fe=262144),Kl=e}else Kl=536870912}return e=qa.current,e!==null&&(e.flags|=32),Kl}function pu(e,t,n){(e===Fl&&(Il===2||Il===9)||e.cancelPendingCommit!==null)&&(bu(e,0),_u(e,Q,Kl,!1)),Ue(e,n),(!(Pl&2)||e!==Fl)&&(e===Fl&&(!(Pl&2)&&(Wl|=n),Hl===4&&_u(e,Q,Kl,!1)),td(e))}function mu(e,t,n){if(Pl&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ze(e,t),a=r?Ou(e,t):Eu(e,t,!0),o=r;do{if(a===0){zl&&!r&&_u(e,t,0,!1);break}if(n=e.current.alternate,o&&!gu(n)){a=Eu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=Jl;var l=c.current.memoizedState.isDehydrated;if(l&&(bu(c,s).flags|=256),s=Eu(c,s,!1),s!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=o,Wl|=o,a=4;break a}o=Yl,Yl=a,o!==null&&(Yl===null?Yl=o:Yl.push.apply(Yl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){bu(e,0),_u(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:_u(r,t,Kl,!Rl);break a;case 2:Yl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Zl+300-ve(),10<a)){if(_u(r,t,Kl,!Rl),Re(r,0,!0)!==0)break a;au=t,r.timeoutHandle=Kd(hu.bind(null,r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,`Throttled`,-0,0),a);break a}hu(r,n,Yl,eu,Xl,t,Kl,Wl,ql,Rl,o,null,-0,0)}break}while(1);td(e)}function hu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wt},El(t,a,d);var m=(a&62914560)===a?Zl-ve():(a&4194048)===a?Ql-ve():0;if(m=qf(d,m),m!==null){au=a,e.cancelPendingCommit=m(Fu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),_u(e,a,o,!l);return}}Fu(e,t,a,n,r,i,o,s,c)}function gu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!fr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _u(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Ae(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ge(e,n,t)}function vu(){return Pl&6?!0:(nd(0,!1),!1)}function yu(){if(Z!==null){if(Il===0)var e=Z.return;else e=Z,Li=Ii=null,xo(e),Sa=null,Ca=0,e=Z;for(;e!==null;)Pc(e.alternate,e),e=e.return;Z=null}}function bu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),au=0,yu(),Fl=e,Z=n=ei(e.current,null),Q=t,Il=0,Ll=null,Rl=!1,zl=ze(e,t),Bl=!1,ql=Kl=Gl=Wl=Ul=Hl=0,Yl=Jl=null,Xl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Ae(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,Wr(),n}function xu(e,t){X=null,F.H=js,t===fa||t===ma?(t=ba(),Il=3):t===pa?(t=ba(),Il=4):Il=t===Ys?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,Z===null&&(Hl=1,Us(e,ci(t,e.current)))}function Su(){var e=qa.current;return e===null?!0:(Q&4194048)===Q?Ja===null:(Q&62914560)===Q||Q&536870912?e===Ja:!1}function Cu(){var e=F.H;return F.H=js,e===null?js:e}function wu(){var e=F.A;return F.A=Ml,e}function Tu(){Hl=4,Rl||(Q&4194048)!==Q&&qa.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Fl===null||_u(Fl,Q,Kl,!1)}function Eu(e,t,n){var r=Pl;Pl|=2;var i=Cu(),a=wu();(Fl!==e||Q!==t)&&(eu=null,bu(e,t)),t=!1;var o=Hl;a:do try{if(Il!==0&&Z!==null){var s=Z,c=Ll;switch(Il){case 8:yu(),o=6;break a;case 3:case 2:case 9:case 6:qa.current===null&&(t=!0);var l=Il;if(Il=0,Ll=null,Mu(e,s,c,l),n&&zl){o=0;break a}break;default:l=Il,Il=0,Ll=null,Mu(e,s,c,l)}}Du(),o=Hl;break}catch(t){xu(e,t)}while(1);return t&&e.shellSuspendCounter++,Li=Ii=null,Pl=r,F.H=i,F.A=a,Z===null&&(Fl=null,Q=0,Wr()),o}function Du(){for(;Z!==null;)Au(Z)}function Ou(e,t){var n=Pl;Pl|=2;var r=Cu(),a=wu();Fl!==e||Q!==t?(eu=null,$l=ve()+500,bu(e,t)):zl=ze(e,t);a:do try{if(Il!==0&&Z!==null){t=Z;var o=Ll;b:switch(Il){case 1:Il=0,Ll=null,Mu(e,t,o,1);break;case 2:case 9:if(ga(o)){Il=0,Ll=null,ju(t);break}t=function(){Il!==2&&Il!==9||Fl!==e||(Il=7),td(e)},o.then(t,t);break a;case 3:Il=7;break a;case 4:Il=5;break a;case 7:ga(o)?(Il=0,Ll=null,ju(t)):(Il=0,Ll=null,Mu(e,t,o,7));break;case 5:var s=null;switch(Z.tag){case 26:s=Z.memoizedState;case 5:case 27:var c=Z;if(s?Wf(s):c.stateNode.complete){Il=0,Ll=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Nu(u))}break b}}Il=0,Ll=null,Mu(e,t,o,5);break;case 6:Il=0,Ll=null,Mu(e,t,o,6);break;case 8:yu(),Hl=6;break a;default:throw Error(i(462))}}ku();break}catch(t){xu(e,t)}while(1);return Li=Ii=null,F.H=r,F.A=a,Pl=n,Z===null?(Fl=null,Q=0,Wr(),Hl):0}function ku(){for(;Z!==null&&!ge();)Au(Z)}function Au(e){var t=Tc(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function ju(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=lc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=lc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:xo(t);default:Pc(n,t),t=Z=ti(t,Vl),t=Tc(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Nu(e):Z=t}function Mu(e,t,n,r){Li=Ii=null,xo(t),Sa=null,Ca=0;var i=t.return;try{if(Js(e,i,t,n,Q)){Hl=1,Us(e,ci(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;Hl=1,Us(e,ci(n,e.current)),Z=null;return}t.flags&32768?(Y||r===1?e=!0:zl||Q&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=qa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Pu(t,e)):Nu(t)}function Nu(e){var t=e;do{if(t.flags&32768){Pu(t,Rl);return}e=t.return;var n=Mc(t.alternate,t,Vl);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);Hl===0&&(Hl=5)}function Pu(e,t){do{var n=Nc(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);Hl=6,Z=null}function Fu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do Bu();while(nu!==0);if(Pl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Ur,We(e,n,o,s,c,l),e===Fl&&(Z=Fl=null,Q=0),iu=t,ru=e,au=n,ou=o,su=a,cu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ju(Se,function(){return Vu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=F.T,F.T=null,a=I.p,I.p=2,s=Pl,Pl|=4;try{$c(e,t,n)}finally{Pl=s,I.p=a,F.T=r}}nu=1,Iu(),Lu(),Ru()}}function Iu(){if(nu===1){nu=0;var e=ru,t=iu,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=F.T,F.T=null;var r=I.p;I.p=2;var i=Pl;Pl|=4;try{fl(t,e);var a=zd,o=_r(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&gr(s.ownerDocument.documentElement,s)){if(c!==null&&vr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=hr(s,h),v=hr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{Pl=i,I.p=r,F.T=n}}e.current=t,nu=2}}function Lu(){if(nu===2){nu=0;var e=ru,t=iu,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=F.T,F.T=null;var r=I.p;I.p=2;var i=Pl;Pl|=4;try{el(e,t.alternate,t)}finally{Pl=i,I.p=r,F.T=n}}nu=3}}function Ru(){if(nu===4||nu===3){nu=0,_e();var e=ru,t=iu,n=au,r=cu;t.subtreeFlags&10256||t.flags&10256?nu=5:(nu=0,iu=ru=null,zu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(tu=null),Ye(n),t=t.stateNode,Oe&&typeof Oe.onCommitFiberRoot==`function`)try{Oe.onCommitFiberRoot(De,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=F.T,i=I.p,I.p=2,F.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{F.T=t,I.p=i}}au&3&&Bu(),td(e),i=e.pendingLanes,n&261930&&i&42?e===uu?lu++:(lu=0,uu=e):lu=0,nd(0,!1)}}function zu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,$i(t)))}function Bu(){return Iu(),Lu(),Ru(),Vu()}function Vu(){if(nu!==5)return!1;var e=ru,t=ou;ou=0;var n=Ye(au),r=F.T,a=I.p;try{I.p=32>n?32:n,F.T=null,n=su,su=null;var o=ru,s=au;if(nu=0,iu=ru=null,au=0,Pl&6)throw Error(i(331));var c=Pl;if(Pl|=4,kl(o.current),xl(o,o.current,s,n),Pl=c,nd(0,!1),Oe&&typeof Oe.onPostCommitFiberRoot==`function`)try{Oe.onPostCommitFiberRoot(De,o)}catch{}return!0}finally{I.p=a,F.T=r,zu(e,t)}}function Hu(e,t,n){t=ci(n,t),t=Gs(e.stateNode,t,2),e=Pa(e,t,2),e!==null&&(Ue(e,2),td(e))}function $(e,t,n){if(e.tag===3)Hu(e,e,n);else for(;t!==null;){if(t.tag===3){Hu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(tu===null||!tu.has(r))){e=ci(n,e),n=Ks(2),r=Pa(t,n,2),r!==null&&(qs(n,r,t,e),Ue(r,2),td(r));break}}t=t.return}}function Uu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Nl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Bl=!0,i.add(n),e=Wu.bind(null,e,t,n),t.then(e,e))}function Wu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Fl===e&&(Q&n)===n&&(Hl===4||Hl===3&&(Q&62914560)===Q&&300>ve()-Zl?!(Pl&2)&&bu(e,0):Gl|=n,ql===Q&&(ql=0)),td(e)}function Gu(e,t){t===0&&(t=Ve()),e=qr(e,t),e!==null&&(Ue(e,t),td(e))}function Ku(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gu(e,n)}function qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Gu(e,n)}function Ju(e,t){return me(e,t)}var Yu=null,Xu=null,Zu=!1,Qu=!1,$u=!1,ed=0;function td(e){e!==Xu&&e.next===null&&(Xu===null?Yu=Xu=e:Xu=Xu.next=e),Qu=!0,Zu||(Zu=!0,cd())}function nd(e,t){if(!$u&&Qu){$u=!0;do for(var n=!1,r=Yu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-Ae(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,sd(r,a))}else a=Q,a=Re(r,r===Fl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ze(r,a)||(n=!0,sd(r,a))}r=r.next}while(n);$u=!1}}function rd(){id()}function id(){Qu=Zu=!1;var e=0;ed!==0&&Gd()&&(e=ed);for(var t=ve(),n=null,r=Yu;r!==null;){var i=r.next,a=ad(r,t);a===0?(r.next=null,n===null?Yu=i:n.next=i,i===null&&(Xu=n)):(n=r,(e!==0||a&3)&&(Qu=!0)),r=i}nu!==0&&nu!==5||nd(e,!1),ed!==0&&(ed=0)}function ad(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Ae(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Be(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Fl,n=Q,n=Re(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Il===2||Il===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&he(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ze(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&he(r),Ye(n)){case 2:case 8:n=xe;break;case 32:n=Se;break;case 268435456:n=we;break;default:n=Se}return r=od.bind(null,e),n=me(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&he(r),e.callbackPriority=2,e.callbackNode=null,2}function od(e,t){if(nu!==0&&nu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Bu()&&e.callbackNode!==n)return null;var r=Q;return r=Re(e,e===Fl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(mu(e,r,t),ad(e,ve()),e.callbackNode!=null&&e.callbackNode===n?od.bind(null,e):null)}function sd(e,t){if(Bu())return null;mu(e,t,!0)}function cd(){Yd(function(){Pl&6?me(be,rd):id()})}function ld(){if(ed===0){var e=na;e===0&&(e=Pe,Pe<<=1,!(Pe&261888)&&(Pe=256)),ed=e}return ed}function ud(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Ut(``+e)}function dd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function fd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=ud((i[G]||null).action),o=r.submitter;o&&(t=(t=o[G]||null)?ud(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new fn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ed!==0){var e=o?dd(i,o):new FormData(i);_s(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?dd(i,o):new FormData(i),_s(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var pd=0;pd<Rr.length;pd++){var md=Rr[pd];zr(md.toLowerCase(),`on`+(md[0].toUpperCase()+md.slice(1)))}zr(Ar,`onAnimationEnd`),zr(jr,`onAnimationIteration`),zr(Mr,`onAnimationStart`),zr(`dblclick`,`onDoubleClick`),zr(`focusin`,`onFocus`),zr(`focusout`,`onBlur`),zr(Nr,`onTransitionRun`),zr(Pr,`onTransitionStart`),zr(Fr,`onTransitionCancel`),zr(Ir,`onTransitionEnd`),ht(`onMouseEnter`,[`mouseout`,`mouseover`]),ht(`onMouseLeave`,[`mouseout`,`mouseover`]),ht(`onPointerEnter`,[`pointerout`,`pointerover`]),ht(`onPointerLeave`,[`pointerout`,`pointerover`]),mt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),mt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),mt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),mt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),mt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),mt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var hd=`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(` `),gd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(hd));function _d(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Br(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Br(e)}i.currentTarget=null,a=c}}}}function vd(e,t){var n=t[tt];n===void 0&&(n=t[tt]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,ft.forEach(function(t){t!==`selectionchange`&&(gd.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!en||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=st(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Zt(function(){var r=a,i=Kt(n),s=[];a:{var c=Lr.get(e);if(c!==void 0){var l=fn,u=e;switch(e){case`keypress`:if(sn(n)===0)break a;case`keydown`:case`keyup`:l=kn;break;case`focusin`:u=`focus`,l=q;break;case`focusout`:u=`blur`,l=q;break;case`beforeblur`:case`afterblur`:l=q;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=bn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=xn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=jn;break;case Ar:case jr:case Mr:l=Sn;break;case Ir:l=Mn;break;case`scroll`:case`scrollend`:l=mn;break;case`wheel`:l=Nn;break;case`copy`:case`cut`:case`paste`:l=Cn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=An;break;case`toggle`:case`beforetoggle`:l=Pn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Qt(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Gt&&(u=n.relatedTarget||n.fromElement)&&(st(u)||u[et]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?st(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=bn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=An,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:lt(l),h=u==null?c:lt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,st(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?lt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=er;else if(Jn(c)){if(tr)v=ur;else{v=cr;var y=sr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Bt(r.elementType)&&(v=er):v=lr;if(v&&=v(e,r)){Yn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Nt(c,`number`,c.value)}switch(y=r?lt(r):window,e){case`focusin`:(Jn(y)||y.contentEditable===`true`)&&(br=y,xr=r,Sr=null);break;case`focusout`:Sr=xr=br=null;break;case`mousedown`:Cr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Cr=!1,wr(s,n,i);break;case`selectionchange`:if(yr)break;case`keydown`:case`keyup`:wr(s,n,i)}var b;if(In)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Wn?Hn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(zn&&n.locale!==`ko`&&(Wn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Wn&&(b=on()):(nn=i,rn=`value`in nn?nn.value:nn.textContent,Wn=!0)),y=Td(r,x),0<y.length&&(x=new wn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Un(n),b!==null&&(x.data=b)))),(b=Rn?Gn(e,n):Kn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new wn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),fd(s,e,r,n,i)}_d(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Qt(e,n),i!=null&&r.unshift(wd(e,i,a)),i=Qt(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Qt(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=Qt(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
|
|
10
|
-
`).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||It(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&It(e,``+r);break;case`className`:xt(e,`class`,r);break;case`tabIndex`:xt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:xt(e,n,r);break;case`style`:zt(e,r,o);break;case`data`:if(t!==`object`){xt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Ut(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Ut(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Wt);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Ut(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:vd(`beforetoggle`,e),vd(`toggle`,e),bt(e,`popover`,r);break;case`xlinkActuate`:St(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:St(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:St(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:St(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:St(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:St(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:St(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:bt(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Vt.get(n)||n,bt(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:zt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?It(e,r):(typeof r==`number`||typeof r==`bigint`)&&It(e,``+r);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Wt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!pt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[G]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):bt(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:vd(`error`,e),vd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:vd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Md(e,t,r,d,n,null)}}Mt(e,o,c,l,u,s,a,!1);return;case`select`:for(a in vd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Pt(e,!!r,n,!0):Pt(e,!!r,t,!1);return;case`textarea`:for(s in vd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Md(e,t,s,c,n,null)}Ft(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:vd(`beforetoggle`,e),vd(`toggle`,e),vd(`cancel`,e),vd(`close`,e);break;case`iframe`:case`object`:vd(`load`,e);break;case`video`:case`audio`:for(r=0;r<hd.length;r++)vd(hd[r],e);break;case`image`:vd(`error`,e),vd(`load`,e);break;case`details`:vd(`toggle`,e);break;case`embed`:case`source`:case`link`:vd(`error`,e),vd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Bt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}jt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Pt(e,!!n,n?[]:``,!1):Pt(e,!!n,t,!0)):Pt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Md(e,t,s,a,r,o)}K(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Bt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[at]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),ot(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[at])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(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===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ot(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=I.d;I.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=vu();return e||t}function yf(e){var t=ct(e);t!==null&&t.tag===5&&t.type===`form`?ys(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=At(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),dt(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+At(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+At(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+At(n.imageSizes)+`"]`)):i+=`[href="`+At(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),dt(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+At(r)+`"][href="`+At(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),dt(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=ut(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);dt(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=ut(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),dt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=ut(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),dt(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=ie.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=ut(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=ut(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=ut(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+At(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),dt(t),e.head.appendChild(t))}function Pf(e){return`[src="`+At(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+At(n.href)+`"]`);if(r)return t.instance=r,dt(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),dt(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,dt(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),dt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,dt(a),a):(r=n,(a=mf.get(o))&&(r=f({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),dt(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[at]||a[$e]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,dt(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),dt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:x,Provider:null,Consumer:null,_currentValue:L,_currentValue2:L,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=He(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=He(0),this.hiddenUpdates=He(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Qr(3,null,null,t),e.current=a,a.stateNode=e,t=Qi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ja(a),e}function tp(e){return e?(e=Xr,e):Xr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Na(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Pa(e,r,t),n!==null&&(pu(n,e,t),Fa(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=qr(e,67108864);t!==null&&pu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=du();t=Je(t);var n=qr(e,t);n!==null&&pu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=2,up(e,t,n,r)}finally{I.p=a,F.T=i}}function lp(e,t,n,r){var i=F.T;F.T=null;var a=I.p;try{I.p=8,up(e,t,n,r)}finally{I.p=a,F.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=ct(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Le(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Ae(o);s.entanglements[1]|=c,o&=~c}td(a),!(Pl&6)&&($l=ve()+500,nd(0,!1))}}break;case 31:case 13:s=qr(a,2),s!==null&&pu(s,a,2),vu(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Kt(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=st(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(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 fp=e,null}function mp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(ye()){case be:return 2;case xe:return 8;case Se:case Ce:return 32;case we:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ct(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=st(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Ze(e.priority,function(){op(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 Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Gt=r,n.target.dispatchEvent(r),Gt=null}else return t=ct(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=ct(n);a!==null&&(e.splice(t,3),t-=3,_s(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[G]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[G]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,du(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),vu(),t[et]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Xe();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.8`)throw Error(i(527,Lp,`19.2.8`));I.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{De=zp.inject(Rp),Oe=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Bs,s=Vs,c=Hs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[et]=t.current,xd(e),new Fp(t)}})),xn=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=bn()})),q=e(E(),1),Sn=q.createContext(null);function Cn(){return q.useContext(Sn)}var wn=typeof Symbol==`function`&&Symbol.for?Symbol.for(`mui.nested`):`__THEME_NESTED__`,J=p();function Tn(e,t){return typeof t==`function`?t(e):{...e,...t}}function En(e){let{children:t,theme:n}=e,r=Cn(),i=q.useMemo(()=>{let e=r===null?{...n}:Tn(r,n);return e!=null&&(e[wn]=r!==null),e},[n,r]);return(0,J.jsx)(Sn.Provider,{value:i,children:t})}function Dn(e){let t=ue(),n=Ue()||``,{modularCssLayers:r}=e,i=`mui.global, mui.components, mui.theme, mui.custom, mui.sx`;return i=!r||t!==null?``:typeof r==`string`?r.replace(/mui(?!\.)/g,i):`@layer ${i};`,Oe(()=>{let e=document.querySelector(`head`);if(!e)return;let t=e.firstChild;if(i){if(t&&t.hasAttribute?.(`data-mui-layer-order`)&&t.getAttribute(`data-mui-layer-order`)===n)return;let r=document.createElement(`style`);r.setAttribute(`data-mui-layer-order`,n),r.textContent=i,e.prepend(r)}else e.querySelector(`style[data-mui-layer-order="${n}"]`)?.remove()},[i,n]),i?(0,J.jsx)(Ct,{styles:i}):null}var On={};function kn(e,t,n,r=!1){return q.useMemo(()=>{let i=e&&t[e]||t;if(typeof n==`function`){let a=n(i),o=e?{...t,[e]:a}:a;return r?()=>o:o}return e?{...t,[e]:n}:{...t,...n}},[e,t,n,r])}function An(e){let{children:t,theme:n,themeId:r}=e,i=ue(On),a=Cn()||On,o=kn(r,i,n),s=kn(r,a,n,!0),c=(r?o[r]:o).direction===`rtl`,l=Dn(o);return(0,J.jsx)(En,{theme:s,children:(0,J.jsx)(ee.Provider,{value:o,children:(0,J.jsx)(Ce,{value:c,children:(0,J.jsxs)(Be,{value:r?o[r].components:o.components,children:[l,t]})})})})}var jn=`mode`,Mn=`color-scheme`,Nn=`data-color-scheme`;({...q}).useSyncExternalStore;function Pn(e){let{defaultMode:t=`system`,defaultLightColorScheme:n=`light`,defaultDarkColorScheme:r=`dark`,modeStorageKey:i=jn,colorSchemeStorageKey:a=Mn,attribute:o=Nn,colorSchemeNode:s=`document.documentElement`,nonce:c}=e||{},l=``,u=o;if(o===`class`&&(u=`.%s`),o===`data`&&(u=`[data-%s]`),u.startsWith(`.`)){let e=u.substring(1);l+=`${s}.classList.remove('${e}'.replace('%s', light), '${e}'.replace('%s', dark));
|
|
11
|
-
${s}.classList.add('${e}'.replace('%s', colorScheme));`}let d=u.match(/\[([^[\]]+)\]/);if(d){let[e,t]=d[1].split(`=`);t||(l+=`${s}.removeAttribute('${e}'.replace('%s', light));
|
|
12
|
-
${s}.removeAttribute('${e}'.replace('%s', dark));`),l+=`
|
|
13
|
-
${s}.setAttribute('${e}'.replace('%s', colorScheme), ${t?`${t}.replace('%s', colorScheme)`:`""`});`}else u!==`.%s`&&(l+=`${s}.setAttribute('${u}', colorScheme);`);return(0,J.jsx)(`script`,{suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(function() {
|
|
14
|
-
try {
|
|
15
|
-
let colorScheme = '';
|
|
16
|
-
const mode = localStorage.getItem('${i}') || '${t}';
|
|
17
|
-
const dark = localStorage.getItem('${a}-dark') || '${r}';
|
|
18
|
-
const light = localStorage.getItem('${a}-light') || '${n}';
|
|
19
|
-
if (mode === 'system') {
|
|
20
|
-
// handle system mode
|
|
21
|
-
const mql = window.matchMedia('(prefers-color-scheme: dark)');
|
|
22
|
-
if (mql.matches) {
|
|
23
|
-
colorScheme = dark
|
|
24
|
-
} else {
|
|
25
|
-
colorScheme = light
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (mode === 'light') {
|
|
29
|
-
colorScheme = light;
|
|
30
|
-
}
|
|
31
|
-
if (mode === 'dark') {
|
|
32
|
-
colorScheme = dark;
|
|
33
|
-
}
|
|
34
|
-
if (colorScheme) {
|
|
35
|
-
${l}
|
|
36
|
-
}
|
|
37
|
-
} catch(e){}})();`}},`mui-color-scheme-init`)}function Fn(){}var In=({key:e,storageWindow:t})=>(!t&&typeof window<`u`&&(t=window),{get(n){if(typeof window>`u`)return;if(!t)return n;let r;try{r=t.localStorage.getItem(e)}catch{}return r||n},set:n=>{if(t)try{t.localStorage.setItem(e,n)}catch{}},subscribe:n=>{if(!t)return Fn;let r=t=>{let r=t.newValue;t.key===e&&n(r)};return t.addEventListener(`storage`,r),()=>{t.removeEventListener(`storage`,r)}}});function Ln(){}function Rn(e){if(typeof window<`u`&&typeof window.matchMedia==`function`&&e===`system`)return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function zn(e,t){if(e.mode===`light`||e.mode===`system`&&e.systemMode===`light`)return t(`light`);if(e.mode===`dark`||e.mode===`system`&&e.systemMode===`dark`)return t(`dark`)}function Bn(e){return zn(e,t=>{if(t===`light`)return e.lightColorScheme;if(t===`dark`)return e.darkColorScheme})}function Vn(e){let{defaultMode:t=`light`,defaultLightColorScheme:n,defaultDarkColorScheme:r,supportedColorSchemes:i=[],modeStorageKey:a=jn,colorSchemeStorageKey:o=Mn,storageWindow:s=typeof window>`u`?void 0:window,storageManager:c=In,noSsr:l=!1}=e,u=i.join(`,`),d=i.length>1,f=q.useMemo(()=>c?.({key:a,storageWindow:s}),[c,a,s]),p=q.useMemo(()=>c?.({key:`${o}-light`,storageWindow:s}),[c,o,s]),m=q.useMemo(()=>c?.({key:`${o}-dark`,storageWindow:s}),[c,o,s]),[h,g]=q.useState(()=>{let e=f?.get(t)||t,i=p?.get(n)||n,a=m?.get(r)||r;return{mode:e,systemMode:Rn(e),lightColorScheme:i,darkColorScheme:a}}),[_,v]=q.useState(l||!d);q.useEffect(()=>{v(!0)},[]);let y=Bn(h),b=q.useCallback(e=>{g(n=>{if(e===n.mode)return n;let r=e??t;return f?.set(r),{...n,mode:r,systemMode:Rn(r)}})},[f,t]),x=q.useCallback(e=>{e?typeof e==`string`?e&&!u.includes(e)?console.error(`\`${e}\` does not exist in \`theme.colorSchemes\`.`):g(t=>{let n={...t};return zn(t,t=>{t===`light`&&(p?.set(e),n.lightColorScheme=e),t===`dark`&&(m?.set(e),n.darkColorScheme=e)}),n}):g(t=>{let i={...t},a=e.light===null?n:e.light,o=e.dark===null?r:e.dark;return a&&(u.includes(a)?(i.lightColorScheme=a,p?.set(a)):console.error(`\`${a}\` does not exist in \`theme.colorSchemes\`.`)),o&&(u.includes(o)?(i.darkColorScheme=o,m?.set(o)):console.error(`\`${o}\` does not exist in \`theme.colorSchemes\`.`)),i}):g(e=>(p?.set(n),m?.set(r),{...e,lightColorScheme:n,darkColorScheme:r}))},[u,p,m,n,r]),S=q.useCallback(e=>{h.mode===`system`&&g(t=>{let n=e?.matches?`dark`:`light`;return t.systemMode===n?t:{...t,systemMode:n}})},[h.mode]),C=q.useRef(S);return C.current=S,q.useEffect(()=>{if(typeof window.matchMedia!=`function`||!d)return;let e=(...e)=>C.current(...e),t=window.matchMedia(`(prefers-color-scheme: dark)`);return t.addListener(e),e(t),()=>{t.removeListener(e)}},[d]),q.useEffect(()=>{if(d){let e=f?.subscribe(e=>{(!e||[`light`,`dark`,`system`].includes(e))&&b(e||t)})||Ln,n=p?.subscribe(e=>{(!e||u.match(e))&&x({light:e})})||Ln,r=m?.subscribe(e=>{(!e||u.match(e))&&x({dark:e})})||Ln;return()=>{e(),n(),r()}}},[x,b,u,t,s,d,f,p,m]),{...h,mode:_?h.mode:void 0,systemMode:_?h.systemMode:void 0,colorScheme:_?y:void 0,setMode:b,setColorScheme:x}}var Hn=`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`;function Un(e){let{themeId:t,theme:n={},modeStorageKey:r=jn,colorSchemeStorageKey:i=Mn,disableTransitionOnChange:a=!1,defaultColorScheme:o,resolveTheme:s}=e,c={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},l=q.createContext(void 0),u=()=>q.useContext(l)||c,d={},f={};function p(e){let{children:c,theme:u,modeStorageKey:p=r,colorSchemeStorageKey:m=i,disableTransitionOnChange:h=a,storageManager:_,storageWindow:v=typeof window>`u`?void 0:window,documentNode:y=typeof document>`u`?void 0:document,colorSchemeNode:b=typeof document>`u`?void 0:document.documentElement,disableNestedContext:x=!1,disableStyleSheetGeneration:S=!1,defaultMode:C=`system`,forceThemeRerender:w=!1,noSsr:T}=e,E=q.useRef(!1),D=Cn(),O=q.useContext(l),k=!!O&&!x,A=q.useMemo(()=>u||(typeof n==`function`?n():n),[u]),j=A[t],M=j||A,{colorSchemes:N=d,components:P=f,cssVarPrefix:F}=M,I=Object.keys(N).filter(e=>!!N[e]).join(`,`),L=q.useMemo(()=>I.split(`,`),[I]),ee=typeof o==`string`?o:o.light,te=typeof o==`string`?o:o.dark,{mode:ne,setMode:R,systemMode:z,lightColorScheme:B,darkColorScheme:re,colorScheme:ie,setColorScheme:ae}=Vn({supportedColorSchemes:L,defaultLightColorScheme:ee,defaultDarkColorScheme:te,modeStorageKey:p,colorSchemeStorageKey:m,defaultMode:N[ee]&&N[te]?C:N[M.defaultColorScheme]?.palette?.mode||M.palette?.mode,storageManager:_,storageWindow:v,noSsr:T}),oe=ne,V=ie;k&&(oe=O.mode,V=O.colorScheme);let H=V||M.defaultColorScheme;M.vars&&!w&&(H=M.defaultColorScheme);let se=q.useMemo(()=>{let e=M.generateThemeVars?.()||M.vars,t={...M,components:P,colorSchemes:N,cssVarPrefix:F,vars:e};if(typeof t.generateSpacing==`function`&&(t.spacing=t.generateSpacing()),H){let e=N[H];e&&typeof e==`object`&&Object.keys(e).forEach(n=>{e[n]&&typeof e[n]==`object`?t[n]={...t[n],...e[n]}:t[n]=e[n]})}return s?s(t):t},[M,H,P,N,F]),ce=M.colorSchemeSelector;Oe(()=>{if(V&&b&&ce&&ce!==`media`){let e=ce,t=ce;if(e===`class`&&(t=`.%s`),e===`data`&&(t=`[data-%s]`),e?.startsWith(`data-`)&&!e.includes(`%s`)&&(t=`[${e}="%s"]`),t.startsWith(`.`))b.classList.remove(...L.map(e=>t.substring(1).replace(`%s`,e))),b.classList.add(t.substring(1).replace(`%s`,V));else{let e=t.replace(`%s`,V).match(/\[([^\]]+)\]/);if(e){let[t,n]=e[1].split(`=`);n||L.forEach(e=>{b.removeAttribute(t.replace(V,e))}),b.setAttribute(t,n?n.replace(/"|'/g,``):``)}else b.setAttribute(t,V)}}},[V,ce,b,L]),q.useEffect(()=>{let e;if(h&&E.current&&y){let t=y.createElement(`style`);t.appendChild(y.createTextNode(Hn)),y.head.appendChild(t),window.getComputedStyle(y.body),e=setTimeout(()=>{y.head.removeChild(t)},1)}return()=>{clearTimeout(e)}},[V,h,y]),q.useEffect(()=>(E.current=!0,()=>{E.current=!1}),[]);let U=q.useMemo(()=>({allColorSchemes:L,colorScheme:V,darkColorScheme:re,lightColorScheme:B,mode:oe,setColorScheme:ae,setMode:R,systemMode:z}),[L,V,re,B,oe,ae,R,z,se.colorSchemeSelector]),le=!0;(S||M.cssVariables===!1||k&&D?.cssVarPrefix===F)&&(le=!1);let ue=(0,J.jsxs)(q.Fragment,{children:[(0,J.jsx)(An,{themeId:j?t:void 0,theme:se,children:c}),le&&(0,J.jsx)(g,{styles:se.generateStyleSheets?.()||[]})]});return k?ue:(0,J.jsx)(l.Provider,{value:U,children:ue})}let m=typeof o==`string`?o:o.light,h=typeof o==`string`?o:o.dark;return{CssVarsProvider:p,useColorScheme:u,getInitColorSchemeScript:e=>Pn({colorSchemeStorageKey:i,defaultLightColorScheme:m,defaultDarkColorScheme:h,modeStorageKey:r,...e})}}var Wn=typeof pt({})==`function`,Gn=(e,t)=>({WebkitFontSmoothing:`antialiased`,MozOsxFontSmoothing:`grayscale`,boxSizing:`border-box`,WebkitTextSizeAdjust:`100%`,...t&&!e.vars&&{colorScheme:e.palette.mode}}),Kn=e=>({color:(e.vars||e).palette.text.primary,...e.typography.body1,backgroundColor:(e.vars||e).palette.background.default,"@media print":{backgroundColor:(e.vars||e).palette.common.white}}),qn=(e,t=!1)=>{let n={};t&&e.colorSchemes&&typeof e.getColorSchemeSelector==`function`&&Object.entries(e.colorSchemes).forEach(([t,r])=>{let i=e.getColorSchemeSelector(t);i.startsWith(`@`)?n[i]={":root":{colorScheme:r.palette?.mode}}:n[i.replace(/\s*&/,``)]={colorScheme:r.palette?.mode}});let r={html:Gn(e,t),"*, *::before, *::after":{boxSizing:`inherit`},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...Kn(e),"&::backdrop":{backgroundColor:(e.vars||e).palette.background.default}},...n},i=e.components?.MuiCssBaseline?.styleOverrides;return i&&(r=[r,i]),r},Jn=`mui-ecs`,Yn=e=>{let t=qn(e,!1),n=Array.isArray(t)?t[0]:t;return!e.vars&&n&&(n.html[`:root:has(${Jn})`]={colorScheme:e.palette.mode}),e.colorSchemes&&Object.entries(e.colorSchemes).forEach(([t,r])=>{let i=e.getColorSchemeSelector(t);i.startsWith(`@`)?n[i]={[`:root:not(:has(.${Jn}))`]:{colorScheme:r.palette?.mode}}:n[i.replace(/\s*&/,``)]={[`&:not(:has(.${Jn}))`]:{colorScheme:r.palette?.mode}}}),t},Xn=pt(Wn?({theme:e,enableColorScheme:t})=>qn(e,t):({theme:e})=>Yn(e));function Zn(e){let{children:t,enableColorScheme:n=!1}=it({props:e,name:`MuiCssBaseline`});return(0,J.jsxs)(q.Fragment,{children:[Wn&&(0,J.jsx)(Xn,{enableColorScheme:n}),!Wn&&!n&&(0,J.jsx)(`span`,{className:Jn,style:{display:`none`}}),t]})}function Qn(e){return String(e).match(/[\d.\-+]*\s*(.*)/)[1]||``}function $n(e){return parseFloat(e)}function er({theme:e,...t}){let n=`$$material`in e?e[_t]:void 0;return(0,J.jsx)(An,{...t,themeId:n?_t:void 0,theme:n||e})}var tr={attribute:`data-mui-color-scheme`,colorSchemeStorageKey:`mui-color-scheme`,defaultLightColorScheme:`light`,defaultDarkColorScheme:`dark`,modeStorageKey:`mui-mode`},{CssVarsProvider:nr,useColorScheme:rr,getInitColorSchemeScript:ir}=Un({themeId:_t,theme:()=>Me({cssVariables:!0}),colorSchemeStorageKey:tr.colorSchemeStorageKey,modeStorageKey:tr.modeStorageKey,defaultColorScheme:{light:tr.defaultLightColorScheme,dark:tr.defaultDarkColorScheme},resolveTheme:e=>{let t={...e,typography:st(e.palette,e.typography)};return t.unstable_sx=function(e){return R({sx:e,theme:this})},t}}),ar=nr;function or({theme:e,...t}){let n=q.useMemo(()=>{if(typeof e==`function`)return e;let t=`$$material`in e?e[_t]:e;return`colorSchemes`in t?null:`vars`in t?e:{...e,vars:null}},[e]);return n?(0,J.jsx)(er,{theme:n,...t}):(0,J.jsx)(ar,{theme:e,...t})}var sr=xn();function cr({value:e,onChange:t}){let{locale:n}=Pt();return(0,J.jsxs)(ge,{value:e,onChange:(e,n)=>t(n),variant:`fullWidth`,"aria-label":K(n,`Thanh bên`,`Sidebar`),children:[(0,J.jsx)(k,{value:`sessions`,label:K(n,`Phiên`,`Sessions`)}),(0,J.jsx)(k,{value:`files`,label:K(n,`Tệp`,`Files`)}),(0,J.jsx)(k,{value:`search`,label:K(n,`Tìm kiếm`,`Search`)})]})}function lr({size:e=28}){return(0,J.jsxs)(W,{component:`svg`,viewBox:`0 0 64 64`,"aria-hidden":`true`,className:`brand-logo`,sx:{width:e,height:e,flexShrink:0,display:`block`,borderRadius:`${Math.round(e*.24)}px`},children:[(0,J.jsx)(`rect`,{width:`64`,height:`64`,rx:`15`,fill:`#141612`}),(0,J.jsx)(`rect`,{x:`.75`,y:`.75`,width:`62.5`,height:`62.5`,rx:`14.25`,fill:`none`,stroke:`#ffffff`,strokeOpacity:`.12`,strokeWidth:`1.5`}),(0,J.jsx)(`path`,{d:`M13 21.5h27M21 22v22M32.5 22v17.5c0 3 1.6 4.5 4.5 4.5`,fill:`none`,stroke:`#f2f2ed`,strokeWidth:`5.5`,strokeLinecap:`round`}),(0,J.jsx)(`rect`,{x:`44`,y:`19.5`,width:`6.5`,height:`25`,rx:`1.8`,fill:`#c6f432`})]})}var ur=`piagent-workspace-open`;function dr(e,t=1){let n=/^(.+?)(?::(\d+)(?::\d+)?)?$/.exec(e.replace(/^@/,``)),r=n?.[1];return!r||r.length>4096||/^[~/]/.test(r)||/[\\\x00-\x1f\x7f:]/.test(r)||r.split(`/`).some(e=>!e||e===`.`||e===`..`)?null:{path:r,line:Math.max(1,Math.min(1e6,Number(n?.[2])||t||1))}}var fr=(0,q.createContext)(null);function pr({sessionRef:e,onOpen:t,children:n}){return(0,J.jsx)(fr.Provider,{value:e?n=>{t(),window.dispatchEvent(new CustomEvent(ur,{detail:{sessionRef:e,...n}}))}:null,children:n})}function mr({path:e,line:t,children:n}){let r=(0,q.useContext)(fr),{locale:i}=Pt(),a=dr(e,t);return!r||!a?n?(0,J.jsx)(J.Fragment,{children:n}):null:(0,J.jsx)(c,{size:`small`,onClick:()=>r(a),sx:{textTransform:`none`,verticalAlign:`baseline`},children:n??K(i,`Mở trong editor`,`Open in editor`)})}function hr({children:e}){return(0,J.jsx)(J.Fragment,{children:q.Children.map(e,e=>typeof e==`string`?e.split(/((?<![\w@])@[\w./-]+\.[\w]+(?::\d+)?)/g).map((e,t)=>e.startsWith(`@`)&&dr(e)?(0,J.jsx)(mr,{path:e,children:e},t):e):e)})}var gr=`modulepreload`,_r=function(e){return`/`+e},vr={},yr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=_r(t,n),t=s(t),t in vr)return;vr[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:gr,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},br=(0,q.lazy)(()=>yr(()=>import(`./WorkspaceQuickOpen-CGoGfUPk.js`),__vite__mapDeps([0,1,2,3,4,5]))),xr=(0,q.lazy)(()=>yr(()=>import(`./TerminalPanel-C--BiN0p.js`),__vite__mapDeps([6,1,2,3,7]))),Sr=(0,q.lazy)(()=>yr(()=>import(`./WorkspaceExplorer-BOafuPU-.js`),__vite__mapDeps([8,1,2,3,5,9,10,7,4]))),Cr=52,wr=36,Tr=25,Er=75,Dr=`piagent-webui-editor-width`;function Or(){try{let e=Number(window.localStorage.getItem(Dr));return e>=Tr&&e<=Er?e:55}catch{return 55}}var kr=e=>({color:e?`text.primary`:`text.secondary`,bgcolor:e?`action.selected`:`transparent`,"& .MuiButton-startIcon svg":{fontSize:16,color:e?`primary.main`:`inherit`}});function Ar({title:e,close:t,onClose:n}){return(0,J.jsxs)(W,{sx:{display:`flex`,alignItems:`center`,gap:1,px:2,minHeight:48,borderBottom:1,borderColor:`divider`},children:[(0,J.jsx)(H,{sx:{fontWeight:600,flex:1},children:e}),(0,J.jsx)(Mt,{size:`small`,"aria-label":t,onClick:n,children:(0,J.jsx)(N,{fontSize:`small`})})]})}function jr({sessionRef:e,children:t,navigationHost:n,sidebarMode:r,onSection:i}){let{locale:a}=Pt(),o=Qe(),s=Ye(o.breakpoints.up(`lg`)),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(),_=(0,q.useRef)(null),[v,y]=(0,q.useState)(Or),x=e=>{let t=Math.min(Er,Math.max(Tr,e));y(t);try{window.localStorage.setItem(Dr,String(Math.round(t)))}catch{}},S=e=>{let t=_.current?.getBoundingClientRect();if(!t)return;e.preventDefault(),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e=>x((e.clientX-t.left)/t.width*100),r=()=>{window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,r),document.body.style.cursor=``,document.body.style.userSelect=``};window.addEventListener(`pointermove`,n),window.addEventListener(`pointerup`,r)};(0,q.useEffect)(()=>{let t=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`p`&&(e.preventDefault(),f(!0))},n=t=>{let n=t.detail;n?.sessionRef===e&&(g({path:n.path,line:n.line}),u(!0),i(`files`))};return window.addEventListener(`keydown`,t),window.addEventListener(ur,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(ur,n)}},[e]),(0,q.useEffect)(()=>{r!==`sessions`&&u(!0)},[r]);let C=(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(me,{size:24}),children:(0,J.jsx)(Sr,{sessionRef:e,target:h,navigationHost:s?n:null,sidebarMode:r,onHide:()=>{u(!1),i(`sessions`)},fill:s})}),w=(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(me,{size:24}),children:(0,J.jsx)(xr,{sessionRef:e,onHide:()=>m(!1)})});return(0,J.jsxs)(J.Fragment,{children:[d&&(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(me,{size:20}),children:(0,J.jsx)(br,{sessionRef:e,onClose:()=>f(!1),onOpen:e=>{f(!1),u(!0),i(`files`),g({path:e})}})}),(0,J.jsxs)(W,{sx:{position:`sticky`,top:Cr,zIndex:2,height:wr,display:`flex`,alignItems:`center`,gap:.5,px:1,bgcolor:`background.default`,borderBottom:1,borderColor:`divider`},children:[(0,J.jsx)(c,{size:`small`,color:`inherit`,startIcon:(0,J.jsx)(D,{}),"aria-expanded":l,onClick:()=>{u(e=>!e),i(l?`sessions`:`files`)},sx:kr(l),children:K(a,`Tệp`,`Files`)}),(0,J.jsx)(c,{size:`small`,color:`inherit`,startIcon:(0,J.jsx)(b,{}),"aria-expanded":p,onClick:()=>m(e=>!e),sx:kr(p),children:`Terminal`}),(0,J.jsx)(W,{sx:{flex:1}}),s&&(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,sx:{pr:.5,display:{xs:`none`,xl:`block`}},children:K(a,`⌘P mở file`,`⌘P to open a file`)})]}),(0,J.jsxs)(W,{ref:_,sx:{display:`flex`,minWidth:0},children:[s&&(l||p)&&(0,J.jsxs)(W,{component:`section`,"aria-label":K(a,`Editor và terminal`,`Editor and terminal`),sx:{position:`sticky`,top:88,alignSelf:`flex-start`,flexShrink:0,minWidth:0,width:`clamp(320px, ${v}%, calc(100% - 360px))`,height:`calc(100vh - 88px - var(--piagent-status-bar, 0px))`,display:`flex`,flexDirection:`column`,bgcolor:`background.default`,zIndex:1},children:[l&&(0,J.jsx)(W,{sx:{flex:1,minHeight:0,overflow:`hidden`},children:C}),p&&(0,J.jsx)(W,{sx:{flexShrink:0,maxHeight:l?`60%`:`100%`,overflow:`auto`,...l?{}:{flex:1}},children:w}),(0,J.jsx)(W,{role:`separator`,"aria-orientation":`vertical`,"aria-label":K(a,`Kéo để đổi độ rộng editor`,`Drag to resize the editor`),"aria-valuenow":Math.round(v),"aria-valuemin":Tr,"aria-valuemax":Er,tabIndex:0,onPointerDown:S,onKeyDown:e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),x(v+(e.key===`ArrowLeft`?-2:2)))},sx:{position:`absolute`,top:0,right:-3,bottom:0,width:6,cursor:`col-resize`,zIndex:2,borderRight:1,borderColor:`divider`,"&:hover, &:focus-visible":{borderColor:`primary.main`,outline:`none`}}})]}),(0,J.jsx)(W,{sx:{flex:1,minWidth:0},children:t})]}),!s&&(0,J.jsxs)(I,{anchor:`bottom`,open:p,onClose:()=>m(!1),children:[(0,J.jsx)(Ar,{title:`Terminal`,close:K(a,`Ẩn terminal`,`Hide terminal`),onClose:()=>m(!1)}),p&&w]}),!s&&(0,J.jsxs)(I,{anchor:`left`,open:l,onClose:()=>u(!1),slotProps:{paper:{sx:{width:`min(96vw, 800px)`}}},children:[(0,J.jsx)(Ar,{title:K(a,`Tệp`,`Files`),close:K(a,`Đóng`,`Close`),onClose:()=>u(!1)}),l&&C]})]})}var Mr=e=>e.name??e.repo;function Nr(e,t,n){let r=n===`vi`,i=t?` ${t}`:``,a=r?` Admin Studio đã được báo.`:` Studio administrators were told.`,o=t=>e.filter(e=>e.kind===t).map(Mr).join(`, `),s=[],c=o(`other_team`),l=o(`unlisted`),u=o(`unregistered`),d=o(`no_repository`);return c&&s.push(r?`${c} thuộc team khác, không phải team${i} của key này.`:`${c} belongs to another team, not this key's team${i}.`),l&&s.push(r?`${l} chưa có trong danh sách project của team${i}.`:`${l} is not in the project list of team${i}.`),u&&s.push(r?`${u} chưa được đăng ký cho team${i}.`:`${u} is not registered to team${i}.`),d&&s.push(r?`Không xác định được project của thư mục ${d}.`:`The project of folder ${d} could not be identified.`),s.join(` `)+a}function Pr({session:e,locale:t}){let n=e.managedProjectWarning;return n?(0,J.jsx)(o,{severity:`warning`,role:`status`,sx:{maxWidth:820,mx:`auto`,mb:1,py:0},children:Nr(n.warnings,n.team,t)}):null}var Fr=j((0,J.jsx)(`path`,{d:`M16.5 6.75v10.58c0 2.09-1.53 3.95-3.61 4.15-2.39.23-4.39-1.64-4.39-3.98V5.14c0-1.31.94-2.5 2.24-2.63 1.5-.15 2.76 1.02 2.76 2.49v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6.75c0-.41-.34-.75-.75-.75s-.75.34-.75.75v8.61c0 1.31.94 2.5 2.24 2.63 1.5.15 2.76-1.02 2.76-2.49V5.17c0-2.09-1.53-3.95-3.61-4.15C9.01.79 7 2.66 7 5v12.27c0 2.87 2.1 5.44 4.96 5.71 3.29.3 6.04-2.26 6.04-5.48V6.75c0-.41-.34-.75-.75-.75s-.75.34-.75.75`}),`AttachFileRounded`),Ir=j((0,J.jsx)(`path`,{d:`M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0a.996.996 0 0 1 0-1.41L10.59 12 7.7 9.11a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0s.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41`}),`CancelRounded`),Lr=j((0,J.jsx)(`path`,{d:`M13 19V7.83l4.88 4.88c.39.39 1.03.39 1.42 0s.39-1.02 0-1.41l-6.59-6.59a.996.996 0 0 0-1.41 0l-6.6 6.58c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0L11 7.83V19c0 .55.45 1 1 1s1-.45 1-1`}),`ArrowUpwardRounded`),Rr=j((0,J.jsx)(`path`,{d:`M2 4v16h20V4zm18 4.67h-2.5V6H20zm-2.5 2H20v2.67h-2.5zM4 6h11.5v12H4zm13.5 12v-2.67H20V18z`}),`ViewSidebarOutlined`),zr=j((0,J.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m3 14H9c-.55 0-1-.45-1-1V9c0-.55.45-1 1-1h6c.55 0 1 .45 1 1v6c0 .55-.45 1-1 1`}),`StopCircleRounded`);function Br(e){return ce(`MuiCollapse`,e)}Et(`MuiCollapse`,[`root`,`horizontal`,`vertical`,`entered`,`hidden`,`wrapper`,`wrapperInner`]);var Vr={},Hr=e=>{let{orientation:t,classes:n}=e;return et({root:[`root`,t],entered:[`entered`],hidden:[`hidden`],wrapper:[`wrapper`,t],wrapperInner:[`wrapperInner`,t]},Br,n)},Ur=Ae(`div`,{name:`MuiCollapse`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.orientation],n.state===`entered`&&t.entered,n.state===`exited`&&!n.in&&n.collapsedSize===`0px`&&t.hidden]}})(Te(({theme:e})=>({height:0,overflow:`hidden`,transition:e.transitions.create(`height`),variants:[{props:{orientation:`horizontal`},style:{height:`auto`,width:0,transition:e.transitions.create(`width`)}},{props:{state:`entered`},style:{height:`auto`,overflow:`visible`}},{props:{state:`entered`,orientation:`horizontal`},style:{width:`auto`}},{props:({ownerState:e})=>e.state===`exited`&&!e.in&&e.collapsedSize===`0px`,style:{visibility:`hidden`}}]}))),Wr=Ae(`div`,{name:`MuiCollapse`,slot:`Wrapper`})({display:`flex`,width:`100%`,variants:[{props:{orientation:`horizontal`},style:{width:`auto`,height:`100%`}}]}),Gr=Ae(`div`,{name:`MuiCollapse`,slot:`WrapperInner`})({width:`100%`,variants:[{props:{orientation:`horizontal`},style:{width:`auto`,height:`100%`}}]}),Kr=q.forwardRef(function(e,t){let n=it({props:e,name:`MuiCollapse`}),{addEndListener:r,children:i,className:a,collapsedSize:o=`0px`,component:s,disablePrefersReducedMotion:c=!1,easing:l,in:d,onEnter:f,onEntered:p,onEntering:m,onExit:h,onExited:g,onExiting:_,orientation:v=`vertical`,slots:y=Vr,slotProps:b=Vr,style:x,timeout:C=Le.standard,TransitionComponent:w=ie,...T}=n,E={...n,orientation:v,collapsedSize:o},D=Hr(E),O=Qe(),k=q.useRef(null),A=q.useRef(null),j=typeof o==`number`?`${o}px`:o,M=v===`horizontal`,N=M?`width`:`height`,P=ve(O.motion.reducedMotion,c),F=q.useRef(null),I=dt(t,F),L=()=>k.current?k.current[M?`clientWidth`:`clientHeight`]:0,ee=nt(F,(e,t)=>{k.current&&M&&(k.current.style.position=`absolute`),e.style[N]=j,f&&f(e,t)}),te=nt(F,(e,t)=>{let n=L();k.current&&M&&(k.current.style.position=``);let{duration:r,easing:i}=Pe({style:x,timeout:C,easing:l},{mode:`enter`});if(C===`auto`&&!P.shouldReduceMotion){let e=O.transitions.getAutoHeightDuration(n);A.current=e}else A.current=null;let a=P.getTransitionTiming({duration:A.current??r,delay:void 0});e.style.transitionDuration=typeof a.duration==`string`?a.duration:`${a.duration}ms`,e.style[N]=`${n}px`,e.style.transitionTimingFunction=i,m&&m(e,t)}),ne=nt(F,(e,t)=>{e.style[N]=`auto`,p&&p(e,t)}),R=nt(F,e=>{e.style[N]=`${L()}px`,h&&h(e)}),z=nt(F,g),B=nt(F,e=>{let t=L(),{duration:n,easing:r}=Pe({style:x,timeout:C,easing:l},{mode:`exit`});if(C===`auto`&&!P.shouldReduceMotion){let e=O.transitions.getAutoHeightDuration(t);A.current=e}else A.current=null;let i=P.getTransitionTiming({duration:A.current??n,delay:void 0});e.style.transitionDuration=typeof i.duration==`string`?i.duration:`${i.duration}ms`,e.style[N]=j,e.style.transitionTimingFunction=r,_&&_(e)}),re=r?e=>{r(F.current,e)}:void 0,ae={slots:y,slotProps:b,component:s},[oe,V]=S(`root`,{ref:I,className:u(D.root,a),elementType:Ur,externalForwardedProps:ae,ownerState:E,additionalProps:{style:{[M?`minWidth`:`minHeight`]:j,...x}}}),[H,se]=S(`wrapper`,{ref:k,className:D.wrapper,elementType:Wr,externalForwardedProps:ae,ownerState:E}),[ce,U]=S(`wrapperInner`,{className:D.wrapperInner,elementType:Gr,externalForwardedProps:ae,ownerState:E});return(0,J.jsx)(w,{in:d,onEnter:ee,onEntered:ne,onEntering:te,onExit:R,onExited:z,onExiting:B,addEndListener:re,getAutoTimeout:C===`auto`?()=>A.current:void 0,reduceMotion:P.shouldReduceMotion,nodeRef:F,timeout:C===`auto`?null:C,...T,children:(e,{ownerState:t,...n})=>{let r={...E,state:e};return(0,J.jsx)(oe,{...V,className:u(V.className,{entered:D.entered,exited:!d&&j===`0px`&&D.hidden}[e]),ownerState:r,...n,children:(0,J.jsx)(H,{...se,ownerState:r,children:(0,J.jsx)(ce,{...U,ownerState:r,children:i})})})}})});Kr&&(Kr.muiSupportAuto=!0);function qr(e){return Array.isArray(e)?`[${e.map(qr).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${qr(t)}`).join(`,`)}}`:JSON.stringify(e)}async function Jr(e){let t=new TextEncoder().encode(typeof e==`string`?e:qr(e)),n=await crypto.subtle.digest(`SHA-256`,t);return`sha256:${[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function Yr(e,t,n,r){let i=new Date,a=new Date(i.getTime()+3e5),o=r?.attachmentRefs??[],s={messageRequestId:r?.messageRequestId??`message-request.${crypto.randomUUID()}`,capabilityAction:n===`steer`?`interruptAndSend`:n===`hold`?`hold`:`send`,delivery:n,text:t,attachmentRefs:o,contentDigest:await Jr({attachmentRefs:o,text:t})},c={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},l={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:i.toISOString(),expiresAt:a.toISOString(),capabilityScope:`control.chat`,action:`chat.send`,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:c,payload:s};return l.actionDigest=await Jr({action:l.action,identity:l.identity,expectedRevisions:c,payload:s}),l}async function Xr(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5);return{schemaVersion:1,version:`piagent-webui-attachment-v1`,messageType:`stage-command`,commandId:`attachment-command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),identity:{...structuredClone(e.identity),toolCallId:null},expectedRuntimeRevision:e.revision.runtimeRevision,messageRequestId:t,file:n}}function Zr(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5);return{schemaVersion:1,version:`piagent-webui-attachment-v1`,messageType:`discard-command`,commandId:`attachment-command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),identity:{...structuredClone(e.identity),toolCallId:null},expectedRuntimeRevision:e.revision.runtimeRevision,messageRequestId:t,attachmentRef:n}}async function Qr(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5),a={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},o={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),capabilityScope:`control.chat`,action:t,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:a,payload:n};return o.actionDigest=await Jr({action:t,identity:o.identity,expectedRevisions:a,payload:n}),o}async function $r(e,t){let n=[];return{queueItemRef:e,text:t,attachmentRefs:n,contentDigest:await Jr({attachmentRefs:n,text:t})}}async function ei(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5),a={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},o=t===`session-options.set-model`?{modelRef:n,effectScopeAcknowledged:`session-and-user-default`}:{thinkingLevel:n,effectScopeAcknowledged:`session-and-user-default`},s={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),capabilityScope:`control.sessionOptions`,action:t,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:a,payload:o};return s.actionDigest=await Jr({action:t,identity:s.identity,expectedRevisions:a,payload:o}),s}async function ti(e,t){let n=new Date,r=new Date(n.getTime()+3e5),i={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},a=t===`lifecycle.stop`?{requestedScope:`current-agent-operation`}:t===`lifecycle.pause`?{safePointPolicy:`after-current-atomic-unit`}:{},o={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:n.toISOString(),expiresAt:r.toISOString(),capabilityScope:`control.lifecycle`,action:t,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:i,payload:a};return o.actionDigest=await Jr({action:t,identity:o.identity,expectedRevisions:i,payload:a}),o}async function ni(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5),a=n?.attachmentRefs??[],o={messageRequestId:n?.messageRequestId??`message-request.${crypto.randomUUID()}`,capabilityAction:`send`,delivery:`new-operation`,text:t,attachmentRefs:a,contentDigest:await Jr({attachmentRefs:a,text:t})},s={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},c={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),capabilityScope:`control.resumeAndContinue`,action:`lifecycle.resume-and-continue`,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:s,payload:o};return c.actionDigest=await Jr({action:c.action,identity:c.identity,expectedRevisions:s,payload:o}),c}var ri={active:`Đang hoạt động`,"pause-requested":`Đang yêu cầu tạm dừng`,paused:`Đã tạm dừng`,terminal:`Đã kết thúc`,idle:`Đang chờ`,running:`Đang chạy`,stopping:`Đang dừng`,settled:`Đã ổn định`,unknown:`Chưa xác định`,pending:`Chưa xong`,completed:`Hoàn thành`,blocked:`Bị chặn`,partial:`Một phần`,failed:`Thất bại`,satisfied:`Đã đạt`,unavailable:`Không có dữ liệu`,connected:`Đã kết nối`,disconnected:`Mất kết nối`,reconnecting:`Đang kết nối lại`,"resync-required":`Cần đồng bộ lại`,none:`Không có`,waiting:`Đang chờ duyệt`,current:`Mới nhất`,stale:`Đã cũ`,"not-run":`Chưa chạy`,"in-progress":`Đang làm`,done:`Đã xong`,skipped:`Bỏ qua`,resume:`Tiếp tục`,retry:`Thử lại`,observed:`Đã ghi nhận`,requested:`Đã yêu cầu`,"possible-interruption":`Có thể bị gián đoạn`,complete:`Đầy đủ`,"aggregate-only":`Chỉ có dữ liệu tổng hợp`,off:`Tắt`,minimal:`Tối thiểu`,low:`Thấp`,medium:`Trung bình`,high:`Cao`,xhigh:`Rất cao`,max:`Tối đa`,orphaned:`Mất owner`,cancelled:`Đã hủy`,succeeded:`Thành công`,"stale-result":`Kết quả đến muộn`,accepted:`Đã nhận`,rejected:`Không nhận`,"not-recorded":`Chưa có kết quả`,parent:`Task cha`,helper:`Helper`,"read-only":`Chỉ đọc`,"workspace-write":`Ghi trong project`,"trusted-full-access":`Toàn quyền`,bypass:`Bypass`,"single-writer":`Một writer`,retriever:`Retriever`,scout:`Scout`,planner:`Planner`,worker:`Worker`,reviewer:`Reviewer`,oracle:`Oracle`,researcher:`Researcher`,ready:`Sẵn sàng`,missing:`Chưa có bằng chứng`,interrupted:`Bị gián đoạn`,stopped:`Đã dừng`,aborted:`Đã hủy do lỗi`,incomplete:`Chưa có kết luận`,passed:`Đạt`,"not-applicable":`Không áp dụng`,smoke:`Smoke`,"public-regression":`Public regression`,capability:`Capability`,"private-holdout":`Private holdout`,"production-shadow":`Production shadow`,"pdf-converter-unavailable":`Host chưa cài pdftotext (poppler) nên chưa đọc được .pdf`,"pdf-text-unavailable":`PDF này không có text bóc được; nhiều khả năng là bản scan, cần OCR trước`,"pdf-extraction-failed":`Không chuyển được PDF này sang text`,"docx-unreadable":`File .docx này hỏng, bị mã hóa, hoặc không phải file Word thật`,"document-text-empty":`Tài liệu không có chữ nào để đọc`,"document-size-limit":`Tài liệu vượt giới hạn dung lượng`,"text-size-limit":`File text vượt giới hạn dung lượng`,"text-content-invalid":`Nội dung file không phải văn bản (file nhị phân), chưa gửi vào chat được`,"image-mime-mismatch":`Nội dung ảnh không khớp với đuôi file`,"model-image-input-unavailable":`Model hiện tại không nhận ảnh`,"attachment-capacity-limit":`Đã chạm giới hạn số file hoặc dung lượng đính kèm`,"no-readable-root":`Chưa có thư mục nào đọc được`,"document-roots-unavailable":`Không xác định được thư mục tài liệu`,"document-not-listed":`Tài liệu không còn trong danh sách; hãy tải lại`,"document-unavailable":`Không mở được tài liệu này`,"document-protected":`Tài liệu nằm trong protectedPaths nên không được đọc`,"document-changed":`File đã thay đổi sau khi liệt kê; chưa đọc gì cả`,"document-unreadable":`Không đọc được nội dung tài liệu`,"document-needs-ocr":`Tài liệu là bản scan, cần OCR trước khi đọc được chữ`,"document-converter-unavailable":`Host chưa cài pdftotext (poppler) nên chưa đọc được .pdf`,"session-command-effect-unknown":`Pi đã nhận yêu cầu nhưng đang đồng bộ trạng thái; không gửi lại để tránh chạy trùng`},ii={active:`Active`,"pause-requested":`Pause requested`,paused:`Paused`,terminal:`Finished`,idle:`Idle`,running:`Running`,stopping:`Stopping`,settled:`Settled`,unknown:`Unknown`,pending:`Pending`,completed:`Completed`,blocked:`Blocked`,partial:`Partial`,failed:`Failed`,satisfied:`Satisfied`,unavailable:`Unavailable`,connected:`Connected`,disconnected:`Disconnected`,reconnecting:`Reconnecting`,"resync-required":`Resync required`,none:`None`,waiting:`Awaiting approval`,current:`Current`,stale:`Stale`,"not-run":`Not run`,"in-progress":`In progress`,done:`Done`,skipped:`Skipped`,resume:`Resume`,retry:`Retry`,observed:`Observed`,requested:`Requested`,"possible-interruption":`Possible interruption`,complete:`Complete`,"aggregate-only":`Aggregate only`,off:`Off`,minimal:`Minimal`,low:`Low`,medium:`Medium`,high:`High`,xhigh:`Extra high`,max:`Maximum`,orphaned:`Owner missing`,cancelled:`Cancelled`,succeeded:`Succeeded`,"stale-result":`Stale result`,accepted:`Accepted`,rejected:`Rejected`,"not-recorded":`Not recorded`,parent:`Parent task`,helper:`Helper`,"read-only":`Read only`,"workspace-write":`Workspace write`,"trusted-full-access":`Full access`,bypass:`Bypass`,"single-writer":`Single writer`,retriever:`Retriever`,scout:`Scout`,planner:`Planner`,worker:`Worker`,reviewer:`Reviewer`,oracle:`Oracle`,researcher:`Researcher`,ready:`Ready`,missing:`Evidence missing`,interrupted:`Interrupted`,stopped:`Stopped`,aborted:`Aborted`,incomplete:`Incomplete`,passed:`Passed`,"not-applicable":`Not applicable`,smoke:`Smoke`,"public-regression":`Public regression`,capability:`Capability`,"private-holdout":`Private holdout`,"production-shadow":`Production shadow`,"pdf-converter-unavailable":`This host has no pdftotext (poppler), so .pdf cannot be read`,"pdf-text-unavailable":`This PDF holds no extractable text; it is probably scanned and needs OCR first`,"pdf-extraction-failed":`The PDF could not be converted to text`,"docx-unreadable":`This .docx is corrupt, encrypted, or not really a Word document`,"document-text-empty":`The document contains no readable text`,"document-size-limit":`The document is over the size limit`,"text-size-limit":`The text file is over the size limit`,"text-content-invalid":`The file is not text (binary), so it cannot go into the chat`,"image-mime-mismatch":`The image content does not match its file extension`,"model-image-input-unavailable":`The current model does not accept images`,"attachment-capacity-limit":`The attachment count or size limit was reached`,"no-readable-root":`No readable directory is available`,"document-roots-unavailable":`The document directories could not be resolved`,"document-not-listed":`The document is no longer listed; reload the list`,"document-unavailable":`This document could not be opened`,"document-protected":`The document is under protectedPaths and is not readable`,"document-changed":`The file changed after it was listed; nothing was read`,"document-unreadable":`The document content could not be read`,"document-needs-ocr":`The document is scanned and needs OCR before it holds text`,"document-converter-unavailable":`This host has no pdftotext (poppler), so .pdf cannot be read`,"session-command-effect-unknown":`Pi received the request and is resyncing; do not resend it, to avoid a duplicate run`};function ai(e,t=`vi`){return e?(t===`vi`?ri:ii)[e]??e.replaceAll(`-`,` `):t===`vi`?`Chưa có`:`Not available`}function oi(e){return[`completed`,`satisfied`,`current`,`connected`,`done`,`passed`].includes(e??``)?`positive`:[`blocked`,`failed`,`error`,`expired`].includes(e??``)?`danger`:[`pause-requested`,`paused`,`waiting`,`stale`,`stale-result`,`orphaned`,`partial`,`reconnecting`].includes(e??``)?`warning`:[`running`,`active`,`in-progress`].includes(e??``)?`info`:`neutral`}function si(e){return e?e.length>22?`${e.slice(0,10)}…${e.slice(-7)}`:e:`—`}function ci(e,t=`vi`){return e.session.model.state===`known`&&e.session.model.value?e.session.model.value.displayName:t===`vi`?`Model chưa xác định`:`Unknown model`}function li(e,t=`vi`){return e.session.thinking.state===`known`&&e.session.thinking.value?ai(e.session.thinking.value,t):t===`vi`?`Chưa xác định`:`Unknown`}function ui(e,t=`vi`){let n=e.session.permissionProfile;return n.state===`known`&&n.value?ai(n.value,t):t===`vi`?`Quyền chưa xác định`:`Unknown permission`}function di(e,t=`vi`){let n=e.relatedFileRefs.length,r=e.verifierAttemptRefs.length;return!n&&!r?t===`vi`?`Chưa có bằng chứng liên kết`:`No linked evidence`:t===`vi`?`${n} file · ${r} lần kiểm tra`:`${n} files · ${r} verifier runs`}function fi(e,t=`vi`){let n=e.task;return n?{completed:n.progress.completed,total:n.progress.total,percent:Math.max(0,Math.min(100,n.progress.percent)),text:t===`vi`?`${n.progress.completed}/${n.progress.total} tiêu chí`:`${n.progress.completed}/${n.progress.total} criteria`}:{completed:0,total:0,percent:0,text:t===`vi`?`Chưa có task đang chạy`:`No active task`}}function pi(e,t,n){return e===`vi`?t:n}var mi={txt:`text/plain`,text:`text/plain`,md:`text/markdown`,markdown:`text/markdown`,csv:`text/csv`,tsv:`text/tab-separated-values`,json:`application/json`,yaml:`application/yaml`,yml:`application/yaml`,pdf:`application/pdf`,docx:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`},hi={xls:`sheet`,xlsx:`sheet`,xlsm:`sheet`,numbers:`sheet`,ods:`sheet`,ppt:`slides`,pptx:`slides`,key:`slides`,odp:`slides`,doc:`word`,pages:`word`,odt:`word`,rtf:`word`,...Object.fromEntries(`zip.gz.tgz.bz2.xz.rar.7z.tar.jar.war.exe.dmg.pkg.msi.deb.rpm.apk.ipa.bin.so.dylib.dll.o.a.lib.class.pyc.wasm.node.iso.img.sqlite.sqlite3.db.mdb.mp3.mp4.m4a.m4v.mov.avi.mkv.wav.flac.ogg.webm.aac.woff.woff2.ttf.otf.eot.ico.icns.heic.heif.tif.tiff.psd.ai.sketch.fig.xd.avif.raw.cr2.nef.dng.blend.fbx.glb`.split(`.`).map(e=>[e,`binary`]))};function gi(e){let t=e.lastIndexOf(`.`),n=t>0||t===0&&e.length>1?e.slice(t+1).toLowerCase():``,r=mi[n];if(r)return{mime:r};let i=hi[n];return i?{refused:i}:{mime:`text/plain`}}var _i=new Set([`application/pdf`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`]);function vi(e){return e>=1048576?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024).toFixed(+(e<10240))} KiB`}function yi(e,t){let n=e.truncated?` · ${pi(t,`đã cắt bớt`,`truncated`)}`:``;return e.kind===`image`?`${pi(t,`Ảnh`,`Image`)} · ${vi(e.sizeBytes)}`:e.kind===`document`?`${pi(t,`Tài liệu`,`Document`)} · ${vi(e.sourceBytes)} → ${vi(e.sizeBytes)} ${pi(t,`văn bản`,`text`)}${n}`:`File · ${vi(e.sizeBytes)}${n}`}function bi(e){return e.has(`text/plain`)?``:[...e,...Object.entries(mi).filter(([,t])=>e.has(t)).map(([e])=>`.${e}`)].join(`,`)}function xi(e){return!!(e&&[...e.types].includes(`Files`))}function Si(e,t){switch(e){case`sheet`:return pi(t,`bảng tính chưa đọc trực tiếp được; hãy xuất sang .csv rồi đính kèm.`,`spreadsheets cannot be read directly; export to .csv and attach that.`);case`slides`:return pi(t,`file trình chiếu chưa đọc trực tiếp được; hãy xuất sang .pdf rồi đính kèm.`,`slide decks cannot be read directly; export to .pdf and attach that.`);case`word`:return pi(t,`định dạng này chưa đọc được; hãy lưu sang .docx, .pdf hoặc .txt.`,`this format cannot be read; save it as .docx, .pdf or .txt.`);default:return pi(t,`file nhị phân không gửi vào chat được; hãy để file trong project để agent tự đọc bằng tool.`,`binary files cannot go into the chat; keep it in the project and the agent can use its tools on it.`)}}async function Ci(e){let{snapshot:t,locale:n}=e,r=[...e.existing],i=null,a=Math.max(0,4-r.length);e.files.length>a&&(i=pi(n,`Chỉ nhận tối đa 4 file mỗi tin nhắn; đã bỏ qua ${e.files.length-a} file.`,`At most 4 files per message; ${e.files.length-a} skipped.`));for(let o of[...e.files].slice(0,a)){let a=gi(o.name);if(`refused`in a){i=`${o.name}: ${Si(a.refused,n)}`;continue}let s=a.mime;if(!e.allowed.has(s)){i=`${o.name}: ${s===`application/pdf`?pi(n,`host chưa cài pdftotext (poppler) nên chưa đọc được .pdf.`,`this host has no pdftotext (poppler), so .pdf cannot be read.`):pi(n,`phiên Pi hiện tại không nhận loại file này.`,`the current Pi session does not accept this file type.`)}`;continue}let c=s.startsWith(`image/`)||_i.has(s)?Math.min(t.capabilities.limits.maxAttachmentFileBytes,8388608):262144;if(o.size<1||o.size>c||r.reduce((e,t)=>e+t.sourceBytes,0)+o.size>t.capabilities.limits.maxAttachmentTotalBytes){i=`${o.name}: ${_i.has(s)?pi(n,`vượt giới hạn gửi trực tiếp ${vi(c)}. Hãy đặt tài liệu lớn trong project rồi mở ở mục Tài liệu; Pi sẽ đọc theo phần thay vì nhét cả file vào chat.`,`exceeds the ${vi(c)} direct-send limit. Put a large document in the project and open Documents; Pi can read it in parts instead of placing the whole file in chat.`):pi(n,`vượt giới hạn đính kèm (tối đa ${vi(c)}).`,`attachment limit exceeded (max ${vi(c)}).`)}`;continue}let l=new Uint8Array(await o.arrayBuffer()),u=``;for(let e=0;e<l.length;e+=32768)u+=String.fromCharCode(...l.subarray(e,e+32768));let d=await e.stage(await Xr(t,e.messageRequestId,{displayName:o.name,declaredMimeType:s,dataBase64:btoa(u)}));if(d.resultCode!==`staged`||!(`attachment`in d)||!d.attachment){i=`${o.name}: ${ai(d.error?.code??d.resultCode,n)}`;continue}r=[...r,d.attachment]}return{attachments:r,status:i}}async function wi(e){let t=await e.stage(Zr(e.snapshot,e.messageRequestId,e.attachmentRef));return t.messageType===`discard-receipt`&&t.resultCode===`discarded`?{discarded:!0,status:null}:{discarded:!1,status:`${pi(e.locale,`Chưa thể bỏ file`,`Unable to remove file`)} · ${ai(t.error?.code??t.resultCode,e.locale)}`}}var Y=(e,[t,n])=>e===`vi`?t:n,Ti={"managed-config-missing":[`Chưa nhập cấu hình công ty. Mở Agent Watch → Studio → Nhập cấu hình cho Piagent (trên Windows: Kết nối Piagent trong WSL).`,`Company configuration is not imported. Open Agent Watch → Studio and import it for Piagent (on Windows: Connect Piagent in WSL).`],"managed-keychain-approval-required":[`macOS chưa cho Agent Watch đọc key. Chọn “Luôn cho phép” khi được hỏi rồi kết nối lại.`,`macOS did not let Agent Watch read the key. Choose “Always Allow” when asked, then connect again.`],"managed-key-unavailable":[`Agent Watch không đọc được key công ty trên máy này. Mở Agent Watch, dán lại mã kết nối, bấm Kết nối Piagent trong WSL rồi kết nối lại.`,`Agent Watch cannot read the company key on this computer. Open Agent Watch, paste the connection code again, choose Connect Piagent in WSL, then connect again.`],"managed-profile-disconnected":[`Cấu hình Piagent đang thuộc key công ty đã ngắt kết nối. Nhập lại cấu hình cho Piagent trong Agent Watch (trên Windows: Kết nối Piagent trong WSL).`,`The Piagent configuration belongs to a disconnected company key. Import it again in Agent Watch (on Windows: Connect Piagent in WSL).`],"managed-launch-binding-changed":[`Agent Watch hoặc Piagent vừa cập nhật. Nhập lại cấu hình cho Piagent trong Agent Watch (trên Windows: Kết nối Piagent trong WSL).`,`Agent Watch or Piagent changed. Import the Piagent configuration again in Agent Watch (on Windows: Connect Piagent in WSL).`],"managed-project-contains-config":[`Không mở Piagent công ty ở thư mục này (thường là thư mục home ~) vì nó chứa cấu hình công ty. Vào thư mục dự án rồi chạy lại: cd ~/đường-dẫn-dự-án && piagent studio, hoặc piagent studio --project ~/đường-dẫn-dự-án.`,`The company Piagent cannot open this folder (usually your home folder ~) because it holds the company configuration. Go to a project folder and run it again: cd ~/your-project && piagent studio, or piagent studio --project ~/your-project.`],"managed-binding-update-pending":[`Agent Watch đang chạy nhưng chưa cập nhật cấu hình sau bản Piagent hoặc Agent Watch mới. Mở Agent Watch → Studio, bấm Áp dụng cho Piagent rồi mở lại.`,`Agent Watch is running but has not updated the configuration after the Piagent or Agent Watch update yet. Open Agent Watch → Studio, apply for Piagent, then open it again.`],"managed-binding-watch-not-running":[`Piagent hoặc Agent Watch vừa cập nhật nhưng Agent Watch không chạy nên chưa cập nhật cấu hình. Mở Agent Watch, chờ vài giây rồi mở lại.`,`Piagent or Agent Watch was updated but Agent Watch is not running, so the configuration was not updated. Open Agent Watch, wait a few seconds, then open it again.`],"managed-launch-version-mismatch":[`Agent Watch đang dùng một bản Piagent khác với dashboard này. Mở Agent Watch → Studio, bấm Áp dụng cho Piagent rồi kết nối lại.`,`Agent Watch points at another Piagent install than this dashboard. Open Agent Watch → Studio, apply for Piagent, then connect again.`],"managed-launch-stale-runtime":[`Phiên công ty của bản Piagent cũ chưa dừng được. Thử kết nối lại sau ít giây.`,`The company runtime from the previous Piagent did not stop yet. Connect again in a few seconds.`],"managed-launch-timeout":[`Phiên công ty khởi động quá lâu. Kết nối lại.`,`The company runtime took too long to start. Connect again.`],"company-gateway-timeout":["Phiên công ty đang chạy nhưng không trả lời. Đóng Piagent, chạy `pkill -f piagent-studio.mjs` trong Terminal (Windows: trong Ubuntu), rồi mở lại.","The company runtime is running but does not answer. Close Piagent, run `pkill -f piagent-studio.mjs` in a terminal (Windows: in Ubuntu), then open it again."]},Ei={"company-quota":{title:[`Hết hạn mức token`,`Token quota used up`],text:[`Hạn mức token của key này đã hết. Chờ kỳ hạn mức mới hoặc liên hệ quản trị viên để tăng hạn mức.`,`This key's token quota is used up. Wait for the next quota period or ask an administrator to raise it.`]},"company-provider-limit":{title:[`Tài khoản model của công ty hết lượt`,`Company model account limited`],text:[`Nhà cung cấp đang giới hạn tài khoản model của công ty (hết lượt dùng hoặc quá tải). Thử lại sau; quản trị viên có thể đổi model trong Harness.`,`The provider is limiting the company's model account (out of usage or overloaded). Try again later; an administrator can switch the harness model.`]},"company-account":{title:[`Tài khoản model cần đăng nhập lại`,`Model account must sign in again`],text:[`Tài khoản model của công ty đã hết phiên đăng nhập. Quản trị viên cần đăng nhập lại trong Studio (Tài khoản AI).`,`The company's model account is signed out. An administrator has to sign it in again in Studio (AI accounts).`]},"company-busy":{title:[`Đang quá tải`,`Busy`],text:[`Studio đang xử lý quá nhiều request của key này, hoặc tài khoản model đang bận. Chờ vài giây rồi gửi lại.`,`Studio is handling too many requests for this key, or the model account is busy. Wait a few seconds and send again.`]},"company-trial-limit":{title:[`Studio hết lượt thử nghiệm`,`Studio live-test limit reached`],text:[`Studio đã dùng hết số request thử nghiệm được cấp. Quản trị viên cần nâng trần trước khi chạy tiếp.`,`Studio has used up its live-test request ceiling. An administrator has to raise it before anything runs.`]},"company-key":{title:[`Key công ty không dùng được`,`Company key unusable`],text:[`Key công ty đã hết hạn, bị thu hồi, hoặc Agent Watch không đọc được. Nhập lại key trong Agent Watch.`,`The company key expired, was revoked, or Agent Watch cannot read it. Import the key again in Agent Watch.`]},"company-policy":{title:[`Không được phép`,`Not allowed`],text:[`Key này không được dùng model, mức suy luận hoặc độ dài trả lời đang chọn. Nếu Harness vừa đổi, gửi lại để dùng cấu hình mới; nếu vẫn lỗi, kiểm tra Harness trong Studio.`,`This key may not use this model, thinking level or answer length. If the harness just changed, send again to use the new one; otherwise check the harness in Studio.`]},"company-new-session":{title:[`Cần cuộc trò chuyện mới`,`New conversation needed`],text:[`Cuộc trò chuyện này không tiếp tục được với tài khoản model hiện tại. Nội dung cũ vẫn đọc được; tạo cuộc trò chuyện mới để làm tiếp.`,`This conversation cannot continue with the current model account. It stays readable; start a new conversation to go on.`]},"company-rejected":{title:[`Yêu cầu bị từ chối`,`Request rejected`],text:[`Model từ chối yêu cầu này, thường vì cuộc trò chuyện đã dài hơn model hiện tại nhận được. Bấm Tiếp tục: phần cũ được tóm tắt rồi mới gửi. Nếu vẫn bị từ chối, rút gọn tin nhắn hoặc tạo cuộc trò chuyện mới.`,`The model rejected this request, usually because the conversation grew longer than the current model accepts. Press Continue: the older part is summarised before sending. If it is still rejected, shorten the message or start a new conversation.`]},"company-refused":{title:[`Model từ chối yêu cầu này`,`The model declined this request`],text:[`Nhà cung cấp model từ chối yêu cầu này theo chính sách sử dụng của họ (ví dụ: in, mã hoá hoặc gửi ra ngoài thông tin bí mật). Gửi lại nguyên văn sẽ bị từ chối tiếp; hãy viết lại yêu cầu theo cách khác.`,`The model's provider declined this request under its usage policy (for example, printing, encoding or sending out secrets). The same request is declined again; ask in a different way.`]},"company-unreachable":{title:[`Lỗi kết nối`,`Connection error`],text:[`Không kết nối được tới Studio. Kiểm tra mạng hoặc VPN rồi gửi lại.`,`Studio could not be reached. Check the network or VPN and send again.`]},"company-service":{title:[`Dịch vụ model lỗi`,`Model service error`],text:[`Studio đã nhận yêu cầu nhưng dịch vụ model phía sau không trả lời. Gửi lại; nếu lặp lại, báo quản trị viên kèm mã bên dưới.`,`Studio took the request but its model service did not answer. Send again; if it repeats, give an administrator the code below.`]},"company-config-changed":{title:[`Cấu hình vừa thay đổi`,`Configuration changed`],text:[`Key hoặc Harness vừa thay đổi trong Studio. Gửi lại để chạy với cấu hình mới.`,`The key or harness just changed in Studio. Send again to run with the new one.`]},"company-update":{title:[`Cần cập nhật Piagent`,`Piagent update needed`],text:[`Harness dùng model mà bản Piagent này chưa biết. Cập nhật Piagent rồi gửi lại.`,`The harness uses a model this Piagent does not know. Update Piagent and send again.`]},"company-tool":{title:[`Công cụ lỗi`,`Tool error`],text:[`Công cụ này không chạy được ở bước này (ví dụ subagent đã chạy đủ 8 lần cho tin nhắn này).`,`This tool could not run at this step (for example, the subagent already ran 8 times for this message).`]},"company-failed":{title:[`Lỗi chưa phân loại`,`Unclassified error`],text:[`Yêu cầu không hoàn tất. Gửi lại; nếu lặp lại, báo quản trị viên kèm mã bên dưới.`,`The request did not complete. Send again; if it repeats, give an administrator the code below.`]}},Di=[`Cuộc trò chuyện này thuộc thành viên hoặc Studio khác với key đang nhập trong Agent Watch. Nội dung cũ vẫn đọc được; tạo cuộc trò chuyện mới để làm tiếp.`,`This conversation belongs to another member or Studio than the key Agent Watch holds. It stays readable; start a new conversation to go on.`],Oi={harness_route_unavailable:{title:[`Không có tài khoản AI cho vai trò này`,`No AI account for this role`],text:[`Không tài khoản AI nào của công ty đang phục vụ model của vai trò này cho team (tài khoản bị ngắt, tắt cho team hoặc hết lượt). Quản trị viên cần gắn hoặc bật tài khoản trong Studio (Tài khoản AI), hoặc đổi model của vai trò trong Harness.`,`No company AI account serves this role's model for the team right now (disconnected, off for the team or out of usage). An administrator has to link or enable one in Studio (AI accounts), or change the role's model in the harness.`]},harness_profile_unavailable:{title:[`Harness không có model cho vai trò này`,`Harness has no model for this role`],text:[`Lượt này bắt đầu khi Harness của team không có model dùng được cho vai trò này. Quản trị viên kiểm tra Harness và tài khoản AI của team trong Studio, rồi gửi lại.`,`This run started while the team's harness had no usable model for this role. An administrator checks the team's harness and AI accounts in Studio; then send again.`]}};function ki(e,t,n){let r=(t?Oi[t]:void 0)??Ei[e]??(e.startsWith(`company-`)?Ei[`company-failed`]:void 0);return r?{title:Y(n,r.title),text:Y(n,t===`managed-session-scope-changed`?Di:r.text)}:null}function Ai(e,t){return e===`main`?`Main agent`:e===`scout`?Y(t,[`Subagent scout`,`Scout subagent`]):e===`research`?Y(t,[`Subagent research`,`Research subagent`]):e===`verify`?Y(t,[`Subagent verify`,`Verify subagent`]):Y(t,[`Subagent review`,`Review subagent`])}function ji(e,t,n){return ki(e,t,n)}var Mi=new Set([`company-quota`,`company-provider-limit`,`company-account`,`company-busy`,`company-trial-limit`,`company-key`,`company-policy`,`company-rejected`,`company-unreachable`,`company-service`,`company-config-changed`,`company-failed`]);function Ni(e){return Mi.has(e)||!e.startsWith(`company-`)}function Pi(e,t){return Ai(e,t)}var Fi=Ti,Ii={"session-revision-stale":[`Danh sách cuộc trò chuyện vừa thay đổi. Gửi lại tin nhắn.`,`The conversation list just changed. Send the message again.`],"catalog-unavailable":[`Danh sách cuộc trò chuyện chưa tải xong. Thử lại sau vài giây.`,`The conversation list has not loaded yet. Try again in a few seconds.`],"session-model-mismatch":[`Cuộc trò chuyện đã tạo nhưng đang dùng model khác model đã chọn, nên tin nhắn chưa được gửi.`,`The conversation was created with a different model than the one chosen, so the message was not sent.`],"gateway-command-response-timeout":[`Piagent chưa xác nhận được cuộc trò chuyện mới sau 2 phút; nó có thể đã được tạo và đang chạy. Xem danh sách cuộc trò chuyện bên trái trước khi gửi lại.`,`Piagent could not confirm the new conversation within 2 minutes; it may have been created and be running. Check the conversation list before sending again.`],"session-command-expired":[`Yêu cầu chờ quá lâu nên đã hết hạn. Gửi lại tin nhắn.`,`The request waited too long and expired. Send the message again.`]};function Li(e,t){let n=e.startsWith(`company-`)?ji(e,null,t):null;if(n)return`${n.title}: ${n.text}`;let r=Ii[e]??Fi[e];return r?K(t,...r):`${K(t,`Chưa tạo được cuộc trò chuyện`,`The conversation could not be created`)} (${e}).`}function Ri(e,t){let n=Fi[e?.reasonCode??``];return n?K(t,...n):null}var zi=(e,t)=>e?.state===`connecting`?K(t,`Đang kết nối phiên công ty…`,`Connecting the company runtime…`):Ri(e,t)??K(t,`Chưa kết nối phiên công ty. Bấm để kết nối.`,`The company runtime is not connected. Select to connect.`);function Bi({locale:e,onConnected:t}){let[n,r]=(0,q.useState)(),[i,a]=(0,q.useState)(!1),s=(0,q.useRef)(!1),l=()=>{s.current&&(s.current=!1,t())};if((0,q.useEffect)(()=>{let e=!0,t=()=>void un().then(t=>{e&&(r(t),t?.state===`ready`?l():t&&(s.current=!0))}).catch(()=>void 0);t();let n=window.setInterval(t,5e3);return()=>{e=!1,window.clearInterval(n)}},[]),!n||n.state===`ready`||n.state===`unconfigured`)return null;let u=async()=>{a(!0);try{let e=await ln();r(e),e.state===`ready`&&l()}catch{r(await un().catch(()=>null)??n)}finally{a(!1)}},d=Ri(n,e),f=i||n.state===`connecting`;return(0,J.jsxs)(o,{severity:`warning`,role:`status`,sx:{mb:2},action:(0,J.jsx)(c,{color:`inherit`,size:`small`,disabled:f,onClick:()=>void u(),sx:{whiteSpace:`nowrap`},children:f?K(e,`Đang kết nối…`,`Connecting…`):K(e,`Kết nối lại`,`Reconnect`)}),children:[K(e,`Chế độ công ty đang tắt nên chưa đọc hay gửi tiếp được cuộc trò chuyện này. Bấm Kết nối lại; macOS có thể hỏi quyền đọc key một lần.`,`Company mode is not running, so this conversation cannot be read or continued yet. Select Reconnect; macOS may ask once to read the key.`),d&&(0,J.jsxs)(J.Fragment,{children:[` `,d]})]})}var Vi={anthropic:`#d97757`,claude:`#d97757`,context7:`#7456f1`,chrome:`#4285f4`,deepseek:`#4d6bfe`,figma:`#1e1e1e`,gemini:`#4285f4`,github:`#24292f`,google:`#4285f4`,groq:`#f55036`,linear:`#5e6ad2`,mistral:`#f7a000`,notion:`#111111`,openai:`#10a37f`,slack:`#611f69`};function Hi(){return(0,J.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1em`,height:`1em`,"aria-hidden":`true`,children:[(0,J.jsx)(`path`,{fill:`#f24e1e`,d:`M5 2h7v7H8.5A3.5 3.5 0 0 1 5 5.5V2Z`}),(0,J.jsx)(`path`,{fill:`#ff7262`,d:`M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2Z`}),(0,J.jsx)(`path`,{fill:`#a259ff`,d:`M5 9h7v7H8.5A3.5 3.5 0 0 1 5 12.5V9Z`}),(0,J.jsx)(`circle`,{cx:`15.5`,cy:`12.5`,r:`3.5`,fill:`#1abcfe`}),(0,J.jsx)(`path`,{fill:`#0acf83`,d:`M5 16h7v3.5A3.5 3.5 0 1 1 5 16Z`})]})}function Ui(e){let t=e.toLowerCase();return t.includes(`figma`)?(0,J.jsx)(Hi,{}):t.includes(`github`)?(0,J.jsx)(ye,{fontSize:`inherit`}):t.includes(`chrome`)||t.includes(`devtools`)?(0,J.jsx)(xe,{fontSize:`inherit`}):t.includes(`anthropic`)||t.includes(`claude`)?(0,J.jsx)(Fe,{fontSize:`inherit`}):t.includes(`file`)||t.includes(`folder`)?(0,J.jsx)(_e,{fontSize:`inherit`}):t.includes(`postgres`)||t.includes(`database`)||t.includes(`supabase`)?(0,J.jsx)(O,{fontSize:`inherit`}):t.includes(`code`)||t.includes(`context7`)?(0,J.jsx)(ae,{fontSize:`inherit`}):t.includes(`google`)||t.includes(`drive`)||t.includes(`cloud`)?(0,J.jsx)(n,{fontSize:`inherit`}):(0,J.jsx)(Ne,{fontSize:`inherit`})}function Wi({name:e,size:t=34}){let n=e.toLowerCase(),r=Object.keys(Vi).find(e=>n.includes(e));return(0,J.jsx)(W,{"aria-hidden":`true`,sx:{width:t,height:t,flex:`0 0 ${t}px`,display:`grid`,placeItems:`center`,borderRadius:t>30?2:1.4,bgcolor:r?Vi[r]:`action.selected`,color:r?`#fff`:`text.secondary`,fontSize:Math.round(t*.52),border:1,borderColor:r?`transparent`:`divider`},children:Ui(e)})}function Gi(e,t){let n=e.name.toLowerCase();return n===`figma-desktop`?K(t,`Cần bật MCP trong Figma Desktop`,`Enable MCP in Figma Desktop`):n===`figma`?e.state===`disabled`?K(t,`Remote OAuth · chưa được Figma duyệt`,`Remote OAuth · not approved by Figma`):`Remote OAuth`:`${e.transport} · ${e.scope}`}function Ki(e,t,n){return e===`mcp-oauth-client-not-approved`&&t.toLowerCase()===`figma`?K(n,`Figma Remote chưa cho phép Piagent đăng ký OAuth. Có thể dùng kết nối Figma Desktop bên dưới.`,`Figma Remote has not approved Piagent as an OAuth client. You can use the Figma Desktop connection below.`):e===`mcp-oauth-client-not-approved`?K(n,`Nhà cung cấp chưa cho phép client OAuth này.`,`The provider has not approved this OAuth client.`):e===`mcp-oauth-registration-rejected`?K(n,`Nhà cung cấp từ chối đăng ký OAuth.`,`The provider rejected OAuth client registration.`):e===`mcp-oauth-cancelled`||e===`cancelled-by-user`?K(n,`Đã hủy đăng nhập.`,`Sign in cancelled.`):K(n,`Không thể kết nối OAuth. Vui lòng thử lại.`,`Could not connect OAuth. Please try again.`)}function qi({sessionRef:e,connection:t,onChanged:n,compact:r=!1}){let{locale:i}=Pt(),[a,o]=(0,q.useState)(!1),[s,l]=(0,q.useState)(),[u,f]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(!s||s.state!==`running`)return;let e=new AbortController,t=window.setTimeout(()=>void _n(s.jobRef,e.signal).then(e=>{l(e),e.state===`completed`&&n()}).catch(()=>f(K(i,`Mất kết nối OAuth`,`OAuth flow disconnected`))),750);return()=>{e.abort(),window.clearTimeout(t)}},[s?.jobRef,s?.generatedAt,s?.state,i,n]);let p=async r=>{o(!0),f(null);try{let i=await sn({action:r?`mcp.enable`:`mcp.disable`,sessionRef:e,connectionRef:t.connectionRef});`connections`in i?n(i):n()}catch{f(K(i,`Không thể cập nhật MCP`,`Could not update MCP`))}finally{o(!1)}},m=async()=>{o(!0),f(null);try{let n=await sn({action:`mcp.oauth`,sessionRef:e,connectionRef:t.connectionRef});if(`jobRef`in n)l(n);else throw Error(`mcp-oauth-job-missing`)}catch{f(K(i,`Không thể bắt đầu OAuth`,`Could not start OAuth`))}finally{o(!1)}},h=async()=>{s?.state===`running`&&await an(s.jobRef).catch(()=>void 0),l(void 0),f(null)};return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(U,{direction:`row`,spacing:.75,sx:{alignItems:`center`,flexWrap:`wrap`,justifyContent:`flex-end`},children:[t.authState===`connected`&&(0,J.jsx)(wt,{size:`small`,color:`success`,variant:`outlined`,icon:(0,J.jsx)(lt,{}),label:K(i,`Đã kết nối`,`Connected`)}),t.oauthSupported&&t.authState!==`connected`&&t.state!==`disabled`&&(0,J.jsx)(c,{size:`small`,variant:`outlined`,disabled:a,onClick:()=>void m(),children:`OAuth`}),t.toggleSupported&&(0,J.jsx)(tt,{title:t.state===`disabled`?K(i,`Bật ${t.name}`,`Enable ${t.name}`):K(i,`Tắt ${t.name}`,`Disable ${t.name}`),arrow:!0,children:(0,J.jsx)(`span`,{children:(0,J.jsx)(C,{size:r?`small`:`medium`,checked:t.state!==`disabled`,disabled:a,onChange:(e,t)=>void p(t),slotProps:{input:{"aria-label":t.state===`disabled`?K(i,`Bật ${t.name}`,`Enable ${t.name}`):K(i,`Tắt ${t.name}`,`Disable ${t.name}`)}}})})})]}),u&&(0,J.jsx)(H,{role:`status`,color:`error`,variant:`caption`,children:u}),(0,J.jsxs)(d,{open:!!s,onClose:()=>void h(),fullWidth:!0,maxWidth:`xs`,children:[(0,J.jsxs)(fe,{children:[t.name,` · OAuth`]}),(0,J.jsx)(he,{children:(0,J.jsxs)(U,{spacing:1.25,sx:{pt:.5},children:[s?.state===`running`&&!s.authorizationUrl&&(0,J.jsx)(H,{color:`text.secondary`,children:K(i,`Đang chuẩn bị đăng nhập…`,`Preparing sign in…`)}),s?.authorizationUrl&&(0,J.jsx)(c,{component:`a`,href:s.authorizationUrl,target:`_blank`,rel:`noopener noreferrer`,variant:`contained`,endIcon:(0,J.jsx)(A,{}),children:K(i,`Mở trang đăng nhập`,`Open sign in`)}),s?.state===`completed`&&(0,J.jsx)(H,{color:`success.main`,children:K(i,`Đã kết nối MCP`,`MCP connected`)}),s&&[`failed`,`cancelled`].includes(s.state)&&(0,J.jsx)(H,{color:`error`,children:Ki(s.reasonCode,t.name,i)})]})}),(0,J.jsx)(x,{children:(0,J.jsx)(c,{color:`inherit`,onClick:()=>void h(),children:s?.state===`running`?K(i,`Hủy`,`Cancel`):K(i,`Đóng`,`Close`)})})]})]})}function Ji({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,onConfirm:a,onCancel:o}){return(0,J.jsxs)(d,{open:e,onClose:o,fullWidth:!0,maxWidth:`xs`,"aria-describedby":`piagent-confirm-dialog-description`,slotProps:{paper:{sx:{borderRadius:1,p:.5}}},children:[(0,J.jsxs)(fe,{sx:{display:`flex`,alignItems:`center`,gap:1.25,pb:1},children:[(0,J.jsx)(W,{sx:{width:36,height:36,borderRadius:1,display:`grid`,placeItems:`center`,bgcolor:`warning.main`,color:`warning.contrastText`},children:(0,J.jsx)(pe,{fontSize:`small`})}),(0,J.jsx)(H,{component:`span`,sx:{fontSize:`1.08rem`,fontWeight:650},children:t})]}),(0,J.jsx)(he,{children:(0,J.jsx)(s,{id:`piagent-confirm-dialog-description`,sx:{color:`text.secondary`,lineHeight:1.65},children:n})}),(0,J.jsxs)(x,{sx:{px:2.5,pb:2,gap:.75},children:[(0,J.jsx)(c,{color:`inherit`,onClick:o,autoFocus:!0,children:i}),(0,J.jsx)(c,{variant:`contained`,color:`warning`,onClick:a,children:r})]})]})}function Yi({name:e,value:t}){return(0,J.jsxs)(U,{direction:`row`,sx:{justifyContent:`space-between`,gap:3,py:.65},children:[(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:e}),(0,J.jsx)(H,{variant:`body2`,sx:{fontWeight:600},children:t})]})}var Xi=(e,t)=>e?K(t,`Fast: bật`,`Fast: on`):K(t,`Fast: tắt`,`Fast: off`),Zi=e=>K(e,`Fast: main agent trả lời nhanh hơn trên model GPT (Codex); token tính vào quota gấp 2,5 lần. Model và mức suy luận không đổi.`,`Fast: the main agent answers faster on GPT (Codex) models; its tokens count 2.5 times toward the quota. Model and thinking level are unchanged.`),Qi={borderColor:`warning.main`,color:`warning.main`,fontWeight:650,bgcolor:e=>kt(e.palette.warning.main,.14),"&:hover":{bgcolor:e=>kt(e.palette.warning.main,.22),color:`warning.main`}};function $i({title:e,label:t,icon:n,active:r,badge:i,tone:a,onClick:o,compact:s=!1}){let l=s?void 0:t,u={border:1,borderColor:r?e=>kt(e.palette.primary.main,.45):`transparent`,bgcolor:r?e=>kt(e.palette.primary.main,.12):`action.hover`,color:r?`primary.main`:`text.secondary`,borderRadius:999,fontWeight:500,"&:hover":{bgcolor:`action.selected`,color:`text.primary`},...r&&a===`warning`?Qi:{}},d=l?(0,J.jsx)(c,{size:`small`,"aria-label":e,onClick:o,startIcon:n,sx:{...u,minHeight:30,minWidth:{xs:30,md:64},maxWidth:260,px:{xs:.75,md:1.15},"& .MuiButton-startIcon":{mr:{xs:0,md:.65},ml:0},"& .MuiButton-startIcon svg":{fontSize:16}},children:(0,J.jsx)(W,{component:`span`,sx:{display:{xs:`none`,md:`inline`},overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:l})}):(0,J.jsx)(Mt,{size:`small`,"aria-label":e,onClick:o,sx:{...u,width:30,height:30},children:n});return(0,J.jsx)(tt,{title:e,children:i?(0,J.jsx)(je,{badgeContent:i,color:`primary`,max:9999,sx:{"& .MuiBadge-badge":{height:16,minWidth:16,px:.4,fontSize:9,fontWeight:650}},children:d}):d})}function ea({session:e,snapshot:t,connections:n,locale:r,onOpenChanges:i,canSetModel:a,canSetThinking:s,canSetPermission:l,onSetModel:u,onSetThinking:d,onSetPermission:f,onSetFast:p,onConnectionsChanged:m,placement:h=`composer`,compact:g=!1}){let[_,v]=(0,q.useState)(null),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(),[C,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(null),[D,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(h!==`header`)return;let e=new AbortController;return qt(e.signal).then(S).catch(()=>void 0),()=>e.abort()},[h]);let j=e=>t=>{v(e),b(t.currentTarget)},M=()=>{v(null),b(null)},N=t?.sourceChanges,P=N?.workingTree.counts.files??0,F=t?.session.permissionProfile,[I,L]=(0,q.useState)(F?.state===`known`?F.value??null:null);(0,q.useEffect)(()=>{L(e.managedPermission??(F?.state===`known`?F.value??null:null))},[e.sessionRef,e.managedPermission,F?.state,F?.value]);let ee=t?.usage.context,te=ee?.state===`known`,ne=te?ee.tokens:e.contextUsage.usedTokens,R=te?ee.contextWindow:e.contextUsage.contextWindow,B=te?ee.percent:e.contextUsage.ratio===null?null:e.contextUsage.ratio*100,re=B==null?`—`:`${Math.round(B)}%`,ie=t?.session.model.state===`known`&&t.session.model.value?t.session.model.value.modelRef:``,ae=x?.models.find(e=>e.modelRef===ie)??(x?.models.length===1?x.models[0]:void 0),oe=e.modelLabel===`agent-watch-auto`||x?.models.length===1&&x.models[0].provider===`agent_watch_managed`,V=(0,q.useMemo)(()=>e.managedThinkingLevels??ae?.thinkingLevels??(oe?[]:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),[ae,e.managedThinkingLevels,oe]),se=async e=>{if(!(!e||!u)){w(!0),E(null);try{await u(e)}catch{E(K(r,`Chưa thể đổi model lúc này`,`Could not change the model right now`))}finally{w(!1)}}},ce=async e=>{if(d){w(!0),E(null);try{await d(e)}catch{E(K(r,`Chưa thể đổi thinking lúc này`,`Could not change thinking right now`))}finally{w(!1)}}},le=e.managedFast===`on`,ue=async()=>{if(!(!p||C)){w(!0);try{await p(!le),A({tone:`success`,text:le?K(r,`Đã tắt Fast. Các lượt sau chạy tốc độ thường.`,`Fast is off. The next calls run at standard speed.`):K(r,`Đã bật Fast: main agent trả lời nhanh hơn trên model GPT, token tính vào quota gấp 2,5 lần. Model và mức suy luận không đổi.`,`Fast is on: the main agent answers faster on GPT models, and its tokens count 2.5 times toward the quota. Model and thinking level are unchanged.`)})}catch(e){let t=e instanceof Error&&/managed-fast-unavailable|unavailable/.test(e.message);A({tone:`error`,text:t?K(r,`Harness của team không cho phép Fast.`,`The team's Harness does not allow Fast.`):K(r,`Chưa đổi được Fast. Thử lại.`,`Fast not changed. Try again.`)})}finally{w(!1)}}},de=async t=>{if(!f)return;w(!0),E(null);let n=oe?ta(t,r):ai(t,r);try{await f(t),L(t),A(oe&&e.liveState===`waiting-approval`?{tone:`info`,text:K(r,`Đã chuyển sang ${n}. Lệnh đang chờ vẫn cần bạn bấm Cho phép hoặc Từ chối; các lệnh sau theo ${n}.`,`Switched to ${n}. The command already waiting still needs Allow or Deny; the next ones follow ${n}.`)}:{tone:`success`,text:K(r,`Đã chuyển sang ${n}.`,`Switched to ${n}.`)})}catch(e){let t=e instanceof Error&&e.message===`session-runtime-busy`?K(r,`Chưa đổi được quyền: lượt này đang chạy. Đổi lại sau khi lượt xong.`,`Access not changed: this turn is running. Change it after the turn ends.`):K(r,`Chưa đổi được quyền. Thử lại.`,`Access not changed. Try again.`);E(t),A({tone:`error`,text:t})}finally{w(!1)}},fe=e=>{if(e===`trusted-full-access`||e===`bypass`){M(),O(e);return}de(e)},pe=_===`model`?`Model & thinking`:_===`context`?`Context`:_===`connections`?K(r,`MCP & kết nối`,`MCP & connections`):_===`permission`?K(r,`Quyền`,`Access`):K(r,`Source Changes`,`Source Changes`);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(W,{sx:{display:`flex`,gap:.65,mb:h===`composer`?.8:0,px:.1,flexWrap:h===`header`?`nowrap`:`wrap`,flexShrink:0,alignItems:`center`,justifyContent:h===`header`?`flex-end`:`flex-start`},children:[h===`header`&&oe&&(e.managedHelpers?.maximum??2)>0&&(0,J.jsxs)(H,{variant:`caption`,color:`text.secondary`,title:K(r,`Subagent đang chạy trong phiên này; Studio giới hạn tổng số theo thành viên.`,`Subagents running in this session; Studio caps the total per member.`),sx:{whiteSpace:`nowrap`,display:{xs:`none`,sm:`block`},mr:.5},children:[K(r,`Subagent`,`Subagents`),` `,e.managedHelpers?.active??0,`/`,e.managedHelpers?.maximum??2]}),h===`header`&&(0,J.jsx)($i,{compact:g,active:_===`model`,onClick:j(`model`),icon:(0,J.jsx)(vt,{fontSize:`small`}),label:`${(oe?`agent-watch-auto`:e.modelLabel)??K(r,`Model session`,`Session model`)} · ${e.thinkingLevel===`unknown`||V.length>0&&!V.includes(e.thinkingLevel)?`—`:ai(e.thinkingLevel,r)}`,title:oe?`agent-watch-auto · Thinking`:K(r,`Đổi model và mức suy luận`,`Change model and thinking level`)}),h===`header`&&(0,J.jsx)($i,{compact:g,active:_===`permission`,onClick:j(`permission`),icon:(0,J.jsx)($e,{fontSize:`small`}),label:oe?ta(I,r):I?ai(I,r):K(r,`Quyền`,`Access`),title:K(r,`Đổi quyền truy cập`,`Change access level`)}),h===`header`&&oe&&e.managedFast&&p&&(0,J.jsx)($i,{compact:g,active:le,tone:`warning`,onClick:()=>void ue(),icon:(0,J.jsx)(ct,{fontSize:`small`}),label:Xi(le,r),title:le?K(r,`Fast đang bật: bấm để tắt (về tốc độ thường). Token tính vào quota gấp 2,5 lần.`,`Fast is on: click to turn it off (standard speed). Tokens count 2.5 times toward the quota.`):K(r,`Bật Fast: trả lời nhanh hơn, token tính vào quota gấp 2,5 lần`,`Turn Fast on: faster answers, tokens count 2.5 times toward the quota`)}),h===`composer`&&(0,J.jsx)($i,{active:_===`context`,onClick:j(`context`),icon:(0,J.jsx)(Re,{fontSize:`small`}),title:`Context · ${re}`}),h===`composer`&&(0,J.jsx)($i,{active:_===`connections`,onClick:j(`connections`),icon:(0,J.jsx)(Ne,{fontSize:`small`}),badge:n?.summary.configured??0,title:(n?.summary.configured??0)>0?K(r,`MCP & kết nối · ${n?.summary.configured}`,`MCP & connections · ${n?.summary.configured}`):K(r,`MCP & kết nối`,`MCP & connections`)}),h===`composer`&&(0,J.jsx)($i,{active:_===`changes`,onClick:j(`changes`),icon:(0,J.jsx)(z,{fontSize:`small`}),badge:P,title:`Source Changes${P?` · ${P}`:``}`})]}),(0,J.jsxs)(ke,{open:_!==null,anchorEl:y,onClose:M,anchorOrigin:{vertical:h===`header`?`bottom`:`top`,horizontal:`left`},transformOrigin:{vertical:h===`header`?`top`:`bottom`,horizontal:`left`},slotProps:{paper:{sx:{width:330,maxWidth:`calc(100vw - 24px)`,borderRadius:1,p:1.5,mt:+(h===`header`)}}},children:[(0,J.jsx)(H,{sx:{px:.5,pb:1,fontWeight:600},children:pe}),(0,J.jsx)(mt,{}),_===`model`&&(0,J.jsxs)(U,{sx:{px:.5,pt:1},spacing:1.25,children:[oe?(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{children:`agent-watch-auto`}),(0,J.jsx)(Yi,{name:`Context`,value:R?new Intl.NumberFormat().format(R):`—`})]}):(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:`Model`}),(0,J.jsx)(xt,{fullWidth:!0,size:`small`,value:ie,disabled:!a||C||e.liveState===`running`,onChange:e=>void se(e.target.value),sx:{mt:.5},children:(x?.models??[]).map(e=>(0,J.jsx)(rt,{value:e.modelRef,children:e.displayName},e.modelRef))})]}),(0,J.jsxs)(W,{children:[(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:`Thinking`}),(0,J.jsx)(xt,{fullWidth:!0,size:`small`,inputProps:{"aria-label":`Thinking`},value:e.thinkingLevel===`unknown`?``:e.thinkingLevel,disabled:!s||C||e.liveState===`running`,onChange:e=>void ce(e.target.value),sx:{mt:.5},children:V.map(e=>(0,J.jsx)(rt,{value:e,children:ai(e,r)},e))})]}),T&&(0,J.jsx)(H,{role:`status`,color:`error`,variant:`caption`,children:T})]}),_===`context`&&(0,J.jsxs)(W,{sx:{px:.5,pt:.75},children:[(0,J.jsx)(Yi,{name:K(r,`Đã dùng`,`Used`),value:re}),(0,J.jsx)(Yi,{name:`Tokens`,value:ne===null?`—`:new Intl.NumberFormat().format(ne)}),(0,J.jsx)(Yi,{name:`Window`,value:R===null?`—`:new Intl.NumberFormat().format(R)})]}),_===`connections`&&(0,J.jsxs)(Dt,{dense:!0,disablePadding:!0,sx:{pt:.5},children:[(n?.connections??[]).map(t=>(0,J.jsxs)(Ee,{sx:{alignItems:`center`,gap:.5},children:[(0,J.jsx)(Ke,{sx:{minWidth:38},children:(0,J.jsx)(Wi,{name:t.name,size:28})}),(0,J.jsx)(ft,{primary:t.name,secondary:Gi(t,r)}),(0,J.jsx)(qi,{compact:!0,sessionRef:e.sessionRef,connection:t,onChanged:e=>m?.(e)})]},t.connectionRef)),n&&n.connections.length===0&&(0,J.jsx)(Ee,{children:(0,J.jsx)(ft,{primary:K(r,`Chưa có MCP`,`No MCP configured`)})}),!n&&(0,J.jsx)(Ee,{children:(0,J.jsx)(ft,{primary:K(r,`Đang đọc…`,`Loading…`)})})]}),_===`permission`&&(0,J.jsxs)(U,{sx:{px:.5,pt:1},spacing:.75,children:[(oe?[`workspace-write`,`trusted-full-access`,...e.managedBypass?[`bypass`]:[]]:[`read-only`,`workspace-write`,`trusted-full-access`,`bypass`]).map(t=>(0,J.jsx)(c,{variant:I===t?`contained`:`outlined`,color:t===`bypass`?`error`:t===`trusted-full-access`?`warning`:`primary`,disabled:!l||C||!oe&&e.liveState===`running`,onClick:()=>fe(t),sx:{justifyContent:`flex-start`},children:oe?ta(t,r):ai(t,r)},t)),T&&(0,J.jsx)(H,{role:`status`,color:`error`,variant:`caption`,children:T})]}),_===`changes`&&(0,J.jsxs)(W,{sx:{px:.5,pt:.75},children:[(0,J.jsx)(Yi,{name:K(r,`Task changes`,`Task changes`),value:String(N?.task?.counts.files??0)}),(0,J.jsx)(Yi,{name:K(r,`Working tree`,`Working tree`),value:String(N?.workingTree.counts.files??0)}),(0,J.jsx)(Yi,{name:K(r,`Staged`,`Staged`),value:String(N?.staged.counts.files??0)}),(0,J.jsx)(c,{fullWidth:!0,variant:`outlined`,startIcon:(0,J.jsx)(z,{}),sx:{mt:1},onClick:()=>{M(),i()},children:K(r,`Mở Source Changes`,`Open Source Changes`)})]})]}),(0,J.jsx)(Ji,{open:D!==null,title:D===`bypass`?K(r,`Bật Bypass?`,`Turn on Bypass?`):K(r,`Bật toàn quyền?`,`Enable full access?`),description:D===`bypass`?oe?ra(r):na(r):oe?ia(r):K(r,`Session này sẽ được phép đọc, sửa file và chạy command trong phạm vi runtime. Các thao tác xóa hoặc gửi dữ liệu ra ngoài vẫn cần xác nhận riêng.`,`This session will be allowed to read and edit files and run commands within the runtime. Destructive actions and external data transfers still require separate confirmation.`),cancelLabel:K(r,`Hủy`,`Cancel`),confirmLabel:D===`bypass`?K(r,`Bật Bypass`,`Turn on Bypass`):K(r,`Bật toàn quyền`,`Enable full access`),onCancel:()=>O(null),onConfirm:()=>{let e=D;O(null),e&&de(e)}}),(0,J.jsx)(gt,{open:k!==null,autoHideDuration:k?.tone===`success`?4e3:12e3,onClose:()=>A(null),anchorOrigin:{vertical:`top`,horizontal:`center`},children:(0,J.jsx)(o,{severity:k?.tone??`info`,variant:`filled`,onClose:()=>A(null),role:k?.tone===`error`?`alert`:`status`,children:k?.text})})]})}function ta(e,t){return e===`bypass`?`Bypass`:e===`trusted-full-access`?K(t,`Toàn quyền`,`Full access`):K(t,`Hỏi trước`,`Ask first`)}function na(e){return K(e,`Không hỏi, không chặn gì trong cuộc trò chuyện personal này: xoá, push, gửi ra ngoài, file được bảo vệ đều chạy luôn, như chế độ bypass của Codex. Output vẫn được che secret và /undo vẫn hoàn tác được từng lượt. Cuộc trò chuyện company theo công tắc Bypass trong Harness của Studio.`,`Nothing is asked or blocked in this personal conversation: deletes, pushes, external sends and protected files all run, as with Codex's bypass mode. Output is still redacted and /undo can still revert each turn. Company conversations follow the Bypass switch of the Studio Harness.`)}function ra(e){return K(e,`Không hỏi gì nữa trong cuộc trò chuyện này: lệnh cần internet, Docker, chạy trên máy, push, deploy, migration đều chạy luôn, như bypass của Codex. Lệnh thường vẫn chạy trong sandbox, output vẫn che secret và /undo vẫn hoàn tác được. Admin Studio có thể tắt Bypass trong Harness.`,`Nothing is asked in this conversation any more: commands that need the internet, Docker or this machine, pushes, deploys and migrations all run, as with Codex's bypass. Plain commands still run in the sandbox, output is still redacted and /undo still works. A Studio administrator can turn Bypass off in the Harness.`)}function ia(e){return K(e,`Lệnh cần internet (cài package, tải file, git pull, test có server hay browser) chạy luôn, không hỏi. Vẫn hỏi trước khi đẩy hoặc gửi dữ liệu ra ngoài (git push, publish, deploy, upload, ssh), chạy migration database, xóa mà không rõ đích hoặc dùng sudo.`,`Commands that need the internet (package installs, downloads, git pull, tests with a server or browser) run without asking. You are still asked before anything that pushes or sends data out (git push, publish, deploy, uploads, ssh), database migrations, deletes whose target is unknown, and sudo.`)}function aa(e){return e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&e.keyCode!==229}var oa=j((0,J.jsx)(`path`,{d:`M12 7V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zM6 19H4v-2h2zm0-4H4v-2h2zm0-4H4V9h2zm0-4H4V5h2zm4 12H8v-2h2zm0-4H8v-2h2zm0-4H8V9h2zm0-4H8V5h2zm9 12h-7v-2h2v-2h-2v-2h2v-2h-2V9h7c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1m-1-8h-2v2h2zm0 4h-2v2h2z`}),`BusinessRounded`),sa=j((0,J.jsx)(`path`,{d:`m19 9 1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm0 6-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25zm-7.5-5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12zm-1.51 3.49L9 15.17l-.99-2.18L5.83 12l2.18-.99L9 8.83l.99 2.18 2.18.99z`}),`AutoAwesomeOutlined`),ca=j((0,J.jsx)(`path`,{d:`M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z`}),`DescriptionOutlined`);function la(e,t){let n=e.slice(0,t),r=/(^|[\s(])@"([^"\n]*)$/.exec(n);if(r)return{start:r.index+r[1].length,end:e[t]===`"`?t+1:t,query:r[2],quoted:!0};let i=/(^|[\s(])@([^\s"]*)$/.exec(n);return i?{start:i.index+i[1].length,end:t+(/^[^\s"]*/.exec(e.slice(t))?.[0].length??0),query:i[2],quoted:!1}:null}function ua(e,t,n){let r=t.quoted||/\s/.test(n.value),i=r?`@"${n.value}"`:`@${n.value}`,a=n.kind===`directory`,o=e.slice(t.end),s=a||/^\s/.test(o)?``:` `;return{text:e.slice(0,t.start)+i+s+o,caret:t.start+i.length+s.length-(a&&r?1:0)}}function da(e,t){let n=e.slice(0,t);return/^\/[^\s/]*$/.test(n)?{start:0,end:t+(/^[^\s]*/.exec(e.slice(t))?.[0].length??0),query:n.slice(1),quoted:!1}:null}function fa(e,t,n){let r=n.kind===`skill`?`/skill:${n.name}`:`/${n.name}`,i=e.slice(t.end);return{text:r+(/^\s/.test(i)?``:` `)+i,caret:r.length+1}}var pa=20,ma=e=>e.normalize(`NFD`).replace(/\p{M}/gu,``).toLowerCase();function ha(e,t,n){let r=ma(t.replace(/^skill:/,``)),i=e=>ma(e.name).startsWith(r)?0:ma(e.name).includes(r)?1:ma(e.description).includes(r)?2:3,a=e=>e.origin===`piagent`?`Piagent`:`${e.scope===`user`?`~/`:``}.${e.origin===`pi`?`pi`:e.origin}`;return e.filter(e=>i(e)<3&&(!t.startsWith(`skill:`)||e.kind===`skill`)).sort((e,t)=>i(e)-i(t)||e.name.localeCompare(t.name)).slice(0,pa).map(e=>({key:`${e.kind}:${e.name}`,icon:e.kind,label:e.kind===`skill`?`/skill:${e.name}`:`/${e.name}`,hint:e.argumentHint,detail:`${e.description}${e.description?` · `:``}${e.kind===`skill`?`skill`:K(n,`lệnh`,`command`)} ${a(e)}`,apply:(t,n)=>fa(t,n,e)}))}function ga({projectRef:e,value:t,onChange:n,locale:r,builtIns:i=[]}){let a=(0,q.useRef)(null),o=(0,q.useId)(),[s,c]=(0,q.useState)(null),[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(0),[h,g]=(0,q.useState)(null),[_,v]=(0,q.useState)(null),y=e&&s!==null&&s<=t.length?s:null,x=y===null?null:da(t,y),S=y===null||x?null:la(t,y),C=x??S,w=x?`command`:`path`,T=C&&`${w}:${C.start}`!==d?C:null,E=T&&w===`path`?T.query:null;(0,q.useEffect)(()=>{if(E===null||!e){g(null);return}let t=new AbortController,n=setTimeout(()=>{Kt(e,E,t.signal).then(e=>{g({query:E,items:e.suggestions.map(e=>({key:e.value,label:e.label,hint:null,icon:e.kind,detail:e.detail.slice(0,Math.max(0,e.detail.length-e.label.replace(/\/$/,``).length)),apply:(t,n)=>ua(t,n,e)}))}),m(0)}).catch(()=>{t.signal.aborted||g({query:E,items:[]})})},90);return()=>{clearTimeout(n),t.abort()}},[e,E]);let O=!!(T&&w===`command`&&e&&_?.projectRef!==e);(0,q.useEffect)(()=>{if(!O||!e)return;let t=new AbortController;return tn(e,t.signal).then(t=>v({projectRef:e,list:t.commands})).catch(()=>{t.signal.aborted||v({projectRef:e,list:[]})}),()=>t.abort()},[O,e]);let k=T?w===`path`?h?.items??null:_&&_.projectRef===e?ha([...i,..._.list.filter(e=>!i.some(t=>t.name===e.name))],T.query,r):null:null;(0,q.useEffect)(()=>{m(0)},[w,T?.query]);let A=!!(l&&T&&k&&a.current),j=A?k:[];(0,q.useEffect)(()=>{A&&document.getElementById(`${o}-${p}`)?.scrollIntoView({block:`nearest`})},[A,p,o]);let M=(0,q.useRef)(null);(0,q.useLayoutEffect)(()=>{let e=M.current,n=a.current;!e||!n||e.text!==t||(M.current=null,n.focus(),n.setSelectionRange(e.caret,e.caret),c(e.caret))},[t]);let N=e=>{if(!T)return;let r=e.apply(t,T);M.current=r,n(r.text),c(r.caret)},P=e=>!A||e.nativeEvent.isComposing||e.keyCode===229?!1:e.key===`Escape`?(e.preventDefault(),f(`${w}:${T.start}`),!0):j.length?e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),m(t=>(t+(e.key===`ArrowDown`?1:j.length-1))%j.length),!0):(e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),N(j[Math.min(p,j.length-1)]),!0):!1,F=e=>e===`directory`?(0,J.jsx)(D,{fontSize:`small`,color:`primary`}):e===`file`?(0,J.jsx)(ca,{fontSize:`small`,color:`action`}):e===`skill`?(0,J.jsx)(sa,{fontSize:`small`,color:`secondary`}):(0,J.jsx)(b,{fontSize:`small`,color:`primary`}),I=w===`command`?K(r,`Lệnh và skill`,`Commands and skills`):K(r,`File và folder`,`Files and folders`),L=a.current,ee=(0,J.jsx)(We,{open:A,anchorEl:L,placement:`top-start`,disablePortal:!0,sx:{zIndex:1350,width:Math.min(640,L?.clientWidth??640)},modifiers:[{name:`offset`,options:{offset:[0,10]}}],children:(0,J.jsxs)(te,{elevation:8,sx:{borderRadius:1,overflow:`hidden`,display:`flex`,flexDirection:`column`,maxHeight:340},children:[(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,sx:{px:1.5,pt:1,pb:.5},children:w===`command`?K(r,`Lệnh và skill của project và trên máy này · Tab để chọn`,`Commands and skills of the project and on this computer · Tab to pick`):K(r,`File và folder · gõ ~/ hoặc / để chọn folder khác trên máy · Tab để chọn`,`Files and folders · type ~/ or / for other folders on this computer · Tab to pick`)}),j.length?(0,J.jsx)(W,{component:`ul`,role:`listbox`,id:o,"aria-label":I,sx:{listStyle:`none`,m:0,p:.5,pt:0,overflowY:`auto`},children:j.map((e,t)=>(0,J.jsxs)(W,{component:`li`,id:`${o}-${t}`,role:`option`,"aria-selected":t===p,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>m(t),onClick:()=>N(e),sx:{display:`flex`,alignItems:`center`,gap:1,minWidth:0,px:1,py:.55,borderRadius:1,cursor:`pointer`,bgcolor:t===p?`action.selected`:`transparent`},children:[F(e.icon),(0,J.jsx)(H,{noWrap:!0,sx:{flexShrink:0,maxWidth:`55%`,fontSize:14,fontWeight:600},children:e.label}),e.hint&&(0,J.jsx)(H,{noWrap:!0,variant:`caption`,sx:{flexShrink:0,maxWidth:`25%`,fontFamily:`monospace`},children:e.hint}),(0,J.jsx)(H,{noWrap:!0,variant:`caption`,color:`text.secondary`,sx:{minWidth:0},children:e.detail})]},e.key))}):(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,sx:{px:1.5,pb:1.25},children:w===`command`?K(r,`Không có lệnh hoặc skill khớp`,`No matching command or skill`):K(r,`Không có file hoặc folder khớp`,`No matching file or folder`)})]})}),ne=e=>c(e.target.selectionStart??null);return{inputRef:a,menu:ee,onKeyDown:P,track:ne,inputProps:{onFocus:()=>u(!0),onBlur:()=>u(!1)},htmlInput:{onSelect:ne,"aria-autocomplete":`list`,"aria-controls":A&&j.length?o:void 0,"aria-activedescendant":A&&j.length?`${o}-${p}`:void 0}}}var _a=`new-chat`,va=`piagent.composer-drafts.v1`,ya=50,ba=32768,xa=12096e5,Sa=null,Ca,wa=new Map;function Ta(){if(Sa)return Sa;Sa=new Map;try{let e=JSON.parse(window.localStorage.getItem(va)??`{}`),t=Date.now();for(let[n,r]of Object.entries(e??{}))typeof r?.text==`string`&&typeof r.savedAt==`number`&&t-r.savedAt<xa&&Sa.set(n,{text:r.text.slice(0,ba),savedAt:r.savedAt})}catch{}return Sa}function Ea(){Ca!==void 0&&(window.clearTimeout(Ca),Ca=void 0);try{let e=[...Ta()].sort((e,t)=>t[1].savedAt-e[1].savedAt).slice(0,ya);window.localStorage.setItem(va,JSON.stringify(Object.fromEntries(e)))}catch{}}var Da=!1;function Oa(){Da||(Da=!0,window.addEventListener(`pagehide`,Ea)),Ca===void 0&&(Ca=window.setTimeout(Ea,300))}function ka(e){return Ta().get(e)?.text??``}function Aa(e,t){let n=Ta();if(t.trim())n.set(e,{text:t.slice(0,ba),savedAt:Date.now()});else if(!n.delete(e))return;Oa()}function ja(e){return wa.get(e)}function Ma(e,t){t===null?wa.delete(e):wa.set(e,t)}var Na=`piagent-composer-appended`;function Pa(e,t){let n=ka(e);Aa(e,n.trim()?`${n.trimEnd()}\n\n${t}`:t),window.dispatchEvent(new CustomEvent(Na,{detail:e}))}var Fa=`agent_watch_managed`;function Ia(e,t,n){return e===`native-project-picker-unavailable`||e===`project-import-picker-failed`?K(n,`Không mở được hộp chọn thư mục của máy. Thử lại; nếu vẫn lỗi, mở cuộc trò chuyện từ Terminal trong thư mục đó (pi hoặc piagent studio).`,`The folder picker could not open. Try again; if it still fails, start a conversation from a Terminal in that folder (pi or piagent studio).`):e===`project-import-folder-invalid`?K(n,`Không dùng được thư mục này: thư mục gốc của ổ đĩa hoặc một liên kết (symlink). Chọn thư mục thật của project.`,`This folder cannot be used: a drive's root or a symbolic link. Choose the project's real folder.`):t===429?K(n,`Thao tác quá nhanh. Đợi vài giây rồi thử lại.`,`Too many attempts. Wait a few seconds and try again.`):K(n,`Không thể thêm thư mục. Thử lại; nếu vẫn lỗi, chạy piagent dashboard doctor.`,`Could not add this folder. Try again; if it still fails, run piagent dashboard doctor.`)}var La=[[`Đọc project này (chỉ đọc) và ghi lại project context.`,`Read this project (read-only) and record the project context.`],[`Review diff hiện tại. Chỉ đọc.`,`Review the current diff. Read-only.`],[`Chạy test của project và giải thích lỗi nếu có.`,`Run the project's tests and explain any failure.`],[`Lập plan cho việc sau, chưa sửa code: `,`Plan this change before editing any code: `]];function Ra({active:e,defaultProjectRef:t,busy:n,error:r,onCancel:i,onCreate:a}){let{locale:o}=Pt(),[s,l]=(0,q.useState)(),[u,d]=(0,q.useState)(void 0),[f,p]=(0,q.useState)(!1),m=u===null&&s?.models.length===1&&s.models[0].provider===`agent_watch_managed`,[h,g]=(0,q.useState)(!1),[_,y]=(0,q.useState)(``),[b,x]=(0,q.useState)(``),[S,C]=(0,q.useState)(`high`),[w,E]=(0,q.useState)(!1),[D,O]=(0,q.useState)(!1),[k,A]=(0,q.useState)(null),[j,N]=(0,q.useState)(()=>ka(_a)),P=e=>{N(e),Aa(_a,e)},[F,I]=(0,q.useState)(null),[L,ee]=(0,q.useState)(()=>ja(`new-chat`)??[]),[te,ne]=(0,q.useState)(null);(0,q.useEffect)(()=>{Ma(_a,L.length?L:null)},[L]);let[R,z]=(0,q.useState)(!1),re=(0,q.useRef)(0),[ie,ae]=(0,q.useState)(null),[oe,se]=(0,q.useState)(null),[ce,le]=(0,q.useState)(!1),[ue,de]=(0,q.useState)(null);(0,q.useEffect)(()=>{if(!e)return;let n=new AbortController;return l(void 0),g(!1),de(null),ne(null),z(!1),E(!1),re.current=0,qt(n.signal).then(e=>{n.signal.aborted||(l(e),y(e.projects.some(e=>e.projectRef===t)?t:e.projects[0]?.projectRef??``),x(e.defaultModelRef??``),C(e.defaultThinkingLevel??`high`),A(null),O(!1))}).catch(()=>{n.signal.aborted||g(!0)}),d(void 0),un(n.signal).then(e=>{n.signal.aborted||d(e)}).catch(()=>{n.signal.aborted||d(null)}),()=>n.abort()},[e,t]),(0,q.useEffect)(()=>{if(!e)return;let t=e=>{xi(e.dataTransfer)&&e.preventDefault()};return window.addEventListener(`dragover`,t),window.addEventListener(`drop`,t),()=>{window.removeEventListener(`dragover`,t),window.removeEventListener(`drop`,t)}},[e]);let fe=s?.projects.find(e=>e.projectRef===_),pe=ga({projectRef:fe?.projectRef,value:j,onChange:P,locale:o}),he=s?.models.find(e=>e.modelRef===b),ge=!m&&he?.provider===Fa,_e=m?[]:s?.models.filter(e=>e.provider===Fa)??[],ve=(m||ge)&&he?.managedFast===!0,ye=m?s?.models??[]:s?.models.filter(e=>e.provider!==Fa)??[],be=async()=>{p(!0);try{let e=await ln().catch(()=>null),t=await qt();l(t),d(e??await un().catch(()=>null));let n=t.models.find(e=>e.provider===Fa);n&&(x(n.modelRef),Te())}catch{g(!0)}finally{p(!1)}},xe=s?.models.find(e=>e.modelRef===s.defaultModelRef),Se=(0,q.useMemo)(()=>he?.thinkingLevels??[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],[he]);(0,q.useEffect)(()=>{Se.includes(S)||C(Se.includes(`high`)?`high`:Se[0]??`off`)},[b,Se]);let Ce=e=>t=>{ae(e),se(t.currentTarget)},Te=()=>{ae(null),se(null)},Ee=async()=>{le(!0),de(null);try{let e=await mn(),t=e.projects?.length?e.projects:[e.project];l(e=>e&&{...e,projects:[...e.projects.filter(e=>!t.some(t=>t.projectRef===e.projectRef)),...t]}),y(e.project.projectRef),Te()}catch(e){e instanceof cn&&e.status===409?de(null):de(Ia(e instanceof cn?e.code:null,e instanceof cn?e.status:0,o))}finally{le(!1)}},De=e=>{if(!e?.length)return;let t=[...L],n=!1,r=null;for(let i of[...e]){if(t.some(e=>e.name===i.name&&e.size===i.size&&e.lastModified===i.lastModified))continue;let e=gi(i.name);if(`refused`in e){r=`${i.name}: ${Si(e.refused,o)}`;continue}if(t.length===4){n=!0;continue}t.push(i)}ee(t),ne(r??(n?K(o,`Mỗi tin nhắn nhận tối đa 4 file.`,`Each message accepts at most 4 files.`):null))},Oe=!n&&!h&&L.length<4,ke=(0,q.useRef)(!1),Ae=()=>{ke.current||n||!fe||!j.trim()||(ke.current=!0,Promise.resolve(a({projectRef:_,placeRef:fe.placeRef,modelRef:b||null,thinkingLevel:S,permissionMode:k,...ve&&D?{fast:!0}:{},message:j,files:L})).finally(()=>{ke.current=!1}))};return(0,J.jsxs)(W,{sx:{minHeight:`calc(100vh - 68px)`,display:`flex`,flexDirection:`column`},children:[(0,J.jsx)(W,{sx:{p:{xs:1.5,sm:2}},children:(0,J.jsx)(Mt,{"aria-label":K(o,`Quay lại`,`Back`),onClick:i,children:(0,J.jsx)(jt,{})})}),(0,J.jsxs)(U,{sx:{flex:1,alignItems:`center`,justifyContent:`center`,px:2,pb:{xs:5,md:12}},spacing:4,children:[(0,J.jsxs)(U,{spacing:1.75,sx:{alignItems:`center`},children:[(0,J.jsx)(lr,{size:44}),(0,J.jsx)(H,{component:`h1`,sx:{fontSize:{xs:`1.9rem`,md:`2.3rem`},fontWeight:650,letterSpacing:`-.04em`,textAlign:`center`},children:K(o,`Hôm nay làm gì?`,`What should we work on?`)}),(0,J.jsx)(H,{color:`text.secondary`,sx:{textAlign:`center`,maxWidth:520,fontSize:14.5},children:K(o,`Nói việc bằng lời thường. Guard kiểm tra mọi tool call; việc rủi ro chờ bạn duyệt.`,`Say what you need in plain language. The guard checks every tool call; risky actions wait for you.`)})]}),(0,J.jsxs)(W,{sx:{position:`relative`,width:`100%`,maxWidth:820,border:1,borderColor:R?`primary.main`:`divider`,borderStyle:R?`dashed`:`solid`,borderRadius:2.5,bgcolor:`background.paper`,p:1.5,boxShadow:`0 24px 60px -24px rgba(0,0,0,.55)`,transition:`border-color .16s, box-shadow .16s`,"&:focus-within":{borderColor:`rgba(var(--piagent-palette-primary-mainChannel) / .55)`,boxShadow:`0 0 0 4px rgba(var(--piagent-palette-primary-mainChannel) / .12), 0 24px 60px -24px rgba(0,0,0,.55)`}},onDragEnter:e=>{xi(e.dataTransfer)&&(re.current+=1,z(!0))},onDragOver:e=>{xi(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=Oe?`copy`:`none`)},onDragLeave:e=>{xi(e.dataTransfer)&&(--re.current,re.current<=0&&(re.current=0,z(!1)))},onDrop:e=>{xi(e.dataTransfer)&&(e.preventDefault(),re.current=0,z(!1),Oe&&De(e.dataTransfer.files))},children:[R&&(0,J.jsxs)(W,{role:`status`,sx:{position:`absolute`,inset:0,zIndex:3,display:`grid`,alignContent:`center`,justifyItems:`center`,gap:.5,borderRadius:1,bgcolor:`background.paper`,opacity:.96,pointerEvents:`none`,textAlign:`center`},children:[(0,J.jsx)(H,{sx:{fontWeight:650},children:Oe?K(o,`Thả tài liệu vào đây`,`Drop documents here`):L.length>=4?K(o,`Đã đủ 4 file cho tin nhắn đầu tiên`,`The first message already holds 4 files`):K(o,`Chưa nhận file lúc này`,`Files cannot be attached right now`)}),Oe&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:K(o,`.md .txt .csv .json .yaml .docx .pdf và ảnh`,`.md .txt .csv .json .yaml .docx .pdf and images`)})]}),!s&&!h?(0,J.jsxs)(U,{direction:`row`,spacing:1.5,sx:{minHeight:126,alignItems:`center`,justifyContent:`center`},children:[(0,J.jsx)(me,{size:20}),(0,J.jsx)(H,{color:`text.secondary`,children:K(o,`Đang mở…`,`Opening…`)})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(we,{autoFocus:!0,fullWidth:!0,multiline:!0,minRows:3,maxRows:8,value:j,disabled:n||h,inputRef:pe.inputRef,...pe.inputProps,onChange:e=>{P(e.target.value),pe.track(e)},onKeyDown:e=>{pe.onKeyDown(e)||aa(e)&&(e.preventDefault(),Ae())},onPaste:e=>{e.clipboardData?.files.length&&(e.preventDefault(),Oe&&De(e.clipboardData.files))},placeholder:K(o,`Nhắn cho Piagent… (@ để chọn file, folder)`,`Message Piagent… (@ for files and folders)`),variant:`standard`,slotProps:{input:{disableUnderline:!0},htmlInput:{maxLength:32768,...pe.htmlInput}},sx:{px:.5}}),pe.menu,L.length>0&&(0,J.jsx)(U,{direction:`row`,sx:{flexWrap:`wrap`,gap:.75,px:.5,pt:.75},"aria-label":K(o,`File sẽ gửi cùng tin nhắn đầu tiên`,`Files for the first message`),children:L.map(e=>(0,J.jsx)(wt,{size:`small`,variant:`outlined`,label:`${e.name} · ${vi(e.size)}`,onDelete:n?void 0:()=>{ee(t=>t.filter(t=>t!==e)),ne(null)},deleteIcon:(0,J.jsx)(Ir,{"aria-label":`${K(o,`Bỏ`,`Remove`)} ${e.name}`,role:`button`})},`${e.name}:${e.size}:${e.lastModified}`))}),(0,J.jsx)(Kr,{in:w,id:`piagent-new-session-options`,children:(0,J.jsxs)(W,{sx:{mx:.35,mt:1,px:1.1,py:1,borderRadius:1,bgcolor:`action.hover`},children:[(0,J.jsx)(H,{variant:`caption`,sx:{display:`block`,mb:.75,fontWeight:650},children:K(o,`Tùy chọn cho tin nhắn đầu tiên`,`Options for the first message`)}),(0,J.jsxs)(U,{direction:`row`,sx:{alignItems:`center`,gap:.75,flexWrap:`wrap`},children:[(0,J.jsx)(c,{size:`small`,color:`inherit`,startIcon:(0,J.jsx)(v,{}),endIcon:(0,J.jsx)(V,{}),onClick:Ce(`thinking`),children:ai(S,o)}),(0,J.jsx)(c,{size:`small`,color:`inherit`,startIcon:(0,J.jsx)(T,{}),endIcon:(0,J.jsx)(V,{}),onClick:Ce(`permission`),children:m||ge?ta(k,o):k?ai(k,o):K(o,`Quyền theo profile`,`Profile access`)}),(0,J.jsxs)(c,{component:`label`,size:`small`,color:`inherit`,startIcon:(0,J.jsx)(Fr,{}),disabled:!Oe,"aria-label":`${K(o,`Thêm file`,`Add files`)} (${L.length}/4)`,children:[K(o,`Đính kèm`,`Attach`),(0,J.jsx)(`input`,{type:`file`,hidden:!0,multiple:!0,disabled:!Oe,accept:``,onChange:e=>{De(e.target.files),e.currentTarget.value=``}})]})]}),ge&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mt:.75},children:K(o,`Model và quyền theo Harness công ty; thinking chọn ở đây.`,`Models and access follow the company Harness; choose thinking here.`)})]})}),(0,J.jsxs)(U,{direction:`row`,sx:{mt:1,alignItems:`center`,gap:.65,flexWrap:`nowrap`,minWidth:0},children:[(0,J.jsx)(tt,{title:w?K(o,`Ẩn tùy chọn`,`Hide options`):K(o,`Thêm tùy chọn`,`More options`),children:(0,J.jsx)(Mt,{size:`small`,"aria-label":w?K(o,`Ẩn tùy chọn`,`Hide options`):K(o,`Thêm tùy chọn`,`More options`),"aria-expanded":w,"aria-controls":`piagent-new-session-options`,onClick:()=>E(e=>!e),sx:{flex:`0 0 auto`,bgcolor:w?`action.selected`:`transparent`},children:(0,J.jsx)(Ze,{fontSize:`small`,sx:{transition:`transform .16s ease`,transform:w?`rotate(45deg)`:`none`}})})}),(0,J.jsx)(c,{size:`small`,color:`inherit`,startIcon:(0,J.jsx)(M,{}),endIcon:(0,J.jsx)(V,{}),onClick:Ce(`project`),"aria-label":`${K(o,`Project`,`Project`)}: ${fe?.label??K(o,`Chọn project`,`Choose project`)}`,sx:{minWidth:0,maxWidth:{xs:118,sm:250},px:{xs:.75,sm:1},"& .MuiButton-startIcon":{display:{xs:`none`,sm:`inherit`}}},children:(0,J.jsx)(W,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:fe?.label??K(o,`Chọn project`,`Choose project`)})}),(0,J.jsx)(c,{size:`small`,color:`inherit`,startIcon:ge?(0,J.jsx)(oa,{}):(0,J.jsx)(vt,{}),endIcon:(0,J.jsx)(V,{}),onClick:Ce(`model`),"aria-label":`${K(o,`Model`,`Model`)}: ${ge?K(o,`Công ty · agent-watch-auto`,`Company · agent-watch-auto`):he?.displayName??xe?.displayName??K(o,`Mặc định của Pi`,`Pi default`)}`,sx:{minWidth:0,maxWidth:{xs:142,sm:250},px:{xs:.75,sm:1},"& .MuiButton-startIcon":{display:{xs:`none`,sm:`inherit`}}},children:(0,J.jsx)(W,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:ge?K(o,`Công ty · agent-watch-auto`,`Company · agent-watch-auto`):he?`${he.displayName}${he.modelRef===s?.defaultModelRef?K(o,` · mặc định`,` · default`):``}`:xe?.displayName??K(o,`Mặc định của Pi`,`Pi default`)})}),ve&&(0,J.jsx)(tt,{title:Zi(o),arrow:!0,children:(0,J.jsx)(c,{size:`small`,color:`inherit`,variant:`outlined`,startIcon:(0,J.jsx)(ct,{}),"aria-pressed":D,"aria-label":`${Xi(D,o)}. ${Zi(o)}`,onClick:()=>O(e=>!e),sx:{flex:`0 0 auto`,minWidth:0,px:{xs:.75,sm:1},borderRadius:1,borderColor:`divider`,color:`text.secondary`,"& .MuiButton-startIcon":{mr:{xs:0,sm:.65},ml:0},...D?Qi:{}},children:(0,J.jsx)(W,{component:`span`,sx:{display:{xs:`none`,sm:`inline`},whiteSpace:`nowrap`},children:Xi(D,o)})})}),(0,J.jsx)(W,{sx:{flex:1,minWidth:0}}),(0,J.jsx)(Mt,{"aria-label":K(o,`Gửi`,`Send`),disabled:n||h||!fe||!j.trim(),onClick:Ae,sx:{flex:`0 0 auto`,width:34,height:34,borderRadius:999,transition:`transform .12s`,bgcolor:`primary.main`,color:`primary.contrastText`,"&:hover":{bgcolor:`primary.main`,color:`primary.contrastText`,transform:`translateY(-1px)`},"&.Mui-disabled":{bgcolor:`action.disabledBackground`}},children:(0,J.jsx)(Lr,{fontSize:`small`})})]}),ve&&D&&(0,J.jsx)(H,{variant:`caption`,sx:{display:`block`,px:.5,pt:.75,color:`warning.main`},children:Zi(o)})]}),(te||ue||r||h)&&(0,J.jsx)(H,{role:`status`,color:`error`,variant:`caption`,sx:{display:`block`,px:.5,pt:1},children:te??ue??r??K(o,`Không tải được lựa chọn`,`Could not load choices`)})]}),s&&!j&&(0,J.jsx)(U,{direction:`row`,role:`group`,"aria-label":K(o,`Việc mẫu`,`Starter tasks`),sx:{flexWrap:`wrap`,justifyContent:`center`,gap:1,maxWidth:820,mt:`16px !important`},children:La.map(([e,t])=>(0,J.jsx)(wt,{variant:`outlined`,clickable:!0,label:K(o,e,t),onClick:()=>{P(K(o,e,t)),requestAnimationFrame(()=>pe.inputRef.current?.focus())},sx:{height:30,color:`text.secondary`,"&:hover":{color:`text.primary`}}},t))})]}),(0,J.jsxs)(At,{anchorEl:oe,open:ie===`project`,onClose:Te,slotProps:{paper:{sx:{width:310,maxHeight:380}}},children:[(s?.projects??[]).map(e=>(0,J.jsxs)(rt,{selected:_===e.projectRef,onClick:()=>{y(e.projectRef),Te()},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(Wi,{name:`folder`,size:26})}),(0,J.jsx)(ft,{primary:e.label,secondary:e.hint,slotProps:{secondary:{noWrap:!0,title:e.hint}}})]},e.projectRef)),(0,J.jsx)(mt,{}),(0,J.jsxs)(rt,{disabled:ce||s?.projectImport?.status!==`available`,onClick:()=>void Ee(),children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(Ze,{})}),(0,J.jsx)(ft,{primary:ce?K(o,`Đang chọn…`,`Choosing…`):K(o,`Thêm một hoặc nhiều folder`,`Add one or more folders`)})]})]}),(0,J.jsxs)(At,{anchorEl:oe,open:ie===`model`,onClose:Te,slotProps:{paper:{sx:{width:360,maxHeight:440}}},children:[!m&&(_e.length>0||u?.available)&&[(0,J.jsx)(B,{children:K(o,`Công ty`,`Company`)},`company-heading`),..._e.length?_e.map(e=>(0,J.jsxs)(rt,{selected:b===e.modelRef,onClick:()=>{x(e.modelRef),Te()},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(oa,{})}),(0,J.jsx)(ft,{primary:`agent-watch-auto`,secondary:K(o,`Harness công ty · Studio quản lý model`,`Company Harness · models managed by Studio`)})]},e.modelRef)):[(0,J.jsxs)(rt,{disabled:f,onClick:()=>void be(),children:[(0,J.jsx)(Ke,{children:f?(0,J.jsx)(me,{size:20}):(0,J.jsx)(oa,{})}),(0,J.jsx)(ft,{primary:`agent-watch-auto`,secondary:f?K(o,`Đang kết nối…`,`Connecting…`):zi(u,o),slotProps:{secondary:{sx:{whiteSpace:`normal`}}}})]},`company-connect`)],(0,J.jsx)(B,{children:K(o,`Cá nhân`,`Personal`)},`personal-heading`)],!s?.defaultModelRef&&(0,J.jsxs)(rt,{selected:!b,onClick:()=>{x(``),Te()},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(vt,{})}),(0,J.jsx)(ft,{primary:K(o,`Model mặc định của Pi`,`Pi default model`)})]}),ye.map(e=>(0,J.jsxs)(rt,{selected:b===e.modelRef,onClick:()=>{x(e.modelRef),Te()},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(Wi,{name:e.provider,size:26})}),(0,J.jsx)(ft,{primary:e.displayName,secondary:e.modelRef===s?.defaultModelRef?K(o,`Mặc định · ${e.provider} · High`,`Default · ${e.provider} · High`):e.provider})]},e.modelRef))]}),(0,J.jsx)(At,{anchorEl:oe,open:ie===`thinking`,onClose:Te,slotProps:{paper:{sx:{width:250,maxHeight:400}}},children:Se.map(e=>(0,J.jsxs)(rt,{value:e,selected:S===e,onClick:()=>{C(e),Te()},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(v,{})}),(0,J.jsx)(ft,{primary:ai(e,o)})]},e))}),(0,J.jsx)(At,{anchorEl:oe,open:ie===`permission`,onClose:Te,slotProps:{paper:{sx:{width:310}}},children:m||ge?[(0,J.jsxs)(rt,{selected:k!==`trusted-full-access`&&k!==`bypass`,onClick:()=>{A(null),Te()},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(T,{})}),(0,J.jsx)(ft,{primary:ta(null,o),secondary:K(o,`Hỏi trước mỗi lệnh cần internet`,`Asks before each command that needs the internet`)})]},`ask`),(0,J.jsxs)(rt,{selected:k===`trusted-full-access`,onClick:()=>{Te(),I(`trusted-full-access`)},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(T,{color:`warning`})}),(0,J.jsx)(ft,{primary:ta(`trusted-full-access`,o),secondary:K(o,`Chỉ hỏi việc bắt buộc phải xác nhận`,`Asks only what must be confirmed`)})]},`full`),...he?.managedBypass?[(0,J.jsxs)(rt,{selected:k===`bypass`,onClick:()=>{Te(),I(`bypass`)},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(T,{color:`error`})}),(0,J.jsx)(ft,{primary:`Bypass`,secondary:K(o,`Không hỏi gì; admin Studio có thể tắt`,`Asks nothing; a Studio administrator can turn it off`)})]},`bypass`)]:[]]:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(rt,{selected:k===null,onClick:()=>{A(null),Te()},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(T,{})}),(0,J.jsx)(ft,{primary:K(o,`Theo profile project`,`Project profile default`)})]}),[`read-only`,`workspace-write`,`trusted-full-access`,`bypass`].map(e=>(0,J.jsxs)(rt,{selected:k===e,onClick:()=>{Te(),e===`trusted-full-access`||e===`bypass`?I(e):A(e)},children:[(0,J.jsx)(Ke,{children:(0,J.jsx)(T,{color:e===`bypass`?`error`:e===`trusted-full-access`?`warning`:void 0})}),(0,J.jsx)(ft,{primary:ai(e,o)})]},e))]})}),(0,J.jsx)(Ji,{open:F!==null,title:F===`bypass`?K(o,`Tạo cuộc trò chuyện với Bypass?`,`Create with Bypass?`):K(o,`Tạo session với toàn quyền?`,`Create with full access?`),description:F===`bypass`?m||ge?ra(o):na(o):m||ge?ia(o):K(o,`Session mới được phép đọc, sửa file và chạy command trong runtime. Xóa dữ liệu và gửi ra ngoài vẫn cần xác nhận riêng.`,`The new session may read and edit files and run commands. Deletion and external transfer still require separate approval.`),cancelLabel:K(o,`Hủy`,`Cancel`),confirmLabel:F===`bypass`?K(o,`Dùng Bypass`,`Use Bypass`):K(o,`Dùng toàn quyền`,`Use full access`),onCancel:()=>I(null),onConfirm:()=>{let e=F;I(null),e&&A(e)}})]})}var za=(e,t,n)=>e===`vi`?t:n,Ba=[[`⌘K`,`Mở bảng lệnh`,`Open the command palette`],[`⌘⇧O`,`Cuộc trò chuyện mới`,`New chat`],[`⌘,`,`Cài đặt`,`Settings`],[`⌘/`,`Phím tắt và lệnh /`,`Shortcuts and / commands`],[`Esc`,`Dừng lượt đang chạy (trong ô nhập)`,`Stop the running turn (in the composer)`]];function Va(e,t){let n=/^\/([a-z][a-z-]*)(?:\s+([\s\S]*))?$/.exec(e.trim()),r=n?t.find(e=>e.name===n[1]):void 0;return r?{command:r,argument:(n[2]??``).trim()}:null}var Ha=(e,t,n,r)=>({tone:`error`,text:t instanceof Error&&t.message===`session-runtime-busy`?za(e,`${n}: lượt này đang chạy, thử lại khi xong.`,`${r}: this turn is running; try again when it ends.`):za(e,`${n}. Thử lại.`,`${r}. Try again.`)});async function Ua(e,t,n,r,i){try{return await t(),n}catch(t){return Ha(e,t,r,i)}}function Wa(e){let{locale:t,actions:n}=e,r=(e,n)=>za(t,e,n),i=(e,t)=>({tone:`success`,text:r(e,t)}),a=(e,t)=>({tone:`warning`,text:r(e,t)}),o=[],s=(e,t,n,i,a)=>o.push({name:e,argumentHint:t,description:r(n,i),run:a});return s(`help`,null,`Danh sách lệnh / và phím tắt`,`The / commands and keyboard shortcuts`,async()=>({tone:`info`,text:[...o.map(e=>`/${e.name}${e.argumentHint?` ${e.argumentHint}`:``} — ${e.description}`),...Ba.map(([e,t,n])=>`${e} — ${r(t,n)}`)].join(`
|
|
38
|
-
`)})),s(`new`,null,`Cuộc trò chuyện mới`,`New chat`,async()=>(n.newChat(),i(`Đã mở cuộc trò chuyện mới.`,`Opened a new chat.`))),s(`stop`,null,`Dừng lượt đang chạy`,`Stop the running turn`,async()=>e.running?Ua(t,n.stop,i(`Đã dừng lượt đang chạy.`,`Stopped the running turn.`),`Chưa dừng được`,`Could not stop`):{tone:`info`,text:r(`Không có lượt nào đang chạy.`,`No turn is running.`)}),s(`name`,`<tên>`,`Đổi tên cuộc trò chuyện`,`Rename the conversation`,async e=>e?Ua(t,()=>n.rename(e.slice(0,200)),i(`Đã đổi tên thành “${e.slice(0,200)}”.`,`Renamed to “${e.slice(0,200)}”.`),`Chưa đổi được tên`,`Could not rename`):a(`Cách dùng: /name <tên mới>`,`Usage: /name <new name>`)),s(`fork`,null,`Tạo cuộc trò chuyện mới từ cuộc này`,`Fork this conversation`,async()=>Ua(t,n.fork,i(`Đã tạo bản sao của cuộc trò chuyện.`,`Forked the conversation.`),`Chưa tạo được bản sao`,`Could not fork`)),s(`pin`,null,e.pinned?`Bỏ ghim cuộc trò chuyện`:`Ghim cuộc trò chuyện`,e.pinned?`Unpin the conversation`:`Pin the conversation`,async()=>Ua(t,()=>n.pin(!e.pinned),e.pinned?i(`Đã bỏ ghim.`,`Unpinned.`):i(`Đã ghim.`,`Pinned.`),`Chưa đổi được ghim`,`Could not change the pin`)),s(`archive`,null,`Lưu trữ cuộc trò chuyện`,`Archive the conversation`,async()=>Ua(t,n.archive,i(`Đã lưu trữ cuộc trò chuyện.`,`Archived the conversation.`),`Chưa lưu trữ được`,`Could not archive`)),e.thinkingLevels.length&&s(`thinking`,`<${e.thinkingLevels.join(`|`)}>`,`Đổi mức suy luận`,`Change the thinking level`,async r=>e.thinkingLevels.includes(r)?Ua(t,()=>n.setThinking(r),i(`Đã đổi thinking sang ${r}.`,`Thinking is now ${r}.`),`Chưa đổi được thinking`,`Could not change thinking`):a(`Cách dùng: /thinking ${e.thinkingLevels.join(`|`)}`,`Usage: /thinking ${e.thinkingLevels.join(`|`)}`)),e.company?(s(`undo`,null,`Hoàn tác file mà lượt trước của agent đã sửa`,`Undo the files the agent's last turn changed`,async()=>({send:!0})),e.fast&&s(`fast`,`[on|off]`,`Bật/tắt Fast (Harness cho phép)`,`Turn Fast on or off (where the Harness allows it)`,async r=>{let o=r===`on`?!0:r===`off`?!1:r?null:e.fast!==`on`;return o===null?a(`Cách dùng: /fast on|off`,`Usage: /fast on|off`):Ua(t,()=>n.setFast(o),o?i(`Đã bật Fast.`,`Fast is on.`):i(`Đã tắt Fast.`,`Fast is off.`),`Chưa đổi được Fast`,`Could not change Fast`)}),s(`bypass`,`<on|full|off>`,`Bypass (không hỏi gì), Toàn quyền (chỉ hỏi việc bắt buộc) hoặc Hỏi trước`,`Bypass (asks nothing), Full access (asks only what must be asked) or Ask first`,async o=>o===`off`?Ua(t,()=>n.setPermission(`workspace-write`),i(`Đã chuyển sang Hỏi trước.`,`Switched to Ask first.`),`Chưa đổi được quyền`,`Access not changed`):o===`full`?{confirm:{title:r(`Bật Toàn quyền?`,`Turn on Full access?`),confirmLabel:r(`Bật Toàn quyền`,`Turn on Full access`),description:r(`Lệnh cần internet hoặc Docker chạy không hỏi; push, deploy và lệnh trên máy vẫn hỏi.`,`Commands that need the internet or Docker run without asking; pushes, deploys and commands on this machine still ask.`),run:()=>Ua(t,()=>n.setPermission(`trusted-full-access`),i(`Đã bật Toàn quyền.`,`Full access is on.`),`Chưa đổi được quyền`,`Access not changed`)}}:o===`on`?e.bypass?{confirm:{title:r(`Bật Bypass?`,`Turn on Bypass?`),confirmLabel:r(`Bật Bypass`,`Turn on Bypass`),description:r(`Không hỏi gì nữa: internet, Docker, lệnh trên máy, push, deploy, migration đều chạy luôn. Lệnh thường vẫn trong sandbox; /undo vẫn dùng được.`,`Nothing is asked any more: internet, Docker, commands on this machine, pushes, deploys and migrations all run. Plain commands stay in the sandbox; /undo still works.`),run:()=>Ua(t,()=>n.setPermission(`bypass`),i(`Đã bật Bypass.`,`Bypass is on.`),`Chưa đổi được quyền`,`Access not changed`)}}:a(`Harness của team đã tắt Bypass (admin Studio). Dùng /bypass full cho Toàn quyền.`,`The team's Harness has Bypass off (Studio administrator). Use /bypass full for Full access.`):a(`Cách dùng: /bypass on|full|off`,`Usage: /bypass on|full|off`))):(s(`model`,`<tên model>`,`Đổi model`,`Change the model`,async r=>{let o=await e.loadModels().catch(()=>[]),s=r.toLowerCase(),c=s?o.filter(e=>e.label.toLowerCase()===s||e.modelRef.toLowerCase()===s):[],l=c.length?c:s?o.filter(e=>e.label.toLowerCase().includes(s)||e.modelRef.toLowerCase().includes(s)):[];return l.length===1?Ua(t,()=>n.setModel(l[0].modelRef),i(`Đã đổi model sang ${l[0].label}.`,`The model is now ${l[0].label}.`),`Chưa đổi được model`,`Could not change the model`):a(`Cách dùng: /model <tên>. Có: ${o.map(e=>e.label).slice(0,12).join(`, `)||`—`}`,`Usage: /model <name>. Available: ${o.map(e=>e.label).slice(0,12).join(`, `)||`—`}`)}),s(`permission`,`<read-only|ask|full|bypass>`,`Đổi quyền của cuộc trò chuyện`,`Change the conversation's access`,async e=>{let o=e===`read-only`?`read-only`:e===`ask`?`workspace-write`:e===`full`?`trusted-full-access`:e===`bypass`?`bypass`:null;if(!o)return a(`Cách dùng: /permission read-only|ask|full|bypass`,`Usage: /permission read-only|ask|full|bypass`);let s=()=>Ua(t,()=>n.setPermission(o),i(`Đã đổi quyền sang ${e}.`,`Access is now ${e}.`),`Chưa đổi được quyền`,`Access not changed`);return o===`bypass`?{confirm:{title:r(`Bật Bypass?`,`Turn on Bypass?`),confirmLabel:r(`Bật Bypass`,`Turn on Bypass`),description:r(`Không hỏi, không chặn gì trong cuộc trò chuyện này (xoá, push, file được bảo vệ đều chạy luôn). Output vẫn che secret, /undo vẫn hoàn tác được.`,`Nothing is asked or blocked in this conversation (deletes, pushes and protected files all run). Output is still redacted and /undo still works.`),run:s}}:o===`trusted-full-access`?{confirm:{title:r(`Bật toàn quyền?`,`Enable full access?`),confirmLabel:r(`Bật toàn quyền`,`Enable full access`),description:r(`Session được đọc, sửa file và chạy command trong phạm vi runtime; xoá hoặc gửi dữ liệu ra ngoài vẫn cần xác nhận riêng.`,`The session may read and edit files and run commands within the runtime; destructive actions and external transfers still ask.`),run:s}}:s()})),s(`changes`,null,`Mở Source Changes`,`Open Source Changes`,async()=>(n.openChanges(),i(`Đã mở Source Changes.`,`Opened Source Changes.`))),s(`settings`,null,`Mở Cài đặt`,`Open Settings`,async()=>(n.openSettings(),i(`Đã mở Cài đặt.`,`Opened Settings.`))),o}var Ga=`piagent dashboard`;function Ka(){return(0,q.useSyncExternalStore)(Ut,Ht,Ht)}function qa({locale:e}){let[t,n]=(0,q.useState)(!1);return(0,J.jsxs)(U,{role:`alert`,spacing:2,sx:{minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,px:2,textAlign:`center`},children:[(0,J.jsx)(H,{variant:`h6`,component:`h1`,children:K(e,`Tab này đã hết phiên đăng nhập`,`This tab is no longer signed in`)}),(0,J.jsx)(H,{color:`text.secondary`,sx:{maxWidth:520},children:K(e,`Piagent vừa khởi động lại, tab không được dùng quá 8 giờ, hoặc tab được mở từ một link cũ. Các cuộc trò chuyện vẫn còn nguyên — mở lại Piagent để vào tiếp.`,`Piagent restarted, this tab was unused for over 8 hours, or this tab came from an old link. Your conversations are kept — open Piagent again to continue.`)}),(0,J.jsxs)(W,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`,justifyContent:`center`},children:[(0,J.jsx)(W,{component:`code`,sx:{px:1.5,py:.75,borderRadius:1,bgcolor:`action.hover`,fontSize:`.9rem`},children:Ga}),(0,J.jsx)(c,{size:`small`,variant:`outlined`,onClick:()=>{navigator.clipboard?.writeText(Ga).then(()=>n(!0),()=>n(!1))},children:t?K(e,`Đã chép`,`Copied`):K(e,`Chép lệnh`,`Copy command`)})]}),(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:K(e,`Chạy lệnh trên trong terminal, hoặc bấm WebUI trong Agent Watch. Sau đó có thể đóng tab này.`,`Run it in a terminal, or choose WebUI in Agent Watch. You can close this tab afterwards.`)})]})}var Ja=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function Ya(e,t){let n;if(t?.method===`POST`){let r=Bt();if(!r)throw new Ja(403,`mutation-authority-rejected`);n=await zt(e,{...t,credentials:`same-origin`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":r}})}else n=await fetch(e,{...t,credentials:`same-origin`,headers:{Accept:`application/json`}});n.status===401&&Vt();let r=await n.json().catch(()=>null);if(!n.ok)throw new Ja(n.status,typeof r?.error?.code==`string`?r.error.code:`request-${n.status}`);return r}var Xa=e=>Ya(`/api/v1/updates`,{signal:e}),Za=()=>Ya(`/api/v1/updates/check`,{method:`POST`,body:`{}`}),Qa=e=>Ya(`/api/v1/updates/apply`,{method:`POST`,body:JSON.stringify({version:e})}),$a=e=>e?.job?.state===`starting`||e?.job?.state===`running`,eo=(0,q.createContext)(null);function to({children:e}){let[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(!0),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(!1),[l,u]=(0,q.useState)(null),d=(0,q.useRef)(!0),f=(0,q.useCallback)(async()=>{try{if(await Wt(),Ht())return;let e=await Xa();d.current&&(n(e),i(!0))}catch(e){d.current&&e instanceof Ja&&e.status===404&&i(!1)}},[]),p=$a(t),m=t!==null||!r;(0,q.useEffect)(()=>{d.current=!0,f();let e=setInterval(()=>void f(),m?p?3e3:6e4:2e3);return()=>{clearInterval(e)}},[f,p,m]),(0,q.useEffect)(()=>()=>{d.current=!1},[]);let h=(0,q.useCallback)(async()=>{o(!0),u(null);try{n(await Za())}catch(e){u(e instanceof Error?e.message:`update-unavailable`)}finally{o(!1)}},[]),g=(0,q.useCallback)(async()=>{let e=t?.piagent.latest;if(e){c(!0),u(null);try{await Qa(e),await f()}catch(e){u(e instanceof Error?e.message:`update-unavailable`),await f()}finally{c(!1)}}},[t?.piagent.latest,f]),_=(0,q.useMemo)(()=>({status:t,supported:r,checking:a||!!t?.checking,applying:s,error:l,refresh:f,check:h,apply:g}),[t,r,a,s,l,f,h,g]);return(0,J.jsx)(eo.Provider,{value:_,children:e})}function no(){let e=(0,q.useContext)(eo);if(!e)throw Error(`Piagent update state is missing`);return e}var X=`~/.pi/piagent-update-job.log`;function ro(e,t){let n={"update-blocked-running":[`Đang có cuộc trò chuyện chạy. Cập nhật khi chúng xong, hoặc bấm Dừng.`,`A conversation is running. Update when it finishes, or stop it.`],"update-already-running":[`Một lần cập nhật khác đang chạy.`,`Another update is running.`],"update-version-changed":[`Đã có bản mới hơn bản bạn thấy. Kiểm tra lại rồi cập nhật.`,`A newer release appeared. Check again, then update.`],"update-not-available":[`Máy này đã ở bản mới nhất.`,`This machine is already up to date.`],"update-not-installable":[`Bản Piagent này không tự cập nhật được từ dashboard.`,`This Piagent cannot update itself from the dashboard.`]}[t];return n?K(e,n[0],n[1]):K(e,`Chưa cập nhật được. Thử lại sau.`,`The update could not start. Try again later.`)}function io(e,t){return t.state===`succeeded`?t.reason===`dashboard-restart-failed`?{severity:`warning`,text:K(e,`Đã cập nhật lên ${t.installed??t.to}, nhưng dashboard chưa tự mở lại. Chạy \`piagent dashboard restart\`.`,`Updated to ${t.installed??t.to}, but the dashboard did not restart. Run \`piagent dashboard restart\`.`)}:{severity:`success`,text:K(e,`Đã cập nhật Piagent ${t.from} → ${t.installed??t.to}.`,`Updated Piagent ${t.from} → ${t.installed??t.to}.`)}:t.state===`failed`?{severity:`error`,text:`${t.reason===`update-interrupted`?K(e,`Lần cập nhật bị ngắt giữa chừng.`,`The update was interrupted.`):t.reason===`update-version-mismatch`?K(e,`Bản cài xong không đúng bản đã chọn.`,`The installed release is not the one chosen.`):K(e,`Lệnh cập nhật báo lỗi.`,`The update command failed.`)} ${K(e,`Chi tiết trong ${X}.`,`Details are in ${X}.`)}`}:null}function ao(e,t){if(!t)return K(e,`chưa kiểm tra`,`not checked yet`);let n=Math.max(0,Math.round((Date.now()-Date.parse(t))/6e4));if(n<1)return K(e,`vừa xong`,`just now`);if(n<60)return K(e,`${n} phút trước`,`${n} min ago`);let r=Math.round(n/60);return r<48?K(e,`${r} giờ trước`,`${r} h ago`):K(e,`${Math.round(r/24)} ngày trước`,`${Math.round(r/24)} days ago`)}function oo({name:e,detail:t,chip:n,tone:r}){return(0,J.jsxs)(U,{direction:{xs:`column`,sm:`row`},sx:{alignItems:{sm:`center`},justifyContent:`space-between`,gap:1.5,p:2.25},children:[(0,J.jsxs)(W,{sx:{minWidth:0},children:[(0,J.jsx)(H,{sx:{fontWeight:650},children:e}),(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:t})]}),(0,J.jsx)(wt,{size:`small`,label:n,color:r,variant:r==="default"?`outlined`:`filled`,sx:{alignSelf:{xs:`flex-start`,sm:`center`}}})]})}function so(e,t){let n=[];return t.piagent.updateAvailable&&n.push(K(e,`Piagent ${t.piagent.installed} → ${t.piagent.latest}`,`Piagent ${t.piagent.installed} → ${t.piagent.latest}`)),t.pi.updateAvailable&&n.push(K(e,`Pi ${t.pi.installed??`?`} → ${t.pi.required} (bản Piagent ${t.piagent.latest} yêu cầu)`,`Pi ${t.pi.installed??`?`} → ${t.pi.required} (the version Piagent ${t.piagent.latest} requires)`)),n.push(K(e,`Dashboard khởi động lại và mở trong tab mới; tab này có thể đóng.`,`The dashboard restarts and opens in a new tab; this tab can be closed.`)),n}function co(){let{locale:e}=Pt(),{status:t,supported:n,checking:r,applying:i,error:a,check:s,apply:l}=no(),[u,f]=(0,q.useState)(!1),p=(0,q.useRef)(null),m=$a(t);if((0,q.useEffect)(()=>{m&&!p.current?.closest(`[role=dialog]`)?.contains(document.activeElement)&&p.current?.focus()},[m]),!n)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(H,{component:`h1`,variant:`h1`,sx:{mb:3},children:K(e,`Cập nhật`,`Updates`)}),(0,J.jsx)(o,{severity:`info`,children:K(e,`Gateway này chưa hỗ trợ kiểm tra cập nhật.`,`This Gateway does not check for updates.`)})]});let h=t?.job,g=h?io(e,h):null,_=(t?.runningConversations??0)>0,v=t?[K(e,`Đang dùng ${t.pi.installed??`—`}`,`Using ${t.pi.installed??`—`}`),t.pi.required?K(e,`Piagent ${t.piagent.latest} cần ${t.pi.required}`,`Piagent ${t.piagent.latest} needs ${t.pi.required}`):null].filter(Boolean).join(` · `):`—`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(H,{component:`h1`,variant:`h1`,ref:p,tabIndex:-1,sx:{mb:1},children:K(e,`Cập nhật`,`Updates`)}),(0,J.jsx)(H,{color:`text.secondary`,sx:{mb:3},children:K(e,`Piagent và Pi được cập nhật cùng nhau: Pi luôn lên đúng bản mà Piagent mới đã kiểm chứng.`,`Piagent and Pi update together: Pi always moves to the version the new Piagent is qualified on.`)}),(0,J.jsxs)(te,{variant:`outlined`,sx:{borderRadius:1,overflow:`hidden`},children:[(0,J.jsx)(oo,{name:`Piagent`,detail:K(e,`Đang dùng ${t?.piagent.installed??`—`}`,`Using ${t?.piagent.installed??`—`}`),chip:t?.piagent.updateAvailable?K(e,`Có bản ${t.piagent.latest}`,`${t.piagent.latest} available`):t?.piagent.latest?K(e,`Mới nhất`,`Up to date`):K(e,`Chưa rõ`,`Unknown`),tone:t?.piagent.updateAvailable?`primary`:`default`}),(0,J.jsx)(mt,{}),(0,J.jsx)(oo,{name:`Pi`,detail:v,chip:t?.pi.updateAvailable?K(e,`Lên ${t.pi.required}`,`To ${t.pi.required}`):K(e,`Đúng bản`,`Matches`),tone:t?.pi.updateAvailable?`primary`:`default`}),t?.pi.newerUntested&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(mt,{}),(0,J.jsx)(W,{sx:{px:2.25,py:1.5},children:(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:K(e,`Pi đã có bản ${t.pi.latest}, nhưng Piagent chưa kiểm chứng bản đó (chưa tương thích). Pi sẽ được nâng khi một bản Piagent hỗ trợ nó.`,`Pi ${t.pi.latest} is out, but Piagent is not qualified on it yet (not compatible). Pi moves when a Piagent release supports it.`)})})]}),(0,J.jsx)(mt,{}),(0,J.jsxs)(U,{direction:{xs:`column`,sm:`row`},sx:{alignItems:{sm:`center`},justifyContent:`space-between`,gap:1.5,p:2.25},children:[(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:K(e,`Kiểm tra lần cuối: ${ao(e,t?.checkedAt??null)} · tự kiểm tra ${(t?.checkEveryHours??1)===1?`mỗi giờ`:`mỗi ${t?.checkEveryHours} giờ`}`,`Last checked: ${ao(e,t?.checkedAt??null)} · checks every ${(t?.checkEveryHours??1)===1?`hour`:`${t?.checkEveryHours} hours`}`)}),(0,J.jsx)(c,{variant:`outlined`,disabled:r||m||!t?.installable,onClick:()=>void s(),startIcon:r?(0,J.jsx)(me,{size:14}):void 0,children:K(e,`Kiểm tra ngay`,`Check now`)})]})]}),(0,J.jsxs)(W,{sx:{mt:2.5,display:`grid`,gap:1.5},children:[t&&!t.installable&&(0,J.jsx)(o,{severity:`info`,children:t.reason===`company-runtime`?K(e,`Đây là runtime công ty; cập nhật từ dashboard Piagent.`,`This is the company runtime; update from the Piagent dashboard.`):K(e,`Piagent này chạy từ mã nguồn (git). Cập nhật bằng git pull rồi cài lại.`,`This Piagent runs from a source checkout. Update it with git pull and reinstall.`)}),m&&(0,J.jsx)(o,{severity:`info`,icon:(0,J.jsx)(me,{size:18}),children:K(e,`Đang cập nhật lên Piagent ${h?.to}… Xong, dashboard mở lại trong tab mới; tab này có thể đóng.`,`Updating to Piagent ${h?.to}… When done, the dashboard opens in a new tab; this tab can be closed.`)}),!m&&g&&(0,J.jsx)(o,{severity:g.severity,children:g.text}),!m&&h?.bindingChanged&&(0,J.jsx)(o,{severity:`warning`,children:K(e,`Bản mới đổi trình khởi chạy công ty: Agent Watch tự cập nhật cấu hình trong vài phút (cần Agent Watch đang chạy), rồi chế độ công ty dùng lại được.`,`The new release changed the company launcher: Agent Watch updates the configuration within a few minutes (it must be running), then company mode works again.`)}),a&&(0,J.jsx)(o,{severity:`error`,role:`alert`,children:ro(e,a)}),t?.installable&&t.updateAvailable&&!m&&(0,J.jsxs)(U,{direction:{xs:`column`,sm:`row`},sx:{alignItems:{sm:`center`},gap:1.5},children:[(0,J.jsx)(c,{variant:`contained`,size:`large`,startIcon:i?(0,J.jsx)(me,{size:16,color:`inherit`}):(0,J.jsx)(L,{}),disabled:i||_,onClick:()=>f(!0),children:K(e,`Cập nhật lên Piagent ${t.piagent.latest}`,`Update to Piagent ${t.piagent.latest}`)}),_&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:K(e,`${t.runningConversations} cuộc trò chuyện đang chạy; nút mở lại khi chúng xong.`,`${t.runningConversations} conversation(s) running; available once they finish.`)})]})]}),(0,J.jsxs)(d,{open:u&&!!t,onClose:()=>f(!1),fullWidth:!0,maxWidth:`xs`,"aria-labelledby":`piagent-update-confirm`,children:[(0,J.jsx)(fe,{id:`piagent-update-confirm`,children:K(e,`Cập nhật Piagent?`,`Update Piagent?`)}),(0,J.jsx)(he,{children:(0,J.jsx)(W,{component:`ul`,sx:{m:0,pl:2.5,display:`grid`,gap:.75},children:t&&so(e,t).map(e=>(0,J.jsx)(H,{component:`li`,variant:`body2`,children:e},e))})}),(0,J.jsxs)(x,{children:[(0,J.jsx)(c,{onClick:()=>f(!1),children:K(e,`Để sau`,`Later`)}),(0,J.jsx)(c,{variant:`contained`,onClick:()=>{f(!1),l()},children:K(e,`Cập nhật`,`Update`)})]})]})]})}var lo=`piagent-update-snooze`,uo=`piagent-update-job-seen`,fo=36e5;function po(e){try{return window.localStorage.getItem(e)}catch{return null}}function mo(e,t){try{window.localStorage.setItem(e,t)}catch{}}function ho(e,t){try{let n=JSON.parse(po(lo)??`null`);return n?.version===e&&typeof n.until==`number`&&t<n.until}catch{return!1}}function go({locale:e,onDetails:t}){let{status:n,applying:r,error:i,apply:a}=no(),[s,l]=(0,q.useState)(()=>Date.now()),[u,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null);(0,q.useEffect)(()=>{let e=window.setInterval(()=>l(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let h=n?.piagent.latest??null,g=n?.job??null;(0,q.useEffect)(()=>{!g||g.state!==`succeeded`||po(uo)===g.startedAt||(mo(uo,g.startedAt),m(K(e,`Đã cập nhật Piagent ${g.from} → ${g.installed??g.to}.`,`Piagent updated ${g.from} → ${g.installed??g.to}.`)))},[g,e]);let _=!!(n?.installable&&n.updateAvailable&&h&&!$a(n))&&u!==h&&!ho(h,s),v=()=>{h&&(mo(lo,JSON.stringify({version:h,until:Date.now()+fo})),f(h))},y=(n?.runningConversations??0)>0;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(d,{open:_,onClose:v,fullWidth:!0,maxWidth:`xs`,"aria-labelledby":`piagent-update-offer`,children:[(0,J.jsxs)(fe,{id:`piagent-update-offer`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,J.jsx)(L,{color:`primary`}),K(e,`Có bản Piagent mới: ${h}`,`Piagent ${h} is available`)]}),(0,J.jsxs)(he,{sx:{display:`grid`,gap:1.5},children:[(0,J.jsx)(W,{component:`ul`,sx:{m:0,pl:2.5,display:`grid`,gap:.75},children:n&&so(e,n).map(e=>(0,J.jsx)(H,{component:`li`,variant:`body2`,children:e},e))}),y&&(0,J.jsx)(o,{severity:`info`,children:K(e,`${n?.runningConversations} cuộc trò chuyện đang chạy. Cập nhật khi chúng xong — dialog này sẽ nhắc lại.`,`${n?.runningConversations} conversation(s) running. Update once they finish — this will ask again.`)}),i&&(0,J.jsx)(o,{severity:`error`,children:ro(e,i)})]}),(0,J.jsxs)(x,{sx:{flexWrap:`wrap`,gap:1},children:[(0,J.jsx)(c,{onClick:v,children:K(e,`Để sau (nhắc lại sau 1 giờ)`,`Later (ask again in an hour)`)}),(0,J.jsx)(c,{onClick:()=>{f(h),t()},children:K(e,`Xem chi tiết`,`Details`)}),(0,J.jsx)(c,{variant:`contained`,disabled:y||r,onClick:()=>{f(h),a().then(t)},children:K(e,`Cập nhật ngay`,`Update now`)})]})]}),(0,J.jsx)(gt,{open:p!==null,autoHideDuration:8e3,onClose:()=>m(null),anchorOrigin:{vertical:`top`,horizontal:`center`},children:(0,J.jsx)(o,{severity:`success`,variant:`filled`,onClose:()=>m(null),children:p})})]})}function _o(e){return ce(`MuiSkeleton`,e)}Et(`MuiSkeleton`,[`root`,`text`,`rectangular`,`rounded`,`circular`,`pulse`,`wave`,`withChildren`,`fitContent`,`heightAuto`]);var vo=e=>{let{classes:t,variant:n,animation:r,hasChildren:i,width:a,height:o}=e;return et({root:[`root`,n,r,i&&`withChildren`,i&&!a&&`fitContent`,i&&!o&&`heightAuto`]},_o,t)},yo=Je`
|
|
39
|
-
0% {
|
|
40
|
-
opacity: 1;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
50% {
|
|
44
|
-
opacity: 0.4;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
100% {
|
|
48
|
-
opacity: 1;
|
|
49
|
-
}
|
|
50
|
-
`,bo=Je`
|
|
51
|
-
0% {
|
|
52
|
-
transform: translateX(-100%);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
50% {
|
|
56
|
-
/* +0.5s of delay between each loop */
|
|
57
|
-
transform: translateX(100%);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
100% {
|
|
61
|
-
transform: translateX(100%);
|
|
62
|
-
}
|
|
63
|
-
`,xo=typeof yo==`string`?null:a`
|
|
64
|
-
animation: ${yo} 2s ease-in-out 0.5s infinite;
|
|
65
|
-
`,So=typeof bo==`string`?null:a`
|
|
66
|
-
&::after {
|
|
67
|
-
animation: ${bo} 2s linear 0.5s infinite;
|
|
68
|
-
}
|
|
69
|
-
`,Co=Ae(`span`,{name:`MuiSkeleton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],n.animation!==!1&&t[n.animation],n.hasChildren&&t.withChildren,n.hasChildren&&!n.width&&t.fitContent,n.hasChildren&&!n.height&&t.heightAuto]}})(Te(({theme:e})=>{let t=Qn(e.shape.borderRadius)||`px`,n=$n(e.shape.borderRadius),i=r(e,{animation:`none`}),a=r(e,{"&::after":{animation:`none`,display:`none`}});return{display:`block`,backgroundColor:e.vars?e.vars.palette.Skeleton.bg:e.alpha(e.palette.text.primary,e.palette.mode===`light`?.11:.13),height:`1.2em`,variants:[{props:{variant:`text`},style:{marginTop:0,marginBottom:0,height:`auto`,transformOrigin:`0 55%`,transform:`scale(1, 0.60)`,borderRadius:`${n}${t}/${Math.round(n/.6*10)/10}${t}`,"&:empty:before":{content:`"\\00a0"`}}},{props:{variant:`circular`},style:{borderRadius:`50%`}},{props:{variant:`rounded`},style:{borderRadius:(e.vars||e).shape.borderRadius}},{props:({ownerState:e})=>e.hasChildren,style:{"& > *":{visibility:`hidden`}}},{props:({ownerState:e})=>e.hasChildren&&!e.width,style:{maxWidth:`fit-content`}},{props:({ownerState:e})=>e.hasChildren&&!e.height,style:{height:`auto`}},{props:{animation:`pulse`},style:xo||{animation:`${yo} 2s ease-in-out 0.5s infinite`}},...i?[{props:{animation:`pulse`},style:i}]:[],{props:{animation:`wave`},style:{position:`relative`,overflow:`hidden`,WebkitMaskImage:`-webkit-radial-gradient(white, black)`,"&::after":{background:`linear-gradient(
|
|
70
|
-
90deg,
|
|
71
|
-
transparent,
|
|
72
|
-
${(e.vars||e).palette.action.hover},
|
|
73
|
-
transparent
|
|
74
|
-
)`,content:`""`,position:`absolute`,transform:`translateX(-100%)`,bottom:0,left:0,right:0,top:0}}},{props:{animation:`wave`},style:So||{"&::after":{animation:`${bo} 2s linear 0.5s infinite`}}},...a?[{props:{animation:`wave`},style:a}]:[]]}})),wo=q.forwardRef(function(e,t){let n=it({props:e,name:`MuiSkeleton`}),{animation:r=`pulse`,className:i,component:a=`span`,height:o,style:s,variant:c=`text`,width:l,...d}=n,f={...n,animation:r,component:a,variant:c,hasChildren:!!d.children},p=vo(f);return(0,J.jsx)(Co,{as:a,ref:t,className:u(p.root,i),ownerState:f,...d,style:{width:l,height:o,...s}})}),To=(e,t,n)=>e===`vi`?t:n,Eo={"workspace-patch":[`Sửa trong project`,`Change in the project`],"external-provider-action":[`Tác động ra bên ngoài`,`Reaches outside this machine`]},Do={"one-shell-command":[`Đúng một lệnh`,`This one command`],"network-command-once":[`Đúng một lệnh, có mạng`,`This one command, with network`],"docker-command-once":[`Đúng một lệnh, có mạng và Docker`,`This one command, with network and Docker`],"host-command-once":[`Đúng một lệnh, chạy trên máy bạn (ngoài sandbox)`,`This one command, on your machine (outside the sandbox)`],"start-docker-once":[`Mở Docker trên máy`,`Start Docker on this machine`],"one-external-action":[`Đúng một hành động`,`This one action`]},Oo={"Run this exact command once, after the guard checks the working tree again.":[`Chạy đúng lệnh này một lần, sau khi guard kiểm tra lại thư mục làm việc.`,``],"The command does not run; the agent is told you declined.":[`Lệnh không chạy; agent được báo là bạn đã từ chối.`,``],"Run this exact action once, after the guard checks its authority again.":[`Thực hiện đúng hành động này một lần, sau khi guard kiểm tra lại quyền.`,``],"The action does not run; nothing outside changes.":[`Hành động không chạy; không có gì bên ngoài bị thay đổi.`,``],"Run this exact command once, with internet access.":[`Chạy đúng lệnh này một lần, có mạng.`,``],"Run this exact command once, with internet access; a server it starts accepts connections while it runs.":[`Chạy đúng lệnh này một lần, có mạng; server mà lệnh mở nhận kết nối trong lúc chạy.`,``],"Run this exact command once, with internet access and the Docker engine; a container it starts can read folders Docker shares from this machine and may keep running.":[`Chạy đúng lệnh này một lần, có mạng và Docker; container mà lệnh tạo đọc được các thư mục Docker chia sẻ trên máy và có thể tiếp tục chạy.`,``],"Run this exact command once on this machine, outside the sandbox, as you: it can read and change your files and use your sign-ins.":[`Chạy đúng lệnh này một lần trên máy bạn, ngoài sandbox, bằng quyền của bạn: lệnh đọc/sửa được file và dùng được tài khoản đã đăng nhập trên máy.`,``],"Docker is not started; the agent is told you declined.":[`Không mở Docker; agent được báo là bạn đã từ chối.`,``]},ko=(e,t,n)=>{let r=e[t];return r?To(n,r[0],r[1]||t):null};function Ao(e,t){return t===`vi`?e.split(`; `).map(e=>{let t=e.match(/^Confirmation required: the command runs (.+)$/);if(t)return`Lệnh có ${t[1]} nên cần bạn duyệt trước khi chạy.`;let n=e.match(/^External provider action (.+) requires confirmation$/);return n?`Hành động ra bên ngoài (${n[1]}) cần bạn duyệt.`:e}).join(` `):e}var jo=(e,t)=>ko(Eo,e.kind,t)??ai(e.kind,t),Mo=(e,t)=>ko(Do,e.requestedScope,t)??ai(e.requestedScope,t);function No(e,t){let n=t===`vi`?/^Start (.+) on this machine; it keeps running after the conversation\.$/.exec(e):null;return n?`Mở ${n[1]} trên máy; nó vẫn chạy sau cuộc trò chuyện.`:ko(Oo,e,t)??e}function Po(e,t){return{schemaVersion:1,version:`piagent-webui-approval-v1`,recordType:`decision`,approvalRef:e.approvalRef,decisionId:`decision.${crypto.randomUUID()}`,decisionToken:e.decisionToken,identity:structuredClone(e.identity),actionDigest:e.action.actionDigest,expectedRevisions:structuredClone(e.expectedRevisions),decision:t,reason:null,decidedAt:new Date().toISOString(),expiresAt:e.expiresAt,decisionSurface:`webui`,executor:`pi-guard`,directExecution:!1}}function Fo({state:e,setState:t,refreshSnapshot:n,locale:r,asker:i}){let a=e.request;if(!a)return(0,J.jsx)(`article`,{className:`approval-card`,children:(0,J.jsx)(`p`,{children:e.error??K(r,`Đang tải yêu cầu phê duyệt…`,`Loading approval request…`)})});let o=a.action,s=Math.max(0,Math.ceil((Date.parse(a.expiresAt)-Date.now())/1e3)),c=async e=>{t({request:a,deciding:e});try{await fn(Po(a,e)),await n?.()}catch{t({request:a,error:K(r,`Yêu cầu đã hết hạn, thay đổi hoặc được trả lời ở terminal. Hãy tải trạng thái mới.`,`The request expired, changed, or was answered in the terminal. Refresh status.`)})}};return(0,J.jsxs)(`article`,{className:`approval-card risk-${o.riskClass}`,"aria-labelledby":`approval-${a.approvalRef}`,children:[(0,J.jsxs)(`header`,{children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`section-kicker`,children:i?K(r,`${i} cần bạn duyệt`,`${i} needs your approval`):K(r,`Cần phê duyệt`,`Approval required`)}),(0,J.jsx)(`h2`,{id:`approval-${a.approvalRef}`,children:o.toolName})]}),(0,J.jsx)(`span`,{className:`approval-risk`,children:ai(o.riskClass,r)})]}),(0,J.jsx)(`p`,{className:`approval-reason`,children:Ao(o.reason,r)}),o.commandPreview&&(0,J.jsx)(`pre`,{className:`approval-preview`,children:(0,J.jsx)(`code`,{children:o.commandPreview})}),!o.commandPreview&&o.parameterPreview&&o.parameterPreview!==`No additional parameters`&&(0,J.jsx)(`p`,{className:`approval-preview`,children:o.parameterPreview}),(0,J.jsxs)(`dl`,{className:`approval-facts`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:K(r,`Hành động`,`Action`)}),(0,J.jsx)(`dd`,{children:jo(o,r)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:K(r,`Phạm vi`,`Scope`)}),(0,J.jsx)(`dd`,{children:Mo(o,r)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:K(r,`Thư mục`,`Directory`)}),(0,J.jsx)(`dd`,{children:o.cwdDisplay??K(r,`Đã ẩn`,`Hidden`)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`dt`,{children:K(r,`Hết hạn`,`Expires`)}),(0,J.jsxs)(`dd`,{children:[s,`s`]})]})]}),o.targetPaths.length>0&&(0,J.jsxs)(`div`,{className:`approval-targets`,children:[(0,J.jsx)(`strong`,{children:K(r,`Đích tác động`,`Targets`)}),(0,J.jsx)(`ul`,{children:o.targetPaths.map(e=>(0,J.jsx)(`li`,{children:e===`.`?K(r,`Cả thư mục project`,`The whole project folder`):e},e))})]}),(0,J.jsxs)(`div`,{className:`approval-consequences`,children:[(0,J.jsxs)(`p`,{children:[(0,J.jsx)(`strong`,{children:K(r,`Nếu cho phép:`,`If allowed:`)}),` `,No(o.consequences.allow,r)]}),(0,J.jsxs)(`p`,{children:[(0,J.jsx)(`strong`,{children:K(r,`Nếu từ chối:`,`If denied:`)}),` `,No(o.consequences.deny,r)]})]}),e.error&&(0,J.jsx)(`p`,{className:`form-error`,role:`alert`,children:e.error}),(0,J.jsxs)(`footer`,{children:[(0,J.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:!!e.deciding,onClick:()=>void c(`deny`),children:K(r,`Từ chối`,`Deny`)}),(0,J.jsx)(`button`,{type:`button`,className:`danger-action`,disabled:!!e.deciding,onClick:()=>void c(`allow`),children:e.deciding===`allow`?K(r,`Đang kiểm tra lại…`,`Rechecking…`):K(r,`Cho phép đúng 1 lần`,`Allow once`)})]})]})}function Io(e,t,n){let r=(0,q.useMemo)(()=>e,[e.join(`\0`)]),[i,a]=(0,q.useState)({});return(0,q.useEffect)(()=>{let e=new AbortController;for(let i of r)(t?on(t,i,e.signal):nn(i,e.signal)).then(e=>a(t=>({...t,[i]:{request:e}})),()=>a(e=>({...e,[i]:{error:K(n,`Không thể tải yêu cầu phê duyệt hiện tại.`,`Unable to load the current approval request.`)}})));return()=>e.abort()},[n,t,r]),{refs:r,states:i,set:(e,t)=>a(n=>({...n,[e]:t}))}}function Lo({approvalRefs:e,sessionRef:t,refreshSnapshot:n}){let{locale:r}=Pt(),{refs:i,states:a,set:o}=Io(e,t,r);return i.length===0?null:(0,J.jsx)(`section`,{className:`approval-stack`,"aria-label":K(r,`Yêu cầu phê duyệt đang chờ`,`Pending approval requests`),"aria-live":`polite`,children:i.map(e=>(0,J.jsx)(Fo,{state:a[e]??{},setState:t=>o(e,t),refreshSnapshot:n,locale:r},e))})}function Ro({snapshot:e,refreshSnapshot:t}){let n=(0,q.useMemo)(()=>e.approvals.pending.map(e=>e.approvalRef),[e.approvals.pending]);return(0,J.jsx)(Lo,{approvalRefs:n,refreshSnapshot:t})}var zo=e=>Array.from({length:e},()=>({selected:[],other:``,otherOn:!1})),Bo=e=>e.selected.length>0||e.otherOn&&e.other.trim().length>0,Vo=(e,t)=>!e||e===`main`?K(t,`Main agent`,`Main agent`):K(t,`Subagent ${e}`,`Subagent ${e}`);function Ho({sessionRef:e,pending:t,locale:n,onDone:r}){let[i,a]=(0,q.useState)(()=>zo(t.questions.length)),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(``),u=(0,q.useRef)([]),d=(0,q.useRef)(null),f=(0,q.useRef)([]),[p,m]=(0,q.useState)(0);(0,q.useEffect)(()=>{d.current?.focus({preventScroll:!0})},[]);let h=(e,t)=>a(n=>n.map((n,r)=>r===e?t(n):n)),g=(e,n)=>h(e,r=>t.questions[e].multiSelect?{...r,selected:r.selected.includes(n)?r.selected.filter(e=>e!==n):[...r.selected,n]}:{selected:[n],other:r.other,otherOn:!1}),_=(e,n=!0)=>{h(e,r=>t.questions[e].multiSelect?{...r,otherOn:n}:{selected:[],other:r.other,otherOn:n}),n&&setTimeout(()=>u.current[e]?.focus(),0)},v=i.every(Bo),y=e=>{if(e.target.tagName===`INPUT`&&e.target.type===`text`)return;if(e.key===`Enter`){v&&(e.preventDefault(),x());return}let n=Number(e.target.closest(`fieldset`)?.getAttribute(`data-question`)??NaN),r=Number.isInteger(n)?n:p,a=Number(e.key),o=t.questions[r],s=o.options.length;if(!(!Number.isInteger(a)||a<1||a>s+1)){if(e.preventDefault(),a===s+1){_(r,!o.multiSelect||!i[r].otherOn);return}g(r,a-1),!o.multiSelect&&r+1<t.questions.length&&(m(r+1),f.current[r+1]?.focus({preventScroll:!1}))}},b=async(i,a)=>{s(a),l(``);try{await dn(e,t.questionRef,i),r()}catch(e){s(null),l(e.status===409?K(n,`Câu hỏi này đã được trả lời hoặc lượt làm việc đã dừng.`,`This question was already answered or the turn stopped.`):K(n,`Chưa gửi được câu trả lời. Thử lại.`,`The answer could not be sent. Try again.`))}},x=()=>{!v||o||b({answers:i.map(e=>({selected:[...e.selected].sort((e,t)=>e-t),...e.otherOn&&e.other.trim()?{other:e.other.trim()}:{}}))},`answer`)},S=t.questions.length;return(0,J.jsxs)(`article`,{className:`question-card`,ref:d,tabIndex:-1,onKeyDown:y,"aria-labelledby":`question-${t.questionRef}`,children:[(0,J.jsxs)(`header`,{children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`section-kicker`,children:K(n,`${Vo(t.role,n)} cần bạn quyết định`,`${Vo(t.role,n)} needs your decision`)}),(0,J.jsx)(`h2`,{id:`question-${t.questionRef}`,children:S>1?K(n,`${S} câu hỏi`,`${S} questions`):K(n,`1 câu hỏi`,`1 question`)})]}),(0,J.jsx)(`span`,{className:`question-hint`,children:K(n,`Bấm số để chọn · Enter để gửi`,`Press a number to choose · Enter to send`)})]}),t.questions.map((e,r)=>{let a=i[r],o=`${t.questionRef}-${r}`,s=e.multiSelect?`checkbox`:`radio`;return(0,J.jsxs)(`fieldset`,{className:r===p?`question-block active`:`question-block`,"data-question":r,tabIndex:-1,ref:e=>{f.current[r]=e},onFocus:()=>m(r),children:[(0,J.jsxs)(`legend`,{children:[S>1&&(0,J.jsxs)(`span`,{className:`question-number`,children:[r+1,`.`]}),e.header&&(0,J.jsx)(`span`,{className:`question-chip`,children:e.header}),(0,J.jsx)(`span`,{className:`question-text`,children:e.question})]}),e.multiSelect&&(0,J.jsx)(`p`,{className:`question-multi`,children:K(n,`Có thể chọn nhiều đáp án.`,`You can choose more than one.`)}),(0,J.jsxs)(`ol`,{className:`question-options`,children:[e.options.map((e,t)=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`label`,{className:a.selected.includes(t)?`selected`:void 0,children:[(0,J.jsx)(`input`,{type:s,name:o,checked:a.selected.includes(t),onChange:()=>g(r,t)}),(0,J.jsx)(`span`,{className:`option-number`,"aria-hidden":`true`,children:t+1}),(0,J.jsxs)(`span`,{className:`option-body`,children:[(0,J.jsx)(`strong`,{children:e.label}),e.description&&(0,J.jsx)(`small`,{children:e.description})]})]})},t)),(0,J.jsxs)(`li`,{className:`question-other`,children:[(0,J.jsxs)(`label`,{className:a.otherOn?`selected`:void 0,children:[(0,J.jsx)(`input`,{type:s,name:o,checked:a.otherOn,onChange:()=>_(r,!e.multiSelect||!a.otherOn)}),(0,J.jsx)(`span`,{className:`option-number`,"aria-hidden":`true`,children:e.options.length+1}),(0,J.jsx)(`span`,{className:`option-body`,children:(0,J.jsx)(`strong`,{children:K(n,`Khác`,`Other`)})})]}),a.otherOn&&(0,J.jsx)(`input`,{type:`text`,ref:e=>{u.current[r]=e},maxLength:1e3,value:a.other,"aria-label":K(n,`Câu trả lời khác cho câu ${r+1}`,`Other answer to question ${r+1}`),placeholder:K(n,`Nhập câu trả lời của bạn`,`Type your answer`),onChange:e=>h(r,t=>({...t,other:e.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x())}})]})]})]},o)}),c&&(0,J.jsx)(`p`,{className:`form-error`,role:`alert`,children:c}),(0,J.jsxs)(`footer`,{children:[(0,J.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:!!o,onClick:()=>void b({skipped:!0},`skip`),children:o===`skip`?K(n,`Đang gửi…`,`Sending…`):K(n,`Để agent tự quyết`,`Let the agent decide`)}),(0,J.jsx)(`button`,{type:`button`,className:`primary-action`,disabled:!v||!!o,onClick:x,children:o===`answer`?K(n,`Đang gửi…`,`Sending…`):K(n,`Gửi câu trả lời`,`Send answer`)})]})]})}function Uo(e,t){let[n,r]=(0,q.useState)([]),[i,a]=(0,q.useState)(0);return(0,q.useEffect)(()=>{let t=new AbortController;return Gt(e,t.signal).then(e=>r(e.questions??[]),()=>void 0),()=>t.abort()},[e,t,i]),(0,q.useEffect)(()=>{if(!t&&!n.length)return;let e=setInterval(()=>a(e=>e+1),n.length?4e3:1500);return()=>clearInterval(e)},[t,n.length]),{pending:n,done:e=>r(t=>t.filter(t=>t.questionRef!==e))}}var Wo={main:0,scout:1,research:2,verify:3,review:4},Go=e=>Wo[e]??5;function Ko(e){return[...e].sort((e,t)=>Go(e.role)-Go(t.role)||Date.parse(e.askedAt)-Date.parse(t.askedAt))}function qo(e){return!!(e&&!e.complete&&e.activities.some(e=>e.toolLabel===`ask_user`&&e.state===`running`))}function Jo(e,t){return qo(t)?`question`:e.liveState===`waiting-approval`?`approval`:e.needsAttention&&(e.liveState===`running`||e.liveState===`idle`)?`question`:null}function Yo(e,t){let n={};for(let r of e){if(r.archived)continue;let e=t[r.sessionRef];n[r.sessionRef]={running:!!(e&&!e.complete),need:Jo(r,e),operationRef:e?.operationRef??null}}return n}function Xo(e,t,n,r){let i=[];for(let a of n){let n=e[a.sessionRef],o=t[a.sessionRef];if(!n||!o)continue;let s=r[a.sessionRef],c=o.operationRef??n.operationRef??`turn`;if(o.need&&o.need!==n.need&&i.push({id:`${a.sessionRef}:${c}:${o.need}:${Date.now()}`,sessionRef:a.sessionRef,title:a.title,kind:o.need}),n.running&&!o.running){let e=s?.settlement===`aborted`?`stopped`:s?.error||s?.settlement===`error`||s?.settlement===`blocked`?`failed`:`done`;i.push({id:`${a.sessionRef}:${c}:${e}`,sessionRef:a.sessionRef,title:a.title,kind:e})}}return i}function Zo({sessionRef:e,waiting:t,approvalRefs:n}){let{locale:r}=Pt(),i=Uo(e,t),a=Io(n,e,r),[o,s]=(0,q.useState)(null),c=Ko([...i.pending.map(e=>({key:e.questionRef,kind:`question`,role:e.role??`main`,askedAt:e.askedAt,label:e.questions[0]?.header||e.questions[0]?.question||K(r,`Câu hỏi`,`Question`)})),...a.refs.map(e=>{let t=a.states[e]?.request;return{key:e,kind:`approval`,role:`main`,askedAt:t?.requestedAt??new Date(864e13).toISOString(),expiresAt:t?.expiresAt??null,label:t?t.action.commandPreview?.split(`
|
|
75
|
-
`)[0]||t.action.toolName:K(r,`Yêu cầu duyệt`,`Approval`)}})]),l=c.find(e=>e.key===o)??c[0];(0,q.useEffect)(()=>{o&&!c.some(e=>e.key===o)&&s(null)},[o,c.map(e=>e.key).join(`\0`)]);let u=l?.key??null;if((0,q.useLayoutEffect)(()=>{if(!u)return;let e=requestAnimationFrame(()=>window.scrollTo({top:document.documentElement.scrollHeight-window.innerHeight,behavior:`smooth`}));return()=>cancelAnimationFrame(e)},[u]),!l)return null;let d=c.indexOf(l);return(0,J.jsxs)(`section`,{className:`decision-queue`,"aria-label":K(r,`Việc đang chờ bạn quyết định`,`Decisions waiting for you`),"aria-live":`polite`,children:[c.length>1&&(0,J.jsxs)(`nav`,{className:`decision-steps`,"aria-label":K(r,`Các việc đang chờ`,`Waiting decisions`),children:[(0,J.jsx)(`strong`,{children:K(r,`Việc cần bạn quyết · ${d+1}/${c.length}`,`Needs your decision · ${d+1}/${c.length}`)}),(0,J.jsx)(`ol`,{children:c.map((e,t)=>(0,J.jsx)(`li`,{children:(0,J.jsxs)(`button`,{type:`button`,"aria-current":e===l?`step`:void 0,className:e===l?`decision-step current`:`decision-step`,onClick:()=>s(e.key),title:`${Vo(e.role,r)} · ${e.label}`,children:[(0,J.jsx)(`span`,{className:`decision-step-number`,children:t+1}),(0,J.jsx)(`span`,{className:`decision-step-kind`,children:e.kind===`question`?K(r,`Hỏi`,`Ask`):K(r,`Duyệt`,`Approve`)}),(0,J.jsx)(`span`,{className:`decision-step-role`,children:Vo(e.role,r)}),(0,J.jsx)(`span`,{className:`decision-step-label`,children:e.label})]})},e.key))})]}),l.kind===`question`?(0,J.jsx)(Ho,{sessionRef:e,locale:r,onDone:()=>i.done(l.key),pending:i.pending.find(e=>e.questionRef===l.key)},l.key):(0,J.jsx)(Fo,{state:a.states[l.key]??{},locale:r,asker:Vo(l.role,r),setState:e=>a.set(l.key,e)},l.key)]})}var Qo=16384,$o=1e3;function es(e,t){let n=new Map;for(let r of[...t,...e])n.has(r.messageRef)||n.set(r.messageRef,r);return[...n.values()].slice(0,$o)}function ts(e){let t=new Map,n=new Map;for(let r of e.slice(-500)){let e=r.kind,i=r.payload??{},a=r.messageRef;if([`agent-operation.settled`,`session.replacement-pending`,`session.replacement-committed`,`session.shutdown`].includes(String(e))){t.clear(),n.clear();continue}if(e===`message.started`&&i.role===`assistant`&&typeof a==`string`)t.set(a,{messageRef:a,text:``,thinking:!1,truncated:!1});else if(e===`message.text-delta`&&typeof a==`string`&&typeof i.delta==`string`){let e=t.get(a);if(!e)continue;let n=`${e.text}${i.delta}`;t.set(a,{...e,text:n.slice(0,Qo),truncated:e.truncated||n.length>Qo})}else if(e===`message.thinking-state`&&typeof a==`string`){let e=t.get(a);if(!e)continue;t.set(a,{...e,thinking:i.state!==`completed`})}else[`message.completed`,`message.failed`].includes(String(e))&&typeof a==`string`&&t.delete(a);[`activity.started`,`activity.progress`,`activity.finished`,`activity.failed`,`activity.blocked`,`activity.aborted`].includes(String(e))&&typeof r.toolCallId==`string`&&typeof i.activityRef==`string`&&typeof i.toolName==`string`&&n.set(r.toolCallId,{toolCallId:r.toolCallId,activityRef:i.activityRef,toolName:i.toolName,state:String(i.state??`unknown`)})}return{assistants:[...t.values()].slice(-2),tools:[...n.values()].slice(-8)}}function ns(e,t){return e?.state===`ready`&&e.gatewayInstanceRef===t&&Number.isSafeInteger(e.eventSequence)&&e.eventSequence>=0&&Array.isArray(e.operations)&&Array.isArray(e.settlements)?e.eventSequence:null}function rs(e,t){return e&&!t?`connected`:`reconnecting`}var is=100,as=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/,os=/^[a-z0-9][a-z0-9.-]{0,95}$/,ss=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function cs(e,t){return typeof t==`string`&&os.test(t)?t:e===`aborted`?`operation-aborted`:e===`blocked`?`operation-blocked`:e===`error`?`operation-failed`:`operation-settlement-unknown`}function ls(e){if(e.settlement===`completed`||typeof e.operationRef!=`string`||!as.test(e.operationRef)||typeof e.settledAt!=`string`||!ss.test(e.settledAt)||!Number.isSafeInteger(e.sequence)||Number(e.sequence)<1)return null;let t=[`blocked`,`aborted`,`error`,`unknown`].includes(String(e.settlement))?e.settlement:`unknown`,n=t===`error`?`failed`:t;return{activityRef:e.operationRef,operationRef:e.operationRef,settlement:t,state:n,reasonCode:cs(t,e.reasonCode),settledAt:e.settledAt,sequence:Number(e.sequence)}}function us(e,t){let n=new Map;for(let r of[...e,...t])n.has(r.operationRef)||n.set(r.operationRef,r);return[...n.values()].sort((e,t)=>t.sequence-e.sequence).slice(0,is)}function ds(e){if(e.state!==`ready`)return{};let t={};for(let n of e.settlements??[]){let e=ls(n);e&&(t[n.sessionRef]=us(t[n.sessionRef]??[],[e]))}return t}function fs(e,t){let n=[`completed`,`blocked`,`aborted`,`error`].includes(String(t.settlement))?t.settlement:`unknown`;return{...e,operationRef:t.operationRef,abortable:!1,complete:!0,settlement:n,activities:[],delivery:e.user?`admitted`:e.delivery,assistant:n===`completed`?e.assistant:``,error:n===`completed`?null:String(t.reasonCode??`operation-settlement-unknown`)}}function ps(e,t){return{...e??{assistant:``,activities:[],operationRef:null,complete:!0,error:null},user:t.message,assistant:``,attachments:t.attachments,activities:[],operationRef:null,abortable:!1,complete:!1,settlement:null,error:null,messageRequestId:t.messageRequestId,delivery:`submitting`,startedAt:t.submittedAt,lastEventAt:t.submittedAt}}function ms(e,t,n,r){let i=t===`admitted`&&!!n&&e.operationRef===n&&e.complete;return{...e,delivery:t,operationRef:n??e.operationRef,abortable:t===`admitted`&&!i&&!!(n??e.operationRef),complete:t===`admitted`?i:e.complete,error:null,lastEventAt:r??e.lastEventAt}}function hs(e,t,n){return!e||e.messageRequestId!==n||e.delivery===`admitted`?e:t}function gs(e,t){if(t.state!==`ready`)return{...e};let n=new Map(t.operations.map(e=>[e.sessionRef,e])),r={...e};for(let[i,a]of Object.entries(e))n.has(i)||a.complete||a.delivery!==`submitting`&&(r[i]={...a,assistant:``,activities:[],operationRef:null,abortable:!1,complete:!0,settlement:`unknown`,error:`operation-settlement-unavailable`,lastEventAt:t.generatedAt});for(let n of t.operations){let i=e[n.sessionRef],a=!(n.messageRequestId&&i?.messageRequestId&&n.messageRequestId!==i.messageRequestId)&&(i?.operationRef===n.operationRef||!!(i?.user&&[`submitting`,`unconfirmed`].includes(String(i.delivery))));r[n.sessionRef]=a?{...i,operationRef:n.operationRef,abortable:n.abortable,complete:!1,settlement:null,messageRequestId:n.messageRequestId??i?.messageRequestId,delivery:i?.user?`admitted`:i?.delivery,error:null,lastEventAt:t.generatedAt}:{user:``,assistant:``,attachments:[],activities:[],operationRef:n.operationRef,messageRequestId:n.messageRequestId??null,abortable:n.abortable,complete:!1,settlement:null,error:null,runtimeRecovery:null,startedAt:t.generatedAt,lastEventAt:t.generatedAt}}return r}function _s(e,t){let n=e.toLowerCase();return n===`compaction`?t===`vi`?`tóm tắt phần cũ của cuộc trò chuyện`:`summarising the older part of the conversation`:n===`capacity-wait`?t===`vi`?`chờ tài khoản công ty rảnh`:`waiting for a free company account`:n===`ask_user`?t===`vi`?`chờ bạn trả lời câu hỏi`:`waiting for your answer`:/(subagent|scout|delegate|agent)/.test(n)?t===`vi`?`phối hợp agent hỗ trợ`:`coordinating a helper agent`:/(bash|exec|shell|command|terminal)/.test(n)?t===`vi`?`chạy lệnh`:`running a command`:/(read|grep|find|list|glob|search_file)/.test(n)?t===`vi`?`đọc mã nguồn`:`reading source`:/(edit|write|patch|apply)/.test(n)?t===`vi`?`cập nhật file`:`updating files`:/(test|verify|check|lint)/.test(n)?t===`vi`?`kiểm tra kết quả`:`verifying results`:/(web|search|browser|fetch)/.test(n)?t===`vi`?`tìm kiếm thông tin`:`searching`:t===`vi`?`chạy công cụ`:`running a tool`}var vs=/(?:sk-(?:proj|live|test|svcacct)-[A-Za-z0-9_-]{8,}|as_(?:live|device|run)_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}_|(?:api[_-]?key|password|secret|token)=)/i;function ys(e){if(typeof e!=`string`)return null;let t=(e.replace(/\\/g,`/`).split(`/`).at(-1)??``).trim();return!t||t===`.`||t===`..`||t.length>160||/[\u0000-\u001f\u007f/\\]/.test(t)||vs.test(t)||t.includes(`[REDACTED`)?null:t}function bs(e,t=`vi`,n=Date.now()){let r=[...e.activities].reverse().find(e=>e.state===`running`),i=r?_s(r.toolLabel,t):e.activities.length?t===`vi`?`tổng hợp bước tiếp theo`:`preparing the next step`:t===`vi`?`phân tích yêu cầu`:`analyzing the request`,a=Date.parse(e.lastEventAt??r?.startedAt??e.startedAt??``),o=Number.isFinite(a)?Math.max(0,Math.floor((n-a)/1e3)):null,s=o===null?t===`vi`?`Đang chờ cập nhật tiến trình đầu tiên`:`Waiting for the first progress update`:o<10?t===`vi`?`Tiến trình vừa cập nhật`:`Progress updated just now`:o<60?t===`vi`?`Cập nhật ${o} giây trước`:`Updated ${o}s ago`:t===`vi`?`Cập nhật ${Math.floor(o/60)} phút trước`:`Updated ${Math.floor(o/60)}m ago`,c=ys(r?.fileLabel),l=c?`${c} · ${s}`:s;return{label:t===`vi`?`Piagent đang ${i}…`:`Piagent is ${i}…`,detail:l}}function xs(e,t,n,r){if(e?.state!==`ready`||e.gatewayInstanceRef!==t)return!1;let i=e.operations.find(e=>e.sessionRef===n);return i?.operationRef===r&&i.abortable===!0}var Ss=/^(?:\p{White_Space}|\p{Cc}|\p{Default_Ignorable_Code_Point})$/u,Cs=/\u001b(?:\[[0-?]*[ -/]*[@-~]|[@-_])/g;function ws(e){for(let t of e.replace(Cs,``))if(!Ss.test(t))return!0;return!1}function Ts(e,t,n){if(!n?.complete)return{key:`${e}:${t}:active`,completionKey:null,user:``,assistant:``,operationRef:null,messageRequestId:null,startedAt:null};let r=n.startedAt??null,i=n.messageRequestId??null,a=`${i??`unknown`}:${n.operationRef??`unknown`}:${r??`unknown`}:${n.user}:${n.assistant.length}`;return{key:`${e}:${t}:complete:${a}`,completionKey:a,user:n.user,assistant:n.assistant,operationRef:n.operationRef,messageRequestId:i,startedAt:r}}function Es(e){let t=/^\[Piagent completion gate: (CONTINUING|NOT APPROVED)\][\t ]*/i.exec(e);if(!t)return{text:e,completionGate:null};let n=t[1]?.toUpperCase()===`CONTINUING`?`continuing`:`not-approved`,r=e.indexOf(`
|
|
76
|
-
|
|
77
|
-
`,t[0].length);return{text:r<0?``:e.slice(r+2).trimStart(),completionGate:n}}var Ds=new Set([`provider-auth-expired`,`provider-auth-required`,`provider-rate-limited`,`provider-unavailable`,`provider-response-failed`,`assistant-output-incomplete`]);function Os(e){let t=e.content.reasonCode;return e.role===`assistant`&&e.toolCalls.length===0&&e.content.state===`unavailable`&&t&&(Ds.has(t)||t.startsWith(`company-`))?t:null}function ks(e){let t=Es(e);return t.completionGate===null&&ws(t.text)?t.text:null}function As(e,t){let n=e?.trim(),r=t.trim();return!!(n&&r&&(n===r||n.startsWith(`/`)&&n.endsWith(` ${r}`)))}function js(e,t){if(e.agentOperationId&&t.operationRef&&e.agentOperationId!==t.operationRef)return!1;if(e.messageRequestId&&t.messageRequestId)return e.messageRequestId===t.messageRequestId;if(e.agentOperationId&&t.operationRef)return e.agentOperationId===t.operationRef;let n=Date.parse(e.recordedAt),r=Date.parse(t.startedAt??``);return Number.isFinite(n)&&Number.isFinite(r)&&n>=r}function Ms(e,t,n){let r=t.trim();if(!r)return-1;for(let t=e.length-1;t>=0;--t){let i=e[t];if(i?.role===`user`&&As(i.content.text,r)&&js(i,n))return t}return-1}function Ns(e,t,n){return Ms(e,t,n)>=0}function Ps(e,t,n,r){let i=Ms(e,t,r);if(i<0)return!1;let a=ks(n)?.trim()??``;if(!a)return!0;let o=e[i]?.messageRef??null;for(let t=i+1;t<e.length;t+=1){let n=e[t];if(n?.role===`user`)return!1;if(!(n?.role!==`assistant`&&n?.role!==`custom`||n.toolCalls.length>0)&&!(o&&n.parentMessageRef&&n.parentMessageRef!==o)&&ks(n.content.text??``)?.trim()===a)return!0}return!1}function Fs(e,t,n){let r=Ms(e,t,n);if(r<0)return!1;let i=e[r]?.messageRef??null;for(let t=r+1;t<e.length;t+=1){let n=e[t];if(n?.role===`user`)return!1;if(!(n?.role!==`assistant`&&n?.role!==`custom`||n.toolCalls.length>0)&&!(i&&n.parentMessageRef&&n.parentMessageRef!==i)&&(ks(n.content.text??``)||Os(n)))return!0}return!1}function Is(e){let t=[],n=new Map,r=new Set,i=null,a=!1,o=null;for(let s of e){if(s.role===`user`){n.clear(),r.add(s.messageRef),i=s.messageRef,t.push(s),a=!1,o=null;continue}if(s.role!==`assistant`&&s.role!==`custom`||(s.parentMessageRef?!r.has(s.parentMessageRef):i===null)||s.toolCalls.length>0)continue;if(Os(s)){if(a)continue;o?t[t.indexOf(o)]=s:t.push(s),o=s;continue}let e=ks(s.content.text??``);if(!e)continue;a=!0,o&&=(t.splice(t.indexOf(o),1),null);let c=`${s.role}:${e.trim()}`,l=n.get(c);l===void 0?(n.set(c,t.length),t.push(s)):t[l]=s}return t}function Ls(e,t){return{key:t,user:e,steps:[],answer:null,failure:null,failureDetail:null,requests:0,tokens:0,model:null,process:null,end:null,startedAt:e.recordedAt,endedAt:null,outputTokens:0,generationMs:0}}var Rs=new Set([`objection`,`rejudge`,`dispute`]);function zs(e){let t=[],n=null,r=NaN;for(let i of e){let e=Date.parse(i.recordedAt),a=r;if(i.role!==`custom`&&(r=e),i.role===`user`){n=Ls(i,i.messageRef),t.push(n);continue}if(!n||i.role===`tool-result`)continue;if(n.endedAt=i.recordedAt,i.role===`custom`&&i.turnEnd){n.end=i.turnEnd;continue}if(i.role===`custom`&&i.process){if(n.process&&(n.answer&&(n.steps.push({kind:`note`,key:`${i.messageRef}:round-answer`,text:n.answer}),n.answer=null),n.steps.push({kind:`process`,key:`${i.messageRef}:round`,process:n.process}),n.process=null),i.process.phase===`final`){n.process=i.process;continue}n.answer&&!Rs.has(i.process.phase)&&(n.steps.push({kind:`note`,key:`${i.messageRef}:answer`,text:n.answer}),n.answer=null),n.steps.push({kind:`process`,key:i.messageRef,process:i.process});continue}i.role===`assistant`&&i.usage?.outputTokens&&e>a&&(n.outputTokens+=i.usage.outputTokens,n.generationMs+=e-a),i.role===`assistant`&&(i.failure?.local||(n.requests+=1),n.tokens+=i.usage?.totalTokens??0,n.model=i.model??n.model);let o=Os(i);if(o){n.answer||(n.failure=o,n.failureDetail=i.failure??null);continue}for(let e of i.toolCalls)n.steps.push({kind:`tool`,key:`${i.messageRef}:${e.toolCallRef}`,tool:e});if(i.toolCalls.length)continue;let s=i.role===`assistant`?ks(i.content.text??``):i.content.text;if(s){if(i.role===`custom`){n.steps.push({kind:`note`,key:i.messageRef,text:s});continue}n.answer&&n.answer.trim()!==s.trim()&&n.steps.push({kind:`note`,key:`${i.messageRef}:previous`,text:n.answer}),n.answer=s,n.failure=null,n.failureDetail=null}}return t}function Bs(e){let t=Date.parse(e.startedAt??``),n=Date.parse(e.endedAt??``);return Number.isFinite(t)&&Number.isFinite(n)&&n>=t?Math.round((n-t)/1e3):null}function Vs(e){if(e.outputTokens<50||e.generationMs<250)return null;let t=e.outputTokens/(e.generationMs/1e3);return t>=10?Math.round(t):Math.round(t*10)/10}function Hs(e,t){return e<40||t<1e3?null:Math.round(e/4/(t/1e3))}function Us(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}k`:`${(e/1e6).toFixed(1)}M`}var Ws=e=>`/api/v1/sessions/${encodeURIComponent(e)}/checkpoints`,Gs=`piagent-webui-checkpoint-v1`;function Ks(e){return Array.isArray(e)?`[${e.map(Ks).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${Ks(t)}`).join(`,`)}}`:JSON.stringify(e)}async function qs(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return`sha256:${[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}var Js=e=>typeof e==`string`&&/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/.test(e),Ys=e=>typeof e==`string`&&/^[a-f0-9]{64}$/.test(e),Xs=(e,t)=>typeof e==`string`&&e.length>0&&e.length<=t,Zs=e=>Array.isArray(e)&&e.length<=1e4&&e.every(e=>Xs(e,4096)),Qs=e=>typeof e==`string`&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e)&&Number.isFinite(Date.parse(e));function $s(e){return e&&[`projectRef`,`runtimeInstanceId`,`sessionRef`].every(t=>typeof e[t]==`string`&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e[t]))&&[`taskId`,`taskRunId`,`agentOperationId`,`toolCallId`].every(t=>e[t]===null||typeof e[t]==`string`&&/^[A-Za-z0-9][A-Za-z0-9._:@~-]{0,159}$/.test(e[t]))}function ec(e){return Js(e.targetId)&&[`ready`,`conflict`,`busy`,`none`,`unavailable`].includes(e.result)&&(e.previewDigest===null||Ys(e.previewDigest))&&(e.tree===null||typeof e.tree==`string`&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(e.tree))&&Array.isArray(e.steps)&&e.steps.length<=64&&e.steps.every(e=>e&&Js(e.id)&&Xs(e.turnRef,256)&&Zs(e.restore)&&Zs(e.remove))&&Zs(e.files)&&Zs(e.conflicts)&&(e.stoppedAt===null||Js(e.stoppedAt))}async function tc(e,t,n){let r=await fetch(Ws(e)+(t?`/${encodeURIComponent(t)}`:``),{credentials:`same-origin`,signal:n,headers:{Accept:`application/json`}});if(r.status===401&&Vt(),!r.ok)throw Error(`checkpoint-unavailable`);let i=await r.json();if(!i||i.schemaVersion!==1||i.version!==Gs||i.identity?.sessionRef!==e||!$s(i.identity)||i.messageType!==(t?`preview`:`state`)||!/^[a-f0-9]{64}$/.test(i.revisions?.checkpointRevision??``)||i.messageType===`state`&&(typeof i.available!=`boolean`||typeof i.agentRunning!=`boolean`||!Array.isArray(i.points)||i.points.length>64||!i.points.every(e=>e&&Js(e.id)&&Xs(e.turnRef,256)&&Number.isSafeInteger(e.at)&&e.at>=0))||i.messageType===`preview`&&(i.targetId!==t||!ec(i)))throw Error(`checkpoint-response-invalid`);return i}var nc=(e,t)=>tc(e,null,t),rc=(e,t,n)=>tc(e,t,n);async function ic(e){if(!ec(e)||!$s(e.identity)||!Ys(e.revisions?.checkpointRevision)||!e.previewDigest||!e.tree||!e.steps.length||![`ready`,`conflict`].includes(e.result))throw Error(`checkpoint-preview-unavailable`);let t=Date.now(),n=`checkpoint.restore`,r={...e.identity},i={...e.revisions},a={targetId:e.targetId,previewDigest:e.previewDigest,expectedTree:e.tree,confirmed:!0};return{schemaVersion:1,version:Gs,messageType:`command`,action:n,identity:r,expectedRevisions:i,payload:a,commandId:crypto.randomUUID(),idempotencyKey:crypto.randomUUID(),requestedAt:new Date(t).toISOString(),expiresAt:new Date(t+6e4).toISOString(),actionDigest:await qs(Ks({action:n,identity:r,expectedRevisions:i,payload:a}))}}async function ac(e,t){let{action:n,identity:r,expectedRevisions:i,payload:a}=e;return e.schemaVersion===1&&e.version===Gs&&e.messageType===`command`&&n===`checkpoint.restore`&&$s(r)&&r.sessionRef===t&&Ys(i?.checkpointRevision)&&a?.confirmed===!0&&Js(a.targetId)&&Ys(a.previewDigest)&&typeof a.expectedTree==`string`&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(a.expectedTree)&&typeof e.commandId==`string`&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e.commandId)&&typeof e.idempotencyKey==`string`&&/^[A-Za-z0-9._~-]{32,128}$/.test(e.idempotencyKey)&&Qs(e.requestedAt)&&Qs(e.expiresAt)&&e.actionDigest===await qs(Ks({action:n,identity:r,expectedRevisions:i,payload:a}))}async function oc(e,t){if(!await ac(t,e))throw Error(`checkpoint-command-invalid`);let n=Bt();if(!n)throw Error(`checkpoint-unavailable`);let r=await zt(Ws(e),{method:`POST`,credentials:`same-origin`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(t)});if(r.status===401&&Vt(),!r.ok)throw Error(`checkpoint-unavailable`);let i=await r.json();if(!i||i.schemaVersion!==1||i.version!==Gs||i.messageType!==`receipt`||i.commandId!==t.commandId||i.actionDigest!==t.actionDigest||i.action!==t.action||i.targetId!==t.payload.targetId||i.idempotencyKeyDigest!==await qs(t.idempotencyKey)||Ks(i.identity)!==Ks(t.identity)||![`settled`,`rejected`,`uncertain`].includes(i.phase)||![`restored`,`conflict`,`stale-revision`,`identity-mismatch`,`read-only`,`busy`,`unavailable`,`expired`,`idempotency-payload-mismatch`,`effect-unknown`].includes(i.resultCode)||i.requestedAt!==t.requestedAt||!Qs(i.settledAt)||typeof i.deduplicated!=`boolean`||!Ys(i.observedRevisionsBefore?.checkpointRevision)||!Ys(i.observedRevisionsAfter?.checkpointRevision)||!Array.isArray(i.completed)||i.completed.length>64||!i.completed.every(Js)||!Zs(i.files)||!Zs(i.conflicts)||!(i.stoppedAt===null||Js(i.stoppedAt))||i.phase===`uncertain`!=(i.resultCode===`effect-unknown`)||i.resultCode===`restored`&&i.phase!==`settled`)throw Error(`checkpoint-receipt-invalid`);return i}var sc=`piagent.checkpoint.pending.v1`,cc=64;function lc(e){let t=e.getItem(sc);if(t===null)return Object.create(null);if(t.length>262144)throw Error(`checkpoint-pending-invalid`);let n=JSON.parse(t);if(!Array.isArray(n)||n.length>cc)throw Error(`checkpoint-pending-invalid`);let r=Object.create(null);for(let e of n){if(!Array.isArray(e)||e.length!==2)throw Error(`checkpoint-pending-invalid`);let[t,n]=e;if(typeof t!=`string`||!/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(t)||r[t]||!n||n.schemaVersion!==1||n.version!==`piagent-webui-checkpoint-v1`||n.messageType!==`command`||n.action!==`checkpoint.restore`||n.identity?.sessionRef!==t||n.payload?.confirmed!==!0||typeof n.payload.targetId!=`string`||typeof n.commandId!=`string`||typeof n.idempotencyKey!=`string`)throw Error(`checkpoint-pending-invalid`);r[t]=n}return r}function uc(e,t=window.sessionStorage){return lc(t)[e]}function dc(e,t,n=window.sessionStorage){let r=lc(n),i=r[e];if(i&&JSON.stringify(i)!==JSON.stringify(t))throw Error(`checkpoint-pending-exists`);if(!i&&Object.keys(r).length>=cc)throw Error(`checkpoint-pending-capacity`);if(t.identity.sessionRef!==e)throw Error(`checkpoint-pending-session`);r[e]=t;let a=JSON.stringify(Object.entries(r));if(a.length>262144)throw Error(`checkpoint-pending-capacity`);if(n.setItem(sc,a),n.getItem(sc)!==a)throw Error(`checkpoint-pending-write-failed`)}function fc(e,t,n=window.sessionStorage){let r=lc(n);if(r[e]){if(JSON.stringify(r[e])!==JSON.stringify(t))throw Error(`checkpoint-pending-replaced`);delete r[e],n.setItem(sc,JSON.stringify(Object.entries(r)))}}var pc=(0,q.createContext)(null);function mc({turnRef:e}){let t=(0,q.useContext)(pc),n=t?.state?.points.find(t=>t.turnRef===e);return!t||!n?null:(0,J.jsx)(c,{size:`small`,disabled:t.busy||t.state?.agentRunning,onClick:()=>t.open(n.id),sx:{alignSelf:`flex-start`},children:K(t.locale,`Khôi phục về trước lượt này`,`Restore before this turn`)})}function hc({sessionRef:e,refresh:t,running:n,locale:r,children:i}){let[a,s]=(0,q.useState)(),[l,u]=(0,q.useState)(0),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(!1),[v,y]=(0,q.useState)(),[b,S]=(0,q.useState)(),[C,w]=(0,q.useState)(!1),[T]=(0,q.useState)(()=>{try{return{command:uc(e),failed:!1}}catch{return{command:void 0,failed:!0}}}),[E,D]=(0,q.useState)(T.command),[O,k]=(0,q.useState)(T.failed),A=(0,q.useRef)(null),j=(0,q.useRef)(!1),M=(0,q.useRef)(!0);(0,q.useEffect)(()=>(M.current=!0,()=>{M.current=!1,A.current?.abort()}),[]),(0,q.useEffect)(()=>{let t=new AbortController;return nc(e,t.signal).then(e=>{t.signal.aborted||s(e)}).catch(()=>{}),()=>t.abort()},[e,t,l]);let N=t=>{if(p(!0),S(void 0),w(!1),E)return;A.current?.abort();let n=new AbortController;A.current=n,y(void 0),h(!0),rc(e,t,n.signal).then(e=>{n.signal.aborted||y(e)}).catch(()=>{n.signal.aborted||w(!0)}).finally(()=>{n.signal.aborted||h(!1)})},P=async()=>{if(!(O||j.current||!E&&(!v||n||a?.agentRunning||![`ready`,`conflict`].includes(v.result)))){j.current=!0,_(!0),w(!1);try{let t=E??await ic(v);try{dc(e,t)}catch{k(!0);return}D(t);let n=await oc(e,t);if(n.phase!==`uncertain`&&fc(e,t),!M.current)return;S(n),n.phase!==`uncertain`&&D(void 0),u(e=>e+1)}catch{M.current&&w(!0)}finally{window.dispatchEvent(new CustomEvent(`piagent-workspace-changed`,{detail:{sessionRef:e}})),j.current=!1,M.current&&_(!1)}}},F=()=>{j.current||(A.current?.abort(),p(!1),h(!1))},I=b?.conflicts??v?.conflicts??[],L=b?.phase===`uncertain`||C&&!!E;return(0,J.jsxs)(pc.Provider,{value:{state:a,busy:n||g||O,open:N,locale:r},children:[a&&!a.available&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:K(r,`Project không dùng Git nên không có checkpoint để khôi phục.`,`This project has no Git repository, so checkpoints are unavailable.`)}),E&&!f&&(0,J.jsx)(o,{severity:`warning`,action:(0,J.jsx)(c,{color:`inherit`,onClick:()=>N(E.payload.targetId),children:K(r,`Xem kết quả`,`Check result`)}),children:K(r,`Một lần khôi phục chưa có kết quả xác nhận.`,`A restore is awaiting a confirmed result.`)}),O&&!f&&(0,J.jsx)(o,{severity:`error`,children:K(r,`Không đọc hoặc lưu được yêu cầu khôi phục đang chờ trong trình duyệt. Chưa gửi yêu cầu mới; hãy kiểm tra file trước khi tiếp tục.`,`The browser could not read or save the pending restore. No new request was sent; inspect your files before continuing.`)}),i,(0,J.jsxs)(d,{open:f,onClose:F,fullWidth:!0,maxWidth:`sm`,"aria-labelledby":`checkpoint-dialog-title`,children:[(0,J.jsx)(fe,{id:`checkpoint-dialog-title`,children:K(r,`Khôi phục về trước lượt này`,`Restore before this turn`)}),(0,J.jsx)(he,{children:(0,J.jsxs)(U,{spacing:2,children:[O&&(0,J.jsx)(o,{severity:`error`,children:K(r,`Không đọc hoặc lưu được yêu cầu khôi phục đang chờ trong trình duyệt. Chưa gửi yêu cầu mới; hãy kiểm tra file trước khi tiếp tục.`,`The browser could not read or save the pending restore. No new request was sent; inspect your files before continuing.`)}),m&&(0,J.jsx)(H,{children:K(r,`Đang xem trước…`,`Loading preview…`)}),v&&!b&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(H,{children:K(r,`Sẽ hoàn tác ${v.steps.length} lượt từ mới nhất về lượt đã chọn. Commit và vùng stage được giữ nguyên.`,`Undo ${v.steps.length} turns from newest to the selected turn. Commits and staged changes are preserved.`)}),(0,J.jsx)(H,{variant:`body2`,sx:{whiteSpace:`pre-wrap`,maxHeight:240,overflow:`auto`},children:v.files.join(`
|
|
78
|
-
`)}),![`ready`,`conflict`].includes(v.result)&&(0,J.jsx)(o,{severity:`info`,children:K(r,`Checkpoint hiện không thể khôi phục. Đóng hộp thoại rồi xem trước lại khi lượt chạy kết thúc.`,`This checkpoint cannot be restored now. Close this dialog and preview again after the running turn ends.`)})]}),I.length>0&&(0,J.jsxs)(o,{severity:`warning`,children:[K(r,`Sẽ dừng trước file đã thay đổi sau lượt: `,`Stop before files changed after the turn: `),I.join(`, `)]}),b&&!L&&(0,J.jsx)(o,{severity:b.resultCode===`restored`?`success`:`warning`,children:b.resultCode===`restored`?K(r,`Đã khôi phục ${b.completed.length} lượt.`,`Restored ${b.completed.length} turns.`):b.resultCode===`conflict`?K(r,`Đã khôi phục ${b.completed.length} lượt và dừng để giữ thay đổi của bạn.`,`Restored ${b.completed.length} turns and stopped to preserve your changes.`):K(r,`Chưa khôi phục: trạng thái hoặc quyền đã thay đổi. Đóng hộp thoại và xem trước lại.`,`Not restored: state or permissions changed. Close this dialog and preview again.`)}),L&&(0,J.jsx)(o,{severity:`warning`,children:K(r,`Chưa xác nhận được kết quả; một số file có thể đã thay đổi. Kiểm tra file trước khi tiếp tục. Nút bên dưới chỉ kiểm tra lại cùng yêu cầu.`,`The result is unconfirmed; some files may have changed. Inspect them before continuing. The button below checks the same request.`)}),C&&!E&&(0,J.jsx)(o,{severity:`error`,children:K(r,`Không tải được preview. Đóng hộp thoại và thử lại.`,`Could not load the preview. Close this dialog and try again.`)})]})}),(0,J.jsxs)(x,{children:[(0,J.jsx)(c,{disabled:g,onClick:F,children:K(r,`Đóng`,`Close`)}),(!b||L)&&(0,J.jsx)(c,{variant:`contained`,disabled:O||g||m||!E&&(n||a?.agentRunning||!v?.steps.length||![`ready`,`conflict`].includes(v?.result??``)),onClick:()=>void P(),children:E?K(r,`Kiểm tra lại kết quả`,`Check result again`):K(r,`Xác nhận khôi phục`,`Confirm restore`)})]})]})]})}var gc=j((0,J.jsx)(`path`,{d:`M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z`}),`ImageOutlined`),_c=j((0,J.jsx)(`path`,{d:`M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3zM7 9H4V5h3zm10 6h3v4h-3zm0-10h3v4h-3z`}),`AccountTreeOutlined`),vc=j((0,J.jsx)(`path`,{d:`m22.61 18.99-9.08-9.08c.93-2.34.45-5.1-1.44-7C9.79.61 6.21.4 3.66 2.26L7.5 6.11 6.08 7.52 2.25 3.69C.39 6.23.6 9.82 2.9 12.11c1.86 1.86 4.57 2.35 6.89 1.48l9.11 9.11c.39.39 1.02.39 1.41 0l2.3-2.3c.4-.38.4-1.01 0-1.41m-3 1.6-9.46-9.46c-.61.45-1.29.72-2 .82-1.36.2-2.79-.21-3.83-1.25C3.37 9.76 2.93 8.5 3 7.26l3.09 3.09 4.24-4.24-3.09-3.09c1.24-.07 2.49.37 3.44 1.31 1.08 1.08 1.49 2.57 1.24 3.96-.12.71-.42 1.37-.88 1.96l9.45 9.45z`}),`BuildOutlined`),yc=j((0,J.jsx)(`path`,{d:`M22 8c0-.55-.45-1-1-1h-7c-.55 0-1 .45-1 1s.45 1 1 1h7c.55 0 1-.45 1-1m-9 8c0 .55.45 1 1 1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7c-.55 0-1 .45-1 1M10.47 4.63c.39.39.39 1.02 0 1.41l-4.23 4.25c-.39.39-1.02.39-1.42 0L2.7 8.16a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0l1.42 1.42 3.54-3.54c.38-.38 1.02-.38 1.4 0m.01 8.01c.39.39.39 1.02 0 1.41L6.25 18.3c-.39.39-1.02.39-1.42 0L2.7 16.16c-.39-.39-.39-1.02 0-1.41s1.02-.39 1.41 0l1.42 1.42 3.54-3.54c.38-.38 1.02-.38 1.41.01`}),`ChecklistRounded`),bc=j((0,J.jsx)(`path`,{d:`m14.85 4.85 1.44 1.44-2.88 2.88 1.42 1.42 2.88-2.88 1.44 1.44c.31.31.85.09.85-.36V4.5c0-.28-.22-.5-.5-.5h-4.29c-.45 0-.67.54-.36.85M8.79 4H4.5c-.28 0-.5.22-.5.5v4.29c0 .45.54.67.85.35L6.29 7.7 11 12.4V19c0 .55.45 1 1 1s1-.45 1-1v-7c0-.26-.11-.52-.29-.71l-5-5.01 1.44-1.44c.31-.3.09-.84-.36-.84`}),`CallSplitRounded`),xc=j((0,J.jsx)(`path`,{d:`m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z`}),`EditOutlined`),Sc=j((0,J.jsx)(`path`,{d:`M8 2c-1.1 0-2 .9-2 2v3.17c0 .53.21 1.04.59 1.42L10 12l-3.42 3.42c-.37.38-.58.89-.58 1.42V20c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2v-3.16c0-.53-.21-1.04-.58-1.41L14 12l3.41-3.4c.38-.38.59-.89.59-1.42V4c0-1.1-.9-2-2-2zm8 14.5V19c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-2.5l4-4zm-4-5-4-4V5c0-.55.45-1 1-1h6c.55 0 1 .45 1 1v2.5z`}),`HourglassEmptyRounded`),Cc=j((0,J.jsx)(`path`,{d:`M13 11h-2v3H8v2h3v3h2v-3h3v-2h-3zm1-9H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z`}),`NoteAddOutlined`),wc=j((0,J.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39`}),`PublicRounded`),Tc=j((0,J.jsx)(`path`,{d:`M2 6c.55 0 1-.45 1-1V4c0-.55.45-1 1-1h1c.55 0 1-.45 1-1s-.45-1-1-1H4C2.34 1 1 2.34 1 4v1c0 .55.45 1 1 1m3 15H4c-.55 0-1-.45-1-1v-1c0-.55-.45-1-1-1s-1 .45-1 1v1c0 1.66 1.34 3 3 3h1c.55 0 1-.45 1-1s-.45-1-1-1M20 1h-1c-.55 0-1 .45-1 1s.45 1 1 1h1c.55 0 1 .45 1 1v1c0 .55.45 1 1 1s1-.45 1-1V4c0-1.66-1.34-3-3-3m2 17c-.55 0-1 .45-1 1v1c0 .55-.45 1-1 1h-1c-.55 0-1 .45-1 1s.45 1 1 1h1c1.66 0 3-1.34 3-3v-1c0-.55-.45-1-1-1m-3-3.13V9.13c0-.72-.38-1.38-1-1.73l-5-2.88c-.31-.18-.65-.27-1-.27s-.69.09-1 .27L6 7.39c-.62.36-1 1.02-1 1.74v5.74c0 .72.38 1.38 1 1.73l5 2.88c.31.18.65.27 1 .27s.69-.09 1-.27l5-2.88c.62-.35 1-1.01 1-1.73m-8 2.3-4-2.3v-4.63l4 2.33zm1-6.33L8.04 8.53 12 6.25l3.96 2.28zm5 4.03-4 2.3v-4.6l4-2.33z`}),`ViewInArRounded`);function Ec(e){return{color:`${e}.dark`,'html[data-piagent-color-mode="dark"] &':{color:`${e}.main`}}}var Dc=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,Oc={read:ca,write:Cc,edit:xc,command:b,search:f,list:M,"web-search":h,"web-fetch":ne,subagent:_c,network:wc,docker:Tc,git:bc,plan:yc,other:vc},kc={read:[`Đọc`,`Read`],write:[`Tạo`,`Write`],edit:[`Sửa`,`Edit`],command:[`Chạy`,`Run`],search:[`Tìm`,`Search`],list:[`Xem thư mục`,`List`],"web-search":[`Tìm web`,`Web search`],"web-fetch":[`Đọc trang`,`Fetch page`],subagent:[`Subagent`,`Subagent`],network:[`Chạy có mạng`,`Run with network`],docker:[`Chạy với Docker`,`Run with Docker`],git:[`Git`,`Git`],plan:[`Plan`,`Plan`],other:[`Công cụ`,`Tool`]},Ac={read:`read`,write:`write`,edit:`edit`,apply_patch:`edit`,bash:`command`,run_experiment:`command`,grep:`search`,find:`search`,ls:`list`,web_search:`web-search`,web_fetch:`web-fetch`,delegate:`subagent`,subagent:`subagent`,run_with_network:`network`,run_with_docker:`docker`,fetch_origin:`git`,update_plan:`plan`};function jc(e){return Ac[e.toLowerCase()]??`other`}function Mc({preview:e}){return(0,J.jsx)(W,{component:`pre`,sx:{m:0,fontFamily:Dc,fontSize:12,lineHeight:1.55,overflowX:`auto`},children:e.split(`
|
|
79
|
-
`).map((e,t)=>{let n=e[0],r=n===`+`?`success`:n===`-`?`error`:null;return(0,J.jsx)(W,{component:`div`,sx:{px:1,whiteSpace:`pre`,...r?Ec(r):{color:e===`@@`?`text.disabled`:`text.secondary`},bgcolor:r?`rgba(var(--piagent-palette-${r}-mainChannel) / .12)`:`transparent`},children:e===`@@`?`⋯`:e||` `},t)})})}function Nc({tool:e,locale:t,live:n,waiting:r}){let i=e.summary??{kind:`other`,target:null,detail:null},a=`change`in e?e.change:void 0,o=`result`in e?e.result:void 0,s=e.state===`failed`||o?.isError===!0,c=`failure`in e&&e.failure?{detail:e.failure,copy:ji(e.failure.reasonCode,e.failure.code,t)}:null,l=n?e.state===`running`:e.state===`requested`,[u,d]=(0,q.useState)(()=>s||(i.kind===`edit`||i.kind===`write`)&&!!a?.preview),f=!!(a?.preview||o?.text||c?.copy||i.detail&&i.kind!==`read`),p=r?Sc:Oc[i.kind],m=kc[i.kind][t===`vi`?0:1],h=i.kind===`other`?e.toolName:m;return(0,J.jsxs)(W,{sx:{border:1,borderColor:s?`error.main`:`divider`,borderRadius:1,bgcolor:`background.paper`,overflow:`hidden`},children:[(0,J.jsxs)(be,{component:`div`,disabled:!f,onClick:()=>d(e=>!e),"aria-expanded":f?u:void 0,sx:{width:`100%`,display:`flex`,alignItems:`center`,gap:1,px:1.25,py:.85,textAlign:`left`,justifyContent:`flex-start`},children:[(0,J.jsx)(p,{sx:{fontSize:17,color:s?`error.main`:`text.secondary`,flexShrink:0}}),(0,J.jsx)(H,{variant:`body2`,sx:{fontWeight:600,flexShrink:0},children:h}),i.target&&(0,J.jsx)(H,{variant:`body2`,noWrap:!0,title:i.target,sx:{fontFamily:Dc,fontSize:12.5,color:`text.secondary`,minWidth:0,flex:1},children:i.target}),!i.target&&(0,J.jsx)(W,{sx:{flex:1}}),i.kind===`read`&&i.detail&&(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,sx:{flexShrink:0},children:K(t,`dòng ${i.detail}`,`lines ${i.detail}`)}),a&&(a.added>0||a.removed>0)&&(0,J.jsxs)(H,{variant:`caption`,sx:{fontFamily:Dc,flexShrink:0},children:[a.added>0&&(0,J.jsxs)(W,{component:`span`,sx:Ec(`success`),children:[`+`,a.added,` `]}),a.removed>0&&(0,J.jsxs)(W,{component:`span`,sx:Ec(`error`),children:[`−`,a.removed]})]}),s&&!l&&(0,J.jsx)(H,{variant:`caption`,sx:{flexShrink:0,fontWeight:600,...Ec(`error`)},children:K(t,`Lỗi`,`Failed`)}),l?(0,J.jsx)(me,{size:14,thickness:5,"aria-label":K(t,`Đang chạy`,`Running`)}):s?(0,J.jsx)(N,{sx:{fontSize:16,color:`error.main`},"aria-hidden":`true`}):(0,J.jsx)(Xe,{sx:{fontSize:16,color:`success.main`},"aria-label":K(t,`Xong`,`Done`)}),f&&(0,J.jsx)(V,{sx:{fontSize:18,color:`text.disabled`,transition:`transform .15s`,transform:u?`rotate(180deg)`:`none`}})]}),i.target&&[`read`,`write`,`edit`].includes(i.kind)&&(0,J.jsx)(mr,{path:i.target,line:Number.parseInt(i.detail??`1`,10)||1}),(0,J.jsx)(Kr,{in:u&&f,unmountOnExit:!0,children:(0,J.jsxs)(W,{sx:{borderTop:1,borderColor:`divider`,bgcolor:`action.hover`,maxHeight:360,overflow:`auto`},children:[i.detail&&i.kind!==`read`&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,sx:{px:1.25,py:.75,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,...i.kind===`command`?{fontFamily:Dc,fontSize:12}:{}},children:i.detail}),c?.copy&&(0,J.jsxs)(W,{sx:{px:1.25,py:.75},children:[(0,J.jsxs)(H,{variant:`body2`,sx:{fontWeight:650,...Ec(`error`)},children:[Pi(c.detail.role,t),` `,K(t,`lỗi`,`failed`),` · `,c.copy.title]}),(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:c.copy.text}),(0,J.jsxs)(H,{variant:`caption`,color:`text.secondary`,sx:{fontFamily:Dc,overflowWrap:`anywhere`},title:c.detail.requestRef??void 0,children:[K(t,`Mã`,`Code`),`: `,c.detail.code,c.detail.requestRef?` · request ${c.detail.requestRef.slice(0,8)}`:``]})]}),a?.preview&&(0,J.jsx)(W,{sx:{py:.5},children:(0,J.jsx)(Mc,{preview:a.preview})}),o?.text&&!c?.copy&&(0,J.jsx)(W,{component:`pre`,sx:{m:0,px:1.25,py:.75,fontFamily:Dc,fontSize:12,lineHeight:1.55,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,color:o.isError?`error.main`:`text.secondary`},children:o.text}),(a?.truncated||o?.truncated)&&(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,sx:{display:`block`,px:1.25,pb:.75},children:K(t,`Đã rút gọn`,`Truncated`)})]})})]})}var Pc=(e,t,n)=>e===`vi`?t:n,Fc={blocking:[`blocking`,`blocking`],major:[`major`,`major`],minor:[`minor`,`minor`]},Ic={wrong_premise:[`sai giả định`,`wrong premise`],conflicts_with_request:[`conflict với yêu cầu`,`conflicts with the request`],ambiguous:[`chưa rõ ràng`,`ambiguous`],out_of_scope:[`out of scope`,`out of scope`]},Lc={too_large:[`patch quá lớn`,`the patch is too large`],not_git:[`thư mục không phải git`,`not a git repository`],limit:[`subagent đã hết lượt gọi`,`the subagent ran out of calls`],failed:[`subagent lỗi`,`the subagent failed`]};function Rc(e,t){let n=[];return e.outcome===`interrupted`?Pc(t,`Lượt bị dừng trước khi check xong`,`The turn stopped before its checks finished`):(e.outcome===`disputed`&&n.push((e.disputes??1)>1?Pc(t,`${e.disputes} conflict giữa main agent và subagent, bạn quyết định`,`${e.disputes} disagreements between the main agent and a subagent; your call`):Pc(t,`Main agent và subagent conflict, bạn quyết định`,`The main agent and a subagent disagree; your call`)),e.unchanged?n.join(` · `)||Pc(t,`Không đổi code`,`No code changed`):(e.verified?n.push(Pc(t,`Check đã pass trên code cuối`,`A check passed on the final code`)):e.verifyPolicy!==`off`&&n.push(Pc(t,`Chưa có check pass trên code cuối`,`No check passed on the final code`)),e.reviewed?n.push(e.blockingOpen?Pc(t,`Còn ${e.blockingOpen} lỗi blocking chưa fix`,`${e.blockingOpen} blocking issue(s) still open`):Pc(t,`Review không có lỗi blocking`,`Review found no blocking issue`)):e.reviewPolicy!==`off`&&n.push(e.outcome===`review_unavailable`?Pc(t,`Không chạy được review`,`The review could not run`)+(e.reviewUnavailable&&Lc[e.reviewUnavailable]?` (${Pc(t,...Lc[e.reviewUnavailable])})`:``):Pc(t,`Chưa review`,`Not reviewed`)),e.planSkipped&&n.push(Pc(t,`Đã sửa code khi chưa có plan`,`Code was changed before a plan existed`)),e.planOpen&&n.push(Pc(t,`Plan còn ${e.planOpen} bước chưa xong`,`${e.planOpen} plan step(s) not completed`)),n.join(` · `)||Pc(t,`Đã đổi code`,`Code changed`)))}function zc(e,t){let n=e.loop&&e.maxLoops?Pc(t,` (vòng ${e.loop}/${e.maxLoops})`,` (round ${e.loop}/${e.maxLoops})`):``,r=Ai(e.role??`review`,t),i=(e.findings??e.claims??e.issues??[]).length;switch(e.phase){case`continue`:return Pc(t,`Harness: checklist còn ${e.planOpen??0} bước (${e.planDone??0}/${e.planSteps??0} xong), cho main agent làm tiếp · vòng ${e.round??1}${e.idle?` (vòng trước không xong thêm bước nào)`:``}`,`Harness: the checklist has ${e.planOpen??0} open step(s) (${e.planDone??0}/${e.planSteps??0} done); sent the main agent on · round ${e.round??1}${e.idle?` (the previous round finished no step)`:``}`);case`plan`:return Pc(t,`Harness: plan còn ${e.planOpen??0} bước chưa đánh dấu xong, yêu cầu agent cập nhật`,`Harness: ${e.planOpen??0} plan step(s) not marked completed; asked the agent to update the plan`);case`verify`:return Pc(t,`Harness: chưa có check nào pass trên code hiện tại, yêu cầu agent chạy check${n}`,`Harness: no check has passed on the current code; asked the agent to run checks${n}`);case`review`:return Pc(t,`Harness: review tìm thấy ${i} lỗi blocking, gửi lại agent để fix hoặc giải thích${n}`,`Harness: the review found ${i} blocking issue(s); sent back to the agent to fix or answer${n}`);case`objection`:return Pc(t,`${r} phản biện brief của main agent`,`${r} objected to the main agent's brief`);case`answer`:return Pc(t,`Harness: yêu cầu main agent nói rõ đã quyết định gì với phản biện của subagent`,`Harness: asked the main agent to say what it decided about the subagent's objection`);case`claims`:return Pc(t,`Harness: ${r} đánh fail ${i} claim, gửi lại main agent`,`Harness: ${r} marked ${i} claim(s) as failed; sent back to the main agent`);case`rejudge`:return e.role===`verify`?Pc(t,`Harness: ${r} check lại các claim cùng câu trả lời của main agent`,`Harness: ${r} checks the claims again with the main agent's answer`):Pc(t,`Harness: main agent giải thích thay vì fix, ${r} xem xét lại lời giải thích`,`Harness: the main agent answered instead of fixing; ${r} judges the answer`);case`undo`:{let n=e.undo,r=n?.files?.length?` (${n.files.join(`, `)})`:``;return n?.result===`done`?Pc(t,`Đã hoàn tác lượt trước: ${n.restored} file trả về như trước, ${n.removed} file lượt đó tạo đã xoá${r}.${n.more?` Gửi /undo lần nữa để hoàn tác lượt trước nữa.`:``} Commit trong lượt đó vẫn giữ.`,`Undid the last turn: ${n.restored} file(s) restored, ${n.removed} file(s) it created removed${r}.${n.more?` Send /undo again to undo the turn before.`:``} Commits made in that turn stay.`):n?.result===`refused`?Pc(t,`Không hoàn tác: file lượt trước đã sửa lại bị đổi tiếp sau đó${r}; hoàn tác sẽ ghi đè thay đổi đó.`,`Not undone: a file the last turn changed was changed again since${r}; undoing would overwrite that change.`):n?.result===`busy`?Pc(t,`Đang có một lượt chạy: chờ nó xong (hoặc dừng nó) rồi /undo.`,`A turn is running: wait for it (or stop it), then /undo.`):n?.result===`none`?Pc(t,`Không có lượt nào để hoàn tác (chỉ áp dụng cho project là git repository, từ khi mở cuộc trò chuyện).`,`There is no turn to undo (git repositories only, since the conversation opened).`):Pc(t,`Không đọc được trạng thái project; không hoàn tác.`,`The project's state could not be read; nothing was undone.`)}case`dispute`:return Pc(t,`Main agent và ${r} vẫn conflict sau 2 lượt, bạn quyết định`,`The main agent and the ${r} still disagree after two rounds; your call`);default:return``}}function Bc(e,t){return(e.findings??[]).map(e=>({tag:Pc(t,...Fc[e.severity]??[e.severity,e.severity]),tone:e.severity===`blocking`?`error`:`warning`,location:e.file?`${e.file}${e.line?`:${e.line}`:``}`:null,text:e.issue})).concat((e.claims??[]).map(e=>({tag:`fail`,tone:`error`,location:null,text:e.claim}))).concat((e.issues??[]).map(e=>({tag:Pc(t,...Ic[e.kind]??[e.kind,e.kind]),tone:`warning`,location:null,text:e.detail})))}var Vc={clean:`success`,disputed:`warning`,blocking_open:`error`,unverified:`warning`,unreviewed:`warning`,review_unavailable:`warning`,interrupted:`warning`,no_change:`info`};function Hc(e,t){return Rc(e,t)}var Uc=e=>e?Vc[e]:`info`,Wc=e=>{let t=Uc(e.outcome);return t===`success`&&(e.planSkipped||e.planOpen)?`warning`:t},Gc={fontFamily:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,fontSize:12.5};function Kc({process:e,locale:t}){let n=Bc(e,t).map(e=>(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(W,{component:`span`,sx:{fontWeight:600,...Ec(e.tone)},children:[`[`,e.tag,`]`]}),e.location&&(0,J.jsxs)(W,{component:`span`,sx:Gc,children:[` `,e.location]}),e.location?` — `:` `,e.text]}));return n.length>0?(0,J.jsx)(W,{component:`ol`,sx:{m:0,pl:3.5},children:n.map((e,t)=>(0,J.jsx)(H,{component:`li`,variant:`body2`,sx:{overflowWrap:`anywhere`},children:e},t))}):null}function qc({process:e,locale:t}){if(e.phase===`final`){let n=Wc(e),r=n===`success`?lt:n===`error`?P:pe;return(0,J.jsxs)(U,{direction:`row`,role:`status`,"aria-label":K(t,`Tiến trình của lượt`,`Turn process`),sx:{alignItems:`flex-start`,gap:.75},children:[(0,J.jsx)(r,{sx:{fontSize:16,mt:.2,...Ec(n)}}),(0,J.jsx)(H,{variant:`body2`,sx:Ec(n),children:Hc(e,t)})]})}let n=e.phase===`dispute`||e.phase===`objection`,r=e.phase===`dispute`?pe:e.phase===`objection`?le:St,i=e.phase===`dispute`?`warning`:null;return(0,J.jsxs)(U,{spacing:.5,role:n?`status`:void 0,sx:{borderLeft:2,borderColor:i?`warning.main`:`divider`,pl:1.25},children:[(0,J.jsxs)(U,{direction:`row`,sx:{alignItems:`flex-start`,gap:.75},children:[(0,J.jsx)(r,{sx:{fontSize:16,mt:.2,...i?Ec(i):{color:`text.secondary`}}}),(0,J.jsx)(H,{variant:`body2`,sx:i?{fontWeight:600,...Ec(i)}:n?{fontWeight:600}:{color:`text.secondary`},children:zc(e,t)})]}),(0,J.jsx)(Kc,{process:e,locale:t})]})}var Jc=(e,t,n)=>e===`vi`?t:n;function Yc(e,t){let n=e.planDeferred??0,r=e.planSteps-e.planDone-n,i=e.rounds?Jc(t,` Harness đã cho agent làm tiếp ${e.rounds} vòng.`,` The harness sent the agent back ${e.rounds} time(s).`):``;if(e.state===`cancelled`)return{tone:`info`,continuable:!0,title:Jc(t,`Bạn đã dừng lượt này`,`You stopped this turn`),text:Jc(t,`Task chưa xong${e.planSteps?` (${e.planDone}/${e.planSteps} bước)`:``}. Bấm Tiếp tục để agent làm tiếp từ chỗ dừng.`,`The task is not finished${e.planSteps?` (${e.planDone}/${e.planSteps} steps)`:``}. Choose Continue to pick up where it stopped.`)};if(e.state===`failed`)return{tone:`error`,continuable:!0,title:Jc(t,`Lượt dừng vì lỗi · ${Ai(e.role??`main`,t)}`,`Turn stopped by a failure · ${Ai(e.role??`main`,t)}`),text:Jc(t,`Task chưa xong${e.planSteps?`: còn ${r}/${e.planSteps} bước`:``}. Xem lỗi phía trên; khi đã xử lý, bấm Tiếp tục để chạy lại từ chỗ dừng.`,`The task is not finished${e.planSteps?`: ${r} of ${e.planSteps} steps open`:``}. See the failure above; once it is resolved, choose Continue.`)+(e.code?` [${e.code}]`:``)};if(e.state===`midway`){let n=e.reason===`idle`?Jc(t,`Main agent dừng 2 vòng liên tiếp mà không xong thêm bước nào: đọc câu trả lời cuối để biết vướng gì.`,`The main agent stopped 2 rounds in a row without finishing a step: its last answer says what is in the way.`):e.reason===`limit`?Jc(t,`Đã tới giới hạn 30 vòng tự làm tiếp cho một tin nhắn.`,`The limit of 30 automatic rounds for one message was reached.`):Jc(t,`Harness của team không bắt buộc plan nên không tự làm tiếp.`,`The team's Harness does not require a plan, so it does not continue on its own.`);return{tone:`warning`,continuable:!0,title:Jc(t,`Dừng giữa chừng · còn ${r}/${e.planSteps} bước`,`Stopped midway · ${r} of ${e.planSteps} steps open`),text:`${n}${i} ${Jc(t,`Bấm Tiếp tục để làm tiếp.`,`Choose Continue to go on.`)}`}}return n?{tone:`info`,continuable:!0,title:Jc(t,`Dừng theo yêu cầu · ${e.planDone}/${e.planSteps} bước xong, ${n} bước để sau`,`Stopped as asked · ${e.planDone} of ${e.planSteps} steps done, ${n} left for later`),text:Jc(t,`Các bước còn lại được để sau theo yêu cầu hoặc vì không cần nữa: câu trả lời cuối nói lý do. Bấm Tiếp tục khi muốn làm nốt.`,`The other steps were left for later as asked, or are no longer needed: the last answer says why. Choose Continue to do them.`)+i}:{tone:`success`,continuable:!1,title:e.planSteps?Jc(t,`Hoàn thành · ${e.planSteps}/${e.planSteps} bước`,`Done · ${e.planSteps}/${e.planSteps} steps`):Jc(t,`Xong lượt`,`Turn finished`),text:(e.planSteps?Jc(t,`Mọi bước trong checklist đã xong.`,`Every checklist step is completed.`):Jc(t,`Main agent đã trả lời xong; lượt này không có checklist.`,`The main agent finished its answer; this turn had no checklist.`))+i}}function Xc(e,t){return e.state===`done`&&e.planDeferred?Jc(t,`Xong ${e.planDone}/${e.planSteps}, để sau ${e.planDeferred}`,`Done ${e.planDone}/${e.planSteps}, ${e.planDeferred} later`):e.state===`midway`?Jc(t,`Dừng giữa chừng ${e.planDone}/${e.planSteps}`,`Stopped ${e.planDone}/${e.planSteps}`):e.state===`failed`?Jc(t,`Lỗi, chưa xong`,`Failed`):e.state===`cancelled`?Jc(t,`Đã dừng`,`Stopped`):e.planSteps?Jc(t,`Xong ${e.planSteps}/${e.planSteps}`,`Done ${e.planSteps}/${e.planSteps}`):Jc(t,`Xong`,`Done`)}function Zc({end:e,locale:t,onContinue:n}){let r=Yc(e,t),a=n&&r.continuable?(0,J.jsx)(c,{color:`inherit`,size:`small`,onClick:n,children:K(t,`Tiếp tục`,`Continue`)}):void 0;return(0,J.jsxs)(o,{severity:r.tone,variant:`outlined`,role:`status`,"aria-label":K(t,`Kết quả của lượt`,`How the turn ended`),action:a,sx:{alignSelf:`stretch`},children:[(0,J.jsx)(i,{sx:{fontSize:`inherit`,fontWeight:650,mb:.25},children:r.title}),r.text]})}var Qc={done:`success`,midway:`warning`,failed:`error`,cancelled:`info`},$c=e=>e.state===`done`&&e.planDeferred?`info`:Qc[e.state];function el(e,t){return Xc(e,t)}var tl=null,nl=null,rl=()=>tl??=yr(()=>import(`./MarkdownMessage-DchODuO7.js`).then(e=>(nl=e.MarkdownMessage,e)),__vite__mapDeps([11,1,2])),il=(0,q.lazy)(async()=>({default:(await rl()).MarkdownMessage}));function al({children:e}){let t=nl;return t?(0,J.jsx)(t,{children:e}):(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(H,{sx:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,lineHeight:1.75},children:e}),children:(0,J.jsx)(il,{children:e})})}function ol({attachments:e,locale:t}){return e.length?(0,J.jsx)(U,{spacing:.75,sx:{mb:1},"aria-label":K(t,`File đã gửi`,`Sent files`),children:e.map((e,n)=>{let r=`sourceBytes`in e?yi(e,t):`${e.kind===`document`?K(t,`Tài liệu`,`Document`):e.kind===`image`?K(t,`Ảnh`,`Image`):`File`}${e.truncated?` · ${K(t,`đã cắt bớt`,`truncated`)}`:``}`;return(0,J.jsxs)(te,{variant:`outlined`,sx:{display:`flex`,alignItems:`center`,gap:1.1,minWidth:220,maxWidth:440,px:1.2,py:1,borderRadius:1,bgcolor:`background.paper`},children:[e.kind===`image`?(0,J.jsx)(gc,{color:`action`}):(0,J.jsx)(ca,{color:`action`}),(0,J.jsxs)(W,{sx:{minWidth:0},children:[(0,J.jsx)(H,{variant:`body2`,noWrap:!0,sx:{fontWeight:650},children:e.displayName}),(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:r})]})]},`${e.displayName}:${n}`)})}):null}var sl=new Set([`assistant-response-failed`,`operation-failed`]);function cl(e,t){switch(e){case`provider-auth-expired`:return K(t,`Phiên đăng nhập model đã hết hạn. Mở Cài đặt → Nhà cung cấp & model để kết nối lại.`,`The model sign-in expired. Open Settings → Providers & models to reconnect.`);case`provider-auth-required`:return K(t,`Model cần đăng nhập lại. Mở Cài đặt → Nhà cung cấp & model.`,`The model needs to sign in again. Open Settings → Providers & models.`);case`provider-rate-limited`:return K(t,`Model đang bị giới hạn lượt gọi hoặc đã hết hạn mức. Thử lại sau.`,`The model is rate limited or out of quota. Try again later.`);case`provider-unavailable`:return K(t,`Model hoặc máy chủ trung gian đang không phục vụ yêu cầu này. Thử lại; nếu lỗi lặp lại, kiểm tra model đang dùng.`,`The model or its gateway did not serve this request. Retry; if it repeats, check the model in use.`);case`assistant-output-incomplete`:return K(t,`Câu trả lời dừng giữa chừng vì chạm giới hạn độ dài. Gửi “tiếp tục” để model viết tiếp.`,`The answer stopped at the length limit. Send “continue” to resume.`);default:return K(t,`Model trả lỗi và chưa có câu trả lời. Gửi lại; nếu lỗi lặp lại, kiểm tra model đang dùng.`,`The model returned an error without an answer. Send again; if it repeats, check the model in use.`)}}function ll({code:e,detail:t,locale:n,onContinue:r}){let a=ji(e,t?.code??null,n),s=r&&Ni(e)?(0,J.jsx)(c,{color:`inherit`,size:`small`,onClick:r,children:K(n,`Tiếp tục`,`Continue`)}):void 0;return a?(0,J.jsxs)(o,{severity:`error`,variant:`outlined`,icon:(0,J.jsx)(P,{}),action:s,sx:{alignSelf:`stretch`},children:[(0,J.jsxs)(i,{sx:{fontSize:`inherit`,fontWeight:650,mb:.25},children:[Pi(t?.role??`main`,n),` `,K(n,`lỗi`,`failed`),` · `,a.title]}),a.text,t&&(0,J.jsxs)(H,{variant:`caption`,component:`div`,color:`text.secondary`,sx:{mt:.5,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,overflowWrap:`anywhere`},title:t.requestRef??void 0,children:[K(n,`Mã`,`Code`),`: `,t.code,t.requestRef?` · request ${t.requestRef.slice(0,8)}`:``]})]}):(0,J.jsx)(o,{severity:`error`,variant:`outlined`,icon:(0,J.jsx)(P,{}),action:s,sx:{alignSelf:`stretch`},children:cl(e,n)})}function ul({text:e,attachments:t,note:n,locale:r}){return(0,J.jsxs)(W,{sx:{alignSelf:`flex-end`,maxWidth:`82%`,bgcolor:`action.selected`,borderRadius:1,px:2,py:1.4},children:[(0,J.jsx)(ol,{attachments:t,locale:r}),e&&(0,J.jsx)(H,{sx:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,lineHeight:1.7},children:(0,J.jsx)(hr,{children:e})}),n&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:n})]})}function dl({children:e}){return(0,J.jsxs)(W,{sx:{display:`flex`,gap:1.5,alignItems:`flex-start`},children:[(0,J.jsx)(lr,{size:26}),(0,J.jsxs)(U,{spacing:1,sx:{minWidth:0,flex:1},children:[(0,J.jsx)(H,{sx:{fontWeight:600},children:`Piagent`}),e]})]})}function fl(e,t){return e.content.redacted?K(t,`Đã ẩn dữ liệu nhạy cảm`,`Sensitive data hidden`):e.content.truncated?K(t,`Nội dung đã rút gọn`,`Content truncated`):null}function pl({turn:e,locale:t}){let n=Bs(e),r=[`${e.requests} request`];e.tokens&&r.push(`${Us(e.tokens)} token`),n!==null&&n>0&&r.push(n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`);let i=Vs(e);return i!==null&&r.push(`${i} tok/s`),e.model&&r.push(e.model),(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,title:K(t,`Request model, token, thời gian và tốc độ sinh token (token đầu ra mỗi giây, tính cả thời gian chờ) của lượt này`,`Model requests, tokens, time and output speed (output tokens per second, waiting included) of this turn`),children:r.join(` · `)})}var ml=(0,q.memo)(function({turn:e,locale:t,onContinue:n}){let r=!!n&&!e.answer&&!e.failure&&!e.end,i=e.steps.length>0||e.answer||e.failure||r||e.process||e.end;return(0,J.jsxs)(U,{spacing:1.5,children:[(0,J.jsx)(ul,{text:e.user.content.text,attachments:e.user.attachments??[],note:fl(e.user,t),locale:t}),i&&(0,J.jsxs)(dl,{children:[e.steps.map(e=>e.kind===`tool`?(0,J.jsx)(Nc,{tool:e.tool,locale:t},e.key):e.kind===`process`?(0,J.jsx)(qc,{process:e.process,locale:t},e.key):(0,J.jsx)(W,{sx:{color:`text.secondary`,fontSize:`.875rem`,"& .MuiTypography-root":{fontSize:`inherit`}},children:(0,J.jsx)(al,{children:e.text})},e.key)),e.failure&&(0,J.jsx)(ll,{code:e.failure,detail:e.failureDetail,locale:t,onContinue:n}),r&&(0,J.jsx)(o,{severity:`info`,variant:`outlined`,sx:{alignSelf:`stretch`},action:(0,J.jsx)(c,{color:`inherit`,size:`small`,onClick:n,children:K(t,`Tiếp tục`,`Continue`)}),children:K(t,`Lượt này chưa có câu trả lời: nó đã bị dừng, hoặc ứng dụng hay máy tắt khi đang chạy. Các bước đã làm vẫn được giữ; bấm Tiếp tục để làm tiếp.`,`This turn has no answer: it was stopped, or the app or the machine went down while it ran. Its steps are kept; press Continue to go on.`)}),e.answer&&(0,J.jsx)(W,{children:(0,J.jsx)(al,{children:e.answer})}),e.process&&(0,J.jsx)(qc,{process:e.process,locale:t}),e.end&&(0,J.jsx)(Zc,{end:e.end,locale:t,onContinue:e.failure?void 0:n}),e.requests>0&&(0,J.jsx)(pl,{turn:e,locale:t})]}),(0,J.jsx)(mc,{turnRef:e.user.messageRef})]})});function hl(e,t){return e===`compaction`?K(t,`Tóm tắt phần cũ của cuộc trò chuyện`,`Summarise the older part of the conversation`):e===`capacity-wait`?K(t,`Chờ tài khoản công ty rảnh (Studio đang bận, sẽ tự gửi lại)`,`Wait for a free company account (Studio is busy; it is sent again by itself)`):e}function gl({user:e,attachments:t,activities:n,assistant:r,running:i,failure:a,status:o,locale:s}){return(0,J.jsxs)(U,{spacing:1.5,children:[e&&(0,J.jsx)(ul,{text:e,attachments:t,locale:s}),(0,J.jsxs)(dl,{children:[n.map(e=>(0,J.jsx)(Nc,{live:!0,locale:s,waiting:e.toolLabel===`capacity-wait`,tool:{toolName:hl(e.toolLabel,s),state:e.state,summary:{kind:jc(e.toolLabel),target:e.fileLabel??null,detail:null}}},e.toolCallRef)),a&&(0,J.jsx)(ll,{code:a,locale:s}),r&&(0,J.jsx)(W,{className:i?`streaming-answer`:void 0,children:(0,J.jsx)(al,{children:r})}),i&&o]})]})}function _l(e){let t=(0,q.useRef)(null),[n,r]=(0,q.useState)(null);return(0,q.useEffect)(()=>{if(!e){t.current=null,r(null);return}t.current??={at:Date.now(),from:e.length},r(Hs(e.length-t.current.from,Date.now()-t.current.at))},[e]),n}function vl({live:e,locale:t,onOpenActivity:n}){let[r,i]=(0,q.useState)(()=>Date.now());(0,q.useEffect)(()=>{let e=window.setInterval(()=>i(Date.now()),1e4);return()=>window.clearInterval(e)},[]);let a=bs(e,t,r),o=_l(e.assistant??``),s=e.activities.some(e=>e.state===`running`)||!!e.assistant;return(0,J.jsxs)(U,{direction:`row`,spacing:1.25,role:`status`,"aria-live":`polite`,sx:{alignItems:`center`,color:`text.secondary`,py:.5,minHeight:36},children:[(0,J.jsx)(W,{sx:{width:18,display:`grid`,placeItems:`center`,flexShrink:0},children:s?(0,J.jsx)(W,{sx:{width:6,height:6,borderRadius:`50%`,bgcolor:`primary.main`,opacity:.7}}):(0,J.jsx)(me,{size:16,thickness:4.5})}),(0,J.jsxs)(W,{sx:{minWidth:0},children:[(0,J.jsx)(H,{variant:`body2`,sx:{fontWeight:600},children:a.label}),(0,J.jsxs)(H,{variant:`caption`,color:`text.disabled`,children:[a.detail,o!==null&&` · ≈ ${o} tok/s`]})]}),n&&(0,J.jsx)(c,{size:`small`,variant:`text`,onClick:n,sx:{ml:`auto !important`},children:K(t,`Xem Activity`,`View Activity`)})]})}var yl=new Map,bl=96,xl=()=>document.documentElement.scrollHeight-window.innerHeight,Sl=()=>xl()-window.scrollY<=bl,Cl=1500,wl=110;function Tl(e,t){let n=(0,q.useRef)(null),r=(0,q.useRef)(!1),i=(0,q.useRef)(!0),a=(0,q.useRef)(null),o=(0,q.useRef)(!1),s=()=>{a.current=null,n.current&&(n.current.style.overflowAnchor=``)},c=()=>{let e=a.current;if(!e)return;if(Date.now()>e.until){s();return}let t=n.current?.querySelector(`[data-turn="${CSS.escape(e.key)}"]`);if(!t)return;let r=t.getBoundingClientRect().top-e.top;Math.abs(r)>=1&&window.scrollBy(0,r)};return(0,q.useLayoutEffect)(()=>{if(!t||r.current)return;r.current=!0;let n=yl.get(e)??`end`;i.current=n===`end`,window.scrollTo(0,n===`end`?xl():Math.min(n,xl()))},[t,e]),(0,q.useEffect)(()=>{let t=window.scrollY,s=()=>{if(!r.current)return;window.scrollY<t-2&&(o.current=!0),t=window.scrollY;let s=a.current;if(s){let e=n.current?.querySelector(`[data-turn="${CSS.escape(s.key)}"]`);e&&(s.top=e.getBoundingClientRect().top)}i.current=Sl(),yl.set(e,i.current?`end`:window.scrollY)};window.addEventListener(`scroll`,s,{passive:!0});let l=n.current,u=typeof ResizeObserver>`u`||!l?null:new ResizeObserver(()=>{r.current&&(a.current?c():i.current&&window.scrollTo(0,xl()))});return l&&u?.observe(l),()=>{window.removeEventListener(`scroll`,s),u?.disconnect()}},[e]),{content:n,hold:()=>{if(window.setTimeout(c,1550),a.current){a.current.until=Date.now()+Cl;return}let e=[...n.current?.querySelectorAll(`[data-turn]`)??[]],t=e.find(e=>e.getBoundingClientRect().bottom>wl)??e[0];!t?.dataset.turn||!n.current||(n.current.style.overflowAnchor=`none`,a.current={key:t.dataset.turn,top:t.getBoundingClientRect().top,until:Date.now()+Cl})},reapply:c,scrolledUp:o,follow:()=>{s(),i.current=!0}}}function El({turns:e=2,label:t}){return(0,J.jsx)(U,{spacing:3,role:`status`,"aria-label":t,sx:{py:1},children:Array.from({length:e},(e,t)=>(0,J.jsxs)(U,{spacing:1.5,children:[(0,J.jsx)(wo,{variant:`rounded`,animation:`wave`,sx:{alignSelf:`flex-end`,width:`46%`,height:44,borderRadius:2}}),(0,J.jsxs)(U,{direction:`row`,spacing:1.5,children:[(0,J.jsx)(wo,{variant:`rounded`,width:26,height:26}),(0,J.jsxs)(U,{spacing:1,sx:{flex:1},children:[(0,J.jsx)(wo,{width:`30%`}),(0,J.jsx)(wo,{width:`92%`}),(0,J.jsx)(wo,{width:`78%`})]})]})]},t))})}function Dl({sessionRef:e,sessionRevision:t,live:n,approvals:r,locale:i,onOpenActivity:a,onContinue:s,reload:l=0}){let[u,d]=(0,q.useState)(),[f,p]=(0,q.useState)(!0),[m,h]=(0,q.useState)(!1),[g,_]=(0,q.useState)(0),[v,y]=(0,q.useState)(!1),[b,x]=(0,q.useState)(!1),[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(null);(0,q.useEffect)(()=>{rl()},[]);let E=Ts(e,t,n),{completionKey:D,user:O,assistant:k,operationRef:A,messageRequestId:j,startedAt:M}=E;(0,q.useEffect)(()=>{let t=new AbortController;p(!0),x(!1),T(null);let n=window.setTimeout(()=>{Promise.all([Jt(e,null,50,t.signal),rl().catch(()=>void 0)]).then(([e])=>{d(e),y(!1),D&&Ps(e.items,O,k,{operationRef:A,messageRequestId:j,startedAt:M})&&T(D)}).catch(()=>{t.signal.aborted||x(!0)}).finally(()=>{t.signal.aborted||p(!1)})},D?100:0);return()=>{window.clearTimeout(n),t.abort()}},[E.key,l,g]);let N=u?.state===`ready`?u.items:[],F=(0,q.useMemo)(()=>zs(N),[N]),I=(0,q.useMemo)(()=>!!(n?.user&&Fs(N,n.user,{operationRef:n.operationRef,messageRequestId:n.messageRequestId,startedAt:n.startedAt})),[N,n?.user,n?.operationRef,n?.messageRequestId,n?.startedAt]),L=!!(n&&!I&&(!n.complete||w!==D)),ee=(0,q.useMemo)(()=>!!(n?.user&&Ns(N,n.user,{operationRef:n.operationRef,messageRequestId:n.messageRequestId,startedAt:n.startedAt})),[N,n?.user,n?.operationRef,n?.messageRequestId,n?.startedAt]),{content:te,hold:ne,reapply:R,scrolledUp:z,follow:B}=Tl(e,!!u||b),re=(0,q.useRef)(!1),ie=(0,q.useRef)(u);ie.current=u;let ae=async()=>{let t=ie.current,n=t?.page.nextBeforeCursor;if(!(!t||!n||re.current)){re.current=!0,ne(),h(!0),C(!1);try{let r=await Jt(e,n,t.page.limit);ne();let i=ie.current;if(!i){ie.current=r,d(r);return}let a=es(i.items,r.items);new Set([...i.items,...r.items].map(e=>e.messageRef)).size>a.length&&y(!0);let o={...i,items:a,page:r.page};ie.current=o,d(o)}catch{C(!0)}finally{re.current=!1,h(!1)}}};(0,q.useLayoutEffect)(()=>{R()},[N.length,m]);let oe=(0,q.useRef)(null);(0,q.useEffect)(()=>{let e=oe.current;if(!e||!u?.page.hasOlder||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&z.current&&!S&&ae()},{rootMargin:`900px 0px 0px 0px`});return t.observe(e),()=>t.disconnect()});let V=n?ks(n.assistant||``):null;return(0,J.jsx)(hc,{sessionRef:e,refresh:`${E.key}:${l}`,running:!!n&&!n.complete&&!n.error,locale:i,children:(0,J.jsxs)(U,{ref:te,spacing:3,children:[u?.page.hasOlder&&(0,J.jsx)(W,{ref:oe,children:m?(0,J.jsx)(El,{label:K(i,`Đang tải tin cũ hơn`,`Loading older messages`)}):(0,J.jsx)(W,{sx:{textAlign:`center`},children:(0,J.jsx)(c,{size:`small`,variant:`text`,color:`inherit`,startIcon:(0,J.jsx)(qe,{}),onClick:()=>void ae(),sx:{color:S?`warning.main`:`text.secondary`},children:S?K(i,`Chưa tải được tin cũ · thử lại`,`Older messages did not load · retry`):K(i,`Tải tin cũ hơn`,`Load older messages`)})})}),u?.state===`ready`&&!u.page.hasOlder&&F.length>3&&(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,sx:{textAlign:`center`,display:`block`},children:K(i,`Đầu cuộc trò chuyện`,`Start of the conversation`)}),f&&!u&&(0,J.jsx)(El,{turns:3,label:K(i,`Đang tải cuộc trò chuyện`,`Loading the conversation`)}),b&&!u&&(0,J.jsx)(o,{severity:`warning`,icon:(0,J.jsx)(P,{}),children:K(i,`Chưa tải được lịch sử cuộc trò chuyện. Thử lại bằng nút làm mới.`,`Session history could not be loaded. You can retry with Refresh.`)}),F.map((e,t)=>(0,J.jsx)(W,{"data-turn":e.key,children:(0,J.jsx)(ml,{turn:e,locale:i,onContinue:t===F.length-1&&!L&&!r?.pending.length?s:void 0})},e.key)),v&&(0,J.jsx)(W,{sx:{textAlign:`center`},children:(0,J.jsx)(c,{size:`small`,variant:`outlined`,onClick:()=>{B(),_(e=>e+1)},children:K(i,`Tin mới hơn đã ẩn · về tin mới nhất`,`Newer messages are hidden · back to the newest`)})}),L&&n&&(0,J.jsx)(gl,{user:n.user&&!ee?n.user:null,attachments:n.attachments,activities:n.activities,assistant:n.error?null:V,running:!n.complete&&!n.error,failure:n.complete&&n.error&&sl.has(n.error)?n.error:null,locale:i,status:(0,J.jsx)(vl,{live:n,locale:i,onOpenActivity:a})}),(0,J.jsx)(Zo,{sessionRef:e,waiting:qo(n),approvalRefs:r?.pending.map(e=>e.approvalRef)??[]})]})})}function Ol(e){return(0,J.jsx)(ut,{viewBox:`0 0 16 16`,...e,children:(0,J.jsx)(`path`,{d:`M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm0 2.122a2.25 2.25 0 1 0-1.5 0v5.256a2.25 2.25 0 1 0 1.5 0V9.5h3.25a2.75 2.75 0 0 0 2.75-2.75v-1.378a2.25 2.25 0 1 0-1.5 0V6.75c0 .69-.56 1.25-1.25 1.25H5V5.372ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm7.5-9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z`})})}function kl(e,t){return e.detached?K(t,`Git không ở nhánh nào (detached HEAD tại ${e.name})`,`Git is not on a branch (detached HEAD at ${e.name})`):K(t,`Nhánh Git của project: ${e.name}`,`The project's Git branch: ${e.name}`)}function Al({branch:e,locale:t,maxWidth:n=220,tooltip:r=!0}){if(!e)return null;let i=(0,J.jsxs)(W,{component:`span`,"aria-label":r?kl(e,t):void 0,sx:{display:`inline-flex`,alignItems:`center`,gap:.4,minWidth:0,maxWidth:n,verticalAlign:`bottom`,color:e.detached?`warning.main`:`inherit`},children:[(0,J.jsx)(Ol,{sx:{fontSize:`1.1em`,flexShrink:0}}),(0,J.jsx)(W,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:`.95em`},children:e.name})]});return r?(0,J.jsx)(tt,{describeChild:!0,title:kl(e,t),children:i}):i}var jl={"branch-switch-blocked-running":[`Có cuộc trò chuyện đang chạy trong folder này. Chờ chạy xong hoặc Dừng rồi chuyển nhánh.`,`A conversation is running in this folder. Wait for it to finish, or stop it, then switch.`],"branch-switch-local-changes":[`Git không chuyển được: thay đổi chưa commit sẽ bị ghi đè. Commit hoặc stash trước.`,`Git refused: uncommitted changes would be overwritten. Commit or stash them first.`],"branch-switch-unfinished-merge":[`Repo đang dở merge hoặc rebase. Xử lý xong rồi chuyển nhánh.`,`The repository is in the middle of a merge or rebase. Finish it first.`],"branch-exists":[`Đã có nhánh tên này.`,`A branch with this name already exists.`],"branch-name-invalid":[`Tên nhánh không hợp lệ với Git.`,`Git does not accept this branch name.`],"branch-not-found":[`Không còn nhánh này.`,`This branch no longer exists.`],"not-a-git-repository":[`Folder này không phải repo Git.`,`This folder is not a Git repository.`],"branch-switch-timeout":[`Git chạy quá lâu nên đã dừng.`,`Git took too long and was stopped.`]};function Ml({projectRef:e,projectLabel:t,branch:r,repositories:i,locale:a,onSwitched:s,maxWidth:c=220}){let[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(null),C=(0,q.useRef)(null),w=(0,q.useRef)(null),[T,E]=(0,q.useState)(null);(0,q.useEffect)(()=>{E(null)},[r?.name,r?.detached,e]);let D=T??r,O=!!l,k=()=>{C.current?.abort();let t=new AbortController;C.current=t,g(!1),gn(e,d,t.signal).then(e=>{t.signal.aborted||m(e)},()=>{t.signal.aborted||g(!0)})};(0,q.useEffect)(()=>(O&&k(),()=>C.current?.abort()),[O,e,d]);let A=()=>{y||(C.current?.abort(),u(null),v(``),S(null),m(null),g(!1),f(null))},j=e=>{C.current?.abort(),m(null),v(``),S(null),f(e)},M=async t=>{b(t.branch),S(null);try{let n=await rn(e,d===null?t:{...t,repository:d});n.head&&d===null&&E(n.head),s?.(),u(null),v(``),m(null),f(null)}catch(e){S(e instanceof pn?{code:e.code,detail:e.detail}:{code:`branch-switch-failed`,detail:null}),k()}finally{b(null)}},N=p?.repository?p:null;(0,q.useEffect)(()=>{O&&N&&requestAnimationFrame(()=>w.current?.focus())},[O,N]);let P=_.trim(),F=(0,q.useMemo)(()=>(N?.branches??[]).filter(e=>!P||e.name.toLowerCase().includes(P.toLowerCase())),[N,P]),I=F.filter(e=>!e.remote),L=F.filter(e=>e.remote),ee=(N?.branches??[]).some(e=>e.name===P),te=(p?.running??0)>0,ne=e=>(0,J.jsxs)(at,{dense:!0,disabled:!e.current&&(te||!!y),selected:e.current,"aria-current":e.current||void 0,onClick:()=>e.current?A():void M({branch:e.name,remote:e.remote}),sx:{borderRadius:1,py:.4},children:[(0,J.jsx)(Ke,{sx:{minWidth:26},children:y===e.name?(0,J.jsx)(me,{size:14}):e.current?(0,J.jsx)(Xe,{sx:{fontSize:16}}):e.remote?(0,J.jsx)(n,{sx:{fontSize:15,color:`text.disabled`}}):null}),(0,J.jsx)(ft,{primary:e.name,secondary:[e.remote,e.committedAt?Q(e.committedAt,a):null].filter(Boolean).join(` · `)||void 0,slotProps:{primary:{noWrap:!0,sx:{fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:12.5}},secondary:{noWrap:!0,sx:{fontSize:11}}}})]},`${e.remote??``}/${e.name}`),R=p&&!p.repository?p.repositories??[]:[],z=!D&&!!i?.length;if(!D&&!z)return null;let re={minWidth:0,maxWidth:c,borderRadius:.75,px:.4,mx:-.4,font:`inherit`,color:`inherit`,justifyContent:`flex-start`,"&:hover":{bgcolor:`action.hover`,color:`text.primary`},"&.Mui-focusVisible":{outline:`2px solid`,outlineColor:`primary.main`}},ie=e=>{e.stopPropagation(),u(e.currentTarget)};return(0,J.jsxs)(J.Fragment,{children:[D?(0,J.jsx)(tt,{describeChild:!0,title:`${kl(D,a)} · ${K(a,`bấm để đổi nhánh`,`click to switch`)}`,children:(0,J.jsx)(be,{onClick:ie,"aria-haspopup":`dialog`,"aria-expanded":O,"aria-label":D.detached?K(a,`Đổi nhánh Git của ${t} (detached HEAD tại ${D.name})`,`Switch ${t}'s Git branch (detached HEAD at ${D.name})`):K(a,`Đổi nhánh Git của ${t} (đang ở ${D.name})`,`Switch ${t}'s Git branch (on ${D.name})`),sx:re,children:(0,J.jsx)(Al,{branch:D,locale:a,maxWidth:`100%`,tooltip:!1})})}):(0,J.jsx)(tt,{describeChild:!0,title:i.map(e=>`${e.name} · ${e.branch?.name??`?`}`).join(`
|
|
80
|
-
`),children:(0,J.jsx)(be,{onClick:ie,"aria-haspopup":`dialog`,"aria-expanded":O,"aria-label":K(a,`${i.length} repo Git trong ${t}`,`${i.length} Git repositories in ${t}`),sx:re,children:(0,J.jsxs)(W,{component:`span`,sx:{display:`inline-flex`,alignItems:`center`,gap:.4,whiteSpace:`nowrap`},children:[(0,J.jsx)(Ol,{sx:{fontSize:`1.1em`}}),K(a,`${i.length} repo`,`${i.length} repos`)]})})}),(0,J.jsxs)(ke,{open:O,anchorEl:l,onClose:A,anchorOrigin:{vertical:`bottom`,horizontal:`left`},slotProps:{paper:{role:`dialog`,"aria-label":K(a,`Nhánh Git`,`Git branches`),sx:{width:`min(360px, calc(100vw - 32px))`,maxHeight:`min(520px, 70vh)`,display:`flex`,flexDirection:`column`,p:1.25,gap:1}}},children:[(0,J.jsxs)(W,{sx:{display:`flex`,alignItems:`center`,gap:.5,minWidth:0},children:[d!==null&&(0,J.jsx)(Mt,{size:`small`,"aria-label":K(a,`Về danh sách repo`,`Back to the repositories`),onClick:()=>j(null),children:(0,J.jsx)(jt,{sx:{fontSize:18}})}),(0,J.jsxs)(W,{sx:{minWidth:0},children:[(0,J.jsx)(H,{variant:`subtitle2`,sx:{fontWeight:650},children:z&&d===null?K(a,`Repo Git`,`Git repositories`):K(a,`Nhánh Git`,`Git branches`)}),(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,noWrap:!0,component:`div`,children:d===null?t:`${t} / ${d}`})]})]}),te&&(0,J.jsx)(o,{severity:`warning`,sx:{py:0,fontSize:12.5},children:K(a,`${p.running} cuộc trò chuyện đang chạy trong folder này. Chờ chạy xong hoặc Dừng rồi mới chuyển nhánh.`,`${p.running} conversation(s) running in this folder. Wait for them to finish, or stop them, before switching.`)}),N&&N.changedFiles>0&&!te&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:K(a,`${N.changedFiles} file đang sửa dở sẽ đi theo sang nhánh mới; Git từ chối nếu chúng bị ghi đè.`,`${N.changedFiles} changed file(s) come along to the new branch; Git refuses if they would be overwritten.`)}),x&&(0,J.jsxs)(o,{severity:`error`,sx:{py:0,fontSize:12.5},children:[K(a,...jl[x.code]??[`Không chuyển được nhánh.`,`The branch could not be switched.`]),x.detail&&(0,J.jsx)(W,{component:`pre`,sx:{m:0,mt:.5,whiteSpace:`pre-wrap`,font:`11px ui-monospace, monospace`,opacity:.85},children:x.detail})]}),!(p&&!p.repository)&&(0,J.jsx)(we,{inputRef:w,size:`small`,value:_,onChange:e=>v(e.target.value),disabled:!N||!!y,placeholder:K(a,`Tìm hoặc đặt tên nhánh mới`,`Find a branch or name a new one`),slotProps:{htmlInput:{maxLength:200,"aria-label":K(a,`Tìm nhánh`,`Find a branch`)}},onKeyDown:e=>{if(e.key===`Enter`&&P&&!te&&!y){let e=N?.branches.find(e=>e.name===P);M(e?{branch:e.name,remote:e.remote}:{branch:P,create:!0})}}}),(0,J.jsxs)(W,{sx:{overflowY:`auto`,minHeight:0,mx:-.5},children:[!p&&!h&&(0,J.jsx)(W,{sx:{display:`flex`,justifyContent:`center`,py:2},children:(0,J.jsx)(me,{size:18})}),h&&(0,J.jsx)(o,{severity:`error`,sx:{py:0,fontSize:12.5},children:K(a,`Không đọc được danh sách nhánh.`,`The branches could not be read.`)}),p&&!p.repository&&R.length>0&&(0,J.jsx)(Dt,{dense:!0,disablePadding:!0,"aria-label":K(a,`Repo trong folder`,`Repositories in the folder`),children:R.map(e=>(0,J.jsxs)(at,{dense:!0,onClick:()=>j(e.name),sx:{borderRadius:1,py:.4},children:[(0,J.jsx)(ft,{primary:e.name,secondary:(0,J.jsxs)(W,{component:`span`,sx:{display:`flex`,alignItems:`center`,gap:.5,minWidth:0,width:`100%`},children:[e.head?(0,J.jsx)(Al,{branch:e.head,locale:a,maxWidth:`100%`,tooltip:!1}):K(a,`chưa có commit`,`no commits`),e.changedFiles>0&&(0,J.jsxs)(W,{component:`span`,sx:{flexShrink:0},children:[`· `,K(a,`${e.changedFiles} file đang sửa`,`${e.changedFiles} changed`)]})]}),slotProps:{primary:{noWrap:!0,sx:{fontSize:13,fontWeight:600}},secondary:{component:`div`,sx:{fontSize:11.5,minWidth:0}}},sx:{minWidth:0}}),(0,J.jsx)(Se,{sx:{fontSize:18,color:`text.disabled`}})]},e.name))}),p&&!p.repository&&R.length===0&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,sx:{px:1},children:K(a,...jl[`not-a-git-repository`])}),N&&(0,J.jsxs)(Dt,{dense:!0,disablePadding:!0,children:[P&&!ee&&(0,J.jsxs)(at,{dense:!0,disabled:te||!!y,onClick:()=>void M({branch:P,create:!0}),sx:{borderRadius:1},children:[(0,J.jsx)(Ke,{sx:{minWidth:26},children:y===P?(0,J.jsx)(me,{size:14}):(0,J.jsx)(Ze,{sx:{fontSize:16}})}),(0,J.jsx)(ft,{primary:K(a,`Tạo nhánh mới “${P}”`,`Create branch “${P}”`),secondary:K(a,`từ ${N.head?.name??`HEAD`}`,`from ${N.head?.name??`HEAD`}`),slotProps:{primary:{noWrap:!0,sx:{fontSize:12.5}},secondary:{sx:{fontSize:11}}}})]}),I.map(ne),L.length>0&&(0,J.jsx)(B,{disableSticky:!0,sx:{lineHeight:`26px`,fontSize:11,bgcolor:`transparent`},children:K(a,`Trên remote`,`On a remote`)}),L.map(ne),F.length===0&&!P&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,sx:{px:1},children:K(a,`Chưa có nhánh nào.`,`No branches yet.`)}),N.truncated&&(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,sx:{px:1},children:K(a,`Chỉ hiện 200 nhánh có commit mới nhất.`,`Showing the 200 most recently committed branches.`)})]})]})]})]})}var Nl=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl`,Pl={height:28,px:1,gap:.75,fontSize:12,color:`text.secondary`,alignItems:`center`},Fl={...Pl,borderRadius:0,"&:hover":{bgcolor:`action.hover`,color:`text.primary`},"&.Mui-focusVisible":{outline:`2px solid`,outlineColor:`primary.main`,outlineOffset:-2}};function Z({locale:e,connection:t,running:n,session:r,onBranchSwitched:i,onUpdates:a,onPalette:o}){let{status:s,supported:c}=no(),l=Ye(e=>e.breakpoints.up(`md`)),u=$a(s),d=!!(s?.updateAvailable&&s.installable),f=s?.piagent.installed?`Piagent ${s.piagent.installed}${s.pi.installed?` · Pi ${s.pi.installed}`:``}`:`Piagent`;return l?(0,J.jsxs)(W,{component:`footer`,"aria-label":K(e,`Thanh trạng thái`,`Status bar`),sx:{position:`fixed`,left:0,right:0,bottom:0,height:28,display:`flex`,alignItems:`stretch`,borderTop:1,borderColor:`divider`,bgcolor:`background.paper`,zIndex:e=>e.zIndex.drawer+1,whiteSpace:`nowrap`},children:[(0,J.jsxs)(U,{direction:`row`,sx:Pl,children:[(0,J.jsx)(W,{sx:{width:7,height:7,borderRadius:`50%`,bgcolor:t===`connected`?`success.main`:`warning.main`}}),(0,J.jsx)(`span`,{children:t===`connected`?`Gateway live`:t}),(0,J.jsx)(W,{component:`span`,sx:{color:`text.disabled`},children:`local`})]}),(r?.gitBranch||!!r?.gitRepositories?.length)&&(0,J.jsx)(U,{direction:`row`,sx:{...Pl,minWidth:0},children:(0,J.jsx)(Ml,{projectRef:r.projectRef,projectLabel:r.projectLabel,branch:r.gitBranch,repositories:r.gitRepositories,locale:e,maxWidth:320,onSwitched:i})}),n>0&&(0,J.jsxs)(U,{direction:`row`,sx:Pl,children:[(0,J.jsx)(W,{sx:{width:7,height:7,borderRadius:`50%`,bgcolor:`primary.main`}}),(0,J.jsx)(`span`,{children:K(e,`${n} đang chạy`,`${n} running`)})]}),(0,J.jsx)(W,{sx:{flex:1}}),c&&(0,J.jsx)(tt,{describeChild:!0,title:d?K(e,`Mở Cập nhật trong Cài đặt`,`Open Updates in Settings`):K(e,`Phiên bản và cập nhật`,`Version and updates`),children:(0,J.jsx)(be,{onClick:a,sx:{...Fl,...d&&{color:`primary.contrastText`,bgcolor:`primary.main`,fontWeight:650,"&:hover":{bgcolor:`primary.dark`,color:`primary.contrastText`}}},children:u?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(me,{size:11,thickness:6,color:`inherit`}),K(e,`Đang cập nhật lên ${s?.job?.to}…`,`Updating to ${s?.job?.to}…`)]}):d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(L,{sx:{fontSize:15}}),K(e,`Cập nhật Piagent ${s?.piagent.latest}`,`Update Piagent ${s?.piagent.latest}`)]}):(0,J.jsx)(`span`,{children:f})})}),(0,J.jsxs)(be,{onClick:o,"aria-label":K(e,`Mở bảng lệnh`,`Open command palette`),sx:Fl,children:[(0,J.jsxs)(W,{component:`kbd`,sx:{font:`inherit`,fontSize:11,px:.6,border:1,borderColor:`divider`,borderRadius:.75},children:[Nl(),` K`]}),(0,J.jsx)(`span`,{children:K(e,`Lệnh`,`Commands`)})]})]}):null}function Q(e,t){let n=Math.max(0,Math.floor((Date.now()-Date.parse(e))/1e3));if(n<60)return K(t,`Vừa mới`,`Just now`);let r=Math.floor(n/60);if(r<60)return K(t,`${r} phút`,`${r}m`);let i=Math.floor(r/60);if(i<24)return K(t,`${i} giờ`,`${i}h`);let a=Math.floor(i/24);return K(t,`${a} ngày`,`${a}d`)}function Il(e,t){return Jo(e,t)?`attention`:t&&!t.complete?`running`:e.state===`terminal-owned`?`elsewhere`:e.state===`recovery-required`?`recovery`:e.needsAttention?`attention`:t?.complete&&t.error?`failed`:e.liveState===`running`?`running`:`idle`}function Ll({activity:e,locale:t,fresh:n=!1,question:r=!1,calm:i=!1}){let a={running:`primary.main`,elsewhere:`info.main`,attention:`warning.main`,recovery:`error.main`,failed:`error.main`,idle:n?`success.main`:`transparent`}[e],o={running:K(t,`Đang chạy`,`Running`),elsewhere:K(t,`Đang chạy ở Terminal hoặc tiến trình khác`,`Running in Terminal or another process`),attention:r?K(t,`Cần bạn trả lời`,`Needs your answer`):K(t,`Cần duyệt`,`Needs approval`),recovery:K(t,`Cần khôi phục`,`Needs recovery`),failed:K(t,`Lượt cuối lỗi`,`Last turn failed`),idle:n?K(t,`Xong, chưa xem`,`Done, not seen`):``}[e];return(0,J.jsx)(W,{role:e===`idle`&&!n?void 0:`img`,"aria-label":o||void 0,title:o,sx:{width:8,height:8,mt:.9,ml:.75,flexShrink:0,borderRadius:`50%`,bgcolor:a,animation:!i&&(e===`running`||e===`elsewhere`||e===`attention`)?`piagent-pulse 1.4s ease-in-out infinite`:`none`}})}var Rl={clean:[`Đủ bước`,`All steps`],unverified:[`Chưa verify`,`Unverified`],unreviewed:[`Chưa review`,`Not reviewed`],blocking_open:[`Còn lỗi blocking`,`Blocking open`],review_unavailable:[`Không review được`,`Review unavailable`],interrupted:[`Bị dừng`,`Stopped`],disputed:[`Cần bạn quyết`,`Needs your call`]};function zl({session:e,live:t,selected:n,locale:r,onSelect:i,onAction:a,showProject:o=!1,fresh:s=!1}){let[c,l]=(0,q.useState)(null),u=e=>{l(null),a(e)},d=e.modelLabel===`agent-watch-auto`,f=Il(e,t),p=f===`running`?K(r,`Đang chạy`,`Running`):f===`elsewhere`?K(r,`Đang chạy ở nơi khác`,`Running elsewhere`):f===`attention`?Jo(e,t)===`question`?K(r,`Cần bạn trả lời`,`Needs your answer`):K(r,`Cần duyệt`,`Needs approval`):s?f===`failed`?K(r,`Lỗi · chưa xem`,`Failed · not seen`):K(r,`Xong · chưa xem`,`Done · not seen`):null,m=d&&!s&&f!==`running`&&f!==`elsewhere`?e.managedTurnEnd??null:null,h=!m&&d&&e.managedProcess&&e.managedProcess.outcome!==`no_change`?e.managedProcess.outcome:null;return(0,J.jsxs)(W,{sx:{display:`flex`,alignItems:`center`,pr:.5,"@media (hover: hover)":{"& .session-item-menu":{opacity:c||n?1:0,transition:`opacity .12s`},"&:hover .session-item-menu, & .session-item-menu:focus-visible":{opacity:1}}},className:f===`attention`?`session-item attention`:s?`session-item fresh`:`session-item`,children:[(0,J.jsxs)(at,{selected:n,onClick:i,sx:{minWidth:0,alignItems:`flex-start`,py:.7,px:1.25},children:[(0,J.jsx)(ft,{primary:(0,J.jsxs)(J.Fragment,{children:[e.pinned&&(0,J.jsx)(De,{sx:{fontSize:13,mr:.5,verticalAlign:`-2px`,color:`text.disabled`}}),e.title]}),secondary:(0,J.jsxs)(J.Fragment,{children:[d&&(0,J.jsxs)(W,{component:`span`,sx:{fontWeight:650,color:`primary.main`},children:[K(r,`Công ty`,`Company`),(0,J.jsx)(`span`,{children:` · `})]}),p??Q(e.updatedAt,r),o&&(0,J.jsxs)(`span`,{children:[` · `,e.projectLabel]}),m&&(0,J.jsxs)(W,{component:`span`,sx:Ec($c(m)),children:[` · `,el(m,r)]}),h&&(0,J.jsxs)(W,{component:`span`,sx:Ec(Uc(h)),children:[` · `,K(r,...Rl[h])]})]}),slotProps:{primary:{noWrap:!0,sx:{fontSize:13.25,fontWeight:n?600:500}},secondary:{noWrap:!0,sx:{mt:.25,fontSize:11.25,...f===`attention`?{color:`warning.main`,fontWeight:650}:s?{color:f===`failed`?`error.main`:`success.main`,fontWeight:650}:{}}}}}),(0,J.jsx)(Ll,{activity:f,locale:r,fresh:s,calm:n,question:Jo(e,t)===`question`})]}),(0,J.jsx)(Mt,{size:`small`,className:`session-item-menu`,"aria-label":K(r,`Tùy chọn cuộc trò chuyện`,`Chat options`),onClick:e=>l(e.currentTarget),children:(0,J.jsx)(Tt,{fontSize:`small`})}),(0,J.jsxs)(At,{anchorEl:c,open:!!c,onClose:()=>l(null),onClick:e=>e.stopPropagation(),children:[!e.archived&&(0,J.jsx)(rt,{onClick:()=>u(`rename`),children:K(r,`Đổi tên`,`Rename`)}),!e.archived&&(0,J.jsx)(rt,{onClick:()=>u(`pin`),children:e.pinned?K(r,`Bỏ ghim`,`Unpin`):K(r,`Ghim`,`Pin`)}),!e.archived&&(0,J.jsx)(rt,{onClick:()=>u(`fork`),children:K(r,`Tạo nhánh`,`Fork`)}),(0,J.jsx)(rt,{onClick:()=>u(e.archived?`unarchive`:`archive`),children:e.archived?K(r,`Bỏ lưu trữ`,`Unarchive`):K(r,`Lưu trữ`,`Archive`)})]})]})}var Bl=5,Vl=`piagent.sidebar.collapsed`;function Hl(e){try{let t=JSON.parse(window.localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`).slice(0,500):[])}catch{return new Set}}function Ul(e,t){try{window.localStorage.setItem(e,JSON.stringify([...t].slice(0,500)))}catch{}}var Wl=new Set,Gl={attention:0,recovery:1,failed:2,idle:3,running:4,elsewhere:5};function Kl({locale:e,canCreate:t,query:n,onQuery:r,groups:i,count:a,selectedRef:o,showArchived:s,archivedCount:u,settingsOpen:d,connection:p,live:m,unseen:h=Wl,onNew:g,onSelect:_,onAction:v,onToggleArchived:y,onSettings:b,updateDot:x=!1}){let S=Ye(e=>e.breakpoints.down(`md`)),[C,w]=(0,q.useState)(`all`),[T,E]=(0,q.useState)(()=>Hl(Vl)),[D,O]=(0,q.useState)(()=>new Set),k=n.trim().length>0,A=e=>e.modelLabel===`agent-watch-auto`,j=i.flatMap(e=>e.sessions),N={company:j.filter(A).length,personal:j.filter(e=>!A(e)).length},P=(0,q.useMemo)(()=>i.map(e=>({...e,sessions:e.sessions.filter(e=>C===`all`||C===`company`===A(e))})).filter(e=>e.sessions.length>0),[i,C]),F=P.reduce((e,t)=>e+t.sessions.length,0),I=s?[]:P.flatMap(e=>e.sessions).filter(e=>Il(e,m[e.sessionRef])!==`idle`||h.has(e.sessionRef)).sort((e,t)=>Gl[Il(e,m[e.sessionRef])]-Gl[Il(t,m[t.sessionRef])]),L=(e,t,n)=>e(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),n&&Ul(Vl,r),r});return(0,J.jsxs)(W,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,bgcolor:`background.paper`},children:[(0,J.jsxs)(Ve,{sx:{minHeight:`52px !important`,px:`16px !important`,gap:1.1},children:[(0,J.jsx)(lr,{size:28}),(0,J.jsxs)(W,{sx:{minWidth:0},children:[(0,J.jsx)(H,{sx:{fontWeight:650,fontSize:14.5,letterSpacing:`-0.01em`,lineHeight:1.2},children:`Piagent`}),(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,sx:{lineHeight:1.2},children:K(e,`Coding agent`,`Coding agent`)})]})]}),(0,J.jsxs)(W,{sx:{px:1.25},children:[(0,J.jsx)(tt,{title:t?K(e,`Tạo cuộc trò chuyện mới`,`Create a new chat`):K(e,`Gateway hiện chưa cho phép tạo cuộc trò chuyện`,`The Gateway cannot create chats right now`),children:(0,J.jsx)(`span`,{children:(0,J.jsxs)(c,{fullWidth:!0,disabled:!t,variant:`outlined`,onClick:g,startIcon:(0,J.jsx)(Ze,{}),sx:{justifyContent:`flex-start`,minHeight:36,color:`text.primary`},children:[K(e,`Cuộc trò chuyện mới`,`New chat`),(0,J.jsxs)(W,{component:`kbd`,"aria-hidden":`true`,sx:{ml:`auto`,font:`inherit`,fontSize:11,color:`text.disabled`,letterSpacing:`.04em`},children:[Nl(),`⇧O`]})]})})}),(0,J.jsx)(we,{value:n,onChange:e=>r(e.target.value),fullWidth:!0,size:`small`,placeholder:K(e,`Tìm cuộc trò chuyện`,`Search chats`),sx:{mt:1,"& .MuiInputBase-root":{height:34,fontSize:13.5}},slotProps:{input:{startAdornment:(0,J.jsx)(yt,{position:`start`,children:(0,J.jsx)(f,{sx:{fontSize:17,color:`text.disabled`}})})}}})]}),(0,J.jsxs)(U,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,px:2,pt:2,pb:.4},children:[(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,sx:{fontWeight:600,textTransform:`uppercase`,letterSpacing:`.08em`},children:s?K(e,`Đã lưu trữ`,`Archived`):K(e,`Cuộc trò chuyện`,`Chats`)}),(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,children:F})]}),N.company>0&&N.personal>0&&(0,J.jsx)(U,{direction:`row`,role:`group`,"aria-label":K(e,`Lọc theo loại`,`Filter by kind`),sx:{px:1.75,pb:.5,gap:.5,flexWrap:`wrap`},children:[`all`,`company`,`personal`].map(t=>(0,J.jsx)(wt,{size:`small`,clickable:!0,"aria-pressed":C===t,onClick:()=>w(t),color:C===t?`primary`:`default`,variant:C===t?`filled`:`outlined`,label:t===`all`?K(e,`Tất cả`,`All`):t===`company`?K(e,`Công ty · ${N.company}`,`Company · ${N.company}`):K(e,`Cá nhân · ${N.personal}`,`Personal · ${N.personal}`)},t))}),(0,J.jsxs)(Dt,{component:`div`,sx:{flex:1,minHeight:0,overflowY:`auto`,py:.25},children:[I.length>0&&(0,J.jsxs)(W,{component:`section`,"aria-label":K(e,`Đang chạy hoặc cần chú ý`,`Running or needing attention`),sx:{mt:.5},children:[(0,J.jsx)(H,{component:`div`,variant:`caption`,color:`text.secondary`,sx:{px:2,py:.55,fontWeight:600},children:K(e,`Đang chạy · cần chú ý`,`Running · needs attention`)}),I.map(t=>(0,J.jsx)(zl,{session:t,live:m[t.sessionRef],showProject:!0,fresh:h.has(t.sessionRef),selected:o===t.sessionRef,locale:e,onSelect:()=>_(t.sessionRef),onAction:e=>v(t,e)},t.sessionRef)),(0,J.jsx)(mt,{sx:{mx:2,mt:.75}})]}),P.map(t=>{let n=t.sessions.some(e=>e.sessionRef===o),r=k||n||!T.has(t.projectRef),i=k||D.has(t.projectRef),a=i?t.sessions:t.sessions.filter((e,t)=>t<Bl||e.sessionRef===o);return(0,J.jsxs)(W,{component:`section`,"aria-label":t.label,sx:{mt:.5},children:[(0,J.jsxs)(be,{onClick:()=>L(E,t.projectRef,!0),"aria-expanded":r,sx:{width:`100%`,justifyContent:`flex-start`,gap:.7,px:2,py:.55,borderRadius:1},children:[(0,J.jsx)(V,{sx:{fontSize:16,color:`text.disabled`,transform:r?`none`:`rotate(-90deg)`,transition:`transform .15s`}}),(0,J.jsx)(M,{sx:{fontSize:15,color:`text.disabled`}}),(0,J.jsx)(H,{component:`div`,variant:`caption`,color:`text.secondary`,noWrap:!0,sx:{flexShrink:1,minWidth:0,fontWeight:600,textAlign:`left`},children:t.label}),(0,J.jsx)(H,{component:`div`,variant:`caption`,color:`text.disabled`,sx:{flex:1,minWidth:0,display:`flex`,textAlign:`left`},children:t.gitBranch?(0,J.jsx)(Al,{branch:t.gitBranch,locale:e,maxWidth:`100%`}):t.gitRepositories?.length?(0,J.jsxs)(W,{component:`span`,title:t.gitRepositories.map(e=>`${e.name} · ${e.branch?.name??`?`}`).join(`
|
|
81
|
-
`),sx:{display:`inline-flex`,alignItems:`center`,gap:.4,whiteSpace:`nowrap`},children:[(0,J.jsx)(Ol,{sx:{fontSize:`1.1em`}}),K(e,`${t.gitRepositories.length} repo`,`${t.gitRepositories.length} repos`)]}):null}),(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,children:t.sessions.length})]}),r&&a.map(t=>(0,J.jsx)(zl,{session:t,live:m[t.sessionRef],fresh:h.has(t.sessionRef),selected:o===t.sessionRef,locale:e,onSelect:()=>_(t.sessionRef),onAction:e=>v(t,e)},t.sessionRef)),r&&!k&&t.sessions.length>Bl&&(0,J.jsx)(c,{size:`small`,onClick:()=>L(O,t.projectRef,!1),sx:{ml:1.5,mb:.25,fontSize:12},children:i?K(e,`Thu gọn`,`Show less`):K(e,`Xem thêm ${t.sessions.length-Bl}`,`Show ${t.sessions.length-Bl} more`)})]},t.projectRef)}),F===0&&(0,J.jsxs)(U,{sx:{alignItems:`center`,textAlign:`center`,px:3,py:5},spacing:1,children:[(0,J.jsx)(se,{color:`disabled`}),(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:K(e,`Không tìm thấy cuộc trò chuyện`,`No conversations found`)})]})]}),(0,J.jsxs)(W,{sx:{p:1.25},children:[(0,J.jsx)(mt,{sx:{mb:1}}),(0,J.jsx)(c,{fullWidth:!0,startIcon:(0,J.jsx)(l,{}),disabled:!s&&u===0,onClick:y,sx:{justifyContent:`flex-start`},children:s?K(e,`Quay lại cuộc trò chuyện`,`Back to chats`):K(e,`Đã lưu trữ (${u})`,`Archived (${u})`)}),(0,J.jsxs)(c,{fullWidth:!0,startIcon:(0,J.jsx)(Ot,{}),onClick:b,sx:{justifyContent:`flex-start`,mt:.25},color:d?`primary`:`inherit`,children:[K(e,`Cài đặt`,`Settings`),x&&(0,J.jsx)(W,{component:`span`,role:`img`,"aria-label":K(e,`Có bản cập nhật`,`Update available`),sx:{ml:`auto`,width:8,height:8,borderRadius:`50%`,bgcolor:`primary.main`}})]}),S&&(0,J.jsxs)(U,{direction:`row`,sx:{px:1.25,pt:1,alignItems:`center`,gap:1},children:[(0,J.jsx)(W,{sx:{width:7,height:7,borderRadius:`50%`,bgcolor:p===`connected`?`success.main`:`warning.main`}}),(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,sx:{flex:1},children:p===`connected`?`Gateway live`:p}),(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,children:`local`})]})]})]})}var ql=9e3,Jl=4,Yl={done:[`Xong`,`Done`,`Agent đã trả lời xong.`,`The agent finished its answer.`],failed:[`Lượt bị lỗi`,`Turn failed`,`Mở để xem lỗi và gửi “tiếp tục”.`,`Open it to see the error and continue.`],stopped:[`Đã dừng`,`Stopped`,`Lượt làm việc đã dừng giữa chừng.`,`The turn stopped midway.`],question:[`Cần bạn trả lời`,`Needs your answer`,`Main agent đang chờ bạn chọn phương án.`,`The main agent is waiting for your choice.`],approval:[`Cần bạn duyệt`,`Needs your approval`,`Main agent xin chạy một lệnh và đang chờ bạn duyệt.`,`The main agent asked to run a command and is waiting.`]},Xl={done:`success`,failed:`error`,stopped:`neutral`,question:`warning`,approval:`warning`};function Zl({sessions:e,live:t,selectedRef:n,onOpen:r,locale:i}){let a=(0,q.useRef)(null),[o,s]=(0,q.useState)([]),[c,l]=(0,q.useState)(()=>new Set);(0,q.useEffect)(()=>{let r=Yo(e,t);if(a.current){let i=document.visibilityState===`visible`,o=Xo(a.current,r,e,t).filter(e=>!(i&&e.sessionRef===n));if(o.length){s(e=>[...o,...e.filter(e=>!o.some(t=>t.sessionRef===e.sessionRef))].slice(0,12));let e=o.filter(e=>[`done`,`failed`,`stopped`].includes(e.kind)).map(e=>e.sessionRef);e.length&&l(t=>new Set([...t,...e]))}}a.current=r,s(e=>{let t=e.filter(e=>![`question`,`approval`].includes(e.kind)||r[e.sessionRef]?.need===e.kind);return t.length===e.length?e:t})},[e,t,n]),(0,q.useEffect)(()=>{n&&(l(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t}),s(e=>e.filter(e=>e.sessionRef!==n)))},[n]);let u=e.filter(e=>!e.archived&&Jo(e,t[e.sessionRef])).length;(0,q.useEffect)(()=>{let e=document.title.replace(/^\(\d+\) /,``);document.title=u?`(${u}) ${e}`:e},[u]);let d=e=>s(t=>t.filter(t=>t.id!==e));return{unseen:c,view:(0,J.jsx)(Ql,{toasts:o.slice(0,Jl),more:Math.max(0,o.length-Jl),locale:i,onClose:d,onOpen:e=>{d(e.id),r(e.sessionRef)}})}}function Ql({toasts:e,more:t,locale:n,onClose:r,onOpen:i}){return(0,J.jsxs)(`section`,{className:`attention-toasts`,"aria-label":K(n,`Thông báo cuộc trò chuyện`,`Chat notifications`),"aria-live":`polite`,children:[e.map(e=>(0,J.jsx)($l,{event:e,locale:n,onClose:()=>r(e.id),onOpen:()=>i(e)},e.id)),t>0&&(0,J.jsx)(`p`,{className:`attention-more`,children:K(n,`và ${t} thông báo khác`,`and ${t} more`)})]})}function $l({event:e,locale:t,onClose:n,onOpen:r}){let i=e.kind===`question`||e.kind===`approval`,[a,o,s,c]=Yl[e.kind];return(0,q.useEffect)(()=>{if(i)return;let e=window.setTimeout(n,ql);return()=>window.clearTimeout(e)},[i]),(0,J.jsxs)(`article`,{className:`attention-toast tone-${Xl[e.kind]}`,role:i?`alert`:`status`,children:[(0,J.jsx)(`span`,{className:`attention-toast-mark`,"aria-hidden":`true`}),(0,J.jsxs)(`div`,{className:`attention-toast-body`,children:[(0,J.jsxs)(`strong`,{children:[K(t,a,o),` · `,(0,J.jsx)(`span`,{className:`attention-toast-title`,children:e.title})]}),(0,J.jsx)(`small`,{children:K(t,s,c)})]}),(0,J.jsxs)(`div`,{className:`attention-toast-actions`,children:[(0,J.jsx)(`button`,{type:`button`,className:`attention-open`,onClick:r,children:K(t,`Mở`,`Open`)}),(0,J.jsx)(`button`,{type:`button`,className:`attention-close`,"aria-label":K(t,`Đóng thông báo`,`Close notification`),onClick:n,children:`×`})]})]})}var eu=j((0,J.jsx)(`path`,{d:`M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h12c.55 0 1 .45 1 1v12c0 .55-.45 1-1 1m1-16H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2`}),`CheckBoxOutlineBlankRounded`),tu=j((0,J.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-8.29 13.29c-.39.39-1.02.39-1.41 0L5.71 12.7a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0s.39 1.02 0 1.41z`}),`CheckBoxRounded`),nu=j((0,J.jsx)(`path`,{d:`m10.8 15.9 4.67-3.5c.27-.2.27-.6 0-.8L10.8 8.1c-.33-.25-.8-.01-.8.4v7c0 .41.47.65.8.4M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8`}),`PlayCircleOutlineRounded`),ru=j((0,J.jsx)(`path`,{d:`M7 12c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1m5-10C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8`}),`RemoveCircleOutlineRounded`);function iu(e){return ce(`MuiLinearProgress`,e)}Et(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`bar`,`bar1`,`bar2`]);var au=4,ou={},su=Je`
|
|
82
|
-
0% {
|
|
83
|
-
left: -35%;
|
|
84
|
-
right: 100%;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
60% {
|
|
88
|
-
left: 100%;
|
|
89
|
-
right: -90%;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
100% {
|
|
93
|
-
left: 100%;
|
|
94
|
-
right: -90%;
|
|
95
|
-
}
|
|
96
|
-
`,cu=typeof su==`string`?null:a`
|
|
97
|
-
animation: ${su} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
|
|
98
|
-
`,lu=Je`
|
|
99
|
-
0% {
|
|
100
|
-
left: -200%;
|
|
101
|
-
right: 100%;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
60% {
|
|
105
|
-
left: 107%;
|
|
106
|
-
right: -8%;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
100% {
|
|
110
|
-
left: 107%;
|
|
111
|
-
right: -8%;
|
|
112
|
-
}
|
|
113
|
-
`,uu=typeof lu==`string`?null:a`
|
|
114
|
-
animation: ${lu} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
|
|
115
|
-
`,du=Je`
|
|
116
|
-
0% {
|
|
117
|
-
opacity: 1;
|
|
118
|
-
background-position: 0 -23px;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
60% {
|
|
122
|
-
opacity: 0;
|
|
123
|
-
background-position: 0 -23px;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
100% {
|
|
127
|
-
opacity: 1;
|
|
128
|
-
background-position: -200px -23px;
|
|
129
|
-
}
|
|
130
|
-
`,fu=typeof du==`string`?null:a`
|
|
131
|
-
animation: ${du} 3s infinite linear;
|
|
132
|
-
`,pu=e=>{let{classes:t,variant:n,color:r}=e,i={root:[`root`,`color${Ge(r)}`,n],dashed:[`dashed`],bar1:[`bar`,`bar1`],bar2:[`bar`,`bar2`,n===`buffer`&&`color${Ge(r)}`]};return et(i,iu,t)},mu=(e,t)=>e.vars?e.vars.palette.LinearProgress[`${t}Bg`]:e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.5),hu=Ae(`span`,{name:`MuiLinearProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`color${Ge(n.color)}`],t[n.variant]]}})(Te(({theme:e})=>({position:`relative`,overflow:`hidden`,display:`block`,height:4,zIndex:0,"@media print":{colorAdjust:`exact`},variants:[...Object.entries(e.palette).filter(w()).map(([t])=>({props:{color:t},style:{backgroundColor:mu(e,t)}})),{props:({ownerState:e})=>e.color===`inherit`&&e.variant!==`buffer`,style:{"&::before":{content:`""`,position:`absolute`,left:0,top:0,right:0,bottom:0,backgroundColor:`currentColor`,opacity:.3}}},{props:{variant:`buffer`},style:{backgroundColor:`transparent`}},{props:{variant:`query`},style:{transform:`rotate(180deg)`}}]}))),gu=Ae(`span`,{name:`MuiLinearProgress`,slot:`Dashed`})(Te(({theme:e})=>({position:`absolute`,marginTop:0,height:`100%`,width:`100%`,backgroundSize:`10px 10px`,backgroundPosition:`0 -23px`,variants:[{props:{color:`inherit`},style:{opacity:.3,backgroundImage:`radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)`}},...Object.entries(e.palette).filter(w()).map(([t])=>{let n=mu(e,t);return{props:{color:t},style:{backgroundImage:`radial-gradient(${n} 0%, ${n} 16%, transparent 42%)`}}})]})),fu||{animation:`${du} 3s infinite linear`},Te(({theme:e})=>r(e,{animation:`none`})||ou)),_u=Ae(`span`,{name:`MuiLinearProgress`,slot:`Bar1`,overridesResolver:(e,t)=>[t.bar,t.bar1]})(Te(({theme:e})=>{let t=r(e,{animation:`none`,left:`30%`,right:`auto`,width:`40%`});return{width:`100%`,position:`absolute`,left:0,bottom:0,top:0,...ht(e,`transform`,{duration:`0.2s`,easing:`linear`}),transformOrigin:`left`,variants:[{props:{color:`inherit`},style:{backgroundColor:`currentColor`}},...Object.entries(e.palette).filter(w()).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main}})),{props:{variant:`determinate`},style:{...ht(e,`transform`,{duration:`.${au}s`,easing:`linear`})}},{props:{variant:`buffer`},style:{zIndex:1,...ht(e,`transform`,{duration:`.${au}s`,easing:`linear`})}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:cu||{animation:`${su} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}},...t?[{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:t}]:[]]}})),vu=Ae(`span`,{name:`MuiLinearProgress`,slot:`Bar2`,overridesResolver:(e,t)=>[t.bar,t.bar2]})(Te(({theme:e})=>{let t=r(e,{animation:`none`,display:`none`});return{width:`100%`,position:`absolute`,left:0,bottom:0,top:0,...ht(e,`transform`,{duration:`0.2s`,easing:`linear`}),transformOrigin:`left`,variants:[...Object.entries(e.palette).filter(w()).map(([t])=>({props:{color:t},style:{"--LinearProgressBar2-barColor":(e.vars||e).palette[t].main}})),{props:({ownerState:e})=>e.variant!==`buffer`&&e.color!==`inherit`,style:{backgroundColor:`var(--LinearProgressBar2-barColor, currentColor)`}},{props:({ownerState:e})=>e.variant!==`buffer`&&e.color===`inherit`,style:{backgroundColor:`currentColor`}},{props:{color:`inherit`},style:{opacity:.3}},...Object.entries(e.palette).filter(w()).map(([t])=>({props:{color:t,variant:`buffer`},style:{backgroundColor:mu(e,t),...ht(e,`transform`,{duration:`.${au}s`,easing:`linear`})}})),{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:uu||{animation:`${lu} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}},...t?[{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:t}]:[]]}})),yu=q.forwardRef(function(e,t){let n=it({props:e,name:`MuiLinearProgress`}),{className:r,color:i=`primary`,max:a,min:o,value:s,valueBuffer:c,variant:l=`indeterminate`,...d}=n,f={...n,color:i,variant:l},p=o??0,m=a??100,h=pu(f),g=bt(),_={},v={bar1:{},bar2:{}};if((l===`determinate`||l===`buffer`)&&s!==void 0){let e=m-p,t=(s-p)/e*100-100;g&&(t=-t),v.bar1.transform=e>0?`translateX(${t}%)`:`translateX(-100%)`,_[`aria-valuenow`]=s,_[`aria-valuemin`]=p,_[`aria-valuemax`]=m}if(l===`buffer`&&c!==void 0){let e=m-p,t=(c-p)/e*100-100;g&&(t=-t),v.bar2.transform=e>0?`translateX(${t}%)`:`translateX(-100%)`}return(0,J.jsxs)(hu,{className:u(h.root,r),ownerState:f,role:`progressbar`,..._,ref:t,...d,children:[l===`buffer`?(0,J.jsx)(gu,{className:h.dashed,ownerState:f}):null,(0,J.jsx)(_u,{className:h.bar1,ownerState:f,style:v.bar1}),l===`determinate`?null:(0,J.jsx)(vu,{className:h.bar2,ownerState:f,style:v.bar2})]})}),bu=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,xu={A:`success`,M:`warning`,D:`error`,R:`info`,C:`info`,U:`success`};function Su({title:e,action:t,children:n}){return(0,J.jsxs)(W,{component:`section`,sx:{px:2,py:1.75,borderBottom:1,borderColor:`divider`},children:[(0,J.jsxs)(U,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,mb:1},children:[(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,sx:{fontWeight:650,textTransform:`uppercase`,letterSpacing:`.06em`},children:e}),t]}),n]})}function Cu({session:e,snapshot:t,live:n,locale:r,onOpenReview:i,onClose:a}){let[o,s]=(0,q.useState)(),[l,u]=(0,q.useState)(!1),d=!!(n&&!n.complete);(0,q.useEffect)(()=>{if(d)return;let t=new AbortController;u(!1);let n=window.setTimeout(()=>void Yt(e.sessionRef,`working-tree`,t.signal).then(e=>s(e)).catch(()=>{t.signal.aborted||u(!0)}),250);return()=>{window.clearTimeout(n),t.abort()}},[e.sessionRef,e.sessionRevision,d]),(0,q.useEffect)(()=>{s(void 0)},[e.sessionRef]);let f=o?.files??[],p=f.reduce((e,t)=>e+(t.stats?.additions??0),0),m=f.reduce((e,t)=>e+(t.stats?.deletions??0),0),h=t?.usage.context,g=h?.state===`known`,_=g?h.percent:e.contextUsage.ratio===null?null:e.contextUsage.ratio*100,v=g?h.contextWindow:e.contextUsage.contextWindow,y=g?h.tokens:e.contextUsage.usedTokens,b=e.managedHelpers?.maximum===0?void 0:e.managedHelpers,x=e.managedPlan,S=e.managedProcess,C=x?.steps.filter(e=>e.status===`completed`).length??0,w=(n?.activities??[]).filter(e=>jc(e.toolLabel)===`subagent`);return(0,J.jsxs)(W,{role:`region`,sx:{height:`100%`,overflowY:`auto`,bgcolor:`background.paper`},"aria-label":K(r,`Thay đổi và ngữ cảnh`,`Changes and context`),children:[(0,J.jsxs)(U,{direction:`row`,sx:{alignItems:`center`,gap:1,px:2,minHeight:52,borderBottom:1,borderColor:`divider`},children:[(0,J.jsx)(H,{sx:{fontWeight:600,flex:1},children:K(r,`Workspace`,`Workspace`)}),a&&(0,J.jsx)(Mt,{size:`small`,"aria-label":K(r,`Đóng khung bên`,`Close side panel`),onClick:a,children:(0,J.jsx)(N,{fontSize:`small`})})]}),(0,J.jsxs)(Su,{title:o?K(r,`Thay đổi · ${f.length} file`,`Changes · ${f.length} files`):K(r,`Thay đổi`,`Changes`),action:f.length>0?(0,J.jsx)(tt,{title:K(r,`Xem diff đầy đủ, stage hoặc hoàn tác`,`Full diff, stage or revert`),children:(0,J.jsx)(c,{size:`small`,startIcon:(0,J.jsx)(z,{fontSize:`small`}),onClick:i,children:K(r,`Review`,`Review`)})}):void 0,children:[(p>0||m>0)&&(0,J.jsxs)(U,{direction:`row`,sx:{alignItems:`center`,gap:.75,mb:1,color:`text.secondary`},children:[(0,J.jsx)(bc,{sx:{fontSize:15}}),(0,J.jsx)(H,{variant:`caption`,children:K(r,`Chưa commit`,`Uncommitted`)}),(0,J.jsxs)(H,{variant:`caption`,sx:{fontFamily:bu,ml:`auto`},children:[(0,J.jsxs)(W,{component:`span`,sx:Ec(`success`),children:[`+`,p]}),` `,(0,J.jsxs)(W,{component:`span`,sx:Ec(`error`),children:[`−`,m]})]})]}),o===void 0&&!l&&(d?(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:K(r,`Cập nhật khi lượt này chạy xong.`,`Updates when this turn finishes.`)}):(0,J.jsx)(yu,{sx:{borderRadius:1}})),(l||o?.availability.state===`unavailable`)&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:K(r,`Chưa đọc được thay đổi (thư mục có thể không phải git repo).`,`Changes are unavailable (the folder may not be a git repository).`)}),o&&o.availability.state!==`unavailable`&&f.length===0&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,children:K(r,`Chưa có thay đổi nào chưa commit.`,`No uncommitted changes.`)}),(0,J.jsx)(U,{spacing:.25,children:f.slice(0,200).map(e=>(0,J.jsxs)(U,{direction:`row`,sx:{alignItems:`center`,gap:1,py:.4},children:[(0,J.jsx)(H,{variant:`caption`,sx:{fontFamily:bu,fontWeight:650,width:12,...xu[e.status]?Ec(xu[e.status]):{color:`text.secondary`}},children:e.status}),(0,J.jsx)(H,{variant:`body2`,noWrap:!0,title:e.path,sx:{fontFamily:bu,fontSize:12.5,flex:1,minWidth:0},children:e.path}),(0,J.jsxs)(H,{variant:`caption`,sx:{fontFamily:bu,flexShrink:0},children:[(e.stats?.additions??0)>0&&(0,J.jsxs)(W,{component:`span`,sx:Ec(`success`),children:[`+`,e.stats.additions,` `]}),(e.stats?.deletions??0)>0&&(0,J.jsxs)(W,{component:`span`,sx:Ec(`error`),children:[`−`,e.stats.deletions]})]})]},e.fileRef))})]}),(x||S)&&(0,J.jsxs)(Su,{title:x?K(r,`Plan · ${C}/${x.steps.length}`,`Plan · ${C}/${x.steps.length}`):K(r,`Tiến trình`,`Process`),children:[x&&(0,J.jsx)(U,{component:`ol`,spacing:.25,sx:{m:0,p:0,listStyle:`none`},"aria-label":K(r,`Plan của agent`,`Agent plan`),children:x.steps.map((e,t)=>{let n=e.status===`completed`?tu:e.status===`in_progress`?nu:e.status===`deferred`?ru:eu;return(0,J.jsxs)(U,{component:`li`,direction:`row`,sx:{alignItems:`flex-start`,gap:.75,py:.25},"aria-label":`${e.step}: ${e.status===`completed`?K(r,`xong`,`done`):e.status===`in_progress`?K(r,`đang làm`,`in progress`):e.status===`deferred`?K(r,`để sau`,`left for later`):K(r,`chưa làm`,`pending`)}`,children:[(0,J.jsx)(n,{sx:{fontSize:16,mt:.2,color:e.status===`in_progress`?`primary.main`:`text.secondary`}}),(0,J.jsx)(H,{variant:`body2`,sx:{flex:1,minWidth:0,overflowWrap:`anywhere`,...e.status===`completed`?{color:`text.secondary`,textDecoration:`line-through`}:e.status===`deferred`?{color:`text.disabled`,fontStyle:`italic`}:{},...e.status===`in_progress`?{fontWeight:600}:{}},children:e.step})]},t)})}),S&&S.outcome!==`no_change`&&(0,J.jsxs)(H,{variant:`body2`,role:`status`,sx:{mt:+!!x,...Ec(Wc(S))},children:[K(r,`Lượt sửa code gần nhất: `,`Last code-changing turn: `),Hc(S,r)]})]}),(0,J.jsxs)(Su,{title:K(r,`Ngữ cảnh`,`Context`),children:[(0,J.jsxs)(U,{direction:`row`,sx:{justifyContent:`space-between`,mb:.75},children:[(0,J.jsx)(H,{variant:`body2`,children:_==null?`—`:`${Math.round(_)}%`}),(0,J.jsxs)(H,{variant:`caption`,color:`text.secondary`,children:[y?Us(y):`—`,v?` / ${Us(v)}`:``]})]}),(0,J.jsx)(yu,{variant:`determinate`,value:Math.min(100,Math.max(0,_??0)),sx:{height:6,borderRadius:1},color:(_??0)>85?`warning`:`primary`,"aria-label":K(r,`Mức dùng ngữ cảnh`,`Context usage`)})]}),(b||w.length>0)&&(0,J.jsxs)(Su,{title:`Subagent`,children:[b&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,sx:{mb:w.length?.75:0},children:K(r,`${b.active??0}/${b.maximum} đang chạy`,`${b.active??0}/${b.maximum} running`)}),w.map(e=>(0,J.jsxs)(U,{direction:`row`,sx:{alignItems:`center`,gap:.75,py:.25},children:[(0,J.jsx)(_c,{sx:{fontSize:15,color:`text.secondary`}}),(0,J.jsx)(H,{variant:`body2`,sx:{flex:1},children:e.fileLabel??`subagent`}),(0,J.jsx)(H,{variant:`caption`,color:e.state===`failed`?`error`:`text.secondary`,children:e.state===`running`?K(r,`đang chạy`,`running`):e.state===`failed`?K(r,`lỗi`,`failed`):K(r,`xong`,`done`)})]},e.toolCallRef))]})]})}var wu=e=>e.normalize(`NFD`).replace(/\p{M}/gu,``).replace(/đ/g,`d`).replace(/Đ/g,`D`).toLowerCase();function Tu(e,t){let n=wu(t).split(/\s+/).filter(Boolean),r=wu(e).split(/[^\p{L}\p{N}]+/u).filter(Boolean);return n.every(e=>r.some(t=>t.startsWith(e)))}function Eu(e,t,n=40){return t.trim()?e.filter(e=>Tu(`${e.label} ${e.keywords??``} ${e.group}`,t)).slice(0,n):e.slice(0,n)}function Du(e){let t=(0,q.useRef)(e);t.current=e,(0,q.useEffect)(()=>{let e=e=>{if(!(e.isComposing||!(e.metaKey||e.ctrlKey)||e.altKey)){if(e.shiftKey){e.key.toLowerCase()===`o`&&t.current.newChat&&(e.preventDefault(),t.current.newChat());return}e.key.toLowerCase()===`k`?(e.preventDefault(),t.current.palette()):e.key===`,`&&(e.preventDefault(),t.current.settings())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Ou({open:e,onClose:t,commands:n,locale:r}){let[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(0),c=(0,q.useMemo)(()=>Eu(n,i),[n,i]),l=(0,q.useRef)(null);(0,q.useEffect)(()=>{e&&(a(``),s(0))},[e]),(0,q.useEffect)(()=>{s(0)},[i]),(0,q.useEffect)(()=>{l.current?.querySelector(`[data-index="${o}"]`)?.scrollIntoView({block:`nearest`})},[o]);let u=e=>{e&&(t(),setTimeout(()=>e.run(),0))},p=e=>{e.nativeEvent.isComposing||(e.key===`ArrowDown`?(e.preventDefault(),s(e=>Math.min(e+1,c.length-1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),u(c[o])))},m=``;return(0,J.jsxs)(d,{open:e,onClose:t,fullWidth:!0,maxWidth:`sm`,slotProps:{paper:{"aria-label":K(r,`Bảng lệnh`,`Command palette`),sx:{alignSelf:`flex-start`,mt:{xs:2,sm:`12vh`},borderRadius:1,overflow:`hidden`}}},children:[(0,J.jsxs)(W,{sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1.25,borderBottom:1,borderColor:`divider`},children:[(0,J.jsx)(f,{fontSize:`small`,color:`action`}),(0,J.jsx)(oe,{autoFocus:!0,fullWidth:!0,value:i,onChange:e=>a(e.target.value),onKeyDown:p,placeholder:K(r,`Gõ lệnh hoặc tên cuộc trò chuyện…`,`Type a command or a conversation name…`),inputProps:{role:`combobox`,"aria-expanded":!0,"aria-controls":`piagent-palette-list`,"aria-activedescendant":c[o]?`palette-${c[o].id}`:void 0,"aria-label":K(r,`Tìm lệnh`,`Search commands`)}})]}),(0,J.jsxs)(Dt,{component:`div`,id:`piagent-palette-list`,role:`listbox`,"aria-label":K(r,`Lệnh`,`Commands`),ref:l,dense:!0,sx:{maxHeight:`min(60vh, 460px)`,overflowY:`auto`,py:.5},children:[c.map((e,t)=>{let n=e.group===m?null:e.group;return m=e.group,(0,J.jsxs)(q.Fragment,{children:[n&&(0,J.jsx)(B,{component:`div`,"aria-hidden":!0,disableSticky:!0,sx:{lineHeight:`28px`,fontSize:11,fontWeight:650,letterSpacing:`.04em`,textTransform:`uppercase`},children:n}),(0,J.jsxs)(at,{id:`palette-${e.id}`,role:`option`,"aria-selected":t===o,"data-index":t,selected:t===o,onMouseMove:()=>s(t),onClick:()=>u(e),sx:{mx:.5,borderRadius:1,gap:2},children:[(0,J.jsx)(H,{sx:{flex:1,minWidth:0,fontSize:14},noWrap:!0,children:e.label}),e.hint&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,noWrap:!0,children:e.hint})]})]},e.id)}),!c.length&&(0,J.jsx)(H,{sx:{px:2.5,py:3},color:`text.secondary`,children:K(r,`Không có lệnh nào khớp.`,`No matching command.`)})]})]})}function ku(e){let t=K(e,`Chung`,`General`),n=`Agent`,r=K(e,`Công cụ`,`Tools`),i=K(e,`Thông tin`,`Information`);return[{id:`general`,group:t,label:K(e,`Giao diện`,`Appearance`),icon:(0,J.jsx)(v,{}),keywords:`ngôn ngữ language chủ đề theme sáng tối light dark tiếng việt english`},{id:`updates`,group:t,label:K(e,`Cập nhật`,`Updates`),icon:(0,J.jsx)(L,{}),keywords:`update phiên bản version pi piagent npm nâng cấp upgrade`},{id:`shortcuts`,group:t,label:K(e,`Phím tắt`,`Shortcuts`),icon:(0,J.jsx)(G,{}),keywords:`keyboard bàn phím shortcut lệnh command palette enter`},{id:`models`,group:n,label:K(e,`Nhà cung cấp & model`,`Providers & models`),icon:(0,J.jsx)(Ie,{}),keywords:`model provider thinking đăng nhập login oauth tài khoản account công ty company`},{id:`controls`,group:n,label:K(e,`Điều khiển project`,`Project controls`),icon:(0,J.jsx)(ze,{}),keywords:`project runtime khởi động lại restart session`},{id:`permissions`,group:n,label:K(e,`Quyền truy cập`,`Access`),icon:(0,J.jsx)(T,{}),keywords:`permission quyền sandbox đọc ghi read write network mạng`},{id:`connections`,group:r,label:K(e,`MCP & kết nối`,`MCP & connections`),icon:(0,J.jsx)(Ne,{}),keywords:`mcp server tool công cụ oauth kết nối connection`},{id:`usage`,group:i,label:K(e,`Sử dụng & context`,`Usage & context`),icon:(0,J.jsx)(ot,{}),keywords:`token usage context ngữ cảnh input output`},{id:`about`,group:i,label:`Piagent`,icon:(0,J.jsx)(He,{}),keywords:`gateway protocol runtime giới thiệu about`}]}function Au(e,t){return t.trim()?e.filter(e=>Tu(`${e.label} ${e.group} ${e.keywords}`,t)):e}function ju({section:e,onSection:t,onBack:n}){let{locale:r}=Pt(),{status:i}=no(),[a,o]=(0,q.useState)(``),s=(0,q.useMemo)(()=>Au(ku(r),a),[r,a]),c=!!(i?.updateAvailable&&i.installable),l=``;return(0,J.jsxs)(W,{component:`nav`,"aria-label":K(r,`Mục cài đặt`,`Settings sections`),sx:{borderRight:{sm:1},borderBottom:{xs:1,sm:0},borderColor:`divider`,bgcolor:`background.paper`,p:1.25,minHeight:0,overflow:`auto`,display:`flex`,flexDirection:`column`},children:[(0,J.jsxs)(U,{direction:`row`,sx:{minHeight:48,alignItems:`center`,justifyContent:`space-between`,px:1},children:[(0,J.jsx)(H,{id:`piagent-settings-title`,sx:{fontWeight:650},children:K(r,`Cài đặt`,`Settings`)}),(0,J.jsx)(Mt,{"aria-label":K(r,`Đóng cài đặt`,`Close settings`),onClick:n,children:(0,J.jsx)(N,{})})]}),(0,J.jsxs)(te,{variant:`outlined`,sx:{display:`flex`,alignItems:`center`,gap:.75,px:1,mx:.5,mb:1,borderRadius:1},children:[(0,J.jsx)(f,{fontSize:`small`,color:`action`}),(0,J.jsx)(oe,{value:a,onChange:e=>o(e.target.value),placeholder:K(r,`Tìm cài đặt`,`Search settings`),inputProps:{"aria-label":K(r,`Tìm cài đặt`,`Search settings`)},onKeyDown:e=>{e.key===`Enter`&&s[0]&&(e.preventDefault(),t(s[0].id))},sx:{flex:1,fontSize:13,py:.5}})]}),(0,J.jsxs)(Dt,{component:`div`,disablePadding:!0,sx:{display:{xs:`flex`,sm:`block`},minWidth:{xs:`max-content`,sm:0},overflowX:`auto`,flex:1},children:[s.map(n=>{let i=n.group===l?null:n.group;return l=n.group,(0,J.jsxs)(W,{sx:{display:{xs:`contents`,sm:`block`}},children:[i&&(0,J.jsx)(B,{component:`div`,disableSticky:!0,sx:{display:{xs:`none`,sm:`block`},bgcolor:`transparent`,lineHeight:`30px`,fontSize:11,fontWeight:650,letterSpacing:`.04em`,textTransform:`uppercase`,mt:.5},children:i}),(0,J.jsxs)(at,{selected:e===n.id,onClick:()=>t(n.id),children:[(0,J.jsx)(Ke,{sx:{minWidth:36,color:`inherit`,"& .MuiSvgIcon-root":{fontSize:19}},children:n.icon}),(0,J.jsx)(ft,{primary:n.label,slotProps:{primary:{sx:{fontSize:13,fontWeight:e===n.id?800:650}}}}),n.id===`updates`&&c&&(0,J.jsx)(W,{"aria-label":K(r,`Có bản cập nhật`,`Update available`),role:`img`,sx:{width:8,height:8,borderRadius:`50%`,bgcolor:`primary.main`,flexShrink:0}})]})]},n.id)}),!s.length&&(0,J.jsx)(H,{variant:`body2`,color:`text.secondary`,sx:{px:1.5,py:2},children:K(r,`Không có mục nào khớp.`,`No matching setting.`)})]}),i?.piagent.installed&&(0,J.jsx)(H,{variant:`caption`,color:`text.disabled`,sx:{display:{xs:`none`,sm:`block`},px:1.5,pt:1},children:`Piagent ${i.piagent.installed}${i.pi.installed?` · Pi ${i.pi.installed}`:``}`})]})}function Mu(){let{locale:e}=Pt(),t=Nl(),n=[[`${t} K`,K(e,`Mở bảng lệnh: mọi thao tác và cuộc trò chuyện theo tên`,`Open the command palette: every action and conversation by name`)],[`${t} ,`,K(e,`Mở Cài đặt`,`Open Settings`)],[`Enter`,K(e,`Gửi tin nhắn`,`Send the message`)],[`Shift Enter`,K(e,`Xuống dòng trong tin nhắn`,`New line in the message`)],[`1 – 5`,K(e,`Chọn đáp án khi main agent hỏi; Enter để gửi câu trả lời`,`Pick an answer when the main agent asks; Enter sends it`)],[`Esc`,K(e,`Đóng hộp thoại hoặc bảng lệnh`,`Close a dialog or the palette`)]];return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(H,{component:`h1`,variant:`h1`,sx:{mb:3},children:K(e,`Phím tắt`,`Shortcuts`)}),(0,J.jsx)(te,{variant:`outlined`,sx:{borderRadius:1,overflow:`hidden`},children:n.map(([e,t],n)=>(0,J.jsxs)(U,{direction:`row`,sx:{px:2.25,py:1.5,gap:2,alignItems:`center`,justifyContent:`space-between`,borderTop:+!!n,borderColor:`divider`},children:[(0,J.jsx)(H,{children:t}),(0,J.jsx)(W,{component:`kbd`,sx:{px:.9,py:.2,border:1,borderColor:`divider`,borderRadius:1,fontSize:12,fontFamily:`inherit`,whiteSpace:`nowrap`,bgcolor:`action.hover`},children:e})]},e))})]})}function Nu(e){let{locale:t,actions:n}=e,r=K(t,`Lệnh`,`Commands`),i=Nl(),a=[];e.canCreate&&a.push({id:`new-chat`,group:r,label:K(t,`Cuộc trò chuyện mới`,`New chat`),hint:`${i} ⇧ O`,keywords:`new create tạo`,run:n.newChat}),e.update.available&&e.update.latest&&a.push({id:`update-now`,group:r,label:K(t,`Cập nhật Piagent ${e.update.latest}`,`Update Piagent ${e.update.latest}`),keywords:`update upgrade nâng cấp phiên bản version`,run:()=>n.settings(`updates`)}),a.push({id:`check-updates`,group:r,label:K(t,`Kiểm tra cập nhật`,`Check for updates`),keywords:`update version phiên bản pi piagent`,run:n.checkUpdates}),e.hasSelection&&a.push({id:`toggle-panel`,group:r,label:K(t,`Bật/tắt khung Workspace`,`Toggle the Workspace panel`),keywords:`panel sidebar changes plan context`,run:n.togglePanel},{id:`open-changes`,group:r,label:K(t,`Mở Source Changes`,`Open Source Changes`),keywords:`diff review thay đổi git`,run:n.openChanges}),a.push({id:`theme`,group:r,label:e.colorMode===`dark`?K(t,`Chuyển sang chủ đề sáng`,`Switch to the light theme`):K(t,`Chuyển sang chủ đề tối`,`Switch to the dark theme`),keywords:`theme chủ đề dark light sáng tối`,run:()=>n.setColorMode(e.colorMode===`dark`?`light`:`dark`)},{id:`language`,group:r,label:t===`vi`?`Switch the interface to English`:`Chuyển giao diện sang tiếng Việt`,keywords:`language ngôn ngữ english tiếng việt`,run:()=>n.setLocale(t===`vi`?`en`:`vi`)},{id:`refresh`,group:r,label:K(t,`Làm mới`,`Refresh`),keywords:`reload tải lại`,run:n.refresh});let o=n.setTheme,s=K(t,`Chủ đề màu`,`Color theme`);if(o)for(let t of Ft)a.push({id:`theme-${t.id}`,group:s,label:`${s}: ${t.label}`,hint:t.id===e.themeId?`✓`:void 0,keywords:`theme chủ đề màu color ${t.mode}`,run:()=>o(t.id)});let c=K(t,`Cài đặt`,`Settings`);for(let e of ku(t))a.push({id:`settings-${e.id}`,group:c,label:`${c}: ${e.label}`,hint:e.id===`general`?`${i} ,`:void 0,keywords:e.keywords,run:()=>n.settings(e.id)});let l=K(t,`Cuộc trò chuyện`,`Conversations`);for(let t of e.sessions)a.push({id:`session-${t.sessionRef}`,group:l,label:t.title,hint:t.projectLabel,keywords:t.projectLabel,run:()=>n.openSession(t.sessionRef)});return a}var Pu=class{#e=0;run(e,t,n){let r=++this.#e;return(async()=>{try{let n=await e();return r===this.#e&&t(n),n}catch{r===this.#e&&n();return}})()}invalidate(){this.#e+=1}},Fu=class{#e;#t;#n;#r=0;#i=0;#a=!1;#o=!1;#s=[];constructor(e){this.#e=e.read,this.#t=e.commit,this.#n=e.classify}request(){if(this.#o)return Promise.resolve({state:`cancelled`,readSequence:this.#i});let e=++this.#r,t=new Promise(t=>this.#s.push({ticket:e,resolve:t}));return this.#c(),t}invalidate(){if(this.#o)return;this.#o=!0;let e={state:`cancelled`,readSequence:this.#i},t=this.#s;this.#s=[];for(let n of t)n.resolve(e)}async#c(){if(!(this.#a||this.#o)){this.#a=!0;try{for(;!this.#o&&this.#s.length>0;){let e=this.#r,t=++this.#i,n;try{let e=await this.#e();if(this.#o)return;try{this.#t(e),n={state:`committed`,value:e,readSequence:t}}catch(e){n={state:`terminal-error`,error:e,readSequence:t}}}catch(e){if(this.#o)return;n={state:this.#n(e)===`retryable`?`retryable-error`:`terminal-error`,error:e,readSequence:t}}let r=this.#s.filter(t=>t.ticket<=e);this.#s=this.#s.filter(t=>t.ticket>e);for(let e of r)e.resolve(n);if(n.state===`terminal-error`){this.#o=!0;let e={state:`cancelled`,readSequence:t},n=this.#s;this.#s=[];for(let t of n)t.resolve(e)}}}finally{this.#a=!1,!this.#o&&this.#s.length>0&&this.#c()}}}},Iu=`piagent-gateway-event-cursor-v1`,Lu=3e4,Ru=12e4,zu=4001,Bu=class extends Error{reasonCode;constructor(e){super(e),this.name=`SessionSendRejectedError`,this.reasonCode=e}};function Vu(e,t){if(!e)return null;try{let n=JSON.parse(e);return n.gatewayInstanceRef===t&&Number.isSafeInteger(n.sequence)&&Number(n.sequence)>=0?Number(n.sequence):null}catch{return null}}function Hu(e,t){if(t!==null)try{window.sessionStorage.setItem(Iu,JSON.stringify({gatewayInstanceRef:e,sequence:t}))}catch{}}function $(e){return`${e}_${crypto.randomUUID().replaceAll(`-`,``)}`}function Uu(e){return e.phase===`rejected`&&e.resultCode===`stale-revision`&&e.error?.code===`session-revision-stale`}var Wu=(0,q.lazy)(()=>yr(()=>import(`./SettingsPage-DX28MsZA.js`).then(e=>({default:e.SettingsPage})),__vite__mapDeps([12,1,2,3,9,5]))),Gu=(0,q.lazy)(()=>yr(()=>import(`./SessionInspectorDrawer-BHHNlct3.js`).then(e=>({default:e.SessionInspectorDrawer})),__vite__mapDeps([13,1,2,3,14,9,5,10]))),Ku=272,qu=52,Ju=320,Yu=`min(44vw, 860px)`,Xu=`piagent-webui-workspace-panel`;function Zu({session:e,live:t,locale:n}){let r=Il(e,t),[i,a]=r===`running`?[K(n,`Đang chạy`,`Running`),`primary`]:r===`elsewhere`?[K(n,`Đang chạy ở nơi khác`,`Running elsewhere`),`info`]:r===`attention`?Jo(e,t)===`question`?[K(n,`Cần bạn trả lời`,`Needs your answer`),`warning`]:[K(n,`Cần duyệt`,`Needs approval`),`warning`]:r===`recovery`?[K(n,`Cần khôi phục`,`Recovery needed`),`error`]:r===`failed`?[K(n,`Lượt cuối lỗi`,`Last turn failed`),`error`]:[K(n,`Sẵn sàng`,`Ready`),`default`],o=a==="default"?`text.disabled`:a===`info`?`info.main`:`${a}.main`;return(0,J.jsxs)(W,{role:`status`,sx:{display:`inline-flex`,alignItems:`center`,gap:.75,height:28,px:1.1,borderRadius:999,whiteSpace:`nowrap`,fontSize:12.5,fontWeight:550,color:a==="default"?`text.secondary`:o,bgcolor:`action.hover`},children:[(0,J.jsx)(W,{component:`span`,"aria-hidden":`true`,sx:{width:7,height:7,borderRadius:`50%`,bgcolor:o}}),i]})}function Qu({session:e,snapshot:t,locale:n,live:r,canSend:i,canRestart:a,send:s,abort:l,restart:u,onInspector:d,commandActions:f}){let p=e.sessionRef,m=ja(p),[h,g]=(0,q.useState)(()=>ka(p)),[_,v]=(0,q.useState)(!1),[y,b]=(0,q.useState)(),x=e=>{g(e),Aa(p,e)},S=e.modelLabel===`agent-watch-auto`,C=!!(r&&!r.complete),w=Wa({locale:n,company:S,running:C,pinned:e.pinned,bypass:e.managedBypass===!0,fast:e.managedFast===`on`||e.managedFast===`off`?e.managedFast:null,thinkingLevels:e.managedThinkingLevels??(S?[]:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),loadModels:()=>qt().then(e=>e.models.map(e=>({modelRef:e.modelRef,label:e.displayName}))),actions:{...f,stop:l}}),T=w.map(e=>({kind:`command`,name:e.name,argumentHint:e.argumentHint,origin:`piagent`,scope:`project`,description:e.description})),[E,D]=(0,q.useState)(null),[O,k]=(0,q.useState)(null);(0,q.useEffect)(()=>{let e=e=>{e.isComposing||O||(e.key===`Escape`&&C&&!e.metaKey&&!e.ctrlKey?(e.preventDefault(),l()):e.key===`/`&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&i&&(e.preventDefault(),x(`/`),requestAnimationFrame(()=>{let e=A.inputRef.current;e?.focus(),e?.setSelectionRange(1,1)})))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let A=ga({projectRef:e.projectRef,value:h,locale:n,builtIns:T,onChange:e=>{x(e),z(null)}});(0,q.useEffect)(()=>{let e=e=>{e.detail===p&&(g(ka(p)),requestAnimationFrame(()=>A.inputRef.current?.focus()))};return window.addEventListener(Na,e),()=>window.removeEventListener(Na,e)},[p]);let[j,M]=(0,q.useState)(()=>m?.attachments??[]),[N,P]=(0,q.useState)(!1),[F,I]=(0,q.useState)(()=>m?.messageRequestId??`message-request.${crypto.randomUUID()}`),[L,ee]=(0,q.useState)(!1),[te,ne]=(0,q.useState)(null),[R,z]=(0,q.useState)(null),[B,re]=(0,q.useState)(()=>m?.sendUnconfirmed??!1);(0,q.useEffect)(()=>{Ma(p,j.length||B?{attachments:j,messageRequestId:F,sendUnconfirmed:B}:null)},[p,j,F,B]),(0,q.useEffect)(()=>{if(!B)return;let e=window.setTimeout(()=>{re(!1),z({tone:`error`,text:K(n,`Tin nhắn chưa được gửi: phiên chưa nhận nó trong 2 phút nên nó sẽ không chạy nữa. Nội dung vẫn còn; bấm Gửi để thử lại.`,`The message was not sent: the session did not take it within 2 minutes, so it will not run. Your message is kept; send it again.`)})},Ru+15e3);return()=>window.clearTimeout(e)},[B,n]);let[ie,ae]=(0,q.useState)(!1),[oe,V]=(0,q.useState)(null),[se,ce]=(0,q.useState)(!1),[le,ue]=(0,q.useState)(0),de=(0,q.useRef)(0);(0,q.useEffect)(()=>{let e=e=>{xi(e.dataTransfer)&&e.preventDefault()};return window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),()=>{window.removeEventListener(`dragover`,e),window.removeEventListener(`drop`,e)}},[]);let fe=t?.capabilities.capabilities.attachments,pe=(0,q.useMemo)(()=>new Set(fe?.status===`available`?fe.mimeTypes:[]),[fe]),me=(0,q.useMemo)(()=>bi(pe),[pe]),he=!!t&&fe?.status===`available`&&i&&!_&&!B&&!L&&j.length<4,ge=async r=>{if(!(!r?.length||!t||fe?.status!==`available`||L)){ee(!0),ne(null);try{let i=await Ci({files:r,snapshot:t,messageRequestId:F,existing:j,allowed:pe,locale:n,stage:t=>hn(e.sessionRef,t)});M(i.attachments),ne(i.status)}catch{ne(K(n,`Không thể đính kèm; file không được gửi vào Pi.`,`Unable to attach the file; it was not sent to Pi.`))}finally{ee(!1)}}},_e=async r=>{if(!(!t||_||L)){ee(!0),ne(null);try{let i=await wi({snapshot:t,messageRequestId:F,attachmentRef:r,locale:n,stage:t=>hn(e.sessionRef,t)});i.discarded?M(e=>e.filter(e=>e.attachmentRef!==r)):ne(i.status)}catch{ne(K(n,`Không thể bỏ file; trạng thái session có thể đã thay đổi.`,`Unable to remove the file; session state may have changed.`))}finally{ee(!1)}}};(0,q.useEffect)(()=>{let t=new AbortController;return b(void 0),$t(e.sessionRef,t.signal).then(b).catch(()=>void 0),()=>t.abort()},[e.sessionRef,e.sessionRevision]);let ve=(0,q.useRef)(!1),ye=async()=>{let e=h;if(!e.trim()||_||B||ve.current)return;let t=j.length===0?Va(e,w):null;if(t){z(null),D(null);let e=await t.command.run(t.argument);if(`confirm`in e){k(e.confirm),x(``);return}if(!(`send`in e)){D(e),e.tone!==`warning`&&x(``);return}}ve.current=!0,v(!0),z(null);let r=j.map(e=>e.attachmentRef);try{if((await s(e,r.length>0?{messageRequestId:F,attachmentRefs:r,attachments:j}:void 0)).state===`unconfirmed`){Ma(p,{attachments:j,messageRequestId:F,sendUnconfirmed:!0}),re(!0),z({tone:`warning`,text:K(n,`Piagent đang xác nhận lần gửi này. Nội dung và file vẫn được giữ; đừng gửi lại để tránh chạy trùng.`,`Piagent is confirming this send. Your message and files remain preserved; do not resend, to avoid a duplicate run.`)});return}x(``),M([]),ne(null),I(`message-request.${crypto.randomUUID()}`),Ma(p,null)}catch{z({tone:`error`,text:K(n,`Tin nhắn chưa được gửi. Nội dung và file vẫn được giữ; có thể thử lại khi session sẵn sàng.`,`The message was not sent. Your message and files are preserved; retry when the session is ready.`)})}finally{ve.current=!1,v(!1)}};(0,q.useEffect)(()=>{!B||r?.messageRequestId!==F||r.delivery!==`admitted`||(x(``),M([]),ne(null),z(null),re(!1),I(`message-request.${crypto.randomUUID()}`))},[r?.delivery,r?.messageRequestId,F,B]);let be=async()=>{if(!(_||B)){v(!0),z(null);try{await s(K(n,`tiếp tục`,`continue`))}catch{z({tone:`error`,text:K(n,`Chưa gửi được. Thử lại khi session sẵn sàng.`,`Not sent. Retry when the session is ready.`)})}finally{v(!1)}}},xe=async t=>{if(t){b(t);return}b(await $t(e.sessionRef).catch(()=>y))},Se=async()=>{if(!ie){ae(!0),V(null);try{await u()}catch(e){V(e instanceof Error?e.message:null)}finally{ae(!1)}}},Ce=r?.runtimeRecovery??(e.state===`recovery-required`?`stale`:null);return(0,J.jsxs)(W,{sx:{minHeight:`calc(100vh - 88px - var(--piagent-status-bar, 0px))`,display:`flex`,flexDirection:`column`},children:[(0,J.jsxs)(W,{sx:{flex:1,width:`100%`,maxWidth:860,mx:`auto`,px:{xs:2,sm:4},py:{xs:3,md:4},display:`flex`,flexDirection:`column`,justifyContent:`flex-end`},children:[!i&&e.modelLabel===`agent-watch-auto`&&(0,J.jsx)(Bi,{locale:n,onConnected:()=>ue(e=>e+1)},e.sessionRef),(0,J.jsx)(W,{sx:{width:`100%`},children:(0,J.jsx)(Dl,{reload:le,sessionRef:e.sessionRef,sessionRevision:e.sessionRevision,live:r,approvals:t?.approvals,locale:n,onOpenActivity:()=>d(`activity`),onContinue:i&&!_&&!B&&e.liveState!==`running`&&(!r||r.complete)?()=>void be():void 0},e.sessionRef)})]}),(0,J.jsxs)(W,{sx:{position:`sticky`,bottom:`var(--piagent-status-bar, 0px)`,px:{xs:1.5,sm:2.5},pb:2.5,background:`linear-gradient(transparent, var(--piagent-palette-background-default) 25%)`},children:[(0,J.jsx)(Pr,{session:e,locale:n}),e.state===`terminal-owned`&&(0,J.jsx)(o,{severity:`info`,role:`status`,sx:{maxWidth:820,mx:`auto`,mb:1},children:K(n,`Cuộc trò chuyện này đang chạy trong Terminal hoặc một tiến trình Piagent khác. Trang này tự cập nhật để bạn theo dõi; gửi tin nhắn khi nó chạy xong.`,`This conversation is running in Terminal or another Piagent process. This page follows it; send a message when it has finished.`)}),Ce&&(0,J.jsx)(o,{severity:Ce===`recovered`?`success`:Ce===`failed`?`error`:`warning`,action:(Ce===`failed`||Ce===`required`||Ce===`stale`)&&a&&e.liveState!==`running`?(0,J.jsx)(c,{color:`inherit`,size:`small`,disabled:ie,onClick:()=>void Se(),children:ie?K(n,`Đang khởi động…`,`Restarting…`):K(n,`Khởi động lại phiên`,`Restart session`)}):void 0,sx:{maxWidth:860,mx:`auto`,mb:1},children:Ce===`recovered`?K(n,`Runtime mới đã được xác minh; lịch sử và context của session được giữ nguyên.`,`The new runtime is verified; session history and context were preserved.`):Ce===`failed`?oe?.startsWith(`company-`)&&ji(oe,null,n)?`${ji(oe,null,n).title}: ${ji(oe,null,n).text}`:K(n,`Runtime đã đổi nhưng chưa khởi động lại được. Hãy dùng nút bên cạnh hoặc restart Dashboard.`,`The runtime changed but could not restart. Use the action here or restart the Dashboard.`):Ce===`stale`&&[`session-runtime-open-failed`,`session-runtime-dispose-failed`].includes(e.reasonCode??``)?K(n,`Runtime của phiên này chưa mở được (thường do key, Harness hoặc Agent Watch lúc đó). Bấm Khởi động lại phiên để thử lại, hoặc lưu trữ phiên; lịch sử được giữ nguyên.`,`This session's runtime did not open (usually the key, the Harness or Agent Watch at the time). Restart the session to try again, or archive it; its history is kept.`):Ce===`stale`?K(n,`Phiên này chưa được đóng đúng cách và có thể đang mở ở cửa sổ Terminal khác. Đóng cửa sổ đó (nếu có) rồi bấm Khởi động lại phiên để làm tiếp; lịch sử được giữ nguyên.`,`This session was not closed cleanly and may still be open in a Terminal window. Close it (if any), then restart the session to go on; its history is kept.`):Ce===`restarting`?K(n,`Runtime vừa được cập nhật. Piagent đang khởi động lại session an toàn sau lượt hiện tại.`,`The runtime was updated. Piagent is safely restarting the session after the current turn.`):K(n,`Phát hiện runtime mới. Piagent sẽ giữ câu trả lời hiện tại rồi tự khởi động lại session.`,`A new runtime was detected. Piagent will preserve the current response and restart the session automatically.`)}),(0,J.jsxs)(W,{sx:{position:`relative`,maxWidth:860,mx:`auto`,border:1,borderColor:se?`primary.main`:`divider`,borderStyle:se?`dashed`:`solid`,borderRadius:2,bgcolor:`background.paper`,px:1.5,pt:1.25,pb:1,boxShadow:`0 12px 40px -18px rgba(0,0,0,.5)`,transition:`border-color .16s, box-shadow .16s`,"&:focus-within":{borderColor:`rgba(var(--piagent-palette-primary-mainChannel) / .55)`,boxShadow:`0 0 0 3px rgba(var(--piagent-palette-primary-mainChannel) / .14), 0 12px 40px -18px rgba(0,0,0,.5)`}},onDragEnter:e=>{xi(e.dataTransfer)&&(de.current+=1,ce(!0))},onDragOver:e=>{xi(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=he?`copy`:`none`)},onDragLeave:e=>{xi(e.dataTransfer)&&(--de.current,de.current<=0&&(de.current=0,ce(!1)))},onDrop:e=>{xi(e.dataTransfer)&&(e.preventDefault(),de.current=0,ce(!1),he&&ge(e.dataTransfer.files))},children:[se&&(0,J.jsxs)(W,{role:`status`,sx:{position:`absolute`,inset:0,zIndex:3,display:`grid`,alignContent:`center`,justifyItems:`center`,gap:.5,borderRadius:1,bgcolor:`background.paper`,opacity:.96,pointerEvents:`none`,textAlign:`center`},children:[(0,J.jsx)(H,{sx:{fontWeight:650},children:he?K(n,`Thả tài liệu vào đây`,`Drop documents here`):j.length>=4?K(n,`Đã đủ 4 file cho tin nhắn này`,`This message already holds 4 files`):K(n,`Chưa nhận file lúc này`,`Files cannot be attached right now`)}),he&&(0,J.jsx)(H,{variant:`caption`,color:`text.secondary`,children:K(n,`.md .txt .csv .json .yaml .docx .pdf và ảnh`,`.md .txt .csv .json .yaml .docx .pdf and images`)})]}),j.length>0&&(0,J.jsx)(U,{direction:`row`,sx:{flexWrap:`wrap`,gap:.75,px:.5,pb:.75},"aria-label":K(n,`File sẽ gửi cùng tin nhắn`,`Files to send with the message`),children:j.map(e=>(0,J.jsx)(wt,{size:`small`,variant:`outlined`,color:e.kind===`document`?`success`:`default`,label:`${e.displayName} · ${yi(e,n)}`,onDelete:_||B||L?void 0:()=>void _e(e.attachmentRef),deleteIcon:(0,J.jsx)(Ir,{"aria-label":`${K(n,`Bỏ`,`Remove`)} ${e.displayName}`,role:`button`})},e.attachmentRef))}),E&&(0,J.jsx)(o,{severity:E.tone,onClose:()=>D(null),sx:{mb:.75,whiteSpace:`pre-line`},children:E.text}),(0,J.jsx)(we,{fullWidth:!0,multiline:!0,minRows:2,disabled:!i||_||B,value:h,inputRef:A.inputRef,...A.inputProps,onChange:e=>{x(e.target.value),z(null),A.track(e)},onKeyDown:e=>{A.onKeyDown(e)||aa(e)&&(e.preventDefault(),ye())},onPaste:e=>{e.clipboardData?.files.length&&(e.preventDefault(),he&&ge(e.clipboardData.files))},placeholder:K(n,`Nhắn cho Piagent… (@ để chọn file, folder)`,`Message Piagent… (@ for files and folders)`),variant:`standard`,slotProps:{input:{disableUnderline:!0},htmlInput:A.htmlInput}}),A.menu,(0,J.jsx)(Ji,{open:O!==null,title:O?.title??``,description:O?.description??``,confirmLabel:O?.confirmLabel??``,cancelLabel:K(n,`Huỷ`,`Cancel`),onCancel:()=>k(null),onConfirm:()=>{let e=O;k(null),e&&e.run().then(D)}}),(0,J.jsx)(Kr,{in:N,id:`piagent-message-options`,children:(0,J.jsxs)(W,{sx:{mt:.65,p:.85,borderRadius:1,bgcolor:`action.hover`},children:[(0,J.jsx)(ea,{session:e,snapshot:t,connections:y,locale:n,onOpenChanges:()=>d(`source`),onConnectionsChanged:xe}),(0,J.jsx)(U,{direction:`row`,sx:{minWidth:0,alignItems:`center`,gap:.75,flexWrap:`wrap`},children:fe?.status===`available`&&(0,J.jsx)(tt,{title:K(n,`Chọn file, hoặc kéo thả / dán thẳng vào khung chat`,`Pick a file, or drag and drop / paste straight into the chat`),children:(0,J.jsxs)(c,{component:`label`,size:`small`,color:`inherit`,startIcon:(0,J.jsx)(Fr,{}),disabled:!he,"aria-label":`${K(n,`Đính kèm`,`Attach`)} (${j.length}/4)`,children:[K(n,`Đính kèm`,`Attach`),(0,J.jsx)(`input`,{type:`file`,multiple:!0,hidden:!0,disabled:!he,accept:me||void 0,onChange:e=>{ge(e.target.files),e.currentTarget.value=``}})]})})})]})}),(0,J.jsxs)(U,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`,mt:.5,gap:1},children:[(0,J.jsxs)(U,{direction:`row`,sx:{minWidth:0,alignItems:`center`,gap:1},children:[(0,J.jsx)(tt,{title:N?K(n,`Ẩn tùy chọn`,`Hide options`):K(n,`File và công cụ`,`Files and tools`),children:(0,J.jsx)(Mt,{size:`small`,"aria-label":N?K(n,`Ẩn tùy chọn`,`Hide options`):K(n,`Thêm tùy chọn`,`More options`),"aria-expanded":N,"aria-controls":`piagent-message-options`,onClick:()=>P(e=>!e),sx:{bgcolor:N?`action.selected`:`transparent`},children:(0,J.jsx)(Ze,{fontSize:`small`,sx:{transition:`transform .16s ease`,transform:N?`rotate(45deg)`:`none`}})})}),(0,J.jsx)(H,{variant:`caption`,color:te||R?.tone===`error`?`error`:R?`warning.main`:`text.disabled`,noWrap:!R,sx:{display:{xs:te||R||L?`block`:`none`,sm:`block`}},children:R?.text??te??(L?K(n,`Đang đọc tài liệu…`,`Reading documents…`):r&&!r.complete?K(n,`Esc để dừng · gửi việc tiếp khi lượt này xong`,`Esc to stop · send the next task when this turn ends`):i?K(n,`Enter để gửi · Shift+Enter xuống dòng`,`Enter to send · Shift+Enter for a new line`):K(n,`Session hiện chỉ đọc`,`Session is currently read only`))})]}),r?.operationRef&&!r.complete&&r.abortable!==!1?(0,J.jsx)(c,{color:`error`,variant:`outlined`,size:`small`,startIcon:(0,J.jsx)(zr,{}),onClick:()=>void l(),sx:{borderRadius:999},children:K(n,`Dừng`,`Stop`)}):(0,J.jsx)(Mt,{"aria-label":K(n,`Gửi`,`Send`),disabled:!i||_||B||!h.trim(),color:`primary`,onClick:()=>void ye(),sx:{width:32,height:32,borderRadius:999,bgcolor:`primary.main`,color:`primary.contrastText`,transition:`transform .12s, background-color .16s`,"&:hover":{bgcolor:`primary.main`,color:`primary.contrastText`,transform:`translateY(-1px)`},"&.Mui-disabled":{bgcolor:`action.disabledBackground`}},children:(0,J.jsx)(Lr,{fontSize:`small`})})]})]})]})]})}function $u({locale:e,canCreate:t,onNew:n}){return(0,J.jsxs)(U,{sx:{minHeight:`calc(100vh - ${qu}px - var(--piagent-status-bar, 0px))`,alignItems:`center`,justifyContent:`center`,px:3,textAlign:`center`},spacing:1.5,children:[(0,J.jsx)(lr,{size:48}),(0,J.jsx)(H,{variant:`h1`,children:K(e,`Bắt đầu với Piagent`,`Start with Piagent`)}),(0,J.jsx)(H,{color:`text.secondary`,sx:{maxWidth:520},children:K(e,`Tạo cuộc trò chuyện mới, chọn project và model; session sẽ được lưu để tiếp tục sau khi đóng Gateway.`,`Create a new chat, choose a project and model, and the session will remain available after the Gateway closes.`)}),(0,J.jsx)(c,{disabled:!t,variant:`contained`,startIcon:(0,J.jsx)(Ze,{}),onClick:n,children:K(e,`Cuộc trò chuyện mới`,`New chat`)})]})}function ed({catalog:e,capabilities:t,connection:n,live:r,terminalActivities:i,refresh:a,create:o,send:s,abort:l,restart:u,setModel:f,setThinking:p,setPermission:h,setFast:g,rename:v,pin:y,archive:b,unarchive:x,fork:S}){let{locale:C,colorMode:w,themeId:T,setLocale:E,setColorMode:D,setThemeId:O}=Pt(),k=Ka(),A=no(),[j,M]=(0,q.useState)(!1),[N,P]=(0,q.useState)(`sessions`),F=Ye(Qe().breakpoints.up(`lg`)),[L,ee]=(0,q.useState)(null),[te,ne]=(0,q.useState)(``),[R,B]=(0,q.useState)(),[re,ie]=(0,q.useState)(!1),[ae,oe]=(0,q.useState)(!1),[V,se]=(0,q.useState)(`chat`),[ce,le]=(0,q.useState)(!1),[ue,fe]=(0,q.useState)(`general`),[pe,he]=(0,q.useState)(!1),[ge,_e]=(0,q.useState)(`task`),ve=!F,[ye,be]=(0,q.useState)(()=>{try{let e=window.localStorage.getItem(Xu);if(e)return e===`open`}catch{}return window.innerWidth>=1200}),[xe,Se]=(0,q.useState)(!1),Ce=()=>ve?Se(e=>!e):be(e=>{try{window.localStorage.setItem(Xu,e?`closed`:`open`)}catch{}return!e}),Te=(0,q.useRef)(!1);pe&&(Te.current=!0);let Ee=(0,q.useRef)(!1);Ee.current=pe&&ge===`activity`;let[De,Oe]=(0,q.useState)(),ke=(0,q.useRef)(null),[Ae,je]=(0,q.useState)(`idle`),Me=(0,q.useRef)(null),Ne=(0,q.useRef)(null);Ne.current??=new Pu;let[Pe,Fe]=(0,q.useState)(!1),[Ie,Le]=(0,q.useState)(null),[Re,ze]=(0,q.useState)(null),[Be,He]=(0,q.useState)(``),[Ue,We]=(0,q.useState)(!1),[Ge,Ke]=(0,q.useState)(null),[qe,Je]=(0,q.useState)(null);(0,q.useEffect)(()=>{V===`chat`&&R||(window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0)},[V,R]);let Xe=(0,q.useMemo)(()=>(e?.sessions??[]).filter(e=>e.archived===ae&&`${e.title} ${e.projectLabel} ${e.preview}`.toLowerCase().includes(te.trim().toLowerCase())),[e,te,ae]),Ze=(0,q.useMemo)(()=>{let e=new Map;for(let t of Xe){let n=e.get(t.projectRef)??{label:t.projectLabel,gitBranch:t.gitBranch,sessions:[]};n.gitBranch??=t.gitBranch,n.gitRepositories??=t.gitRepositories,n.sessions.push(t),e.set(t.projectRef,n)}return[...e.entries()].map(([e,t])=>({projectRef:e,...t,sessions:t.sessions.sort((e,t)=>Number(t.pinned)-Number(e.pinned)||Date.parse(t.updatedAt)-Date.parse(e.updatedAt))})).sort((e,t)=>Date.parse(t.sessions[0]?.updatedAt??``)-Date.parse(e.sessions[0]?.updatedAt??``))},[Xe]),$e=e?.sessions.filter(e=>e.archived).length??0;(0,q.useEffect)(()=>{(!R||!(e?.sessions??[]).some(e=>e.sessionRef===R))&&B((e?.sessions??[]).find(e=>!e.archived)?.sessionRef)},[R,e]);let G=(e?.sessions??[]).find(e=>e.sessionRef===R),et=G?.sessionRef,nt=G?.state===`terminal-owned`,rt=(e?.sessions??[]).some(e=>e.state===`terminal-owned`);(0,q.useEffect)(()=>{let e=nt?3e3:rt?1e4:3e4,t=window.setInterval(()=>{document.visibilityState===`visible`&&a()},e);return()=>window.clearInterval(t)},[nt,rt,a]);let it=(0,q.useRef)(et);it.current=et;let at=ke.current&&ke.current.sessionRef===et&&ke.current.snapshot===De?De:void 0,ot=Me.current===et?Ae:et?`loading`:`idle`,st=G?r[G.sessionRef]:void 0,[ct,lt]=(0,q.useState)(null),ut=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(!e||ut.current)return;ut.current=!0;let t=Rt();t&&(lt(t),se(`new`))},[e]);let dt=e=>{lt(null),B(e),se(`chat`),ie(!1)},ft=Zl({sessions:(0,q.useMemo)(()=>e?.sessions??[],[e]),live:r,selectedRef:V===`chat`?et:void 0,onOpen:dt,locale:C}),pt=e=>{fe(e),le(!0)};Du({palette:()=>M(!0),settings:()=>pt(`general`),newChat:()=>{gt&&(Le(null),se(`new`))}});let mt=e=>{_e(e),he(!0)},ht=async()=>{let e=it.current;if(!e)return;ke.current?.sessionRef!==e&&(Me.current=e,je(`loading`));let t=await Ne.current.run(()=>Zt(e),t=>{it.current===e&&(ke.current={sessionRef:e,snapshot:t},Me.current=e,Oe(t),je(`ready`))},()=>{it.current===e&&(Me.current=e,je(ke.current?.sessionRef===e?`ready`:`error`))});return it.current===e?t:void 0};(0,q.useEffect)(()=>{if(!et){Ne.current.invalidate(),ke.current=null,Me.current=null,Oe(void 0),je(`idle`);return}let e=et,t=new AbortController;return Me.current=e,ke.current?.sessionRef!==e&&(ke.current=null,Oe(void 0),je(`loading`)),Ne.current.run(()=>Zt(e,t.signal),n=>{t.signal.aborted||it.current!==e||(ke.current={sessionRef:e,snapshot:n},Me.current=e,Oe(n),je(`ready`))},()=>{t.signal.aborted||it.current!==e||(Me.current=e,je(ke.current?.sessionRef===e?`ready`:`error`))}),()=>t.abort()},[et,G?.sessionRevision]),(0,q.useEffect)(()=>{if(!pe||ge!==`activity`||!et||!at||!st?.operationRef||st.complete)return;let e=et,t=!1,n,r=async()=>{await Ne.current.run(()=>Zt(e),n=>{t||!Ee.current||it.current!==e||(ke.current={sessionRef:e,snapshot:n},Me.current=e,Oe(n),je(`ready`))},()=>void 0),t||(n=window.setTimeout(()=>void r(),2e3))};return n=window.setTimeout(()=>void r(),2e3),()=>{t=!0,n!==void 0&&window.clearTimeout(n)}},[pe,ge,et,!!at,st?.operationRef,st?.complete]);let gt=n===`connected`&&t?.capabilities.sessionActions.create.status===`available`,_t=async e=>{Fe(!0),Le(null);let t=null;try{let n=`message-request.${crypto.randomUUID()}`,r=e.files.length>0,i=await o({projectRef:e.projectRef,placeRef:e.placeRef,modelRef:e.modelRef,thinkingLevel:e.thinkingLevel,workflow:e.workflow,permissionMode:e.permissionMode,fast:e.fast,message:e.message,messageRequestId:n,deferInitialMessage:r});if(t=i.sessionRef,!t)throw Error(`session-create-result-invalid`);if(Aa(_a,``),Ma(_a,null),i.phase!==`settled`){B(t),se(`chat`),Je({title:K(C,`Session đã được tạo`,`The session was created`),message:K(C,`Pi đã nhận yêu cầu và session đang tự đồng bộ. Không gửi lại để tránh chạy trùng.`,`Pi received the request and the session is resyncing. Do not resend it, to avoid a duplicate run.`)});return}if(r){let r=(await a())?.sessions.find(e=>e.sessionRef===t);if(!r)throw Error(`session-catalog-refresh-failed`);let i=await Zt(t),o=i.capabilities.capabilities.attachments;if(o.status!==`available`)throw Error(o.reason?.code??`session-attachment-unavailable`);let c=await Ci({files:e.files,snapshot:i,messageRequestId:n,existing:[],allowed:new Set(o.mimeTypes),locale:C,stage:e=>hn(t,e)});if(c.status||c.attachments.length!==e.files.length)throw await Promise.all(c.attachments.map(async e=>{try{await wi({snapshot:i,messageRequestId:n,attachmentRef:e.attachmentRef,locale:C,stage:e=>hn(t,e)})}catch{}})),Error(c.status??`session-attachment-incomplete`);await s(r,e.message,{messageRequestId:n,attachmentRefs:c.attachments.map(e=>e.attachmentRef),attachments:c.attachments,workflow:e.workflow})}B(t),se(`chat`)}catch(n){let r=n instanceof Error?n.message:`session-create-failed`;t?(e.files.length>0&&Aa(t,e.message),B(t),se(`chat`),Je({title:K(C,`Session đã tạo nhưng file chưa được gửi`,`The session was created, but the files were not sent`),message:r})):Le(Li(r,C))}finally{Fe(!1)}},vt=(e,t)=>{if(t===`pin`){y(e,!e.pinned).catch(e=>Je({title:K(C,`Không thể đổi trạng thái ghim`,`Could not change pin state`),message:e instanceof Error?e.message:`session-pin-failed`}));return}if(t===`unarchive`){x(e).then(()=>oe(!1)).catch(e=>Je({title:K(C,`Không thể khôi phục cuộc trò chuyện`,`Could not restore chat`),message:e instanceof Error?e.message:`session-unarchive-failed`}));return}Ke(null),He(t===`rename`?e.title:t===`fork`?`${e.title} · ${K(C,`nhánh`,`fork`)}`:``),ze({kind:t,session:e})},yt=async()=>{if(!(!Re||Ue)){We(!0),Ke(null);try{if(Re.kind===`rename`)await v(Re.session,Be.trim());else if(Re.kind===`archive`)await b(Re.session);else{let e=await S(Re.session,Be.trim()||null);e.sessionRef&&(B(e.sessionRef),se(`chat`))}ze(null)}catch(e){Ke(rd(Re.kind,e instanceof Error?e.message:`session-action-failed`,C))}finally{We(!1)}}},bt=(0,J.jsx)(Kl,{locale:C,canCreate:gt,query:te,onQuery:ne,groups:Ze,count:Xe.length,selectedRef:V===`chat`?G?.sessionRef:void 0,showArchived:ae,archivedCount:$e,settingsOpen:ce,connection:n,live:r,unseen:ft.unseen,onSelect:dt,onAction:vt,onNew:()=>{Le(null),se(`new`),ie(!1)},onToggleArchived:()=>{oe(e=>!e),ie(!1)},updateDot:!!(A.status?.updateAvailable&&A.status.installable),onSettings:()=>{pt(A.status?.updateAvailable&&A.status.installable?`updates`:`general`),ie(!1)}}),xt=V===`chat`&&G?(0,J.jsx)(Cu,{session:G,snapshot:at,live:st,locale:C,onOpenReview:()=>mt(`source`),onClose:()=>ve?Se(!1):be(!1)}):null,St=!!xt&&(ve?xe:ye)&&!pe;if(k)return(0,J.jsx)(qa,{locale:C});if(!e&&n!==`failed`)return(0,J.jsxs)(U,{sx:{minHeight:`100vh`,alignItems:`center`,justifyContent:`center`},spacing:2,children:[(0,J.jsx)(me,{size:24}),(0,J.jsx)(H,{children:K(C,`Đang mở Piagent…`,`Opening Piagent…`)})]});let Ct=V===`new`?K(C,`Cuộc trò chuyện mới`,`New chat`):G?.title??`Piagent`,wt=Nu({locale:C,colorMode:w,themeId:T,canCreate:gt,hasSelection:V===`chat`&&!!G,sessions:(e?.sessions??[]).filter(e=>!e.archived),update:{available:!!(A.status?.updateAvailable&&A.status.installable&&!$a(A.status)),latest:A.status?.piagent.latest??null},actions:{newChat:()=>{Le(null),se(`new`)},togglePanel:Ce,openChanges:()=>mt(`source`),refresh:()=>void a(),settings:pt,checkUpdates:()=>{pt(`updates`),A.check()},setColorMode:D,setTheme:O,setLocale:E,openSession:dt}}),Tt=Object.values(r).filter(e=>e&&!e.complete).length;return(0,J.jsx)(pr,{sessionRef:V===`chat`?et:void 0,onOpen:()=>he(!1),children:(0,J.jsxs)(W,{sx:{minHeight:`100vh`,bgcolor:`background.default`,"--piagent-status-bar":{xs:`0px`,md:`28px`}},children:[(0,J.jsx)(de,{position:`fixed`,color:`transparent`,elevation:0,sx:{left:{md:`${Ku}px`},right:{lg:St?`${Ju}px`:0,xl:pe?Yu:St?`${Ju}px`:0},width:{xs:`100%`,md:`auto`},borderBottom:1,transition:`right .2s ease`,borderColor:`divider`,bgcolor:`rgba(var(--piagent-palette-background-defaultChannel) / .9)`,backdropFilter:`blur(18px)`},children:(0,J.jsxs)(Ve,{sx:{minHeight:`${qu}px !important`,gap:1,px:{xs:1.5,sm:2.5}},children:[(0,J.jsx)(Mt,{"aria-label":K(C,`Mở điều hướng`,`Open navigation`),onClick:()=>ie(!0),sx:{display:{md:`none`}},children:(0,J.jsx)(m,{})}),(0,J.jsxs)(W,{sx:{flex:1,minWidth:0},children:[(0,J.jsx)(H,{component:`h1`,noWrap:!0,sx:{fontWeight:600,fontSize:14.5,letterSpacing:`-0.01em`,lineHeight:1.3},children:Ct}),V===`chat`&&G&&(0,J.jsxs)(H,{variant:`caption`,color:`text.secondary`,noWrap:!0,component:`div`,sx:{display:`flex`,alignItems:`center`,gap:.75,minWidth:0},children:[(0,J.jsx)(W,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,flexShrink:3,minWidth:24},children:G.projectLabel}),(G.gitBranch||!!G.gitRepositories?.length)&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(W,{component:`span`,"aria-hidden":!0,sx:{color:`text.disabled`},children:`·`}),(0,J.jsx)(Ml,{projectRef:G.projectRef,projectLabel:G.projectLabel,branch:G.gitBranch,repositories:G.gitRepositories,locale:C,maxWidth:`45%`,onSwitched:()=>void a()})]})]})]}),V===`chat`&&G&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(ea,{placement:`header`,compact:pe,session:G,snapshot:at,locale:C,onOpenChanges:()=>mt(`source`),canSetModel:n===`connected`&&t?.capabilities.sessionActions.setModel.status===`available`,canSetThinking:n===`connected`&&t?.capabilities.sessionActions.setThinking.status===`available`,canSetPermission:n===`connected`&&t?.capabilities.sessionActions.setPermission.status===`available`,onSetModel:e=>f(G,e),onSetThinking:e=>p(G,e),onSetPermission:e=>h(G,e),onSetFast:e=>g(G,e)}),(0,J.jsx)(W,{sx:{display:{xs:`none`,sm:pe?`none`:`block`}},children:(0,J.jsx)(Zu,{session:G,live:st,locale:C})}),(0,J.jsx)(W,{"aria-hidden":`true`,sx:{width:`1px`,height:20,bgcolor:`divider`,mx:.5,display:{xs:`none`,sm:`block`}}}),(0,J.jsx)(tt,{title:`Source Changes`,children:(0,J.jsx)(Mt,{"aria-label":K(C,`Mở Source Changes Inspector`,`Open Source Changes Inspector`),onClick:()=>mt(`source`),children:(0,J.jsx)(z,{fontSize:`small`})})}),(0,J.jsx)(tt,{title:K(C,`Khung Workspace: thay đổi, ngữ cảnh, subagent`,`Workspace panel: changes, context, subagents`),children:(0,J.jsx)(Mt,{"aria-label":K(C,`Khung Workspace`,`Workspace panel`),"aria-pressed":St,onClick:()=>Ce(),color:St?`primary`:`default`,children:(0,J.jsx)(Rr,{fontSize:`small`,sx:{transform:`scaleX(-1)`}})})})]}),(0,J.jsx)(tt,{title:K(C,`Làm mới`,`Refresh`),children:(0,J.jsx)(Mt,{"aria-label":K(C,`Làm mới`,`Refresh`),onClick:()=>void a(),children:(0,J.jsx)(_,{fontSize:`small`})})})]})}),(0,J.jsxs)(W,{component:`nav`,sx:{width:{md:Ku}},children:[(0,J.jsx)(I,{variant:`temporary`,open:re,onClose:()=>ie(!1),sx:{display:{xs:`block`,md:`none`},"& .MuiDrawer-paper":{width:Ku}},children:bt}),(0,J.jsxs)(I,{variant:`permanent`,sx:{display:{xs:`none`,md:`block`},"& .MuiDrawer-paper":{width:Ku,borderRight:1,borderColor:`divider`,height:`calc(100% - var(--piagent-status-bar, 0px))`}},children:[F&&G&&V===`chat`&&(0,J.jsx)(cr,{value:N,onChange:P}),!F||N===`sessions`||!G||V!==`chat`?bt:(0,J.jsx)(W,{ref:ee,sx:{overflow:`auto`,flex:1}})]})]}),(0,J.jsx)(W,{component:`main`,sx:{ml:{md:`${Ku}px`},mr:{lg:St?`${Ju}px`:0,xl:pe?Yu:St?`${Ju}px`:0},pt:`${qu}px`,transition:`margin-right .2s ease`},children:V===`new`?(0,J.jsx)(Ra,{active:!0,defaultProjectRef:ct??G?.projectRef,busy:Pe,error:Ie,onCancel:()=>se(`chat`),onCreate:e=>_t(e)}):G?(0,J.jsx)(jr,{sessionRef:G.sessionRef,navigationHost:L,sidebarMode:N,onSection:P,children:(0,J.jsx)(Qu,{session:G,snapshot:at,locale:C,live:r[G.sessionRef],commandActions:{setModel:e=>f(G,e),setThinking:e=>p(G,e),setFast:e=>g(G,e),setPermission:e=>h(G,e),rename:e=>v(G,e),fork:()=>S(G,null),pin:e=>y(G,e),archive:()=>b(G),newChat:()=>{Le(null),se(`new`)},openChanges:()=>mt(`source`),openSettings:()=>pt(`general`)},canSend:n===`connected`&&G.composerAvailable&&t?.capabilities.sessionActions.send.status===`available`&&(!st||st.complete)&&![`required`,`restarting`,`failed`].includes(String(r[G.sessionRef]?.runtimeRecovery)),canRestart:n===`connected`&&t?.capabilities.sessionActions.release.status===`available`&&t?.capabilities.sessionActions.acquire.status===`available`,send:(e,t)=>s(G,e,t),abort:()=>l(G).catch(e=>Je({title:K(C,`Chưa dừng được lượt này`,`This turn could not be stopped`),message:e instanceof Error&&e.message===`operation-unavailable`?K(C,`Lượt đã kết thúc hoặc đang chuyển bước. Nếu vẫn còn chạy, bấm Dừng lần nữa.`,`The turn already ended or is between steps. If it is still running, press Stop again.`):e instanceof Error?e.message:`session-abort-failed`})),restart:()=>u(G),onInspector:mt},G.sessionRef)},G.sessionRef):(0,J.jsx)($u,{locale:C,canCreate:gt,onNew:()=>se(`new`)})}),xt&&St&&!ve&&(0,J.jsx)(W,{component:`aside`,sx:{display:{xs:`none`,lg:`block`},position:`fixed`,top:0,right:0,bottom:`var(--piagent-status-bar, 0px)`,width:Ju,borderLeft:1,borderColor:`divider`,zIndex:e=>e.zIndex.appBar-1},children:xt}),xt&&(0,J.jsx)(I,{anchor:`right`,variant:`temporary`,open:xe&&!pe&&ve,onClose:()=>Se(!1),sx:{display:{xs:`block`,lg:`none`},"& .MuiDrawer-paper":{width:`min(${Ju}px, 88vw)`}},children:xt}),Te.current&&(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(Gu,{open:pe,active:ge,snapshot:at,state:ot,sessionRef:et,terminalActivities:G?i[G.sessionRef]:void 0,liveActivities:st&&!st.complete?st.activities:void 0,onClose:()=>he(!1),onActive:_e,refresh:ht,findings:G?.managedReview?.findings,onSendComments:G&&G.composerAvailable?e=>{Pa(G.sessionRef,e),he(!1)}:void 0})}),(0,J.jsx)(go,{locale:C,onDetails:()=>pt(`updates`)}),ft.view,(0,J.jsx)(Z,{locale:C,connection:n,running:Tt,session:V===`chat`?G:void 0,onBranchSwitched:()=>void a(),onUpdates:()=>pt(`updates`),onPalette:()=>M(!0)}),(0,J.jsx)(Ou,{open:j,onClose:()=>M(!1),commands:wt,locale:C}),(0,J.jsx)(d,{open:ce,onClose:()=>le(!1),fullWidth:!0,maxWidth:`lg`,"aria-labelledby":`piagent-settings-title`,slotProps:{paper:{sx:{m:{xs:0,sm:2},width:{xs:`100%`,sm:`calc(100% - 32px)`},height:{xs:`100%`,sm:`min(86vh, 840px)`},maxHeight:{xs:`100%`,sm:`86vh`},borderRadius:{xs:0,sm:2.5},overflow:`hidden`}}},children:(0,J.jsx)(q.Suspense,{fallback:(0,J.jsx)(U,{sx:{height:`100%`,alignItems:`center`,justifyContent:`center`},children:(0,J.jsx)(me,{size:22})}),children:(0,J.jsx)(Wu,{section:ue,onSection:fe,onBack:()=>le(!1),session:G,snapshot:at,capabilities:t,connection:n,onSetModel:G?e=>f(G,e):void 0,onSetThinking:G?e=>p(G,e):void 0,onSetPermission:G?e=>h(G,e):void 0,onRuntimeChanged:async()=>{await a(),await ht()}})})}),(0,J.jsx)(d,{open:!!Re,onClose:()=>!Ue&&ze(null),fullWidth:!0,maxWidth:`xs`,children:(0,J.jsxs)(U,{spacing:2,sx:{p:3},children:[(0,J.jsx)(H,{variant:`h2`,children:Re?.kind===`rename`?K(C,`Đổi tên cuộc trò chuyện`,`Rename chat`):Re?.kind===`fork`?K(C,`Tạo nhánh cuộc trò chuyện`,`Fork chat`):K(C,`Lưu trữ cuộc trò chuyện`,`Archive chat`)}),Re?.kind===`archive`?(0,J.jsx)(H,{color:`text.secondary`,children:K(C,`Cuộc trò chuyện vẫn được lưu và có thể khôi phục từ mục Đã lưu trữ.`,`The chat remains saved and can be restored from Archived.`)}):(0,J.jsx)(we,{autoFocus:!0,label:K(C,`Tên`,`Title`),value:Be,onChange:e=>He(e.target.value),slotProps:{htmlInput:{maxLength:500}}}),Ge&&(0,J.jsx)(H,{color:`error`,children:Ge}),(0,J.jsxs)(U,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`},children:[(0,J.jsx)(c,{disabled:Ue,onClick:()=>ze(null),children:K(C,`Hủy`,`Cancel`)}),(0,J.jsx)(c,{variant:`contained`,disabled:Ue||Re?.kind!==`archive`&&!Be.trim(),onClick:()=>void yt(),children:K(C,`Xác nhận`,`Confirm`)})]})]})}),(0,J.jsx)(d,{open:!!qe,onClose:()=>Je(null),fullWidth:!0,maxWidth:`xs`,"aria-labelledby":`piagent-session-notice-title`,children:(0,J.jsxs)(U,{spacing:2,sx:{p:3},children:[(0,J.jsx)(H,{id:`piagent-session-notice-title`,variant:`h2`,children:qe?.title}),(0,J.jsx)(H,{color:`text.secondary`,children:qe?.message}),(0,J.jsx)(U,{direction:`row`,sx:{justifyContent:`flex-end`},children:(0,J.jsx)(c,{variant:`contained`,onClick:()=>Je(null),children:K(C,`Đóng`,`Close`)})})]})})]})})}var td={"session-revision-stale":[`Cuộc trò chuyện vừa thay đổi trong lúc gửi. Bấm Xác nhận lần nữa.`,`The chat changed while this was sent. Select Confirm again.`],"session-runtime-busy":[`Cuộc trò chuyện đang bận. Thử lại khi lượt này xong.`,`The chat is busy. Try again when this turn ends.`],"session-runtime-unavailable":[`Cuộc trò chuyện chưa mở được. Mở lại cuộc trò chuyện rồi thử lại.`,`The chat is not open. Open it again and retry.`],"session-unavailable":[`Không còn thấy cuộc trò chuyện này trong danh sách. Tải lại trang rồi thử lại.`,`This chat is no longer in the list. Reload the page and retry.`],"session-archived":[`Cuộc trò chuyện đã được lưu trữ. Bỏ lưu trữ trước.`,`The chat is archived. Unarchive it first.`],"session-command-expired":[`Yêu cầu chờ quá lâu nên đã hết hạn. Thử lại.`,`The request waited too long and expired. Try again.`],"gateway-command-response-timeout":[`Piagent chưa trả lời. Xem lại danh sách trước khi thử lại.`,`Piagent did not answer. Check the list before trying again.`]},nd={rename:[`Chưa đổi được tên`,`Could not rename`],fork:[`Chưa tạo được nhánh`,`Could not fork`],archive:[`Chưa lưu trữ được`,`Could not archive`]};function rd(e,t,n){let r=td[t];return`${K(n,...nd[e])}: ${r?K(n,...r):K(n,`thử lại.`,`try again.`)} (${t})`}function id(e){let t=e.mode===`dark`,n=e.mode,{primary:r,secondary:i,background:a,paper:o,text:s,muted:c,divider:l}=e,u=t?`0 16px 48px -12px ${kt(`#000`,.7)}, 0 0 0 1px ${kt(s,.06)}`:`0 16px 40px -16px ${kt(`#1a1a2e`,.25)}, 0 0 0 1px ${kt(s,.06)}`,d=`0 0 0 3px ${kt(r,t?.28:.22)}`;return Me({cssVariables:{cssVarPrefix:`piagent`},palette:{mode:n,primary:{main:r,contrastText:e.onPrimary},secondary:{main:i},success:{main:i},warning:{main:e.warning},error:{main:e.error},background:{default:a,paper:o},text:{primary:s,secondary:c,disabled:c},divider:l,action:{hover:kt(s,.05),selected:kt(s,.08),focus:kt(r,.14)}},shape:{borderRadius:6},transitions:{duration:{shortest:120,shorter:160,short:180,standard:200,complex:260,enteringScreen:200,leavingScreen:160}},typography:{fontFamily:`system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif`,fontSize:14,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:600,h1:{fontSize:`1.6rem`,fontWeight:650,letterSpacing:`-0.03em`,lineHeight:1.2},h2:{fontSize:`1.15rem`,fontWeight:600,letterSpacing:`-0.02em`},h3:{fontSize:`0.95rem`,fontWeight:600},body2:{fontSize:`0.8125rem`},button:{fontSize:`0.8125rem`,fontWeight:550,textTransform:`none`,letterSpacing:0},caption:{fontSize:`0.72rem`,letterSpacing:0},overline:{fontSize:`0.68rem`,fontWeight:600,letterSpacing:`0.08em`}},components:{MuiCssBaseline:{styleOverrides:{html:{backgroundColor:a,WebkitFontSmoothing:`antialiased`},body:{minWidth:320,minHeight:`100vh`,backgroundColor:a},"::selection":{backgroundColor:kt(r,.28)},"*":{scrollbarWidth:`thin`,scrollbarColor:`${kt(s,.18)} transparent`}}},MuiPaper:{defaultProps:{elevation:0},styleOverrides:{root:{backgroundImage:`none`}}},MuiButtonBase:{defaultProps:{disableRipple:!0}},MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:32,borderRadius:8,paddingInline:12,transition:`background-color .16s, border-color .16s, box-shadow .16s, color .16s`,"&.Mui-focusVisible":{boxShadow:d}},sizeSmall:{minHeight:28,paddingInline:10,fontSize:`0.78rem`},outlined:{borderColor:kt(s,.14),"&:hover":{borderColor:kt(s,.28),backgroundColor:kt(s,.04)}},contained:{"&.MuiButton-colorPrimary:hover":{backgroundColor:kt(r,.88),boxShadow:`0 0 0 3px ${kt(r,.18)}`}},text:{"&:hover":{backgroundColor:kt(s,.06)}}}},MuiIconButton:{styleOverrides:{root:{borderRadius:8,color:c,transition:`background-color .16s, color .16s`,"&:hover":{color:s,backgroundColor:kt(s,.07)},"&.Mui-focusVisible":{boxShadow:d}},sizeSmall:{padding:5}}},MuiChip:{styleOverrides:{root:{height:24,borderRadius:999,fontWeight:500,fontSize:`0.75rem`},outlined:{borderColor:kt(s,.14)},label:{paddingInline:9}}},MuiListItemButton:{styleOverrides:{root:{minHeight:36,margin:`1px 8px`,borderRadius:8,color:c,transition:`background-color .12s, color .12s`,"&:hover":{backgroundColor:kt(s,.05),color:s},"&.Mui-selected":{color:s,backgroundColor:kt(s,t?.08:.07)},"&.Mui-selected:hover":{backgroundColor:kt(s,t?.11:.09)},"&.Mui-focusVisible":{boxShadow:d}}}},MuiTabs:{styleOverrides:{root:{minHeight:40},indicator:{height:2,borderRadius:2}}},MuiTab:{styleOverrides:{root:{minHeight:40,paddingInline:14,textTransform:`none`,fontWeight:550,fontSize:`0.8125rem`,color:c,"&.Mui-selected":{color:s}}}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:8,backgroundColor:kt(s,t?.03:.02),transition:`box-shadow .16s`,"& .MuiOutlinedInput-notchedOutline":{borderColor:kt(s,.12)},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:kt(s,.24)},"&.Mui-focused":{boxShadow:d},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:r,borderWidth:1}}}},MuiTooltip:{defaultProps:{arrow:!1,enterDelay:350},styleOverrides:{tooltip:{fontSize:`0.75rem`,fontWeight:500,padding:`5px 9px`,borderRadius:6,color:t?s:`#fafafa`,backgroundColor:t?kt(o,.98):`#1f1f24`,boxShadow:u}}},MuiMenu:{styleOverrides:{paper:{borderRadius:10,boxShadow:u,backgroundImage:`none`,marginTop:4},list:{padding:4}}},MuiPopover:{styleOverrides:{paper:{borderRadius:10,boxShadow:u}}},MuiMenuItem:{styleOverrides:{root:{minHeight:32,borderRadius:6,fontSize:`0.8125rem`,"&:hover":{backgroundColor:kt(s,.06)},"&.Mui-selected":{backgroundColor:kt(r,.12)}}}},MuiDialog:{styleOverrides:{paper:{borderRadius:14,boxShadow:u,backgroundImage:`none`}}},MuiBackdrop:{styleOverrides:{root:{backgroundColor:kt(`#000`,t?.6:.32),backdropFilter:`blur(2px)`}}},MuiDrawer:{styleOverrides:{paper:{backgroundImage:`none`,backgroundColor:o}}},MuiAlert:{styleOverrides:{root:{borderRadius:10,border:`1px solid ${kt(s,.1)}`,fontSize:`0.8125rem`,alignItems:`center`}}},MuiDivider:{styleOverrides:{root:{borderColor:l}}},MuiLinearProgress:{styleOverrides:{root:{borderRadius:999,height:4},bar:{borderRadius:999}}}}})}async function ad(){let e=await fetch(`/api/v1/preferences`,{credentials:`same-origin`,headers:{Accept:`application/json`}});return e.ok?await e.json():null}async function od(e){let t=Bt();t&&await zt(`/api/v1/preferences`,{method:`POST`,credentials:`same-origin`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":t},body:JSON.stringify(e)})}function sd(e,t,n){let r=(0,q.useRef)(!1),i=(0,q.useRef)(t);i.current=t,(0,q.useEffect)(()=>{if(!e||r.current)return;let t=!1;return ad().then(e=>{t||!e||(r.current=!0,e.locale&&n.setLocale(e.locale),e.themeId&&It(e.themeId)&&n.setThemeId(e.themeId),(!e.locale||!e.themeId)&&od({...i.current,...e}).catch(()=>{}))}).catch(()=>{}),()=>{t=!0}},[e]),(0,q.useEffect)(()=>{r.current&&od(t).catch(()=>{})},[t.locale,t.themeId])}function cd(e){for(let t of e??[]){let e=String(t).toLowerCase().split(`-`)[0];if(e===`vi`)return`vi`;if(e)return`en`}return`en`}var ld=250,ud=4e3,dd=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/;function fd(e){return Math.min(ld*2**Math.min(Math.max(0,e),16),ud)}function pd(e){return e instanceof cn?e.status===408||e.status===409||e.status===423||e.status===425||e.status===429||e.status>=500?`retryable`:`terminal`:typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`?`terminal`:e instanceof TypeError?`retryable`:`terminal`}function md(e,...t){for(let e of t)if(typeof e==`string`&&dd.test(e))return e;return e}function hd(e){if(!e||typeof e!=`object`)throw Error(`invalid-inspection-snapshot`);let t=e;if(t.schemaVersion!==1||t.version!==`piagent-webui-snapshot-v1`||typeof t.generatedAt!=`string`||[`identity`,`revision`,`capabilities`,`session`,`sourceChanges`,`activity`,`approvals`,`verification`,`usage`,`continuation`,`health`].some(e=>!t[e]||typeof t[e]!=`object`))throw Error(`invalid-inspection-snapshot`);let n=t.revision;if(typeof n.eventCursor!=`string`||!dd.test(n.eventCursor))throw Error(`invalid-inspection-snapshot-cursor`);return e}function gd(e=0){return{state:`cancelled`,readSequence:e}}async function _d(e){let t=0;for(;!e.stopped();){let n=await e.read();if(e.stopped())return gd(n.readSequence);if(n.state!==`retryable-error`)return n;await e.wait(fd(t)),t=Math.min(t+1,16)}return gd()}function vd(){let[e,t]=(0,q.useState)(),[n,r]=(0,q.useState)(`connecting`),[i,a]=(0,q.useState)([]),o=(0,q.useRef)(()=>Promise.resolve(gd())),s=(0,q.useRef)(()=>void 0),c=(0,q.useCallback)(async()=>{let e=await o.current();if(e.state===`committed`)return s.current(e.value),e.value},[]);return(0,q.useEffect)(()=>{let e=new AbortController,n,i,c,l,u,d=0,f=0,p=0,m=0,h=null,g=!1,_=!1,v=!1,y=!1,b=!1,x=!1,S=!1,C=!1,w=()=>{window.clearTimeout(i),i=void 0},T=()=>{window.clearTimeout(c),c=void 0},E=()=>{window.clearTimeout(l),l=void 0;let e=u;u=void 0,e?.()},D=e=>new Promise(t=>{let n=()=>{u===n&&(u=void 0,l=void 0),t()};u=n,l=window.setTimeout(n,e)}),O=()=>{d+=1,E()},k,A=()=>{C||S||(S=!0,O(),w(),T(),e.abort(),k.invalidate(),n?.close(),n=void 0,y=!1,r(`failed`))};k=new Fu({read:async()=>{let t=m;return{snapshot:hd(await Xt(e.signal)),eventGenerationAtStart:t}},commit:({snapshot:e,eventGenerationAtStart:n})=>{C||S||(_=!0,v=!0,m===n&&(h=md(null,e.revision.eventCursor)),t(e),y&&r(`connected`))},classify:pd});let j=async()=>{let e=await k.request();return e.state===`committed`?{...e,value:e.value.snapshot}:(e.state===`terminal-error`&&A(),e)};o.current=j;let M=()=>void 0,N=()=>void 0,P=()=>{if(C||S||!g||!_||n)return;O();let e=h?`?after=${encodeURIComponent(h)}`:``,t;try{t=new EventSource(`/api/v1/events${e}`,{withCredentials:!0})}catch{f=Math.min(f+1,16),r(`reconnecting`),M(fd(f-1));return}n=t,y=!1,r(e=>e===`connecting`?`connecting`:`reconnecting`),t.onopen=()=>{C||S||n!==t||(y=!0,f=0,r(v?`connected`:`reconnecting`))},t.addEventListener(`runtime-event`,e=>{if(!(C||S||n!==t))try{let t=e,n=JSON.parse(t.data);if(!n||typeof n.kind!=`string`)return;let r=md(h,t.lastEventId,n.eventCursor);r!==h&&(h=r,m+=1),a(e=>[...e,n].slice(-500)),[`message.text-delta`,`message.thinking-state`,`activity.progress`].includes(String(n.kind))||N()}catch{}}),t.addEventListener(`resync-required`,()=>{C||S||n!==t||(t.close(),n=void 0,y=!1,w(),T(),x=!1,a([]),r(`reconnecting`),M(0,!0))}),t.onerror=()=>{C||S||n!==t||(t.close(),n=void 0,y=!1,v=!1,f=Math.min(f+1,16),r(`reconnecting`),M(fd(f-1)))}};M=(e=0,t=!1)=>{if(C||S)return;let i=++d;E(),t&&a([]),r(_?`reconnecting`:`connecting`),(async()=>{if(e>0&&await D(e),C||S||d!==i||n)return;let t=await _d({read:j,wait:D,stopped:()=>C||S||d!==i||!!n});C||S||d!==i||n||t.state===`committed`&&P()})()};let F=()=>{if(C||S||!n||c!==void 0)return;let e=fd(p);p=Math.min(p+1,16),c=window.setTimeout(()=>{c=void 0,x=!0,I()},e)},I=async()=>{if(!(C||S||!n)){if(b){x=!0;return}b=!0;try{do{x=!1;let e=await j();if(C||S||!n||e.state===`cancelled`||e.state===`terminal-error`)return;if(e.state===`retryable-error`){v=!1,r(`reconnecting`),x=!0,F();return}p=0}while(x&&!C&&!S&&n)}finally{b=!1,x&&c===void 0&&i===void 0&&n&&!S&&!C&&(i=window.setTimeout(()=>{i=void 0,I()},80))}}};N=()=>{x=!0,!(C||S||b||c!==void 0||i!==void 0)&&(i=window.setTimeout(()=>{i=void 0,I()},80))};let L=e=>{!C&&!S&&g&&!n&&P()};return s.current=L,(async()=>{let e;try{e=await Wt()}catch{!C&&!S&&A();return}if(!(C||S)){if(e===`failed`){A();return}g=!0,M()}})(),()=>{C=!0,O(),e.abort(),k.invalidate(),n?.close(),w(),T(),s.current===L&&(s.current=()=>void 0),o.current===j&&(o.current=()=>Promise.resolve(gd()))}},[]),{snapshot:e,connection:n,events:i,refreshSnapshot:c}}var yd=e=>!!e&&typeof e==`object`&&!Array.isArray(e),bd=e=>typeof e==`string`&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e),xd=(e,t)=>Object.keys(e).length===t.length&&Object.keys(e).every(e=>t.includes(e));function Sd(e){if(!yd(e)||e.schemaVersion!==1||e.version!==`piagent-terminal-v1`||!yd(e.identity)||!xd(e.identity,[`gatewayInstanceRef`,`runtimeInstanceRef`,`sessionRef`])||![`gatewayInstanceRef`,`runtimeInstanceRef`,`sessionRef`].every(t=>bd(e.identity[t])))return!1;let t=[`schemaVersion`,`version`,`messageType`,`identity`];return e.messageType===`state`?xd(e,[...t,`revisions`,`available`,`reasonCode`,`terminals`])&&yd(e.revisions)&&xd(e.revisions,[`terminalRevision`])&&typeof e.revisions.terminalRevision==`string`&&typeof e.available==`boolean`&&(e.reasonCode===null||typeof e.reasonCode==`string`)&&Array.isArray(e.terminals)&&e.terminals.length<=4&&e.terminals.every(e=>yd(e)&&xd(e,[`terminalRef`,`number`,`state`,`cols`,`rows`,`sequence`,`exitCode`])&&bd(e.terminalRef)&&Number.isSafeInteger(e.number)&&e.number>0&&[`running`,`exited`].includes(e.state)&&Number.isSafeInteger(e.sequence)&&e.sequence>=0&&Number.isInteger(e.cols)&&e.cols>=2&&e.cols<=500&&Number.isInteger(e.rows)&&e.rows>=1&&e.rows<=200&&(e.exitCode===null||Number.isInteger(e.exitCode))):!bd(e.terminalRef)||!Number.isSafeInteger(e.sequence)||e.sequence<0?!1:e.messageType===`output`?xd(e,[...t,`terminalRef`,`sequence`,`data`,`replay`,`reset`,`complete`,`truncated`])&&typeof e.data==`string`&&e.data.length<=8192&&[`replay`,`reset`,`complete`,`truncated`].every(t=>typeof e[t]==`boolean`):e.messageType===`exit`&&xd(e,[...t,`terminalRef`,`sequence`,`exitCode`,`signal`])&&(e.exitCode===null||Number.isInteger(e.exitCode))&&(e.signal===null||Number.isInteger(e.signal))}var Cd=e=>!!e&&typeof e==`object`&&!Array.isArray(e),wd=e=>typeof e==`string`&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e);function Td(e){return Sd(e)}var Ed=new class{#e=null;#t=!1;#n=new Map;#r=new Set;#i=new Set;#a;constructor(e=Bt){this.#a=e}get ready(){return this.#t}#o(e){this.#t=e;for(let t of this.#i)t(e)}attach(e){this.#s(),this.#e=e,e.addEventListener(`message`,t=>{if(e!==this.#e)return;let n;try{n=JSON.parse(String(t.data))}catch{return}if(Cd(n)){if(n.messageType===`hello`&&n.version===`piagent-gateway-protocol-v1`){this.#o(!0);return}if(n.messageType===`response`&&n.version===`piagent-gateway-protocol-v1`){let e=this.#n.get(n.requestId);if(!e)return;this.#n.delete(n.requestId),clearTimeout(e.timer),n.method===e.method?n.ok===!0?e.resolve(n.result):e.reject(Error(String(n.error?.code??`terminal-request-failed`))):e.reject(Error(`terminal-response-invalid`));return}if(Td(n))for(let e of this.#r)e(n)}}),e.addEventListener(`close`,()=>{e===this.#e&&this.#s()})}#s(){this.#e=null,this.#o(!1);for(let e of this.#n.values())clearTimeout(e.timer),e.reject(Error(`terminal-connection-lost`));this.#n.clear()}subscribe(e){return this.#r.add(e),()=>{this.#r.delete(e)}}connection(e){return this.#i.add(e),()=>{this.#i.delete(e)}}#c(e,t){let n=this.#e,r=this.#a();if(!this.#t||!n||n.readyState!==1||!r)return Promise.reject(Error(`terminal-not-connected`));if(this.#n.size>=64)return Promise.reject(Error(`terminal-request-capacity`));let i=`terminal_${crypto.randomUUID().replaceAll(`-`,``)}`;return new Promise((a,o)=>{let s=setTimeout(()=>{this.#n.delete(i),o(Error(`terminal-response-timeout`))},15e3);this.#n.set(i,{method:e,resolve:a,reject:o,timer:s});try{n.send(JSON.stringify({schemaVersion:1,version:`piagent-gateway-protocol-v1`,messageType:`request`,requestId:i,method:e,params:{...t,csrfToken:r}}))}catch{clearTimeout(s),this.#n.delete(i),o(Error(`terminal-send-failed`))}})}async state(e){let t=await this.#c(`terminals.state`,{sessionRef:e});if(!Td(t)||t.messageType!==`state`||t.identity.sessionRef!==e)throw Error(`terminal-state-invalid`);return t}async execute(e){let t=await this.#c(`terminals.command`,{command:e});if(!Cd(t)||t.schemaVersion!==1||t.version!==e.version||t.messageType!==`receipt`||t.commandId!==e.commandId||t.idempotencyKey!==e.idempotencyKey||t.actionDigest!==e.actionDigest||t.action!==e.action||!Cd(t.identity)||!Object.entries(e.identity).every(([e,n])=>t.identity[e]===n)||!Cd(t.observedRevisions)||typeof t.observedRevisions.terminalRevision!=`string`||![`settled`,`rejected`,`uncertain`].includes(t.phase)||typeof t.deduplicated!=`boolean`||!(t.terminalRef===null||wd(t.terminalRef))||t.reasonCode!==null&&typeof t.reasonCode!=`string`)throw Error(`terminal-receipt-invalid`);return t}};function Dd(e,t=150){let n,r=!1,i=!1,a=!1,o=()=>{if(!a){if(r||n!==void 0){i=r;return}n=setTimeout(()=>{n=void 0,r=!0,e().catch(()=>void 0).finally(()=>{r=!1,i&&(i=!1,o())})},t)}};return{request:o,stop:()=>{a=!0,n!==void 0&&clearTimeout(n),n=void 0}}}var Od=class extends Error{effectMayHaveOccurred;constructor(e,t){super(e),this.name=`GatewayCommandTransportError`,this.effectMayHaveOccurred=t}};async function kd(e,t,n=4){for(let r=1;;r+=1)try{return await e(t)}catch(e){if(r>=n||!(e instanceof Od)||e.message!==`gateway-command-response-timeout`)throw e}}function Ad(e,t){return e instanceof Od?e.effectMayHaveOccurred:t}function jd(e,t,n=null,r=null){return!e||e.serial<=t||e.operationRef===n||r&&e.messageRequestId&&e.messageRequestId!==r?null:e}function Md(e,t,n=null){return e&&e.operationRef!==t&&!(n&&e.messageRequestId&&e.messageRequestId!==n)?{operationRef:e.operationRef,complete:!1}:null}function Nd(e,t){return t?`observed`:e?.phase===`settled`||e?.phase===`accepted`?`confirmed`:e?.phase===`rejected`?`rejected`:`unconfirmed`}function Pd(e,t){let n=new AbortController,r=()=>void 0,i=new Promise(e=>{r=e}),a=setTimeout(()=>{n.abort(),r(null)},t);return{promise:Promise.race([e(n.signal).catch(()=>null),i]).finally(()=>clearTimeout(a)),cancel(){n.abort(),r(null),clearTimeout(a)}}}function Fd(e,t,n,r,i){let a=e[t];if(!a||a.messageRequestId!==n||i===`unconfirmed`&&(a.delivery===`admitted`||a.operationRef))return e;let o=ms(a,i,r.operationRef,new Date().toISOString()),s=i===`unconfirmed`||r.complete||!!(r.operationRef&&a.operationRef===r.operationRef&&a.complete);return{...e,[t]:{...o,complete:s,abortable:i===`admitted`&&!s&&!!r.operationRef}}}async function Id(e,t={}){let n=()=>{let t=jd(e.readLocalObservation?.()??e.localObservation,e.afterSerial,e.priorOperationRef,e.messageRequestId);return t?{operationRef:t.operationRef,complete:t.complete}:null},r=n();if(r)return r;let i=t.timeoutMs??5e3,a=t.readLiveState??en,o=t.readTranscript??Jt,s=[Pd(async t=>{let n=await a(t);return Md(n?.state===`ready`?n.operations.find(t=>t.sessionRef===e.sessionRef):void 0,e.priorOperationRef,e.messageRequestId)},i),Pd(async t=>{let n=await o(e.sessionRef,null,50,t);if(n?.state!==`ready`)return null;let r=[...n.items].reverse().find(t=>t.role===`user`&&t.messageRequestId===e.messageRequestId);if(r)return{operationRef:r.agentOperationId,complete:Fs(n.items,e.message,{operationRef:r.agentOperationId,messageRequestId:e.messageRequestId,startedAt:null})};let i=Date.parse(e.requestedAt),a=[...n.items].reverse().find(t=>t.role===`user`&&!t.messageRequestId&&As(t.content.text,e.message)&&Date.parse(t.recordedAt)>=i);return a?{operationRef:a.agentOperationId,complete:Fs(n.items,e.message,{operationRef:a.agentOperationId,messageRequestId:null,startedAt:e.requestedAt})}:null},i)],c=new Map(s.map((e,t)=>[t,e.promise.then(e=>({evidence:e,index:t}))]));try{for(;c.size>0;){let e=await Promise.race(c.values());if(c.delete(e.index),e.evidence)return e.evidence;let t=n();if(t)return t}return n()}finally{for(let e of s)e.cancel()}}function Ld(e){return(0,q.useMemo)(()=>{let t=[],n=0,r=()=>{if(n&&cancelAnimationFrame(n),n=0,t.length===0)return;let r=t;t=[],e(e=>r.reduce((e,t)=>t(e),e))};return{now:t=>{r(),e(t)},later:e=>{t.push(e),n||=requestAnimationFrame(r)}}},[e])}function Rd(){let[e,t]=(0,q.useState)(),[n,r]=(0,q.useState)(),[i,a]=(0,q.useState)(`connecting`),[o,s]=(0,q.useState)({}),{now:c,later:l}=Ld(s),[u,d]=(0,q.useState)({}),f=(0,q.useRef)(void 0),p=(0,q.useRef)(null),m=(0,q.useRef)(null),h=(0,q.useRef)({});h.current=o;let g=(0,q.useRef)(0),_=(0,q.useRef)(new Map),v=(0,q.useRef)(null),y=(0,q.useRef)(!0),b=(0,q.useRef)(0),x=(0,q.useRef)(0),S=(0,q.useRef)(new Map),C=(0,q.useCallback)(Hu,[]),w=(0,q.useCallback)(async(e={})=>{let n=++b.current;try{let[r,i]=await Promise.all([Qt(),en().catch(()=>void 0)]),o=ns(i,r.gatewayInstanceRef),s=!1;if(n>=x.current){x.current=n,f.current=r,t(r);let l=v.current;l!==null&&l!==r.gatewayInstanceRef&&(y.current=!0),v.current=r.gatewayInstanceRef;let u=e.requireLiveState||y.current,h=p.current?.readyState===WebSocket.OPEN;if(a(rs(h,u)),!h&&i&&o!==null)m.current=o,C(r.gatewayInstanceRef,o),c(e=>gs(e,i)),d(ds(i)),y.current=!1,s=!0;else if(l!==r.gatewayInstanceRef){if(d({}),u)m.current=null;else{let e=null;try{e=window.sessionStorage.getItem(Iu)}catch{}m.current=Vu(e,r.gatewayInstanceRef)}}}return e.requireLiveState&&!s?void 0:f.current??r}catch{a(`reconnecting`);return}},[C]),T=(0,q.useCallback)(e=>{let t=p.current;if(!t||t.readyState!==WebSocket.OPEN)return Promise.reject(new Od(`gateway-not-connected`,!1));let n=$(`request`);return new Promise((r,i)=>{let a=window.setTimeout(()=>{S.current.delete(n)&&i(new Od(`gateway-command-response-timeout`,!0))},Lu);S.current.set(n,{resolve:r,reject:i,timeout:a});try{t.send(JSON.stringify({schemaVersion:1,version:`piagent-gateway-protocol-v1`,messageType:`request`,requestId:n,method:`sessions.command`,params:{command:e}}))}catch(e){window.clearTimeout(a),S.current.delete(n),i(new Od(e instanceof Error?e.message:`gateway-request-failed`,!1))}})},[]),E=(0,q.useCallback)((e,t,n,r,i,a)=>Id({sessionRef:e,message:t,requestedAt:n,afterSerial:r,priorOperationRef:i,messageRequestId:a,readLocalObservation:()=>_.current.get(e)}),[]),D=(0,q.useCallback)(async e=>{let t=f.current,n=e.message.trim(),r=e.messageRequestId??$(`message`);if(!t?.catalogRevision)throw Error(`catalog-unavailable`);if(!n)throw Error(`message-empty`);let i=t=>{if(!t.catalogRevision)throw Error(`catalog-unavailable`);let i=new Date;return kd(T,{schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:$(`command`),idempotencyKey:$(`idempotency`),action:`session.create`,requestedAt:i.toISOString(),expiresAt:new Date(i.getTime()+3e5).toISOString(),sessionRef:null,expectedCatalogRevision:t.catalogRevision,expectedSessionRevision:null,payload:{projectRef:e.projectRef,placeRef:e.placeRef,modelRef:e.modelRef,thinkingLevel:e.thinkingLevel,workflow:e.workflow,message:n,messageRequestId:r,...e.permissionMode?{permissionMode:e.permissionMode}:{},...e.fast?{fast:!0}:{},...e.deferInitialMessage?{deferInitialMessage:!0}:{}}})},a=await i(t);if(Uu(a)){let e=await w();e?.catalogRevision&&(a=await i(e))}if(!(a.phase===`uncertain`&&a.sessionRef)&&a.phase!==`settled`||!a.sessionRef)throw Error(a.error?.code??a.resultCode);let o=a.settledAt??a.requestedAt;return a.phase===`settled`&&!e.deferInitialMessage&&c(e=>{let t=e[a.sessionRef];return{...e,[a.sessionRef]:{...t??{assistant:``,attachments:[],activities:[],complete:!1,error:null},user:n,operationRef:a.operationRef,messageRequestId:r,abortable:!t?.complete&&!!a.operationRef,startedAt:t?.startedAt??o,lastEventAt:t?.lastEventAt??o}}}),await w(),a},[w,T]),O=(0,q.useCallback)(async(e,t,n)=>{let r=f.current;if(!r?.catalogRevision)throw Error(`catalog-unavailable`);let i=t.trim();if(!i)throw Error(`message-empty`);let a=n?.messageRequestId??$(`message`),o=n?.attachmentRefs??[],s=h.current[e.sessionRef],l=g.current,u=_.current.get(e.sessionRef)?.operationRef??s?.operationRef??null,d=new Date().toISOString();c(t=>({...t,[e.sessionRef]:ps(t[e.sessionRef],{message:i,attachments:n?.attachments??[],messageRequestId:a,submittedAt:d})}));let p=()=>c(t=>{let n=t[e.sessionRef],r=hs(n,s,a);if(r===n)return t;let i={...t};return r?i[e.sessionRef]=r:delete i[e.sessionRef],i}),m=(t,n)=>c(r=>Fd(r,e.sessionRef,a,t,n)),v=d,y=!1;try{let t=t=>{let r=t.sessions.find(t=>t.sessionRef===e.sessionRef);if(!t.catalogRevision||!r)throw Error(`session-unavailable`);let s=new Date;return v=s.toISOString(),{schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:$(`command`),idempotencyKey:$(`idempotency`),action:`session.send`,requestedAt:s.toISOString(),expiresAt:new Date(s.getTime()+Ru).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:t.catalogRevision,expectedSessionRevision:r.sessionRevision,payload:{delivery:`new-operation`,message:i,messageRequestId:a,expectedOperationRef:null,attachmentRefs:o,...n?.workflow?{workflow:n.workflow}:{}}}},s=t(r);y=!0;let c=await T(s);if(Uu(c)){let e=await w();e?.catalogRevision&&(s=t(e),c=await T(s))}if(Nd(c,null)===`confirmed`)return m({operationRef:c.operationRef,complete:!1},`admitted`),w(),{state:`confirmed`,receipt:c};let d=await E(e.sessionRef,i,v,l,u,a),f=Nd(c,d);if(f===`observed`&&d)return m(d,`admitted`),w(),{state:`observed`,receipt:c};if(f===`unconfirmed`)return m({operationRef:null,complete:!0},`unconfirmed`),w(),{state:`unconfirmed`,receipt:c};throw p(),new Bu(c.error?.code??c.resultCode)}catch(t){if(t instanceof Bu)throw t;if(Ad(t,y)){let t=await E(e.sessionRef,i,v,l,u,a);return Nd(null,t)===`observed`&&t?(m(t,`admitted`),w(),{state:`observed`,receipt:null}):(m({operationRef:null,complete:!0},`unconfirmed`),w(),{state:`unconfirmed`,receipt:null})}throw p(),t}},[E,w,T]),k=(0,q.useCallback)(async e=>{let t=f.current,n=o[e.sessionRef]?.operationRef,r=t?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!t?.catalogRevision||!r||!n||o[e.sessionRef]?.abortable===!1)throw Error(`operation-unavailable`);let i=t=>{let r=t.sessions.find(t=>t.sessionRef===e.sessionRef);if(!t.catalogRevision||!r)throw Error(`operation-unavailable`);let i=new Date;return T({schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:$(`command`),idempotencyKey:$(`idempotency`),action:`session.abort`,requestedAt:i.toISOString(),expiresAt:new Date(i.getTime()+3e5).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:t.catalogRevision,expectedSessionRevision:r.sessionRevision,payload:{operationRef:n,clearQueued:!0}})},a=await i(t);if(Uu(a)){let[t,r]=await Promise.all([w(),en().catch(()=>void 0)]);if(!t||!xs(r,t.gatewayInstanceRef,e.sessionRef,n))throw Error(`operation-unavailable`);a=await i(t)}if(a.phase!==`settled`)throw Error(a.error?.code??a.resultCode);return w(),a},[o,w,T]),A=(0,q.useCallback)(async e=>{let t=async t=>{let n=await w(),r=n?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!n?.catalogRevision||!r)throw Error(`session-unavailable`);let i=new Date,a=await T({schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:$(`command`),idempotencyKey:$(`idempotency`),action:t,requestedAt:i.toISOString(),expiresAt:new Date(i.getTime()+3e5).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:n.catalogRevision,expectedSessionRevision:r.sessionRevision,payload:{}});if(a.phase!==`settled`)throw Error(a.error?.code??a.resultCode);return a};c(t=>({...t,[e.sessionRef]:{...t[e.sessionRef]??{user:``,assistant:``,attachments:[],activities:[],operationRef:null,complete:!0,error:null},runtimeRecovery:`restarting`}}));try{let n=(await w())?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!n)throw Error(`session-unavailable`);n.state===`gateway-owned`&&await t(`session.release`);let r=await t(`session.acquire`);return c(t=>({...t,[e.sessionRef]:{...t[e.sessionRef]??{user:``,assistant:``,attachments:[],activities:[],operationRef:null,complete:!0,error:null},runtimeRecovery:`recovered`}})),await w(),r}catch(t){throw c(t=>({...t,[e.sessionRef]:{...t[e.sessionRef]??{user:``,assistant:``,attachments:[],activities:[],operationRef:null,complete:!0,error:null},runtimeRecovery:`failed`}})),t}},[w,T]),j=(0,q.useCallback)(async(e,t,n)=>{let r=r=>{let i=r?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!r?.catalogRevision||!i)throw Error(`session-unavailable`);let a=new Date;return T({schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:$(`command`),idempotencyKey:$(`idempotency`),action:t,requestedAt:a.toISOString(),expiresAt:new Date(a.getTime()+3e5).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:r.catalogRevision,expectedSessionRevision:i.sessionRevision,payload:n})},i=await r(f.current);for(let e=0;[`session.set-permission`,`session.set-fast`].includes(t)&&Uu(i)&&e<2;e++)i=await r(await w());if(i.phase!==`settled`)throw Error(i.error?.code??i.resultCode);return await w(),i},[w,T]),M=(0,q.useCallback)((e,t)=>j(e,`session.set-model`,{modelRef:t}),[j]),N=(0,q.useCallback)((e,t)=>j(e,`session.set-thinking`,{thinkingLevel:t}),[j]),P=(0,q.useCallback)((e,t)=>j(e,`session.set-permission`,{permissionMode:t}),[j]),F=(0,q.useCallback)((e,t)=>j(e,`session.set-fast`,{fast:t}),[j]),I=(0,q.useCallback)(async(e,t,n)=>{let r=r=>{let i=r?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!r?.catalogRevision||!i)throw Error(`session-unavailable`);let a=new Date;return T({schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:$(`command`),idempotencyKey:$(`idempotency`),action:t,requestedAt:a.toISOString(),expiresAt:new Date(a.getTime()+3e5).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:r.catalogRevision,expectedSessionRevision:i.sessionRevision,payload:n})},i=await r(f.current);for(let e=0;t===`session.rename`&&Uu(i)&&e<2;e++)i=await r(await w());if(i.phase!==`settled`)throw Error(i.error?.code??i.resultCode);return await w(),i},[w,T]),L=(0,q.useCallback)((e,t)=>I(e,`session.rename`,{title:t}),[I]),ee=(0,q.useCallback)((e,t)=>I(e,`session.pin`,{pinned:t}),[I]),te=(0,q.useCallback)(e=>I(e,`session.archive`,{}),[I]),ne=(0,q.useCallback)(e=>I(e,`session.unarchive`,{}),[I]),R=(0,q.useCallback)((e,t)=>I(e,`session.fork`,{entryRef:null,title:t}),[I]);return(0,q.useEffect)(()=>{let e=!1,t,n=0,i=!1,o=Dd(()=>w()),s=o.request,u=(()=>{try{let e=window.localStorage.getItem(`piagent-gateway-client-ref`);if(e&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e))return e;let t=$(`client`);return window.localStorage.setItem(`piagent-gateway-client-ref`,t),t}catch{return $(`client`)}})(),h=()=>{if(e||Ht())return;a(n===0?`connecting`:`reconnecting`);let o=window.location.protocol===`https:`?`wss:`:`ws:`,x=new WebSocket(`${o}//${window.location.host}/api/v1/gateway`,`piagent.gateway.v1`);p.current=x,Ed.attach(x);let w=window.setTimeout(()=>x.close(1008,`hello-timeout`),5e3);x.addEventListener(`open`,()=>x.send(JSON.stringify({schemaVersion:1,version:`piagent-gateway-protocol-v1`,messageType:`connect`,clientRef:u,minimumProtocol:1,maximumProtocol:1,lastEventSequence:m.current,catalogRevision:f.current?.catalogRevision??null}))),x.addEventListener(`message`,e=>{let t;try{t=JSON.parse(String(e.data))}catch{x.close(1007,`invalid-json`);return}if(!t||typeof t!=`object`){x.close(1008,`invalid-frame`);return}let o=t;if(o.messageType===`hello`){window.clearTimeout(w);let e=typeof o.capabilities?.gatewayInstanceRef==`string`?o.capabilities.gatewayInstanceRef:null;if(!e||v.current&&e!==v.current){m.current=null,y.current=!0,i=!0,x.close(zu,`gateway-epoch-changed`);return}v.current=e,n=0,r(o.capabilities),a(`connected`);return}if(o.messageType===`response`){let e=S.current.get(String(o.requestId));if(!e)return;S.current.delete(String(o.requestId)),window.clearTimeout(e.timeout),o.ok===!0&&o.result?e.resolve(o.result):e.reject(new Od(String(o.error?.code??`gateway-request-failed`),!1));return}if(o.messageType!==`event`||!Number.isSafeInteger(o.sequence))return;let u=o.payload,f=typeof o.generatedAt==`string`?o.generatedAt:new Date().toISOString(),p=typeof u.messageRequestId==`string`?u.messageRequestId:null,h=e=>e&&p&&e.messageRequestId&&e.messageRequestId!==p?void 0:e;if(o.kind===`resync.required`){y.current=!0,i=!0,x.close(zu,`canonical-resync-required`);return}let b=Number(o.sequence),T=m.current;if(!(T!==null&&b<=T)){if(T!==null&&b!==T+1){y.current=!0,i=!0,x.close(zu,`gateway-event-sequence-gap`);return}if(m.current=b,v.current&&C(v.current,b),typeof u?.sessionRef==`string`&&typeof u.operationRef==`string`&&[`runtime.changed`,`message.delta`,`tool.started`,`tool.completed`,`message.completed`,`operation.settled`].includes(String(o.kind))&&(g.current+=1,_.current.set(u.sessionRef,{serial:g.current,operationRef:u.operationRef,messageRequestId:p,complete:[`message.completed`,`operation.settled`].includes(String(o.kind))})),o.kind===`message.delta`&&typeof u?.sessionRef==`string`&&typeof u.delta==`string`&&l(e=>{let t=h(e[u.sessionRef]);return{...e,[u.sessionRef]:{...t??{user:``,assistant:``,attachments:[],activities:[],complete:!1,error:null},operationRef:u.operationRef,messageRequestId:p??t?.messageRequestId,abortable:!0,complete:!1,delivery:t?.user?`admitted`:t?.delivery,assistant:`${t?.assistant??``}${u.delta}`,startedAt:t?.startedAt??f,lastEventAt:f}}}),[`tool.started`,`tool.completed`].includes(String(o.kind))&&typeof u?.sessionRef==`string`&&typeof u.toolCallRef==`string`&&typeof u.toolLabel==`string`&&c(e=>{let t=h(e[u.sessionRef])??{user:``,assistant:``,attachments:[],activities:[],operationRef:u.operationRef??null,abortable:!0,complete:!1,error:null,runtimeRecovery:null},n=o.kind===`tool.started`?`running`:u.isError===!0?`failed`:`completed`,r=t.activities.find(e=>e.toolCallRef===u.toolCallRef),i=[...t.activities.filter(e=>e.toolCallRef!==u.toolCallRef),{toolCallRef:u.toolCallRef,toolLabel:u.toolLabel,fileLabel:typeof u.fileLabel==`string`?u.fileLabel:r?.fileLabel??null,state:n,reasonCode:u.reasonCode??null,startedAt:r?.startedAt??f,finishedAt:n===`running`?null:f}].slice(-16),a=u.reasonCode===`runtime-restart-required`?`required`:t.runtimeRecovery;return{...e,[u.sessionRef]:{...t,operationRef:u.operationRef??t.operationRef,messageRequestId:p??t.messageRequestId,activities:i,complete:!1,delivery:t.user?`admitted`:t.delivery,runtimeRecovery:a,startedAt:t.startedAt??f,lastEventAt:f}}}),o.kind===`runtime.changed`&&typeof u?.sessionRef==`string`&&c(e=>{let t=[`running`,`paused`,`waiting-approval`].includes(String(u.liveState)),n=h(e[u.sessionRef])??(t&&typeof u.operationRef==`string`?{user:``,assistant:``,attachments:[],activities:[],operationRef:u.operationRef,messageRequestId:p,abortable:!0,complete:!1,settlement:null,error:null,runtimeRecovery:null}:null);if(!n)return e;let r=u.reasonCode===`runtime-restart-required`?`restarting`:u.reasonCode===`runtime-restart-failed`?`failed`:[`required`,`restarting`].includes(String(n.runtimeRecovery))&&u.liveState===`idle`?`recovered`:n.runtimeRecovery;return t?{...e,[u.sessionRef]:{...n,operationRef:u.operationRef??n.operationRef,messageRequestId:p??n.messageRequestId,abortable:!0,complete:!1,settlement:null,delivery:n.user?`admitted`:n.delivery,runtimeRecovery:r,startedAt:n.startedAt??f,lastEventAt:f}}:!n.complete&&u.operationRef===null?{...e,[u.sessionRef]:{...n,assistant:``,activities:[],abortable:!1,complete:!0,settlement:`unknown`,messageRequestId:p??n.messageRequestId,error:u.reasonCode??`operation-settlement-unknown`,runtimeRecovery:r,lastEventAt:f}}:r===n.runtimeRecovery?e:{...e,[u.sessionRef]:{...n,runtimeRecovery:r}}}),o.kind===`message.completed`&&typeof u?.sessionRef==`string`&&c(e=>{let t=h(e[u.sessionRef]);return{...e,[u.sessionRef]:{...t??{user:``,assistant:``,attachments:[],activities:[],operationRef:u.operationRef,error:null},operationRef:u.operationRef,messageRequestId:p??t?.messageRequestId,abortable:!1,complete:!0,settlement:`completed`,delivery:t?.user?`admitted`:t?.delivery,error:null,lastEventAt:f}}}),o.kind===`operation.settled`&&typeof u?.sessionRef==`string`&&typeof u.operationRef==`string`){c(e=>{let t=h(e[u.sessionRef])??{user:``,assistant:``,attachments:[],activities:[],operationRef:u.operationRef,complete:!1,error:null,runtimeRecovery:null};return t.operationRef&&t.operationRef!==u.operationRef?e:{...e,[u.sessionRef]:{...fs(t,{operationRef:u.operationRef,settlement:u.settlement,reasonCode:u.reasonCode}),messageRequestId:p??t.messageRequestId,lastEventAt:f}}});let e=ls({operationRef:u.operationRef,settlement:u.settlement,reasonCode:u.reasonCode,settledAt:o.generatedAt,sequence:b});e&&d(t=>({...t,[u.sessionRef]:us(t[u.sessionRef]??[],[e])}))}[`catalog.changed`,`session.changed`,`runtime.changed`,`message.completed`,`operation.settled`].includes(String(o.kind))&&s(),[`session.changed`,`tool.completed`,`operation.settled`].includes(String(o.kind))&&typeof u?.sessionRef==`string`&&window.dispatchEvent(new CustomEvent(`piagent-workspace-changed`,{detail:{sessionRef:u.sessionRef}}))}}),x.addEventListener(`close`,()=>{window.clearTimeout(w);for(let e of S.current.values())window.clearTimeout(e.timeout),e.reject(new Od(`gateway-connection-lost`,!0));if(S.current.clear(),!e){if(a(`reconnecting`),i){i=!1,b();return}n+=1,t=window.setTimeout(h,Math.min(5e3,250*2**Math.min(n,5)))}}),x.addEventListener(`error`,()=>{})},b=async()=>{if(e||Ht())return;let r=await w({requireLiveState:!0});if(!e){if(r){n=0,h();return}a(`reconnecting`),n+=1,t=window.setTimeout(()=>void b(),Math.min(5e3,250*2**Math.min(n,5)))}};(async()=>{let t=await Wt();if(!e){if(t===`failed`){a(`failed`);return}await b()}})();let x=()=>{!e&&document.visibilityState===`visible`&&w()};return document.addEventListener(`visibilitychange`,x),()=>{e=!0,t&&window.clearTimeout(t),o.stop();for(let e of S.current.values())window.clearTimeout(e.timeout),e.reject(new Od(`gateway-client-unmounted`,!0));S.current.clear(),p.current?.close(1e3,`client-unmount`),document.removeEventListener(`visibilitychange`,x)}},[C,w]),{catalog:e,capabilities:n,connection:i,live:o,terminalActivities:u,refresh:w,create:D,send:O,abort:k,restart:A,setModel:M,setThinking:N,setPermission:P,setFast:F,rename:L,pin:ee,archive:te,unarchive:ne,fork:R}}var zd=document.getElementById(`root`);if(!zd)throw Error(`Piagent WebUI root is missing`);var Bd=document.querySelector(`meta[name="csp-nonce"]`)?.content,Vd=re({key:`piagent-mui`,nonce:Bd&&!Bd.startsWith(`__PIAGENT_`)?Bd:void 0,prepend:!0}),Hd=(0,q.lazy)(()=>yr(()=>import(`./App-DBx4BU3F.js`).then(e=>e.t).then(e=>({default:e.App})),__vite__mapDeps([14,1,2,3,9,5,10])));function Ud(){let e=vd();return(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(Hd,{...e})})}function Wd(){let e=Rd(),{locale:t,themeId:n,setLocale:r,setThemeId:i}=Pt();return sd(!!e.catalog,{locale:t,themeId:n},{setLocale:r,setThemeId:i}),(0,J.jsx)(to,{children:(0,J.jsx)(ed,{...e})})}function Gd(e,t,n){try{let r=window.localStorage.getItem(e);return r&&t.includes(r)?r:n}catch{return n}}function Kd(){let[e,t]=(0,q.useState)(()=>Gd(`piagent-webui-locale`,[`vi`,`en`],cd(window.navigator?.languages??[window.navigator?.language??``]))),[n,r]=(0,q.useState)(()=>Gd(`piagent-webui-theme`,Ft.map(e=>e.id),``)||Nt[Gd(`piagent-webui-color-mode`,[`light`,`dark`],window.matchMedia?.(`(prefers-color-scheme: light)`).matches?`light`:`dark`)]),i=It(n)??It(Nt.dark),a=i.mode,o=(0,q.useCallback)(e=>r(t=>It(t)?.mode===e?t:Nt[e]),[]),s=(0,q.useMemo)(()=>id(i),[i]);(0,q.useEffect)(()=>{document.documentElement.lang=e,document.documentElement.dataset.piagentColorMode=a,document.documentElement.dataset.piagentTheme=i.id;try{window.localStorage.setItem(`piagent-webui-locale`,e),window.localStorage.setItem(`piagent-webui-color-mode`,a),window.localStorage.setItem(`piagent-webui-theme`,i.id)}catch{}},[a,e,i]);let c=(0,q.useMemo)(()=>({locale:e,colorMode:a,themeId:i.id,setLocale:t,setColorMode:o,setThemeId:r}),[a,e,i,o]),l=document.querySelector(`meta[name="piagent-webui-mode"]`)?.content;return(0,J.jsx)(Lt,{value:c,children:(0,J.jsxs)(or,{theme:s,children:[(0,J.jsx)(Zn,{}),l===`gateway`?(0,J.jsx)(Wd,{}):(0,J.jsx)(Ud,{})]})})}(0,sr.createRoot)(zd).render((0,J.jsx)(q.StrictMode,{children:(0,J.jsx)(F,{value:Vd,children:(0,J.jsx)(Kd,{})})}));export{Qr as A,ci as C,oi as D,li as E,mr as F,hr as I,dr as L,ei as M,$r as N,Yr as O,yr as P,ai as S,fi as T,wi as _,ts as a,si as b,co as c,Ji as d,qi as f,yi as g,bi as h,Is as i,ni as j,ti as k,Pa as l,Wi as m,ju as n,es as o,Gi as p,Mu as r,Ro as s,Ed as t,na as u,xi as v,ui as w,di as x,Ci as y};
|